:root {
    --ink: #0b132b;
    --paper: #f6fff8;
    --aqua: #5bc0be;
    --sun: #ffd166;
    --coral: #ef476f;
    --leaf: #2a9d8f;
    --muted: #5c667a;
    --line: rgba(11, 19, 43, .12);
    --soft: rgba(91, 192, 190, .12);
    --shadow: 0 22px 55px rgba(11, 19, 43, .16);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(11, 19, 43, .04) 1px, transparent 1px),
        linear-gradient(0deg, rgba(11, 19, 43, .035) 1px, transparent 1px),
        var(--paper);
    background-size: 46px 46px;
    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: 92px minmax(0, 1fr);
    min-height: 100vh;
}

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

.brand {
    display: grid;
    gap: 8px;
    justify-items: center;
    color: inherit;
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    line-height: 1.1;
}

.brand img {
    width: 48px;
    height: 48px;
    border-radius: 16px;
}

.rail-nav {
    display: grid;
    gap: 12px;
}

.rail-button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    color: var(--paper);
    background: rgba(246, 255, 248, .08);
    border: 1px solid rgba(246, 255, 248, .14);
    border-radius: 8px;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.rail-button span {
    font-size: 24px;
    line-height: 1;
}

.rail-button:hover,
.rail-button.is-active {
    transform: translateY(-1px);
    color: var(--ink);
    background: var(--sun);
    border-color: var(--sun);
}

.rail-status {
    margin-top: auto;
    display: grid;
    justify-items: center;
    gap: 6px;
    color: rgba(246, 255, 248, .72);
    font-size: 11px;
    text-transform: uppercase;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--aqua);
    box-shadow: 0 0 0 0 rgba(91, 192, 190, .5);
    animation: pulse 1.8s infinite;
}

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

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.kicker {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 72px);
    line-height: .92;
    letter-spacing: 0;
}

h2 {
    margin: 0;
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: 0;
}

h3 {
    margin: 0;
    font-size: 18px;
}

.topbar-tools {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.search-box {
    min-width: min(280px, 100%);
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.search-box input,
.note-form textarea,
.note-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: var(--ink);
    outline: none;
}

.search-box input {
    min-height: 42px;
    padding: 0 14px;
}

.primary-button {
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    background: var(--sun);
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(255, 209, 102, .25);
    transition: transform .16s ease, box-shadow .16s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(255, 209, 102, .34);
}

.status-lane {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.status-lane div {
    min-width: 0;
    padding: 16px;
    background: rgba(246, 255, 248, .88);
}

.status-lane span,
.inspector-top span,
.section-head span,
.case-meta,
.timeline-card span,
.candidate span,
.note-card span,
.calendar-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-lane strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(28px, 5vw, 56px);
    line-height: .86;
    letter-spacing: 0;
}

.screen {
    display: none;
    animation: rise .24s ease both;
}

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

.work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.canvas,
.inspector,
.notebook,
.media-strip,
.calendar-board,
.report-board {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(246, 255, 248, .9);
    box-shadow: var(--shadow);
}

.canvas {
    min-height: 610px;
    padding: 20px;
}

.canvas-head,
.section-head,
.inspector-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.canvas-head p {
    margin: 8px 0 0;
    color: var(--muted);
}

.stage-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stage-tab {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.stage-tab.is-active {
    color: var(--ink);
    background: var(--aqua);
    border-color: var(--aqua);
}

.progress-track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(168px, 1fr));
    gap: 14px;
    align-items: stretch;
}

.progress-track:before {
    position: absolute;
    top: 40px;
    left: 5%;
    right: 5%;
    height: 3px;
    background: linear-gradient(90deg, var(--aqua), var(--sun), var(--coral));
    border-radius: 99px;
    content: "";
}

.track-column {
    position: relative;
    z-index: 1;
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 14px;
}

.track-head {
    min-height: 82px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 6px;
}

.track-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-weight: 900;
    box-shadow: 0 0 0 8px rgba(246, 255, 248, .95);
}

.track-head strong {
    text-align: center;
    font-size: 13px;
}

.case-card {
    min-width: 0;
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: left;
    white-space: normal;
    overflow: hidden;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.case-card:hover,
.case-card.is-selected {
    transform: translateY(-2px);
    border-color: rgba(91, 192, 190, .8);
    box-shadow: 0 14px 32px rgba(11, 19, 43, .12);
}

.case-card h3 {
    font-size: 16px;
    line-height: 1.18;
    overflow-wrap: anywhere;
    word-break: normal;
}

.case-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.risk-meter {
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(11, 19, 43, .1);
}

.risk-meter span {
    display: block;
    height: 100%;
    width: var(--risk);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--leaf), var(--sun), var(--coral));
}

