:root {
    --ink: #0f1f1c;
    --paper: #f8f9fa;
    --rose: #c9ada7;
    --leaf: #4a7c59;
    --line: rgba(15, 31, 28, 0.14);
    --muted: rgba(15, 31, 28, 0.64);
    --warn: #a8473b;
    --gold: #c08b3c;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 12%, rgba(201, 173, 167, 0.26), transparent 32rem),
        linear-gradient(135deg, #f8f9fa 0%, #eef2ee 48%, #dbc9c3 100%);
    font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 100vh;
}

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px;
    color: var(--paper);
    background: var(--ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
}

.brand {
    color: var(--paper);
    text-decoration: none;
    display: grid;
    gap: 9px;
    justify-items: center;
    text-align: center;
    text-transform: uppercase;
    font-weight: 800;
    font-size: 13px;
    line-height: 1.05;
}

.brand img {
    width: 48px;
    height: 48px;
}

.nav-tabs {
    display: grid;
    gap: 10px;
    width: 100%;
}

.nav-button {
    min-height: 42px;
    border: 1px solid rgba(248, 249, 250, 0.2);
    border-radius: 8px;
    color: rgba(248, 249, 250, 0.72);
    background: transparent;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button:hover,
.nav-button.is-active {
    color: var(--ink);
    background: var(--rose);
    transform: translateX(3px);
}

.rail-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
    justify-items: center;
    color: rgba(248, 249, 250, 0.62);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
}

.health-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 0 5px rgba(168, 71, 59, 0.18);
}

.health-dot.is-ok {
    background: var(--leaf);
    box-shadow: 0 0 0 5px rgba(74, 124, 89, 0.22);
}

.workspace {
    min-width: 0;
    padding: 26px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.eyebrow,
.section-title span {
    margin: 0 0 7px;
    color: var(--leaf);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(28px, 4vw, 52px);
    line-height: 0.98;
    max-width: 820px;
}

h2 {
    margin-bottom: 8px;
    font-size: clamp(25px, 3vw, 42px);
    line-height: 1.02;
}

h3 {
    margin-bottom: 7px;
    font-size: 19px;
    line-height: 1.12;
}

p,
small {
    line-height: 1.55;
}

.status-pack {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

#syncStatus {
    min-width: 98px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.6);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-size: 21px;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
    background: rgba(248, 249, 250, 0.58);
    backdrop-filter: blur(12px);
}

.metric {
    min-width: 0;
    padding: 16px;
    border-right: 1px solid var(--line);
}

.metric:last-child {
    border-right: 0;
}

.metric span,
.detail-grid span,
.next-step span {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(24px, 4vw, 38px);
    line-height: 1;
}

.metric.is-alert strong {
    color: var(--warn);
}

.portal-frame {
    min-height: 620px;
    animation: rise 420ms ease both;
}

.empty-state {
    min-height: 320px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: rgba(248, 249, 250, 0.52);
}

.empty-state.is-error {
    color: var(--warn);
}

.split-dashboard {
    display: grid;
    grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.45fr);
    gap: 18px;
    align-items: start;
}

.timeline-sheet,
.case-sheet,
.approval-sheet,
.vendor-sheet {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.68);
    backdrop-filter: blur(14px);
}

.timeline-sheet,
.approval-sheet,
.vendor-sheet {
    padding: 18px;
}

.case-sheet {
    padding: 22px;
}

.section-title {
    margin-bottom: 15px;
}

.section-title strong {
    display: block;
    font-size: 18px;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    position: relative;
    padding: 0 0 14px 24px;
    border-bottom: 1px solid var(--line);
}

.timeline-item:before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 0 5px rgba(201, 173, 167, 0.18);
}

.timeline-item.is-done:before {
    background: var(--leaf);
}

.timeline-item.is-blocked:before {
    background: var(--warn);
}

.timeline-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.stage {
    display: block;
    color: var(--leaf);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 900;
}

.timeline-item strong,
.timeline-item small {
    display: block;
}

.timeline-item p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.case-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.case-head p {
    margin-bottom: 0;
    color: var(--muted);
}

.quality-orb {
    flex: 0 0 auto;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    align-content: center;
    color: var(--paper);
    background: conic-gradient(var(--leaf), var(--rose), var(--ink), var(--leaf));
    box-shadow: inset 0 0 0 9px rgba(248, 249, 250, 0.78);
}

.quality-orb span {
    display: block;
    font-size: 28px;
    font-weight: 900;
}

.quality-orb small {
    display: block;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 18px 0;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.detail-grid > div {
    min-width: 0;
    padding: 14px;
    background: rgba(248, 249, 250, 0.72);
}

.detail-grid strong,
.next-step strong {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.next-step {
    padding: 15px 16px;
    border-left: 5px solid var(--leaf);
    background: rgba(74, 124, 89, 0.09);
    border-radius: 0 8px 8px 0;
    margin-bottom: 18px;
}

.work-columns,
.calendar-view,
.report-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.78fr);
    gap: 18px;
}

.work-columns.lower {
    margin-top: 18px;
}

.check-list,
.homework-list,
.vote-log,
.lesson-list,
.report-list {
    display: grid;
    gap: 10px;
}

.check-row {
    width: 100%;
    display: grid;
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.72);
    text-align: left;
    transition: transform 160ms ease, border-color 160ms ease;
}

