:root {
    --ink: #1b1b3a;
    --paper: #fbfefb;
    --coral: #ff6b6b;
    --mint: #4ecdc4;
    --line: rgba(27, 27, 58, 0.14);
    --muted: rgba(27, 27, 58, 0.62);
    --panel: rgba(255, 255, 255, 0.72);
    --shadow: 0 22px 70px rgba(27, 27, 58, 0.14);
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(78, 205, 196, 0.08), transparent 36%),
        linear-gradient(180deg, #fbfefb 0%, #eef8f5 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.rail {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: 100vh;
    padding: 22px 18px;
    color: var(--paper);
    background: var(--ink);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand strong {
    display: block;
    font-size: 18px;
    line-height: 1.1;
}

.brand small,
.rail-footer,
.mono {
    font-size: 11px;
    line-height: 1.25;
    text-transform: uppercase;
    color: rgba(251, 254, 251, 0.68);
}

.mono {
    color: var(--muted);
    font-weight: 780;
}

.nav-tabs {
    display: grid;
    gap: 8px;
}

.nav-tab {
    width: 100%;
    padding: 12px 12px;
    border: 1px solid rgba(251, 254, 251, 0.14);
    border-radius: 7px;
    color: rgba(251, 254, 251, 0.78);
    background: transparent;
    text-align: left;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-tab:hover,
.nav-tab.is-active {
    color: var(--paper);
    background: rgba(78, 205, 196, 0.16);
    transform: translateX(2px);
}

.rail-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(251, 254, 251, 0.14);
}

.rail-footer strong {
    display: block;
    margin-top: 6px;
    color: var(--mint);
    font-size: 14px;
    text-transform: none;
}

.workspace {
    min-width: 0;
    padding: 26px clamp(16px, 3vw, 42px) 42px;
}

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

.eyebrow {
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(30px, 5vw, 60px);
    line-height: 0.96;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 8px;
    font-size: 18px;
    line-height: 1.15;
    letter-spacing: 0;
}

p,
small,
dd {
    color: var(--muted);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.68);
}

.search input {
    width: min(28vw, 240px);
    min-width: 120px;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
}

.primary-button,
.secondary-button,
.icon-button {
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    font-weight: 800;
}

.primary-button {
    padding: 0 16px;
    color: var(--paper);
    background: var(--coral);
    box-shadow: 0 12px 28px rgba(255, 107, 107, 0.26);
}

.secondary-button {
    width: 100%;
    padding: 0 14px;
    color: var(--ink);
    background: rgba(78, 205, 196, 0.18);
}

.icon-button {
    width: 42px;
    color: var(--ink);
    background: rgba(27, 27, 58, 0.08);
}

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

.metrics article {
    min-width: 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.82);
}

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

.metric-hot strong {
    color: var(--coral);
}

.view {
    display: none;
    animation: lift 220ms ease both;
}

.view.is-visible {
    display: block;
}

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

.wall-head,
.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.wall-head p {
    max-width: 680px;
    margin-bottom: 0;
}

.stage-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.stage-filter button {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.62);
}

.stage-filter button.is-active {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
}

.reservation-wall {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.lane {
    min-height: 172px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
}

.lane h3 {
    margin: 4px 0 16px;
    font-size: 16px;
}

.lane-meter {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(27, 27, 58, 0.09);
}

.lane-meter span {
    display: block;
    height: 100%;
    width: var(--value);
    background: linear-gradient(90deg, var(--mint), var(--coral));
    transition: width 260ms ease;
}

.lane-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.lane-facts strong {
    display: block;
    font-size: 24px;
}

.split,
.intake-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    align-items: start;
}

.object-list,
.inspector,
.intake-form,
.intake-preview,
.doc-card,
.finance-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 16px 44px rgba(27, 27, 58, 0.08);
}

.object-list,
.intake-form,
.intake-preview {
    padding: 16px;
}

.item-grid {
    display: grid;
    gap: 10px;
}

.item-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.5fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr) minmax(92px, 0.5fr);
    gap: 12px;
    align-items: center;
    min-height: 72px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: rgba(251, 254, 251, 0.78);
    text-align: left;
    transition: border 160ms ease, transform 160ms ease, background 160ms ease;
}

.item-row:hover,
.item-row.is-active {
    border-color: rgba(78, 205, 196, 0.7);
    background: #fff;
    transform: translateY(-1px);
}

.item-row strong,
.item-row span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.risk {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: var(--ink);
    background: rgba(78, 205, 196, 0.2);
}

.risk.conflict {
    color: var(--paper);
    background: var(--coral);
}

.risk.watch {
    background: rgba(255, 107, 107, 0.18);
}

.inspector {
    position: sticky;
    top: 22px;
    padding: 18px;
}

.inspector p {
    margin-bottom: 18px;
}

dl {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 9px 12px;
    margin: 0 0 18px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.intake-form {
    display: grid;
    gap: 13px;
}

.intake-form label,
.dialog-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.intake-form input,
.intake-form select,
.intake-form textarea,
.dialog-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    color: var(--ink);
    background: rgba(251, 254, 251, 0.9);
}

.intake-preview {
    min-height: 320px;
}

.intake-preview h2 {
    font-size: 28px;
}

.doc-grid,
.finance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.doc-card,
.finance-card {
    min-height: 170px;
    padding: 16px;
}

.doc-card strong,
.finance-card strong {
    display: block;
    margin: 8px 0;
    font-size: 19px;
    overflow-wrap: anywhere;
}

.amount {
    color: var(--coral);
    font-size: 26px;
    font-weight: 900;
}

dialog {
    width: min(520px, calc(100vw - 28px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    color: var(--ink);
    background: var(--paper);
    box-shadow: var(--shadow);
}

dialog::backdrop {
    background: rgba(27, 27, 58, 0.36);
}

.dialog-form {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-actions button:not(.primary-button) {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: transparent;
}

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

    .rail {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 14px;
    }

    .nav-tabs {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
    }

    .rail-footer {
        display: none;
    }

    .reservation-wall,
    .doc-grid,
    .finance-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split,
    .intake-layout {
        grid-template-columns: 1fr;
    }

    .inspector {
        position: static;
    }
}

@media (max-width: 720px) {
    .workspace {
        padding: 18px 12px 34px;
    }

    .topbar,
    .wall-head,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    h1 {
        font-size: 34px;
    }

    .toolbar {
        justify-content: stretch;
    }

    .search,
    .primary-button {
        width: 100%;
    }

    .search input {
        width: 100%;
    }

    .metrics,
    .reservation-wall,
    .doc-grid,
    .finance-grid {
        grid-template-columns: 1fr;
    }

    .item-row {
        grid-template-columns: 1fr;
    }

    .rail {
        align-items: stretch;
        flex-direction: column;
    }

    .nav-tabs {
        grid-auto-flow: row;
    }
}
