:root {
    --ink: #2f3e46;
    --paper: #f1faee;
    --linen: #fbfff8;
    --gold: #e9c46a;
    --blue: #457b9d;
    --mint: #a8dadc;
    --danger: #c8553d;
    --line: rgba(47, 62, 70, 0.16);
    --shadow: 0 18px 48px rgba(47, 62, 70, 0.14);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100svh;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

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

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

.brand {
    color: inherit;
    text-decoration: none;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.brand strong {
    display: block;
    font-size: 20px;
    line-height: 1.05;
}

.brand small,
.kpi-label,
td small,
.note small,
.zone-row small,
.public-row small {
    display: block;
    color: rgba(47, 62, 70, 0.68);
    font-size: 12px;
    line-height: 1.35;
}

.brand small {
    color: rgba(241, 250, 238, 0.68);
}

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

.tab {
    min-height: 48px;
    border: 1px solid rgba(241, 250, 238, 0.16);
    border-radius: 8px;
    background: transparent;
    color: rgba(241, 250, 238, 0.76);
    text-align: left;
    padding: 0 14px;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
    background: var(--paper);
    color: var(--ink);
    transform: translateX(2px);
}

.workspace {
    min-width: 0;
    padding: 22px clamp(14px, 3vw, 34px) 34px;
}

.summary-strip {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
    box-shadow: var(--shadow);
}

.summary-strip > div {
    min-height: 86px;
    padding: 14px 16px;
    background: var(--linen);
}

.summary-strip strong {
    display: block;
    margin-top: 4px;
    font-size: clamp(26px, 4vw, 44px);
    line-height: 1;
    letter-spacing: 0;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
    gap: 18px;
    align-items: end;
    padding: 28px 0 18px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(28px, 5vw, 58px);
    line-height: 0.98;
    letter-spacing: 0;
}

h2 {
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: 0;
}

.toolbar p,
.import-console p,
.public-status p,
.accent-panel p {
    margin-top: 8px;
    color: rgba(47, 62, 70, 0.72);
    max-width: 660px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: 10px;
}

input,
select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--linen);
    color: var(--ink);
    padding: 0 12px;
}

.view {
    display: none;
}

.view.is-active {
    display: block;
    animation: rise 220ms ease both;
}

.table-wrap {
    overflow-x: auto;
    background: var(--linen);
    border: 1px solid var(--line);
    box-shadow: 0 14px 38px rgba(69, 123, 157, 0.12);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

th {
    position: sticky;
    top: 88px;
    z-index: 2;
    background: #dbeedd;
    color: rgba(47, 62, 70, 0.78);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

td strong {
    display: block;
    line-height: 1.2;
}

.benefit,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 5px;
    font-size: 13px;
    line-height: 1.2;
}

.benefit {
    background: color-mix(in srgb, var(--benefit) 24%, white);
    border: 1px solid color-mix(in srgb, var(--benefit) 58%, white);
}

.status {
    border: 1px solid rgba(47, 62, 70, 0.14);
    background: #eef7f1;
}

.risk-high {
    background: #f8dfd8;
    color: #792d20;
}

.risk-medium {
    background: #fff2cf;
    color: #6f5410;
}

.risk-low {
    background: #dff1ef;
    color: #285f62;
}

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

.actions button,
.primary-action {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}

.actions button:hover,
.primary-action:hover {
    transform: translateY(-1px);
    background: #1f2c32;
}

.primary-action {
    width: fit-content;
    min-width: 220px;
    padding: 0 18px;
    background: var(--blue);
}

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

.panel,
.import-console,
.public-status {
    border: 1px solid var(--line);
    background: var(--linen);
    padding: 18px;
}

.accent-panel {
    background: var(--ink);
    color: var(--paper);
}

.accent-panel .kpi-label,
.accent-panel p {
    color: rgba(241, 250, 238, 0.72);
}

.accent-panel strong {
    display: block;
    margin: 12px 0;
    font-size: 52px;
    line-height: 1;
}

.bars,
.zone-list,
.notes-list,
.public-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.bar-row {
    display: grid;
    grid-template-columns: 82px minmax(80px, 1fr) 34px;
    gap: 10px;
    align-items: center;
}

.bar-row div {
    height: 12px;
    background: #e1eadf;
    overflow: hidden;
}

.bar-row i {
    display: block;
    height: 100%;
    background: var(--gold);
}

.zone-row,
.public-row,
.note {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.zone-row,
.public-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: baseline;
}

.import-console {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

output {
    grid-column: 1 / -1;
    min-height: 22px;
    color: #285f62;
}

.note {
    background: rgba(255, 255, 255, 0.48);
    padding: 12px;
}

.note span {
    color: var(--blue);
    font-size: 12px;
}

.note p {
    margin-top: 6px;
    line-height: 1.45;
}

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

@media (max-width: 860px) {
    .app-shell {
        display: block;
    }

    .rail {
        position: static;
        height: auto;
        padding: 14px;
        gap: 14px;
    }

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

    .tab {
        min-height: 44px;
        padding: 0 8px;
        text-align: center;
    }

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

    .toolbar,
    .filters,
    .split,
    .import-console {
        grid-template-columns: 1fr;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        min-width: 0;
    }

    thead {
        display: none;
    }

    tr {
        border-bottom: 1px solid var(--line);
        padding: 10px 0;
    }

    td {
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 10px;
        border-bottom: 0;
        padding: 8px 12px;
    }

    td::before {
        content: attr(data-label);
        color: rgba(47, 62, 70, 0.6);
        font-size: 12px;
    }

    .actions {
        justify-content: start;
    }
}

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

    .summary-strip > div {
        min-height: 72px;
        padding: 12px;
    }

    .tabs {
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(92px, 1fr));
    }

    td {
        grid-template-columns: 1fr;
    }

    .zone-row,
    .public-row,
    .bar-row {
        grid-template-columns: 1fr;
    }
}

