:root {
    --ink: #102a43;
    --paper: #f5f7fa;
    --paper-deep: #e7edf3;
    --line: #c9d4df;
    --muted: #627386;
    --red: #d64545;
    --teal: #56a3a6;
    --white: #ffffff;
    --shadow: 0 18px 50px rgba(16, 42, 67, 0.14);
}

* {
    box-sizing: border-box;
}

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

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

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

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

.rail {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
    height: 100vh;
    padding: 26px 18px;
    color: var(--paper);
    background:
        linear-gradient(180deg, rgba(86, 163, 166, 0.15), rgba(214, 69, 69, 0.12)),
        var(--ink);
}

.brand {
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand span {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

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

.tab {
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-left: 3px solid transparent;
    color: rgba(245, 247, 250, 0.72);
    text-align: left;
    text-transform: uppercase;
    background: transparent;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.tab:hover,
.tab.is-active {
    color: var(--paper);
    border-color: var(--teal);
    background: rgba(245, 247, 250, 0.08);
    transform: translateX(3px);
}

.rail-note {
    margin-top: auto;
    padding: 16px 0 0;
    border-top: 1px solid rgba(245, 247, 250, 0.18);
    line-height: 1.55;
}

.note-kicker,
.eyebrow {
    display: block;
    margin: 0 0 7px;
    color: var(--teal);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.rail-note strong {
    display: block;
    max-width: 180px;
    color: rgba(245, 247, 250, 0.9);
    font-size: 15px;
}

.workspace {
    min-width: 0;
    padding: 28px clamp(16px, 3vw, 42px) 36px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

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

.toolbar {
    display: flex;
    align-items: end;
    gap: 10px;
}

.search,
.select {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.search input,
.select select {
    width: min(36vw, 250px);
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.76);
}

.search input {
    padding: 0 12px;
}

.select select {
    padding: 0 10px;
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: var(--white);
    transition: transform 180ms ease, border-color 180ms ease;
}

.icon-button:hover {
    border-color: var(--teal);
    transform: rotate(-20deg);
}

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

.metric {
    min-height: 92px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.82);
}

.metric span {
    display: block;
    margin-bottom: 13px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    font-size: clamp(25px, 3vw, 38px);
    line-height: 1;
}

.metric.accent {
    color: var(--paper);
    background: var(--red);
}

.metric.accent span {
    color: rgba(245, 247, 250, 0.8);
}

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

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

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

.timeline,
.detail-sheet,
.workflow-grid,
.activity-list,
.team-grid {
    min-width: 0;
}

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

.section-title.wide {
    border-bottom: 2px solid var(--ink);
    padding-bottom: 12px;
}

.section-title h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
}

.section-title span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.drawer-list {
    display: grid;
    gap: 8px;
}

.drawer-row {
    position: relative;
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) 116px;
    gap: 14px;
    align-items: center;
    width: 100%;
    min-height: 72px;
    padding: 12px 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    text-align: left;
    background: rgba(255, 255, 255, 0.9);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.drawer-row::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    background: var(--teal);
    content: "";
}

.drawer-row:hover,
.drawer-row.is-selected {
    z-index: 1;
    border-color: var(--ink);
    box-shadow: 10px 10px 0 rgba(86, 163, 166, 0.16);
    transform: translateY(-2px);
}

.row-index {
    font-weight: 900;
    font-size: 13px;
}

.row-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.row-main strong,
.activity strong,
.person strong {
    overflow-wrap: anywhere;
}

.row-main em,
.row-meta small,
.activity span,
.person span,
.person small,
.sheet-copy {
    color: var(--muted);
    font-style: normal;
    line-height: 1.55;
}

.row-meta {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.stage {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    background: var(--paper-deep);
}

.stage-point {
    background: #d8e9ea;
}

.stage-collection {
    color: var(--paper);
    background: var(--teal);
}

.stage-sorting {
    color: var(--paper);
    background: var(--ink);
}

.stage-effect {
    color: var(--paper);
    background: var(--red);
}

.detail-sheet {
    position: sticky;
    top: 22px;
    min-height: 460px;
    padding: 22px;
    border: 1px solid var(--ink);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(16, 42, 67, 0.06) 1px, transparent 1px),
        var(--white);
    background-size: 18px 18px;
    box-shadow: var(--shadow);
}

.sheet-pin {
    width: 56px;
    height: 6px;
    margin: -8px auto 18px;
    border-radius: 999px;
    background: var(--red);
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sheet-head strong {
    font-size: 13px;
}

.detail-sheet h2 {
    margin: 18px 0 8px;
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 22px 0;
    border: 1px solid var(--line);
    background: var(--line);
}

.facts div {
    min-height: 76px;
    padding: 12px;
    background: rgba(245, 247, 250, 0.9);
}

.facts dt {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.facts dd {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.progress-track,
.load-line {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--paper-deep);
}

.progress-track span,
.load-line span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--red));
    transition: width 320ms ease;
}

.sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
}

