:root {
    --ink: #141414;
    --paper: #faf7f0;
    --muted: #7b756b;
    --line: rgba(20, 20, 20, 0.14);
    --violet: #7c3aed;
    --green: #10b981;
    --amber: #d97706;
    --red: #dc2626;
    --white: #fffdf8;
    --shadow: 0 18px 60px rgba(20, 20, 20, 0.12);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(124, 58, 237, 0.08), transparent 28%),
        linear-gradient(180deg, #fffdf8 0, var(--paper) 52%, #f3efe5 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.shell {
    min-height: 100vh;
}

.command-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.4fr) minmax(260px, 1fr);
    gap: 18px;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(250, 247, 240, 0.92);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
    min-width: 0;
}

.brand img {
    flex: 0 0 auto;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(20, 20, 20, 0.18);
}

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

.brand small,
.metrics small,
.section-title span,
.source-pill,
.kicker,
.eyebrow {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0;
}

.views {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.view-tab,
.ghost-btn,
.icon-btn,
.primary-btn {
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.72);
    color: var(--ink);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.view-tab {
    padding: 8px 12px;
}

.view-tab:hover,
.ghost-btn:hover,
.icon-btn:hover,
.primary-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 58, 237, 0.4);
}

.view-tab.is-active,
.primary-btn {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

.bar-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}

.search {
    display: grid;
    gap: 3px;
    min-width: 210px;
}

.search span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.search input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
    padding: 8px 10px;
    outline: none;
}

.icon-btn {
    width: 40px;
    font-size: 20px;
}

.workspace {
    width: min(1480px, calc(100% - 36px));
    margin: 0 auto;
    padding: 24px 0 36px;
}

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

.metrics article {
    min-width: 0;
    padding: 18px;
    background: rgba(255, 253, 248, 0.9);
}

.metrics span,
.kicker,
.eyebrow {
    display: block;
    text-transform: uppercase;
    font-weight: 700;
}

.metrics strong {
    display: block;
    margin: 8px 0 2px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 0.95;
}

.metric-alert strong {
    color: var(--red);
}

.screen {
    display: none;
    margin-top: 22px;
}

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

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

.board-head,
.split-head,
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--violet);
}

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

h1 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 5vw, 72px);
    line-height: 0.96;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 18px;
    line-height: 1.2;
}

.source-pill {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fffdf8;
}

.lane-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.lane {
    min-height: 126px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(250, 247, 240, 0.82));
}

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

.lane-meter {
    height: 8px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.1);
}

.lane-meter span {
    display: block;
    height: 100%;
    width: var(--fill);
    background: linear-gradient(90deg, var(--green), var(--violet));
}

.work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.75fr);
    gap: 16px;
    align-items: start;
}

.order-panel,
.inspector,
.event-stream,
.analytics-grid > article,
.maintenance-band,
.import-layout,
.import-log,
.public-status,
.status-ticket,
.public-steps {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.86);
}

.order-panel,
.inspector,
.event-stream,
.maintenance-band,
.import-layout,
.public-status,
.public-steps {
    padding: 16px;
}

.order-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.order-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.2fr) minmax(100px, 0.6fr) minmax(90px, 0.5fr) minmax(110px, 0.5fr) 98px;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(250, 247, 240, 0.8);
    text-align: left;
}

.order-row:hover,
.order-row.is-selected {
    border-color: rgba(124, 58, 237, 0.45);
    background: #fffdf8;
}

.order-code {
    font-weight: 800;
}

.muted {
    color: var(--muted);
    font-size: 12px;
}

.badge {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(124, 58, 237, 0.1);
    color: #4c1d95;
    font-size: 12px;
    font-weight: 800;
    white-space: normal;
}

.badge.green {
    background: rgba(16, 185, 129, 0.13);
    color: #065f46;
}

.badge.red {
    background: rgba(220, 38, 38, 0.11);
    color: #991b1b;
}

.progress {
    min-width: 0;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.1);
}

.progress-track span {
    display: block;
    height: 100%;
    width: var(--fill);
    background: var(--green);
}

.inspector {
    position: sticky;
    top: 92px;
}

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

.asset-stack,
.checklist,
.events,
.maintenance-list,
.analytics-grid {
    display: grid;
    gap: 10px;
}

.asset {
    padding: 11px;
    border-left: 4px solid var(--violet);
    background: rgba(124, 58, 237, 0.07);
}

.check-item {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.check-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.inspector-actions,
.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.primary-btn,
.ghost-btn {
    padding: 9px 12px;
}

.event-stream {
    margin-top: 16px;
}

.events {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
}

.event {
    min-height: 116px;
    padding: 12px;
    border-radius: 8px;
    background: #f3efe5;
}

.event strong {
    display: block;
}

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

.analytics-grid > article {
    padding: 16px;
    min-height: 190px;
}

.bar {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}

.bar-line {
    height: 9px;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.09);
    overflow: hidden;
}

.bar-line span {
    display: block;
    height: 100%;
    width: var(--fill);
    background: var(--violet);
}

.maintenance-band {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    margin-top: 16px;
}

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

.maintenance-item {
    border-left: 4px solid var(--green);
    padding: 10px 12px;
    background: #f3efe5;
}

.import-layout,
.public-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
    gap: 20px;
    align-items: start;
}

.import-layout p,
.public-status p {
    max-width: 680px;
    color: var(--muted);
}

.import-facts {
    display: grid;
    gap: 1px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.import-facts div {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    background: #fffdf8;
}

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

.import-facts dd {
    margin: 0;
    word-break: break-word;
}

.import-log {
    min-height: 130px;
    margin: 14px 0 0;
    padding: 14px;
    overflow: auto;
    white-space: pre-wrap;
}

.status-ticket {
    padding: 16px;
    background: var(--ink);
    color: var(--paper);
}

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

.public-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 14px;
    overflow: hidden;
    background: var(--line);
}

.public-step {
    min-height: 128px;
    padding: 14px;
    background: #fffdf8;
}

.public-step.is-done {
    background: rgba(16, 185, 129, 0.12);
}

dialog {
    width: min(520px, calc(100% - 28px));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: var(--shadow);
}

dialog::backdrop {
    background: rgba(20, 20, 20, 0.38);
}

.dialog-form {
    display: grid;
    gap: 14px;
}

.dialog-form label {
    display: grid;
    gap: 6px;
}

.dialog-form textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fffdf8;
}

@media (max-width: 1080px) {
    .command-bar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .views,
    .bar-actions {
        justify-content: flex-start;
    }

    .metrics,
    .lane-board,
    .analytics-grid,
    .public-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-grid,
    .maintenance-band,
    .import-layout,
    .public-status {
        grid-template-columns: 1fr;
    }

    .inspector {
        position: static;
    }
}

@media (max-width: 720px) {
    .workspace {
        width: min(100% - 20px, 1480px);
        padding-top: 14px;
    }

    .command-bar {
        padding: 12px;
    }

    .bar-actions,
    .search {
        width: 100%;
    }

    .metrics,
    .lane-board,
    .analytics-grid,
    .events,
    .maintenance-list,
    .public-steps {
        grid-template-columns: 1fr;
    }

    .board-head,
    .split-head,
    .section-title {
        align-items: start;
        flex-direction: column;
    }

    .order-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .source-pill {
        width: 100%;
    }
}
