:root {
    --ink: #202c39;
    --paper: #f4f1de;
    --steel: #3d5a80;
    --coral: #e07a5f;
    --mint: #8ab17d;
    --line: rgba(32, 44, 57, 0.16);
    --muted: rgba(32, 44, 57, 0.66);
    --white: #fffdf7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(61, 90, 128, 0.07) 1px, transparent 1px),
        linear-gradient(180deg, rgba(61, 90, 128, 0.06) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
    cursor: pointer;
}

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

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

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

.brand strong {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 25px;
    line-height: 1;
}

.brand small,
.rail-note,
.eyebrow {
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand small {
    color: rgba(244, 241, 222, 0.7);
    font-size: 12px;
}

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

.nav-tab {
    width: 100%;
    border: 1px solid rgba(244, 241, 222, 0.16);
    border-radius: 8px;
    padding: 12px 14px;
    color: rgba(244, 241, 222, 0.78);
    background: transparent;
    text-align: left;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-tab:hover,
.nav-tab.active {
    color: var(--paper);
    background: rgba(224, 122, 95, 0.2);
    transform: translateX(3px);
}

.rail-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    color: rgba(244, 241, 222, 0.7);
    font-size: 12px;
    line-height: 1.4;
}

.signal {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 7px rgba(138, 177, 125, 0.18);
}

.workspace {
    padding: 26px clamp(16px, 4vw, 48px) 42px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 22px;
    align-items: end;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--coral);
    font-size: 12px;
    font-weight: 800;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

h1 {
    max-width: 780px;
    font-size: clamp(34px, 5vw, 76px);
    line-height: 0.95;
}

h2 {
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1;
}

h3 {
    font-size: 22px;
}

p {
    color: var(--muted);
    line-height: 1.55;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
}

.search-form label,
.action-form label {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.search-form input,
.search-form button,
.action-form select,
.action-form textarea,
.action-form button,
.panel-head select {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
}

.search-form input,
.action-form select,
.action-form textarea,
.panel-head select {
    width: 100%;
    color: var(--ink);
    background: rgba(255, 253, 247, 0.88);
}

.search-form button,
.action-form button {
    border-color: var(--ink);
    color: var(--paper);
    background: var(--ink);
    font-weight: 800;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 28px 0;
    border: 1px solid var(--line);
    background: var(--line);
}

.metric-strip div {
    padding: 18px;
    background: rgba(255, 253, 247, 0.82);
}

.metric-strip span {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 38px;
    line-height: 1;
}

.metric-strip small,
.stage-stop small,
.order-row small,
.timeline-item small,
.team-member small,
.settings-item span {
    color: var(--muted);
}

.route-map {
    position: relative;
    margin-bottom: 26px;
    padding: 20px 0;
}

.route-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 3px;
    background: linear-gradient(90deg, var(--steel), var(--coral), var(--mint));
}

.stage-track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stage-stop {
    min-height: 104px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: rgba(244, 241, 222, 0.92);
    text-align: left;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.stage-stop:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 26px rgba(32, 44, 57, 0.12);
}

.stage-stop span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    border-radius: 50%;
    color: var(--paper);
    background: var(--steel);
    font-weight: 800;
}

.stage-stop strong,
.stage-stop small {
    display: block;
}

.screen {
    display: none;
}

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

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

.queue-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
    gap: 28px;
    align-items: start;
}

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

.panel-head p,
.section-head p {
    max-width: 620px;
    margin: 8px 0 0;
}

.orders-list,
.timeline-list,
.team-list,
.settings-list {
    display: grid;
    gap: 10px;
}

.order-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    color: var(--ink);
    background: rgba(255, 253, 247, 0.72);
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.order-row:hover,
.order-row.active {
    border-color: rgba(224, 122, 95, 0.65);
    background: var(--white);
    transform: translateX(3px);
}

.route-index {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--paper);
    background: var(--ink);
    font-weight: 800;
}