.primary-action,
.ghost-action,
.danger-action {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 6px;
    font-weight: 900;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-action {
    grid-column: 1 / -1;
    border: 0;
    color: var(--paper);
    background: var(--ink);
}

.ghost-action {
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--white);
}

.danger-action {
    border: 0;
    color: var(--paper);
    background: var(--red);
}

.primary-action:hover,
.ghost-action:hover,
.danger-action:hover {
    transform: translateY(-1px);
    box-shadow: 6px 6px 0 rgba(16, 42, 67, 0.12);
}

.activity-list {
    display: grid;
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
}

.activity {
    display: grid;
    grid-template-columns: 176px minmax(0, 1fr);
    gap: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.88);
}

.activity time {
    color: var(--red);
    font-weight: 900;
}

.activity p {
    margin: 7px 0;
    line-height: 1.55;
}

.workflow-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(300px, 0.8fr);
    gap: 22px;
}

.settings-list {
    display: grid;
    gap: 8px;
}

.setting-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 12px;
    min-height: 60px;
    align-items: center;
    padding: 12px 14px;
    border-left: 5px solid var(--teal);
    background: rgba(255, 255, 255, 0.9);
}

.setting-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.setting-row strong {
    overflow-wrap: anywhere;
}

.stage-wall {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
    box-shadow: var(--shadow);
}

.stage-column {
    display: grid;
    align-content: center;
    min-height: 165px;
    padding: 18px;
    background: var(--white);
}

.stage-column span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.stage-column strong {
    margin: 12px 0 4px;
    font-size: 56px;
    line-height: 1;
}

.stage-column em {
    color: var(--teal);
    font-style: normal;
    font-weight: 900;
}

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

.person {
    display: grid;
    gap: 12px;
    min-height: 240px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.88);
}

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

.person p {
    margin: 0;
    color: var(--red);
    font-weight: 900;
}

.empty-state {
    padding: 24px;
    border: 1px dashed var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.64);
}

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

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

.is-loading .workspace {
    cursor: progress;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    .rail {
        position: static;
        display: grid;
        grid-template-columns: minmax(180px, auto) 1fr;
        height: auto;
        padding: 16px;
    }

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

    .rail-note {
        display: none;
    }

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

    .detail-sheet {
        position: static;
    }

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

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

    .rail {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tabs {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .tab {
        flex: 0 0 auto;
        min-width: 104px;
        text-align: center;
        border-left: 0;
        border-bottom: 3px solid transparent;
    }

    .topbar {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr 42px;
        width: 100%;
    }

    .search input,
    .select select {
        width: 100%;
    }

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

    .drawer-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding-left: 18px;
    }

    .row-meta {
        justify-items: start;
    }

    .facts,
    .sheet-actions,
    .stage-wall,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .activity {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .setting-row {
        grid-template-columns: 1fr;
    }
}

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

    .icon-button {
        width: 100%;
    }

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

