* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a0f;
    --surface: #14141f;
    --surface2: #1e1e2e;
    --border: #2a2a3a;
    --text: #e0e0e8;
    --text-dim: #8888aa;
    --accent: #ff4444;
    --accent2: #ff6b35;
    --green: #00cc66;
    --blue: #4488ff;
    --yellow: #ffcc00;
    --purple: #aa66ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

nav .logo {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
}

.nav-links { display: flex; gap: 16px; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: 0.9em; }
.nav-links a:hover { color: var(--text); }

main { max-width: 900px; margin: 0 auto; padding: 20px; }

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.8em;
    margin-top: 40px;
}

h1 { margin-bottom: 16px; }
h2 { margin: 24px 0 12px; color: var(--text); }

a { color: var(--blue); }

/* Hero */
.hero { text-align: center; padding: 40px 0 20px; }
.hero h1 { font-size: 2.5em; color: var(--accent); }
.tagline { font-size: 1.2em; color: var(--text); margin: 8px 0; }
.subtitle { color: var(--text-dim); }

/* Stats */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    margin: 20px 0;
    background: var(--surface);
    border-radius: 8px;
}
.stat { text-align: center; }
.stat-num { display: block; font-size: 1.8em; font-weight: bold; color: var(--green); }
.stat-label { color: var(--text-dim); font-size: 0.85em; }

/* Cards */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.big-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s;
}
.big-card:hover { border-color: var(--accent); }
.big-card h2 { margin: 0 0 8px; }
.big-card p { color: var(--text-dim); }

/* Project list */
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}
.project-card:hover { border-color: var(--accent); }
.budget { color: var(--green); font-weight: bold; margin-left: auto; }

