:root {
    --ink: #14213d;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --soft: #f8fafc;
    --brand: #2563eb;
    --brand-2: #0f766e;
    --danger: #dc2626;
    --warn: #d97706;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: #eef2f7;
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-nav { background: #0f172a; box-shadow: 0 8px 24px rgba(15, 23, 42, .16); }
.app-shell { padding: 18px 0 96px; }
.container-fluid { max-width: 1240px; }
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 18px;
}
.page-head h1, .auth-panel h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.35rem); font-weight: 800; letter-spacing: 0; }
.eyebrow { margin: 0 0 3px; color: var(--brand-2); font-size: .76rem; text-transform: uppercase; font-weight: 800; }
.panel, .project-card, .metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}
.panel { padding: 16px; }
.panel h2, .project-card h2, .task-card h2 { font-size: 1.05rem; font-weight: 800; margin: 0 0 10px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.metric { padding: 14px; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: .86rem; }
.metric strong { font-size: 1.28rem; line-height: 1.15; overflow-wrap: anywhere; }
.metric.danger strong { color: var(--danger); }
.metric.warn strong { color: var(--warn); }
.project-search {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: end;
}
.project-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.project-total, .status-pill {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.project-total span, .status-pill span { color: var(--muted); }
.project-total strong, .status-pill strong { color: var(--ink); font-size: 1.2rem; }
.status-pill:hover { text-decoration: none; border-color: var(--brand); }
.project-list, .task-stack { display: grid; gap: 12px; }
.project-section { margin-top: 22px; }
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.section-title h2 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.section-title span { color: var(--muted); font-size: .9rem; }
.project-card { padding: 15px; display: grid; gap: 12px; }
.project-card-top, .project-dates {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.project-number {
    background: #eef6ff;
    color: #1d4ed8;
    border-radius: 8px;
    padding: 4px 8px;
    font-weight: 800;
    font-size: .78rem;
}
.status-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.status-in_progress { background: #2563eb; }
.status-future { background: #d97706; }
.status-completed { background: #0f766e; }
.status-archived { background: #64748b; }
.project-card p { color: var(--muted); margin: 4px 0 0; }
.project-dates { color: var(--muted); font-size: .82rem; margin-top: 10px; }
.mini-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
}
.mini-metrics span, .soft-row {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
}
.mini-metrics strong { display: block; font-size: 1rem; }
.mini-metrics em { color: var(--muted); font-style: normal; font-size: .82rem; }
.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 14px;
    color: var(--muted);
    background: rgba(255,255,255,.55);
}
.soft-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.soft-row span { color: var(--muted); }
.soft-row strong { text-align: right; }
.auth-wrap {
    min-height: calc(100vh - 80px);
    display: grid;
    place-items: center;
    padding: 20px;
}
.auth-panel {
    width: min(100%, 430px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 22px 50px rgba(15, 23, 42, .12);
}
.filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.table { margin-bottom: 0; }
.btn, .form-control, .form-select { border-radius: 8px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }

@media (min-width: 768px) {
    .app-shell { padding-top: 28px; }
    .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .project-search { grid-template-columns: 1fr auto auto; }
    .project-overview { grid-template-columns: 1.2fr repeat(4, 1fr); }
    .project-card { grid-template-columns: 1.4fr 1fr; align-items: center; }
    .filter-bar { grid-template-columns: 1fr 1fr auto; }
}

@media print {
    .app-nav, .btn, form { display: none !important; }
    body { background: #fff; }
    .panel, .metric { box-shadow: none; }
}
