:root {
    --ink: #102a43;
    --paper: #f5f7fa;
    --signal: #d64545;
    --teal: #56a3a6;
    --line: #d8e1ea;
    --muted: #6b7c8f;
    --wood: #b38b59;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
    letter-spacing: 0;
    background:
        linear-gradient(90deg, rgba(16, 42, 67, 0.06) 1px, transparent 1px),
        linear-gradient(180deg, rgba(16, 42, 67, 0.04) 1px, transparent 1px),
        var(--paper);
    background-size: 44px 44px;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--paper);
    text-decoration: none;
    font-weight: 800;
    line-height: 0.95;
    text-transform: uppercase;
}

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

.tab {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(245, 247, 250, 0.18);
    border-radius: 7px;
    color: var(--paper);
    background: transparent;
    text-align: left;
    padding: 0 12px;
    text-transform: uppercase;
    font-size: 13px;
    transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

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

.rail-note {
    margin-top: auto;
    border-top: 1px solid rgba(245, 247, 250, 0.18);
    padding-top: 18px;
    display: grid;
    gap: 8px;
    line-height: 1.45;
}

.rail-note span,
.eyebrow,
.section-title span {
    color: var(--teal);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
}

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

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

h1 {
    margin: 4px 0 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 0.98;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0;
}

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

.search label {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 13px;
}

.search input,
.search button,
textarea,
.workflow-step input {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--white);
    color: var(--ink);
}

.search input {
    min-width: 0;
    height: 44px;
    padding: 0 12px;
}

.search button,
.action-button {
    min-height: 44px;
    border: 0;
    border-radius: 7px;
    background: var(--signal);
    color: var(--white);
    padding: 0 14px;
    font-weight: 800;
}

.metric-wall {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    margin-bottom: 24px;
}

.metric {
    min-height: 112px;
    padding: 16px;
    display: grid;
    gap: 8px;
    align-content: center;
    background: rgba(255, 255, 255, 0.72);
    border-right: 1px solid var(--line);
    animation: liftIn 420ms ease both;
}

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

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

.metric strong {
    font-size: 36px;
    line-height: 0.9;
}

.metric em {
    color: var(--muted);
    font-style: normal;
}

.view {
    display: none;
}

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

.queue-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
    gap: 24px;
    align-items: start;
}

.drawer-wall,
.detail-sheet,
.timeline,
.workflow-board,
.team-grid {
    min-width: 0;
}

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title strong {
    font-size: 22px;
}

.filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.filter {
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--white);
    color: var(--ink);
    padding: 8px;
    display: grid;
    gap: 4px;
    text-align: left;
}

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

.filter strong {
    font-size: 20px;
}

.filter.is-active {
    border-color: var(--ink);
    box-shadow: inset 0 -4px 0 var(--teal);
}

.item-list {
    display: grid;
    gap: 10px;
}

.drawer {
    width: 100%;
    min-height: 116px;
    border: 1px solid var(--line);
    border-left: 8px solid var(--wood);
    border-radius: 7px;
    background: var(--white);
    color: var(--ink);
    padding: 14px;
    text-align: left;
    display: grid;
    gap: 8px;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.drawer:hover,
.drawer.is-active {
    transform: translateY(-2px);
    border-color: var(--ink);
    box-shadow: 0 12px 28px rgba(16, 42, 67, 0.12);
}

.drawer-code {
    color: var(--teal);
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
}

.drawer strong {
    font-size: 19px;
    line-height: 1.14;
}

.drawer em,
.drawer-meta,
.scenario,
.timeline-row p,
.workflow-step p,
.person p {
    color: var(--muted);
    font-style: normal;
    line-height: 1.55;
}

.drawer-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.drawer-meta b {
    color: var(--ink);
}

.drawer-meta i {
    color: var(--signal);
    font-style: normal;
    font-weight: 800;
}

.detail-sheet {
    position: sticky;
    top: 28px;
    min-height: 620px;
    background:
        linear-gradient(180deg, transparent 31px, rgba(86, 163, 166, 0.14) 32px),
        var(--white);
    background-size: 100% 32px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 12px 12px 0 rgba(16, 42, 67, 0.12);
}

.sheet-head {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.sheet-head span {
    color: var(--signal);
    font-weight: 800;
}

.sheet-head strong {
    font-size: clamp(26px, 3vw, 42px);
    line-height: 1.02;
}

.score-line,
.readiness {
    height: 8px;
    border-radius: 999px;
    background: #e8eef4;
    overflow: hidden;
}

.score-line span,
.readiness i {
    display: block;
    height: 100%;
    background: var(--teal);
    transition: width 260ms ease;
}

.sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.sheet-grid div {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 0;
    line-height: 1.35;
}

.workflow-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 20px 0;
}

.workflow-strip span {
    min-height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    font-weight: 800;
    text-align: center;
}

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

.action-form label {
    color: var(--muted);
}

textarea {
    width: 100%;
    resize: vertical;
    padding: 12px;
    line-height: 1.5;
}

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

.action-button {
    min-width: 0;
    white-space: normal;
    line-height: 1.15;
}

.timeline,
.workflow-board {
    max-width: 980px;
}

.timeline-row,
.workflow-step,
.person {
    display: grid;
    grid-template-columns: 170px 1fr 150px minmax(180px, 0.8fr) 70px;
    gap: 14px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

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

.timeline-row em {
    justify-self: end;
    font-style: normal;
    font-weight: 900;
}

.timeline-row em.good {
    color: var(--teal);
}

.timeline-row em.bad {
    color: var(--signal);
}

.workflow-step {
    grid-template-columns: 1fr 130px 120px;
    background: rgba(255, 255, 255, 0.62);
    padding: 16px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.workflow-step span {
    color: var(--teal);
    text-transform: uppercase;
    font-weight: 800;
    font-size: 12px;
}

.workflow-step label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.workflow-step input {
    width: 100%;
    height: 40px;
    padding: 0 10px;
}

.workflow-step b {
    color: var(--signal);
}

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

.team-grid .section-title {
    grid-column: 1 / -1;
}

.person {
    grid-template-columns: 56px 1fr;
    align-items: start;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: var(--paper);
    font-weight: 900;
}

.person span,
.person p,
.person .readiness {
    grid-column: 2;
}

.empty {
    padding: 22px;
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.6);
    color: var(--muted);
    line-height: 1.5;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(360px, calc(100vw - 36px));
    padding: 13px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 7px;
    box-shadow: 0 18px 42px rgba(16, 42, 67, 0.22);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

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

    .rail {
        position: static;
        height: auto;
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
    }

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

    .rail-note {
        grid-column: 1 / -1;
        margin-top: 0;
    }

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

    .detail-sheet {
        position: static;
        min-height: 0;
    }

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

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

    .tabs,
    .filters,
    .team-grid,
    .metric-wall,
    .sheet-grid,
    .workflow-strip,
    .action-row {
        grid-template-columns: 1fr;
    }

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

    .tab {
        text-align: center;
    }

    .timeline-row,
    .workflow-step,
    .person {
        grid-template-columns: 1fr;
    }

    .person span,
    .person p,
    .person .readiness {
        grid-column: auto;
    }
}
