:root {
    --ink: #202c39;
    --paper: #f4f1de;
    --blue: #3d5a80;
    --copper: #e07a5f;
    --green: #5a7d58;
    --line: rgba(32, 44, 57, 0.16);
    --muted: rgba(32, 44, 57, 0.66);
    --white: #fffaf0;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(32, 44, 57, 0.06) 1px, transparent 1px),
        linear-gradient(0deg, rgba(32, 44, 57, 0.05) 1px, transparent 1px),
        var(--paper);
    background-size: 34px 34px;
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    background: var(--ink);
    color: var(--paper);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 21px;
    line-height: 0.95;
}

.nav {
    display: grid;
    gap: 8px;
    margin-top: 40px;
}

.nav__item,
.ghost,
.search button,
.mobile-mirror button,
.workflow-row button {
    border: 0;
    border-radius: 8px;
    padding: 11px 13px;
    background: rgba(244, 241, 222, 0.08);
    color: inherit;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav__item {
    text-align: left;
}

.nav__item:hover,
.nav__item.is-active,
.ghost:hover {
    background: var(--copper);
    color: #1b232d;
    transform: translateX(3px);
}

.rail__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(244, 241, 222, 0.74);
    font-size: 13px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #8fd694;
    box-shadow: 0 0 0 7px rgba(143, 214, 148, 0.14);
}

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

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

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

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

h1,
h2 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 0.95;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(23px, 3vw, 34px);
    line-height: 1;
}

.search {
    display: grid;
    grid-template-columns: minmax(160px, 270px) auto;
    gap: 8px;
}

.search input,
select,
.workflow-row input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 240, 0.78);
    color: var(--ink);
    padding: 0 12px;
    outline: none;
}

.search button,
.mobile-mirror button,
.workflow-row button {
    background: var(--ink);
    color: var(--paper);
}

.screen {
    display: none;
    animation: rise 260ms ease both;
}

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

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

.dispatch-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 22px;
    align-items: start;
}

.route-board,
.field-console,
.screen[data-panel="history"],
.screen[data-panel="workflow"],
.screen[data-panel="team"] {
    border-top: 3px solid var(--ink);
    padding-top: 18px;
}

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

.timeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 250, 240, 0.72);
}

.timeline__stop {
    min-height: 104px;
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    padding: 14px;
    text-align: left;
    display: grid;
    align-content: space-between;
    gap: 7px;
}

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

.timeline__stop:hover,
.timeline__stop.is-current {
    background: rgba(224, 122, 95, 0.14);
}

.timeline__dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--stop-color, var(--copper));
    box-shadow: 0 0 0 5px rgba(32, 44, 57, 0.08);
}

.timeline__title {
    font-weight: 800;
}

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

.orders {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.order {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(136px, 180px);
    gap: 18px;
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
    transition: background 180ms ease, padding 180ms ease;
}

.order:hover,
.order.is-selected {
    background: rgba(61, 90, 128, 0.1);
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 8px;
}

.code {
    color: var(--copper);
    font-weight: 900;
}

.order h3 {
    margin: 5px 0;
    font-size: 21px;
}

.order p {
    margin-bottom: 10px;
    color: var(--muted);
}

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

.artifacts span,
.stage,
.save-state {
    border-radius: 999px;
    background: rgba(32, 44, 57, 0.08);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}

.stage {
    color: var(--stage-color, var(--blue));
    background: rgba(255, 250, 240, 0.86);
}

.order__side {
    display: grid;
    justify-items: end;
    align-content: space-between;
    gap: 10px;
}

meter {
    width: 100%;
    height: 9px;
}

.field-console {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 14px;
}

.map {
    position: relative;
    min-height: 250px;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(61, 90, 128, 0.2), rgba(224, 122, 95, 0.16)),
        var(--white);
    border: 1px solid var(--line);
}

.map__grid {
    position: absolute;
    inset: 18px;
    border: 2px dashed rgba(32, 44, 57, 0.25);
    border-radius: 42% 38% 45% 32%;
}

.map__grid::before,
.map__grid::after {
    content: "";
    position: absolute;
    background: rgba(32, 44, 57, 0.16);
}

.map__grid::before {
    width: 72%;
    height: 2px;
    left: 14%;
    top: 48%;
    transform: rotate(-15deg);
}

.map__grid::after {
    width: 2px;
    height: 70%;
    left: 50%;
    top: 14%;
    transform: rotate(21deg);
}

.pin {
    position: absolute;
    border-radius: 999px;
    padding: 7px 10px;
    background: var(--ink);
    color: var(--paper);
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 12px 30px rgba(32, 44, 57, 0.18);
}

.pin--order {
    left: 22px;
    top: 34px;
}

.pin--makeup {
    right: 38px;
    top: 56px;
    background: var(--blue);
}

.pin--shop {
    left: 48%;
    top: 48%;
    background: var(--copper);
    color: var(--ink);
}

.pin--gate {
    right: 20px;
    bottom: 28px;
    background: var(--green);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--line);
}

.metrics div {
    min-height: 86px;
    background: rgba(255, 250, 240, 0.82);
    padding: 13px;
}

.metrics span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.metrics strong {
    display: block;
    margin-top: 9px;
    font-size: clamp(22px, 3vw, 30px);
}

.mobile-mirror {
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    padding: 18px;
}

.mobile-mirror .eyebrow {
    color: var(--copper);
}

.mobile-mirror p {
    color: rgba(244, 241, 222, 0.75);
}

.mobile-mirror button {
    width: 100%;
    background: var(--copper);
    color: var(--ink);
}

.mobile-mirror button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.feed,
.workflow-editor,
.team-list {
    display: grid;
    gap: 10px;
}

.feed__item,
.workflow-row,
.member {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.feed__item time,
.feed__item span,
.member span,
.member em {
    color: var(--muted);
    font-style: normal;
}

.feed__item p {
    margin: 0;
}

.workflow-row {
    grid-template-columns: 18px minmax(160px, 1fr) minmax(130px, 170px) minmax(140px, 190px) auto;
}

.workflow-row label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
}

.member {
    grid-template-columns: minmax(160px, 1fr) minmax(120px, 280px) 130px;
}

.load {
    height: 11px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(32, 44, 57, 0.12);
}

.load span {
    display: block;
    width: var(--load);
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--copper));
}

.empty {
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 240, 0.7);
}

.empty--error {
    border-color: rgba(224, 122, 95, 0.7);
    color: #8d2d1c;
}

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

    .rail {
        position: static;
        height: auto;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 14px;
    }

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

    .nav__item {
        text-align: center;
        padding: 10px 8px;
    }

    .rail__foot {
        display: none;
    }

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

    .field-console {
        position: static;
    }
}

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

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

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

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

    .order,
    .feed__item,
    .workflow-row,
    .member {
        grid-template-columns: 1fr;
    }

    .order__side {
        justify-items: start;
    }

    .nav {
        grid-column: 1 / -1;
        overflow-x: auto;
    }
}

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

    .brand span {
        font-size: 18px;
    }

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

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

