:root {
    color-scheme: light;
    --ink: #17202a;
    --paper: #f7f3e8;
    --paper-2: #fffaf0;
    --line: rgba(23, 32, 42, 0.16);
    --green: #2f8f83;
    --gold: #f2b544;
    --red: #b74b3f;
    --muted: rgba(23, 32, 42, 0.66);
    --shadow: 0 18px 44px rgba(23, 32, 42, 0.12);
}

* {
    box-sizing: border-box;
}

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

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

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

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

.brand strong,
h1,
h2,
h3 {
    letter-spacing: 0;
}

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

.brand small,
.mono,
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

.brand small {
    color: rgba(247, 243, 232, 0.68);
}

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

.nav-tab,
.ghost-button,
.primary-button,
.segment,
.action-stack button {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 42px;
    padding: 0 14px;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-tab {
    background: rgba(247, 243, 232, 0.08);
    color: var(--paper);
    text-align: left;
}

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

.rail-note {
    margin-top: auto;
    border-top: 1px solid rgba(247, 243, 232, 0.2);
    padding-top: 18px;
}

.rail-note strong {
    display: block;
    margin-top: 6px;
}

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

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

.eyebrow,
.mono {
    color: var(--muted);
}

.topbar h1 {
    margin: 5px 0 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 0.95;
}

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

.search {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
}

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

.primary-button {
    background: var(--green);
    color: white;
    border-color: transparent;
    font-weight: 760;
}

.ghost-button {
    background: var(--paper-2);
    color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.segment:hover,
.action-stack button:hover {
    transform: translateY(-1px);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    background: var(--paper-2);
    margin-bottom: 20px;
}

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

.metrics article:last-child {
    border-right: 0;
}

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

.metrics small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.view {
    display: none;
}

.view.is-visible {
    display: block;
    animation: rise 240ms ease both;
}

.planner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    align-items: start;
}

.wall,
.booking-table,
.inspector,
.analytics-layout > section,
.import-panel {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.wall,
.analytics-layout > section,
.import-panel {
    padding: 18px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-head h2,
.section-head p {
    margin: 0;
}

.section-head p {
    margin-top: 5px;
    color: var(--muted);
    max-width: 680px;
}

.segment-control {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.segment {
    min-height: 34px;
    background: transparent;
    color: var(--ink);
}

.segment.is-active {
    background: var(--ink);
    color: var(--paper);
}

.time-scale {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    color: var(--muted);
    font-size: 12px;
    margin: 10px 0 8px 164px;
}

.lane-board {
    display: grid;
    gap: 10px;
}

.lane {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.lane-meta strong,
.lane-meta span {
    display: block;
}

.lane-meta span {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.lane-track {
    position: relative;
    min-height: 74px;
    border: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(23, 32, 42, 0.06) 1px, transparent 1px) 0 0 / 16.66% 100%,
        #f9f5ec;
    overflow: hidden;
}

.booking-block {
    position: absolute;
    top: 10px;
    min-height: 54px;
    border: 0;
    border-radius: 7px;
    padding: 8px 10px;
    text-align: left;
    color: white;
    overflow: hidden;
    box-shadow: 0 10px 18px rgba(23, 32, 42, 0.18);
}

.booking-block span,
.booking-block small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-block small {
    margin-top: 4px;
    opacity: 0.78;
}

.status-booked {
    background: var(--green);
}

.status-access {
    background: #396f9f;
}

.status-services {
    background: var(--gold);
    color: #2c220f;
}

.status-payment {
    background: var(--red);
}

.booking-block.is-selected,
.booking-row.is-selected {
    outline: 3px solid rgba(242, 181, 68, 0.5);
}

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

.inspector h2 {
    margin: 8px 0;
    font-size: 26px;
    line-height: 1.05;
}

.inspector p {
    color: var(--muted);
    line-height: 1.45;
}

.inspector dl {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.inspector dl div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 9px;
}

.inspector dt {
    color: var(--muted);
}

.inspector dd {
    margin: 0;
    text-align: right;
    font-weight: 720;
}

.action-stack {
    display: grid;
    gap: 8px;
}

.action-stack button {
    background: var(--ink);
    color: var(--paper);
    text-align: left;
}

.booking-table {
    margin-top: 18px;
    padding: 18px;
}

.booking-grid {
    display: grid;
    gap: 8px;
}

.booking-row {
    width: 100%;
    display: grid;
    grid-template-columns: 18px minmax(180px, 1.4fr) minmax(110px, 0.8fr) 120px 70px 70px;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    border: 1px solid var(--line);
    background: #fbf8ef;
    border-radius: 7px;
    padding: 0 12px;
    color: var(--ink);
    text-align: left;
}

.booking-row span,
.booking-row strong {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.analytics-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
    gap: 18px;
}

.analytics-bars,
.timeline {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(120px, 1fr) 40px;
    align-items: center;
    gap: 14px;
}

.bar-row strong,
.bar-row span {
    display: block;
}

.bar-row span {
    color: var(--muted);
    font-size: 13px;
}

.bar-track {
    height: 12px;
    background: rgba(23, 32, 42, 0.1);
    overflow: hidden;
}

.bar-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--gold));
}

.timeline-item {
    border-left: 4px solid var(--green);
    padding: 0 0 12px 12px;
}

.timeline-item h3,
.timeline-item p {
    margin: 4px 0;
}

.timeline-item p,
.timeline-item small {
    color: var(--muted);
}

.import-panel {
    max-width: 760px;
}

.import-panel h2 {
    margin: 8px 0;
    font-size: 32px;
}

.import-panel p {
    color: var(--muted);
    line-height: 1.5;
}

pre {
    margin: 18px 0 0;
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--ink);
    color: var(--paper);
    border-radius: 8px;
}

.public-status {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.public-tile {
    min-height: 160px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper-2);
}

.public-tile h3 {
    margin: 16px 0 8px;
    font-size: 25px;
}

.public-tile p {
    min-height: 38px;
    color: var(--muted);
}

.public-tile strong {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(47, 143, 131, 0.14);
    color: var(--green);
}

.public-tile.is-busy strong {
    background: rgba(183, 75, 63, 0.14);
    color: var(--red);
}

.empty {
    margin: 0;
    padding: 18px;
    color: var(--muted);
}

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

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

    .rail {
        position: static;
        height: auto;
    }

    .nav-tabs,
    .metrics,
    .public-status {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .planner,
    .analytics-layout {
        grid-template-columns: 1fr;
    }

    .inspector {
        position: static;
    }
}

@media (max-width: 720px) {
    .workspace,
    .rail {
        padding: 16px;
    }

    .topbar,
    .section-head {
        display: grid;
    }

    .toolbar {
        justify-content: stretch;
    }

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

    .metrics,
    .nav-tabs,
    .public-status {
        grid-template-columns: 1fr;
    }

    .metrics article {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .time-scale {
        margin-left: 0;
        font-size: 10px;
    }

    .lane {
        grid-template-columns: 1fr;
    }

    .lane-track {
        min-height: 96px;
        overflow-x: auto;
    }

    .booking-block {
        min-width: 140px;
    }

    .booking-row {
        grid-template-columns: 14px minmax(130px, 1fr) 82px;
    }

    .booking-row span:nth-of-type(2),
    .booking-row span:nth-of-type(4),
    .booking-row span:nth-of-type(5) {
        display: none;
    }
}
