:root {
    --ink: #22333b;
    --paper: #f2f4f3;
    --accent: #e63946;
    --mint: #a8dadc;
    --line: rgba(34, 51, 59, 0.14);
    --muted: rgba(34, 51, 59, 0.62);
    --white: #ffffff;
    --shadow: 0 24px 70px rgba(34, 51, 59, 0.12);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(90deg, #22333b 0 22rem, #f2f4f3 22rem 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.metrics-spine {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    color: var(--paper);
    background: var(--ink);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: inherit;
    text-decoration: none;
}

.brand img {
    flex: 0 0 auto;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.18));
}

.brand strong {
    display: block;
    font-size: 1.05rem;
    line-height: 1.1;
}

.brand small {
    display: block;
    margin-top: 0.25rem;
    color: rgba(242, 244, 243, 0.65);
    font-size: 0.78rem;
}

.screen-tabs {
    display: grid;
    gap: 0.45rem;
}

.tab {
    min-height: 2.75rem;
    padding: 0 0.9rem;
    border: 1px solid rgba(242, 244, 243, 0.16);
    border-radius: 8px;
    color: rgba(242, 244, 243, 0.72);
    background: transparent;
    text-align: left;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

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

.spine-metrics {
    display: grid;
    gap: 0.75rem;
}

.metric {
    padding: 1rem 0;
    border-top: 1px solid rgba(242, 244, 243, 0.15);
}

.metric span {
    display: block;
    color: rgba(242, 244, 243, 0.64);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 0.2rem;
    color: var(--paper);
    font-size: clamp(1.5rem, 2rem, 2rem);
    line-height: 1;
}

.metric.primary strong {
    color: var(--mint);
    font-size: 3.5rem;
}

.quick-create {
    margin-top: auto;
    display: grid;
    gap: 0.7rem;
}

.quick-create label {
    color: rgba(242, 244, 243, 0.72);
    font-size: 0.76rem;
    text-transform: uppercase;
}

.quick-create select,
.quick-create textarea,
.toolbar input,
.toolbar select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.92);
    outline: none;
}

.quick-create select,
.toolbar input,
.toolbar select {
    min-height: 2.75rem;
    padding: 0 0.75rem;
}

.quick-create textarea {
    resize: vertical;
    min-height: 5.75rem;
    padding: 0.75rem;
}

.quick-create button,
.advance,
.ghost {
    min-height: 2.75rem;
    border: 0;
    border-radius: 8px;
    color: var(--white);
    background: var(--accent);
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.quick-create button:hover,
.advance:hover,
.ghost:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(230, 57, 70, 0.2);
}

.workspace {
    min-width: 0;
    padding: 2rem clamp(1rem, 3vw, 3rem) 3rem;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 4.4rem);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
    line-height: 1.2;
}

h3 {
    margin-bottom: 0.35rem;
    font-size: 1rem;
    line-height: 1.2;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(14rem, 22rem) 10rem;
    gap: 0.7rem;
    width: min(100%, 34rem);
}

.screen {
    display: none;
    animation: enter 220ms ease both;
}

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

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

.kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(15rem, 1fr));
    gap: 1rem;
    align-items: start;
}

.kanban-column {
    min-width: 0;
}

.kanban-column header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 4.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.kanban-column header p,
.section-head p,
.client,
.issue,
.workflow-step p,
.person-row p,
.resource-row p,
.activity-row p {
    margin-bottom: 0;
    color: var(--muted);
}

.kanban-column header strong {
    min-width: 2rem;
    min-height: 2rem;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: var(--ink);
    background: var(--mint);
}

.cards {
    display: grid;
    gap: 0.85rem;
    padding-top: 1rem;
}

.dossier-card,
.workflow-step,
.person-row,
.resource-row,
.activity-row,
.empty {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
}

.dossier-card {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.dossier-card:hover {
    transform: translateY(-3px);
    border-color: rgba(34, 51, 59, 0.26);
    background: var(--white);
}

.dossier-card.is-urgent {
    border-color: rgba(230, 57, 70, 0.55);
}

.card-top,
.card-meta,
.step-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.plate,
.sla,
.card-meta,
.step-foot,
.activity-row time,
.resource-row em {
    color: var(--muted);
    font-size: 0.78rem;
}

.plate {
    color: var(--paper);
    background: var(--ink);
    border-radius: 6px;
    padding: 0.25rem 0.45rem;
}

.issue {
    min-height: 2.6rem;
    line-height: 1.35;
}

.progress {
    height: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(34, 51, 59, 0.09);
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--mint), var(--accent));
}

.next-action {
    padding: 0.75rem;
    border-left: 3px solid var(--mint);
    color: rgba(34, 51, 59, 0.82);
    background: rgba(168, 218, 220, 0.18);
    line-height: 1.35;
}

.advance {
    width: 100%;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.ghost {
    min-width: 7.5rem;
    color: var(--ink);
    background: var(--mint);
}

.activity-list,
.workflow-grid,
.people-list,
.resource-list {
    display: grid;
    gap: 0.85rem;
}

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

.workflow-step {
    min-height: 13rem;
    padding: 1.1rem;
}

.step-order {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    margin-bottom: 1.4rem;
    border-radius: 50%;
    color: var(--paper);
    background: var(--ink);
    font-size: 0.85rem;
    font-weight: 800;
}

.team-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 0.9fr);
    gap: 1rem;
}

.person-row,
.resource-row,
.activity-row {
    display: grid;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.person-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.person-row small {
    grid-column: 1 / -1;
    color: var(--muted);
}

.resource-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.activity-row {
    grid-template-columns: 7rem minmax(0, 1fr) minmax(8rem, 13rem);
}

.state-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--mint);
}

.state-busy {
    background: var(--accent);
}

.state-reserved {
    background: #22333b;
}

.empty {
    padding: 1rem;
    color: var(--muted);
    box-shadow: none;
}

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

@media (max-width: 1180px) {
    body {
        background: var(--paper);
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .metrics-spine {
        position: static;
        display: grid;
        grid-template-columns: 1fr;
        padding: 1.2rem;
    }

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

    .quick-create {
        margin-top: 0;
    }

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

@media (max-width: 760px) {
    .metrics-spine,
    .workspace {
        padding: 1rem;
    }

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

    .toolbar,
    .screen-tabs,
    .spine-metrics,
    .kanban,
    .workflow-grid,
    .team-layout {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.3rem;
    }

    .metric.primary strong {
        font-size: 2.6rem;
    }

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