:root {
    --ink: #2b2d42;
    --paper: #edf2f4;
    --accent: #ef233c;
    --steel: #8d99ae;
    --line: rgba(43, 45, 66, 0.16);
    --surface: rgba(255, 255, 255, 0.78);
    --shadow: 0 18px 50px rgba(43, 45, 66, 0.14);
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: Inter, Arial, Helvetica, sans-serif;
    letter-spacing: 0;
    background:
        linear-gradient(90deg, rgba(43, 45, 66, 0.05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(43, 45, 66, 0.05) 1px, transparent 1px),
        var(--paper);
    background-size: 34px 34px;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.side-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: var(--paper);
    background: var(--ink);
}

.brand {
    display: grid;
    gap: 8px;
    justify-items: center;
    color: var(--paper);
    text-decoration: none;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    line-height: 1.05;
    text-transform: uppercase;
}

.brand img {
    width: 44px;
    height: 44px;
}

.rail-nav {
    display: grid;
    gap: 12px;
}

.nav-item,
.icon-btn {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(237, 242, 244, 0.22);
    border-radius: 8px;
    color: var(--paper);
    background: transparent;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-item:hover,
.icon-btn:hover,
.nav-item.is-active {
    transform: translateY(-1px);
    border-color: var(--accent);
    background: rgba(239, 35, 60, 0.18);
}

.rail-foot {
    display: grid;
    gap: 6px;
    justify-items: center;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    text-transform: uppercase;
}

.signal {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 7px rgba(239, 35, 60, 0.18);
}

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

.top-strip {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--steel);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    line-height: 1.3;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(34px, 5vw, 68px);
    line-height: 0.9;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.02;
    letter-spacing: 0;
}

.alert-strip {
    flex: 1;
    min-height: 82px;
    max-width: 760px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    border-top: 3px solid var(--accent);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.58);
}

.alert-strip span {
    flex: 0 0 auto;
    max-width: 280px;
    padding: 9px 12px;
    border-left: 2px solid var(--accent);
    color: var(--ink);
    background: rgba(239, 35, 60, 0.08);
    font-size: 13px;
    line-height: 1.3;
}

.ops-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 18px;
    align-items: stretch;
}

.canvas-panel,
.inspector {
    min-width: 0;
}

.canvas-head {
    min-height: 74px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.search-box {
    width: min(100%, 330px);
    display: grid;
    gap: 5px;
    color: var(--steel);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    text-transform: uppercase;
}

.search-box input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(239, 35, 60, 0.11);
}

.map-canvas {
    position: relative;
    min-height: 500px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(43, 45, 66, 0.92), rgba(43, 45, 66, 0.72)),
        radial-gradient(circle at 24% 24%, rgba(237, 242, 244, 0.18), transparent 26%);
    box-shadow: var(--shadow);
}

.grid-lines {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(237, 242, 244, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(237, 242, 244, 0.08) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, black, transparent 92%);
}

.route {
    position: absolute;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--accent) 0 18px, transparent 18px 28px);
    opacity: 0.86;
    transform-origin: left center;
}

.route-a {
    width: 66%;
    left: 15%;
    top: 34%;
    transform: rotate(14deg);
}

.route-b {
    width: 58%;
    left: 21%;
    top: 64%;
    transform: rotate(-20deg);
}

.zone {
    position: absolute;
    width: clamp(118px, 15vw, 172px);
    min-height: 86px;
    display: grid;
    align-content: center;
    gap: 6px;
    border: 1px solid rgba(237, 242, 244, 0.34);
    border-radius: 8px;
    padding: 14px;
    color: var(--paper);
    text-align: left;
    background: rgba(43, 45, 66, 0.82);
    backdrop-filter: blur(8px);
    transition: transform 180ms ease, border-color 180ms ease;
}

.zone:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.zone strong {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 17px;
    text-transform: uppercase;
}