.mini-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mini-stats div {
    padding: 8px;
    border-radius: 8px;
    background: rgba(91, 192, 190, .12);
}

.mini-stats span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.mini-stats strong {
    display: block;
    margin-top: 3px;
    font-size: 20px;
}

.inspector {
    position: sticky;
    top: 28px;
    min-height: 610px;
    padding: 18px;
}

.inspector-top strong {
    font-size: 46px;
    line-height: .85;
}

.inspector-body {
    display: grid;
    gap: 16px;
}

.radar-plate {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background:
        radial-gradient(circle, rgba(91, 192, 190, .2) 0 2px, transparent 3px),
        repeating-radial-gradient(circle, rgba(91, 192, 190, .18) 0 2px, transparent 2px 42px),
        linear-gradient(135deg, #101a38, #0b132b);
}

.radar-plate:after {
    position: absolute;
    inset: -40%;
    background: conic-gradient(from -30deg, rgba(91, 192, 190, .45), transparent 20%, transparent 100%);
    content: "";
    animation: sweep 3.8s linear infinite;
}

.radar-plate strong {
    position: absolute;
    z-index: 1;
    left: 18px;
    bottom: 16px;
    max-width: calc(100% - 36px);
    color: var(--paper);
    font-size: 22px;
    line-height: 1.05;
}

.candidate-list,
.timeline-list,
.notes-list,
.calendar-list,
.badge-wall {
    display: grid;
    gap: 10px;
}

.candidate,
.timeline-card,
.note-card,
.calendar-card,
.report-panel,
.badge {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.candidate strong,
.timeline-card strong,
.note-card strong,
.calendar-card strong {
    display: block;
    margin-top: 4px;
}

.candidate-score {
    float: right;
    color: var(--ink);
    font-weight: 900;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
}

.notebook,
.media-strip,
.calendar-board,
.report-board {
    padding: 20px;
}

.note-form {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
    margin-top: 16px;
}

.note-form textarea,
.note-form select {
    min-height: 48px;
    padding: 12px;
    resize: vertical;
}

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

.badge i {
    width: 34px;
    height: 34px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--sun);
    color: var(--ink);
    font-style: normal;
    font-weight: 900;
}

.calendar-board,
.report-board {
    min-height: 610px;
}

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

.calendar-card {
    min-height: 148px;
    display: grid;
    align-content: space-between;
}

.report-board {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
}

.report-panel {
    display: grid;
    gap: 16px;
    align-content: start;
}

.report-score {
    font-size: clamp(48px, 10vw, 112px);
    line-height: .82;
    font-weight: 950;
}

.empty-state {
    padding: 20px;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 8px;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 12px rgba(91, 192, 190, 0); }
    100% { box-shadow: 0 0 0 0 rgba(91, 192, 190, 0); }
}

@keyframes sweep {
    to { transform: rotate(360deg); }
}

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

@media (max-width: 1120px) {
    .work-grid,
    .detail-layout,
    .report-board {
        grid-template-columns: 1fr;
    }

    .inspector {
        position: static;
        min-height: auto;
    }

    .progress-track {
        overflow-x: auto;
        padding-bottom: 6px;
    }
}

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

    .left-rail {
        position: sticky;
        z-index: 5;
        top: 0;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 12px;
    }

    .brand {
        grid-template-columns: 34px auto;
        align-items: center;
        justify-items: start;
        text-align: left;
    }

    .brand img {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .rail-nav {
        display: flex;
        gap: 7px;
    }

    .rail-button {
        width: 36px;
        height: 36px;
    }

    .rail-button span {
        font-size: 18px;
    }

    .rail-status {
        display: none;
    }

    .workspace {
        padding: 18px 12px 24px;
    }

    .topbar {
        display: grid;
    }

    .topbar-tools,
    .canvas-head,
    .section-head {
        justify-content: stretch;
    }

    .search-box,
    .primary-button {
        width: 100%;
    }

    .status-lane,
    .calendar-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .status-lane div {
        padding: 12px;
    }

    .canvas,
    .notebook,
    .media-strip,
    .calendar-board,
    .report-board {
        padding: 14px;
    }

    .note-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .brand span {
        display: none;
    }

    .status-lane {
        grid-template-columns: 1fr;
    }

    .stage-tabs {
        justify-content: flex-start;
    }

    .calendar-list {
        grid-template-columns: 1fr;
    }

    .progress-track {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .progress-track:before {
        display: none;
    }

    .track-head {
        min-height: auto;
        grid-template-columns: 40px minmax(0, 1fr);
        justify-items: start;
    }

    .case-card {
        min-height: auto;
    }
}
