:root {
    color-scheme: light;
    --ink: #102a43;
    --paper: #f5f7fa;
    --accent: #d64545;
    --aqua: #56a3a6;
    --line: #d7dee6;
    --muted: #65758a;
    --drawer: #e9edf2;
    --shadow: 0 18px 50px rgba(16, 42, 67, 0.12);
}

* {
    box-sizing: border-box;
}

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

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

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

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

.brand img {
    flex: 0 0 auto;
}

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

.tab {
    min-height: 42px;
    border: 1px solid rgba(245, 247, 250, 0.16);
    border-radius: 8px;
    color: rgba(245, 247, 250, 0.74);
    background: transparent;
    text-align: left;
    padding: 9px 12px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
    background: rgba(86, 163, 166, 0.24);
    color: #fff;
    transform: translateX(2px);
}

.rail-note {
    margin-top: auto;
    padding: 14px;
    border-left: 3px solid var(--aqua);
    background: rgba(245, 247, 250, 0.08);
    line-height: 1.55;
}

.note-label,
.eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--aqua);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

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

.topbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 18px;
}

h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 62px);
    line-height: 0.95;
}

.search-box {
    width: min(360px, 100%);
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.search-box input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 0 12px;
    text-transform: none;
    letter-spacing: 0;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 20px;
    background: var(--ink);
    border: 1px solid var(--ink);
}

.metric-strip div {
    min-width: 0;
    background: #fff;
    padding: 14px;
}

.metric-strip span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.metric-strip strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1;
}

.desk-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 20px;
    align-items: start;
}

.portfolio-wall,
.detail-sheet {
    min-width: 0;
}

.section-title {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.1em;
    font-weight: 800;
}

.ghost-button,
.detail-actions button {
    border: 1px solid var(--ink);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    min-height: 38px;
    padding: 0 12px;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.ghost-button:hover,
.detail-actions button:hover {
    background: var(--ink);
    color: #fff;
    transform: translateY(-1px);
}

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

.stage-tile {
    position: relative;
    min-height: 116px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 12px;
    text-align: left;
    box-shadow: var(--shadow);
}

.stage-tile::after {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -22px;
    width: 78px;
    height: 58px;
    border: 12px solid rgba(86, 163, 166, 0.22);
    transform: rotate(-17deg);
}

.stage-tile span,
.stage-tile em {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    line-height: 1.35;
}

.stage-tile strong {
    display: block;
    margin: 18px 0 8px;
    font-size: 36px;
    line-height: 1;
}

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

.project-row,
.setting-row {
    width: 100%;
    min-height: 74px;
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr) 72px 88px;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-left: 10px solid var(--aqua);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    padding: 10px 12px;
    text-align: left;
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.project-row:hover,
.project-row.is-selected {
    border-color: var(--ink);
    box-shadow: var(--shadow);
    transform: translateX(2px);
}

.row-drawer,
.setting-row span {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
}

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

.row-main strong,
.setting-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 17px;
    line-height: 1.2;
}

.row-main em,
.setting-row em {
    color: var(--muted);
    font-style: normal;
    line-height: 1.45;
}

.row-score {
    font-size: 24px;
    font-weight: 900;
}

.risk {
    min-width: 0;
    display: inline-flex;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.1;
    color: #fff;
    background: var(--aqua);
}

.risk-high {
    background: var(--accent);
}

.risk-medium {
    color: var(--ink);
    background: #f0c96d;
}

.detail-sheet {
    position: sticky;
    top: 24px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.sheet-header {
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(86, 163, 166, 0.18), rgba(214, 69, 69, 0.08));
}

.sheet-header span {
    display: block;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.35;
}

.sheet-header h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

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

.detail-grid div {
    min-width: 0;
    padding: 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

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

.detail-grid dd {
    margin: 6px 0 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.detail-meter {
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.detail-meter span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.meter {
    height: 14px;
    background: var(--drawer);
    border-radius: 999px;
    overflow: hidden;
}

.meter i {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--aqua), var(--accent));
    transition: width 240ms ease;
}

.detail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.timeline {
    padding: 14px;
}

.timeline-item {
    display: grid;
    gap: 5px;
    padding: 12px 0 12px 16px;
    border-left: 2px solid var(--aqua);
}

.timeline-item span {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.timeline-item strong {
    line-height: 1.35;
}

.timeline-item em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    padding: 18px;
    line-height: 1.5;
}

.empty-state.compact {
    padding: 12px;
    font-size: 14px;
}

.setting-row {
    grid-template-columns: 110px minmax(0, 0.8fr) minmax(0, 1.2fr);
}

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

    .rail {
        position: static;
        height: auto;
    }

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

    .topbar,
    .desk-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .detail-sheet {
        position: static;
    }

    .metric-strip,
    .stage-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .rail {
        padding: 16px;
    }

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

    .metric-strip,
    .stage-board,
    .detail-actions,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .project-row,
    .setting-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .risk {
        justify-content: flex-start;
        width: max-content;
        max-width: 100%;
    }
}