/* Status badges */
.status-badge, .project-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}
.status-badge.queued, .project-status.pending_decomposition { background: var(--surface2); color: var(--text-dim); }
.status-badge.claimed { background: #1a3366; color: var(--blue); }
.status-badge.submitted { background: #332200; color: var(--yellow); }
.status-badge.approved { background: #003322; color: var(--green); }
.status-badge.completed, .project-status.completed { background: #003322; color: var(--green); }
.status-badge.active, .project-status.active { background: #1a3366; color: var(--blue); }

/* Worker page */
.worker-header { margin-bottom: 20px; }
.worker-stats { margin: 8px 0; }
.balance { font-size: 2em; font-weight: bold; color: var(--green); }
.label { display: block; color: var(--text-dim); font-size: 0.85em; }
.worker-switch { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 0.9em; color: var(--text-dim); }
.worker-switch a {
    padding: 4px 12px; border-radius: 4px; text-decoration: none;
    background: var(--surface2); color: var(--text-dim);
}
.worker-switch a.active { background: var(--accent); color: white; }

/* Task cards */
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.task-card.available { border-left: 3px solid var(--blue); }
.task-card.claimed { border-left: 3px solid var(--yellow); }
.task-card.submitted { border-left: 3px solid var(--accent2); }
.task-card.approved { border-left: 3px solid var(--green); }

.task-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.step-badge {
    background: var(--surface2); padding: 2px 8px; border-radius: 4px;
    font-size: 0.8em; color: var(--text-dim);
}
.payment { margin-left: auto; font-weight: bold; color: var(--green); }
.task-desc { margin-bottom: 4px; }
.task-project { color: var(--text-dim); font-size: 0.85em; }
.verification { color: var(--purple); font-size: 0.85em; margin-top: 4px; }

/* Escrow bars */
.escrow-bars { margin: 8px 0; }
.escrow-bar {
    display: flex;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    font-size: 0.7em;
    font-weight: bold;
}
.escrow-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: rgba(255,255,255,0.5);
}
.escrow-segment.verify { background: #333; }
.escrow-segment.verify.released { background: var(--blue); color: white; }
.escrow-segment.perform { background: #2a2a2a; }
.escrow-segment.perform.released { background: var(--green); color: white; }
.escrow-segment.holdback { background: #222; position: relative; overflow: hidden; }
.holdback-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: var(--purple);
    opacity: 0.6;
    transition: width 0.3s;
}

/* Escrow viz */
.escrow-viz { background: var(--surface); border-radius: 8px; padding: 16px; margin: 16px 0; }
.bar-container { height: 32px; background: var(--surface2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar { height: 100%; display: flex; align-items: center; padding: 0 8px; font-size: 0.85em; font-weight: bold; min-width: fit-content; }
.bar.earned { background: var(--green); color: white; }

/* Forms */
.submit-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
textarea, input[type="text"] {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
}
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
}
.btn.claim { background: var(--blue); color: white; }
.btn.submit { background: var(--accent2); color: white; }
.btn.approve { background: var(--green); color: white; }
.btn:hover { opacity: 0.9; }

.proof {
    margin-top: 8px;
    padding: 8px;
    background: var(--surface2);
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--text-dim);
}

.empty { color: var(--text-dim); padding: 20px; text-align: center; }

/* Pipeline */
.pipeline {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding: 16px 0;
}
.pipeline-step {
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    flex-shrink: 0;
}
.pipeline-step.queued { border-top: 3px solid var(--text-dim); }
.pipeline-step.claimed { border-top: 3px solid var(--blue); }
.pipeline-step.submitted { border-top: 3px solid var(--yellow); }
.pipeline-step.approved { border-top: 3px solid var(--green); }
.pipeline-step.completed { border-top: 3px solid var(--green); }

.step-number {
    width: 32px; height: 32px;
    background: var(--surface2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; margin-bottom: 8px;
}
.step-status { font-size: 0.8em; text-transform: uppercase; color: var(--text-dim); }
.step-desc { font-size: 0.85em; margin: 4px 0; }
.step-worker { font-size: 0.8em; color: var(--blue); }
.step-payment { font-size: 0.85em; color: var(--green); font-weight: bold; }

.pipeline-arrow {
    font-size: 1.5em;
    color: var(--text-dim);
    align-self: center;
    flex-shrink: 0;
}

/* Fund flows */
.flow-list { display: flex; flex-direction: column; gap: 4px; }
.flow-item {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    padding: 8px;
    background: var(--surface);
    border-radius: 4px;
    font-size: 0.85em;
}
.flow-amount { color: var(--green); font-weight: bold; min-width: 70px; }
.flow-from, .flow-to { color: var(--blue); }
.flow-arrow { color: var(--text-dim); }
.flow-cat { color: var(--purple); font-size: 0.8em; }
.flow-desc { color: var(--text-dim); }

/* API docs */
.api-section { margin: 24px 0; }
.api-section h2 { color: var(--accent2); }
pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 0.85em;
    margin: 8px 0;
}
code { color: var(--green); }
.api-section ul { padding-left: 20px; }
.api-section li { margin: 4px 0; }

.project-info { margin-bottom: 20px; }
.project-desc { font-size: 1.1em; margin-bottom: 8px; }
.project-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Mobile */
@media (max-width: 600px) {
    .card-grid { grid-template-columns: 1fr; }
    .stats-bar { gap: 20px; }
    .hero h1 { font-size: 1.8em; }
    .pipeline { flex-direction: column; }
    .pipeline-arrow { transform: rotate(90deg); align-self: center; }
    .pipeline-step { min-width: auto; width: 100%; }
}

/* Auth pages */
.auth-page { max-width: 420px; margin: 2rem auto; }
.auth-page h1 { margin-bottom: 0.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }
.auth-form label { font-weight: bold; margin-bottom: -0.5rem; }
.auth-form input { padding: 0.6rem; border: 1px solid #555; border-radius: 6px; font-size: 1rem; background: #1a1a2e; color: #eee; }
.auth-form button { margin-top: 0.5rem; }
.auth-alt { margin-top: 1.5rem; text-align: center; color: #888; }
.auth-alt a { color: #4ecdc4; }
.error-msg { background: #ff6b6b22; border: 1px solid #ff6b6b; color: #ff6b6b; padding: 0.75rem; border-radius: 6px; margin: 1rem 0; }
