:root {
    --ink: #1b1b3a;
    --paper: #fbfefb;
    --coral: #ff6b6b;
    --teal: #4ecdc4;
    --gold: #f7d06b;
    --line: rgba(27, 27, 58, 0.14);
    --muted: #69707d;
    --surface: #ffffff;
    --shadow: 0 18px 50px rgba(27, 27, 58, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

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

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-weight: 820;
    font-size: 20px;
}

.brand img {
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
}

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

.tab {
    border: 0;
    text-align: left;
    color: rgba(251, 254, 251, 0.72);
    background: transparent;
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
    color: var(--paper);
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.rail-note {
    margin-top: auto;
    padding: 16px;
    border: 1px solid rgba(251, 254, 251, 0.14);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    line-height: 1.35;
}

.note-label,
.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 800;
    color: var(--teal);
}

.workspace {
    min-width: 0;
    padding: 24px;
    display: grid;
    align-content: start;
    gap: 18px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 4px 0 0;
    font-size: clamp(26px, 4vw, 44px);
    line-height: 1.03;
    max-width: 760px;
}

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

h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.25;
}

.sync-pill {
    flex: 0 0 auto;
    min-width: 150px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
}

.sync-pill.is-live {
    color: #187a72;
    border-color: rgba(78, 205, 196, 0.45);
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(160px, 0.45fr));
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid var(--line);
    border-radius: 8px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.18);
}

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

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

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.metric {
    min-height: 112px;
    padding: 16px;
    border-left: 4px solid var(--teal);
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: 8px;
}

.metric:nth-child(2) {
    border-color: var(--coral);
}

.metric:nth-child(3) {
    border-color: var(--gold);
}

.metric strong {
    display: block;
    font-size: 28px;
    line-height: 1;
    margin-top: 14px;
}

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

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.9fr);
    gap: 14px;
    align-items: start;
}

.portfolio-pane,
.detail-pane,
.request-form,
.finance-board {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.portfolio-pane,
.detail-pane {
    min-height: 560px;
}

.pane-head {
    min-height: 60px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--line);
}

.pane-head span {
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

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

.route-tile {
    min-height: 218px;
    border: 0;
    padding: 16px;
    text-align: left;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    gap: 14px;
    align-content: start;
    transition: transform 170ms ease, background 170ms ease, box-shadow 170ms ease;
}

.route-tile:hover,
.route-tile.is-selected {
    background: #fcfffd;
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 2px rgba(78, 205, 196, 0.38);
}

.tile-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--ink);
    background: rgba(78, 205, 196, 0.2);
    font-size: 11px;
    font-weight: 850;
}

.badge.blocked,
.badge.high {
    background: rgba(255, 107, 107, 0.2);
    color: #9c3131;
}

.badge.closed,
.badge.low {
    background: rgba(27, 27, 58, 0.08);
}

.meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.progress-track {
    height: 9px;
    border-radius: 99px;
    background: rgba(27, 27, 58, 0.1);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: var(--progress);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
    transition: width 220ms ease;
}

.detail-pane {
    position: sticky;
    top: 24px;
    overflow: hidden;
}

.detail-body {
    padding: 16px;
    display: grid;
    gap: 16px;
    animation: slideIn 200ms ease both;
}

.empty-state {
    min-height: 560px;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

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

.step {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.step-dot {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(27, 27, 58, 0.12);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 900;
}

.step.approved .step-dot {
    background: var(--teal);
    color: var(--ink);
}

.step.active .step-dot {
    background: var(--gold);
}

.step.blocked .step-dot {
    background: var(--coral);
    color: #fff;
}

.step-copy {
    display: grid;
    gap: 3px;
    color: var(--muted);
    font-size: 13px;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.primary-action,
.ghost-action {
    border: 0;
    border-radius: 8px;
    padding: 11px 14px;
    min-height: 42px;
    cursor: pointer;
    font-weight: 820;
    transition: transform 160ms ease, opacity 160ms ease;
}

.primary-action {
    background: var(--ink);
    color: var(--paper);
}

.ghost-action {
    background: rgba(27, 27, 58, 0.08);
    color: var(--ink);
}

.primary-action:hover,
.ghost-action:hover {
    transform: translateY(-1px);
}

.request-form {
    max-width: 720px;
    padding: 22px;
    display: grid;
    gap: 16px;
}

.form-copy p:last-child {
    margin: 8px 0 0;
    color: var(--muted);
    max-width: 560px;
}

.data-table {
    display: grid;
}

.table-row {
    display: grid;
    grid-template-columns: 1.35fr 0.8fr 0.55fr 0.55fr;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.table-row.header {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.finance-board {
    overflow: hidden;
}

.finance-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
}

.finance-summary .metric {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 13px 15px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    box-shadow: 0 18px 40px rgba(27, 27, 58, 0.24);
    animation: rise 180ms ease both;
    z-index: 10;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

    .rail {
        position: static;
        height: auto;
        padding: 14px;
    }

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

    .tab {
        text-align: center;
        padding: 10px 8px;
    }

    .rail-note {
        display: none;
    }

    .split-layout {
        grid-template-columns: 1fr;
    }

    .detail-pane {
        position: static;
    }
}

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

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

    .sync-pill {
        width: 100%;
    }

    .filters,
    .metric-strip,
    .route-grid,
    .finance-summary {
        grid-template-columns: 1fr;
    }

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

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

    .table-row.header {
        display: none;
    }
}