.order-main,
.order-side {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.order-main strong {
    overflow-wrap: anywhere;
}

.order-side {
    justify-items: end;
    text-align: right;
}

.risk {
    border-radius: 999px;
    padding: 5px 9px;
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
}

.risk-high {
    color: #7c2f21;
    background: rgba(224, 122, 95, 0.22);
}

.risk-medium {
    color: #2f527c;
    background: rgba(61, 90, 128, 0.16);
}

.risk-low {
    color: #42633a;
    background: rgba(138, 177, 125, 0.18);
}

.progress,
.load-bar {
    display: block;
    overflow: hidden;
    height: 7px;
    border-radius: 999px;
    background: rgba(32, 44, 57, 0.12);
}

.progress i,
.load-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--steel), var(--coral));
}

.phone-frame {
    position: sticky;
    top: 24px;
    overflow: hidden;
    border: 10px solid var(--ink);
    border-radius: 30px;
    padding: 18px;
    background: var(--white);
    box-shadow: 0 24px 60px rgba(32, 44, 57, 0.2);
}

.phone-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 13px;
}

.selected-order h2 {
    margin-bottom: 16px;
    font-size: 30px;
}

.selected-order dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.selected-order div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}

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

.selected-order dd {
    margin: 0;
    text-align: right;
}

.mini-map {
    position: relative;
    height: 150px;
    margin: 18px 0;
    border: 1px solid rgba(61, 90, 128, 0.2);
    border-radius: 8px;
    background:
        radial-gradient(circle at 30% 35%, rgba(224, 122, 95, 0.2), transparent 18%),
        linear-gradient(135deg, rgba(61, 90, 128, 0.13) 25%, transparent 25%),
        linear-gradient(45deg, rgba(32, 44, 57, 0.08) 25%, transparent 25%),
        var(--paper);
    background-size: auto, 34px 34px, 34px 34px, auto;
}

.map-dot {
    position: absolute;
    z-index: 2;
    width: 16px;
    height: 16px;
    border: 3px solid var(--white);
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 0 0 4px rgba(224, 122, 95, 0.2);
}

.dot-a {
    left: 18%;
    top: 34%;
}

.dot-b {
    left: 52%;
    top: 54%;
    background: var(--steel);
}

.dot-c {
    right: 16%;
    top: 26%;
    background: var(--mint);
}

.map-route {
    position: absolute;
    left: 22%;
    right: 20%;
    top: 43%;
    height: 42px;
    border-top: 3px dashed var(--ink);
    border-right: 3px dashed var(--ink);
    transform: skewY(-12deg);
    opacity: 0.42;
}

.action-form {
    display: grid;
    gap: 10px;
}

.action-form textarea {
    resize: vertical;
}

.timeline-item,
.settings-item,
.team-member {
    display: grid;
    gap: 8px;
    border-left: 4px solid var(--coral);
    padding: 14px 16px;
    background: rgba(255, 253, 247, 0.76);
}

.timeline-item {
    grid-template-columns: 160px minmax(0, 1fr);
}

.timeline-item time {
    color: var(--steel);
    font-weight: 800;
}

.timeline-item p {
    margin: 5px 0;
}

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

.team-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.team-member {
    border-left-color: var(--steel);
}

.team-member div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.team-member span {
    color: var(--muted);
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 253, 247, 0.62);
}

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

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

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

    .nav-tab {
        text-align: center;
    }

    .topbar,
    .queue-layout,
    .settings-grid,
    .team-list {
        grid-template-columns: 1fr;
    }

    .phone-frame {
        position: static;
        max-width: 430px;
        margin: 0 auto;
    }
}

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

    h1 {
        font-size: 38px;
    }

    .search-form,
    .metric-strip,
    .stage-track {
        grid-template-columns: 1fr;
    }

    .route-line {
        display: none;
    }

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

    .panel-head,
    .section-head {
        display: grid;
        align-items: start;
    }

    .order-row {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .order-side {
        grid-column: 2;
        justify-items: start;
        text-align: left;
    }

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