.zone span {
    color: rgba(237, 242, 244, 0.72);
    font-size: 13px;
}

.zone-brief {
    left: 7%;
    top: 13%;
}

.zone-concept {
    right: 12%;
    top: 21%;
}

.zone-revision {
    left: 20%;
    bottom: 16%;
}

.zone-procure {
    right: 8%;
    bottom: 11%;
}

.pulse-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(239, 35, 60, 0.55);
    animation: pulse 2.2s infinite;
}

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

.dot-b {
    left: 57%;
    top: 57%;
    animation-delay: 420ms;
}

.dot-c {
    left: 72%;
    top: 42%;
    animation-delay: 780ms;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 35, 60, 0.55);
    }
    70% {
        box-shadow: 0 0 0 18px rgba(239, 35, 60, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 35, 60, 0);
    }
}

.metric-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.metric {
    min-width: 0;
    padding: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.metric span {
    display: block;
    color: var(--steel);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    line-height: 1.25;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(20px, 2.2vw, 30px);
    line-height: 1;
}

.inspector {
    min-height: 670px;
    border-left: 1px solid var(--line);
    padding-left: 18px;
}

.inspector-head {
    min-height: 74px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 14px;
}

.inspector .icon-btn {
    color: var(--ink);
    border-color: var(--line);
}

.item-list {
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 132px);
    overflow: auto;
    padding-right: 2px;
}

.work-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(43, 45, 66, 0.08);
}

.work-item h3 {
    margin-bottom: 8px;
    font-size: 18px;
    line-height: 1.16;
}

.work-item p {
    margin-bottom: 10px;
    color: rgba(43, 45, 66, 0.72);
    font-size: 14px;
    line-height: 1.4;
}

.item-top,
.item-actions,
.vendor-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tag,
.state,
.item-actions small,
.score-grid small {
    color: var(--steel);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    line-height: 1.25;
    text-transform: uppercase;
}

.tag {
    color: var(--accent);
}

.state {
    text-align: right;
}

.vendor-line {
    align-items: flex-start;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.vendor-line strong {
    min-width: 0;
}

.vendor-line span {
    flex: 0 0 auto;
    color: var(--ink);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.history {
    min-height: 40px;
}

.item-actions button,
.import-demo {
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px;
    color: white;
    background: var(--ink);
}

.item-actions button:hover,
.import-demo:hover {
    background: var(--accent);
}

.item-actions button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.status-blocked {
    border-left: 4px solid var(--accent);
}

.status-active {
    border-left: 4px solid var(--ink);
}

.status-queued {
    border-left: 4px solid var(--steel);
}

.status-done {
    opacity: 0.72;
}

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

.score-grid span {
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.score-grid b {
    display: block;
    overflow-wrap: anywhere;
}

.import-demo {
    width: 100%;
    margin-bottom: 2px;
    background: var(--accent);
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    color: rgba(43, 45, 66, 0.72);
    background: rgba(255, 255, 255, 0.55);
}

.empty-state.error {
    color: var(--accent);
}

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

    .side-rail {
        position: static;
        height: auto;
        flex-direction: row;
        padding: 10px 14px;
    }

    .brand {
        grid-template-columns: auto auto;
        align-items: center;
        justify-items: start;
    }

    .rail-nav {
        display: flex;
    }

    .rail-foot {
        display: none;
    }

    .top-strip,
    .canvas-head {
        display: grid;
    }

    .alert-strip {
        max-width: none;
    }

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

    .inspector {
        min-height: 0;
        border-left: 0;
        padding-left: 0;
    }

    .item-list {
        max-height: none;
    }
}

@media (max-width: 620px) {
    .workspace {
        padding: 14px;
    }

    .nav-item,
    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .map-canvas {
        min-height: 430px;
    }

    .zone {
        width: 132px;
        min-height: 76px;
        padding: 12px;
    }

    .metric-row,
    .score-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vendor-line,
    .item-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}
