:root {
    color-scheme: light;
    --ink: #263238;
    --paper: #f0f4f8;
    --paper-strong: #ffffff;
    --green: #00a676;
    --yellow: #ffcf56;
    --red: #d95d39;
    --line: #c9d4dc;
    --muted: #60717a;
    --shadow: 0 18px 50px rgba(38, 50, 56, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(38, 50, 56, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(180deg, rgba(38, 50, 56, 0.035) 1px, transparent 1px) 0 0 / 24px 24px,
        var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

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

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

.brand strong,
.brand small {
    display: block;
}

.brand small,
.db-badge strong {
    color: #d7e1e7;
}

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

.tab {
    border: 1px solid rgba(240, 244, 248, 0.22);
    background: transparent;
    color: var(--paper);
    min-height: 42px;
    border-radius: 8px;
    text-align: left;
    padding: 10px 12px;
}

.tab.is-active {
    background: var(--green);
    border-color: var(--green);
    color: #062b21;
    font-weight: 800;
}

.db-badge {
    margin-top: auto;
    border: 1px dashed rgba(255, 207, 86, 0.55);
    border-radius: 8px;
    padding: 14px;
}

.mono {
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

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

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.03;
}

h2 {
    font-size: 22px;
    line-height: 1.15;
    margin-bottom: 8px;
}

h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.search {
    min-width: min(280px, 100%);
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.search input,
textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper-strong);
    min-height: 40px;
    padding: 10px 12px;
    color: var(--ink);
}

.icon-button,
.primary-button,
.ghost-button {
    border-radius: 8px;
    min-height: 42px;
    border: 1px solid var(--ink);
    padding: 10px 14px;
}

.icon-button {
    width: 42px;
    padding: 0;
    background: var(--paper-strong);
}

.primary-button {
    background: var(--green);
    color: #062b21;
    font-weight: 800;
}

.ghost-button {
    background: var(--paper-strong);
    color: var(--ink);
}

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

.metric {
    background: var(--paper-strong);
    border: 1px solid var(--line);
    border-left: 6px solid var(--ink);
    border-radius: 8px;
    padding: 16px;
    min-height: 118px;
    box-shadow: 0 8px 24px rgba(38, 50, 56, 0.06);
}

.metric-green {
    border-left-color: var(--green);
}

.metric-yellow {
    border-left-color: var(--yellow);
}

.metric strong {
    display: block;
    font-size: 31px;
    line-height: 1.1;
    margin: 8px 0;
}

.metric small {
    color: var(--muted);
}

.view {
    display: none;
}

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

.notebook-head,
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.72);
    margin-bottom: 14px;
}

.notebook-head p {
    margin-bottom: 0;
    color: var(--muted);
}

.version,
.stage-badge,
.date-pill,
.priority {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 10px;
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    white-space: nowrap;
}

.version {
    background: var(--yellow);
    color: var(--ink);
    font-weight: 800;
}

.lane-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(190px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.lane {
    background: var(--paper-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    min-height: 282px;
    box-shadow: var(--shadow);
}

.lane-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.lane p {
    color: var(--muted);
    font-size: 13px;
    min-height: 48px;
}

.resource-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #edf7f2;
    border: 1px solid rgba(0, 166, 118, 0.3);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.resource-chip span {
    color: #216653;
    font-size: 12px;
}

.lane-items {
    display: grid;
    gap: 8px;
}

.lane-card {
    position: relative;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    text-align: left;
    padding: 10px;
    min-height: 72px;
}

.lane-card span,
.lane-card small {
    display: block;
}

.lane-card small {
    margin-top: 4px;
    color: var(--muted);
}

.has-conflict {
    outline: 3px solid rgba(217, 93, 57, 0.2);
    border-color: var(--red);
}

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

.request-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 150px 120px 140px;
    align-items: center;
    gap: 12px;
    background: var(--paper-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.request-row.is-selected {
    border-color: var(--green);
}

.row-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
}

.row-main strong,
.row-main small {
    display: block;
}

.row-main small {
    color: var(--muted);
    margin-top: 4px;
}

.priority {
    background: #e8eef2;
}

.priority-high {
    background: #ffe9df;
    color: #8b2e12;
}

.priority-low {
    background: #eaf6ef;
    color: #126444;
}

.row-meter {
    height: 12px;
    border-radius: 999px;
    background: #dce6eb;
    overflow: hidden;
}

.row-meter span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--yellow));
}

.stage-badge {
    background: var(--ink);
    color: var(--paper);
    justify-content: center;
}

.date-pill {
    background: #fff7d8;
    color: #5c4700;
    justify-content: center;
}

.two-column,
.report-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
    gap: 16px;
}

.inspector,
.timeline-panel,
.report-sheet,
.publication-panel {
    background: var(--paper-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.inspector dl {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px 14px;
    margin: 18px 0;
}

.inspector dt {
    color: var(--muted);
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    text-transform: uppercase;
}

.inspector dd {
    margin: 0;
    min-width: 0;
}

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

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
}

.timeline-item p {
    margin-bottom: 0;
    color: var(--muted);
}

.dot {
    width: 12px;
    height: 12px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(0, 166, 118, 0.14);
}

.calendar-lanes {
    display: grid;
    gap: 12px;
}

.calendar-row {
    display: grid;
    grid-template-columns: 230px minmax(360px, 1fr);
    gap: 12px;
    align-items: center;
    background: var(--paper-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
}

.calendar-label strong,
.calendar-label small {
    display: block;
}

.calendar-label small {
    color: var(--muted);
    margin-top: 4px;
}

.calendar-track {
    position: relative;
    height: 58px;
    min-width: 360px;
    border-radius: 8px;
    background:
        repeating-linear-gradient(90deg, #e7eff3 0, #e7eff3 1px, transparent 1px, transparent 12.5%),
        #f8fafb;
    border: 1px solid var(--line);
}

.calendar-block {
    position: absolute;
    top: 8px;
    bottom: 8px;
    border: 1px solid rgba(38, 50, 56, 0.26);
    border-radius: 8px;
    background: var(--yellow);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 160px;
    padding: 8px 10px;
    overflow: hidden;
}

.calendar-block span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-block b {
    flex: 0 0 auto;
}

.report-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.report-kpis article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #f8fafb;
}

.report-kpis strong {
    display: block;
    font-size: 24px;
    margin-top: 8px;
}

.publication-panel ul {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.publication-panel li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 10px;
}

.publication-panel span {
    color: var(--muted);
    text-align: right;
}

dialog {
    border: 0;
    border-radius: 8px;
    padding: 0;
    width: min(520px, calc(100vw - 32px));
    box-shadow: var(--shadow);
}

dialog::backdrop {
    background: rgba(38, 50, 56, 0.36);
}

.dialog-form {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.dialog-form label {
    display: grid;
    gap: 8px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

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

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

    .tab {
        text-align: center;
        padding: 9px 6px;
    }

    .db-badge {
        display: none;
    }

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

    .toolbar {
        justify-content: stretch;
    }

    .search {
        width: 100%;
    }

    .metric-strip,
    .two-column,
    .report-grid {
        grid-template-columns: 1fr;
    }

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

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

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

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

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

    .metric-strip,
    .report-kpis {
        grid-template-columns: 1fr;
    }

    .lane-board {
        grid-template-columns: minmax(250px, 1fr);
    }

    .inspector dl {
        grid-template-columns: 1fr;
    }

    .publication-panel li {
        display: grid;
    }

    .publication-panel span {
        text-align: left;
    }
}