.check-row:hover {
    transform: translateY(-2px);
    border-color: rgba(74, 124, 89, 0.42);
}

.check-mark {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--rose);
    display: grid;
    place-items: center;
    color: var(--paper);
    background: transparent;
    font-weight: 900;
}

.check-row.is-done .check-mark {
    border-color: var(--leaf);
    background: var(--leaf);
}

.check-row strong,
.check-row small {
    display: block;
}

.check-row small {
    margin-top: 5px;
    color: var(--muted);
}

.homework-row,
.record-row,
.lesson-row,
.report-row {
    display: grid;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.72);
}

.homework-row {
    grid-template-columns: minmax(0, 1fr) 54px auto;
    padding: 12px;
}

.homework-row strong,
.homework-row small {
    display: block;
}

.homework-row p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.delta {
    color: var(--warn);
    font-weight: 900;
}

.text-button,
.wide-action,
.vote-button {
    border: 0;
    border-radius: 8px;
    font-weight: 900;
    transition: transform 160ms ease, filter 160ms ease;
}

.text-button {
    padding: 9px 11px;
    background: var(--ink);
    color: var(--paper);
}

.wide-action {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: var(--leaf);
    color: var(--paper);
}

.text-button:hover,
.wide-action:hover,
.vote-button:hover {
    transform: translateY(-2px);
    filter: saturate(1.08);
}

.soft-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.vote-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.vote-button {
    min-height: 42px;
    padding: 9px;
    color: var(--paper);
    background: var(--leaf);
}

.vote-button.review {
    background: var(--gold);
}

.vote-button.block {
    background: var(--warn);
}

.vote-row,
.approval-row,
.vendor-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.62);
}

.vote-row strong,
.vote-row p,
.approval-row strong,
.approval-row small,
.vendor-row span,
.vendor-row small {
    display: block;
}

.vote-row p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.decision {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    margin-bottom: 8px;
    border-radius: 999px;
    color: var(--ink);
    background: var(--rose);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.decision.is-approve,
.decision.is-approved {
    color: var(--paper);
    background: var(--leaf);
}

.decision.is-block,
.decision.is-blocked {
    color: var(--paper);
    background: var(--warn);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.photo-tile {
    margin: 0;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(248, 249, 250, 0.72);
}

.photo-tile img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.photo-tile figcaption {
    padding: 9px;
}

.photo-tile strong,
.photo-tile span {
    display: block;
    font-size: 13px;
    line-height: 1.35;
}

.photo-tile span {
    color: var(--muted);
}

.records-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    margin-bottom: 16px;
}

.records-toolbar input {
    width: min(430px, 100%);
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 13px;
    background: rgba(248, 249, 250, 0.8);
}

.record-list {
    display: grid;
    gap: 10px;
}

.record-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 16px;
}

.record-row h3,
.record-row p {
    margin-bottom: 0;
}

.record-meta {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 12px;
    align-items: center;
    color: var(--muted);
}

.record-meta strong {
    color: var(--ink);
    font-size: 26px;
}

.calendar-view,
.report-view {
    align-items: start;
}

.lesson-row {
    grid-template-columns: 116px minmax(0, 1fr) auto;
    padding: 15px;
}

.lesson-row time {
    color: var(--leaf);
    font-weight: 900;
}

.lesson-row p,
.lesson-row h3,
.report-row p,
.report-row h3 {
    margin-bottom: 4px;
}

.lesson-row small,
.report-row p,
.vendor-row span,
.vendor-row small {
    color: var(--muted);
}

.lesson-row > span {
    font-weight: 900;
    text-transform: uppercase;
}

.approval-sheet,
.vendor-sheet {
    display: grid;
    gap: 10px;
}

.approval-row strong,
.vendor-row strong {
    display: block;
    line-height: 1.25;
}

.report-row {
    grid-template-columns: minmax(0, 1fr) 114px;
    padding: 16px;
}

.report-score {
    width: 98px;
    height: 98px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    align-content: center;
    background: var(--ink);
    color: var(--paper);
}

.report-score span {
    font-size: 27px;
    font-weight: 900;
}

.report-score small {
    color: rgba(248, 249, 250, 0.76);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1040px) {
    .app-shell {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .split-dashboard,
    .work-columns,
    .calendar-view,
    .report-view {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .rail {
        position: static;
        height: auto;
        padding: 12px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .brand {
        grid-template-columns: 38px auto;
        align-items: center;
        text-align: left;
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .nav-tabs {
        width: auto;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        flex: 1;
    }

    .nav-button {
        min-height: 36px;
        font-size: 11px;
        padding: 0 6px;
    }

    .rail-footer {
        display: none;
    }

    .workspace {
        padding: 16px;
    }

    .topbar,
    .records-toolbar,
    .case-head {
        display: grid;
    }

    .metric-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric:nth-child(2) {
        border-right: 0;
    }

    .metric:nth-child(1),
    .metric:nth-child(2) {
        border-bottom: 1px solid var(--line);
    }

    .case-sheet,
    .timeline-sheet,
    .approval-sheet,
    .vendor-sheet {
        padding: 14px;
    }

    .quality-orb {
        width: 96px;
        height: 96px;
    }

    .detail-grid,
    .homework-row,
    .record-row,
    .lesson-row,
    .report-row,
    .record-meta,
    .vote-actions,
    .photo-grid {
        grid-template-columns: 1fr;
    }

    .record-meta {
        justify-items: start;
    }
}

