:root {
    --bg: #f3f7fb;
    --surface: #ffffff;
    --surface-2: #edf6fd;
    --line: #d7e4ee;
    --line-strong: #adc4d8;
    --text: #16191d;
    --muted: #647485;
    --accent: #078fe3;
    --accent-strong: #0569ad;
    --blue: #078fe3;
    --red: #d14343;
    --amber: #b76e00;
    --green: #16815a;
    --purple: #5f63b8;
    --ink: #111417;
    --shadow: 0 12px 32px rgba(15, 45, 68, .09);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font: 14px/1.45 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;
}

a {
    color: inherit;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 18px;
    border-right: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    border-bottom: 1px solid var(--line);
    margin: -2px -4px 4px;
    padding: 0 4px 16px;
}

.brand img {
    width: 156px;
    max-height: 40px;
    object-fit: contain;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
}

.brand-title {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand-title strong {
    font-size: 14px;
}

.brand-title span {
    color: var(--muted);
    font-size: 12px;
}

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

.nav button,
.logout-btn {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 11px 12px;
    color: #2c3a46;
    background: transparent;
    text-align: left;
}

.nav button.active,
.nav button:hover,
.logout-btn:hover {
    background: #edf6fd;
    border-color: #c6e5f8;
    color: var(--accent-strong);
}

.nav button.active {
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
    margin-top: auto;
    color: var(--muted);
    font-size: 12px;
}

.main {
    min-width: 0;
    padding: 28px clamp(18px, 3vw, 36px) 48px;
}

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

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
}

h1 {
    font-size: clamp(26px, 4vw, 42px);
    max-width: 980px;
}

h2 {
    font-size: 22px;
}

h3 {
    font-size: 16px;
}

p {
    margin: 0;
}

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

.stack {
    display: grid;
    gap: 16px;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.metrics {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
}

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

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

.metric,
.panel,
.item-card,
.public-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric {
    min-height: 102px;
    padding: 16px;
}

.metric span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric strong {
    font-size: 30px;
    line-height: 1;
}

.panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 8px 13px;
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    border-color: #8fa0b1;
}

.btn.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.btn.primary:hover {
    background: var(--accent-strong);
}

.btn.danger {
    border-color: rgba(209, 67, 67, .35);
    color: var(--red);
}

.btn.ghost {
    background: transparent;
}

.btn.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

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

textarea {
    min-height: 86px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    flex: 1;
}

.toolbar input,
.toolbar select {
    width: min(260px, 100%);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    vertical-align: middle;
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td strong {
    display: block;
}

.progress {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ecf1;
}

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

.progress-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 9px;
    color: #26313b;
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.chip.green {
    color: #0b5138;
    background: #dff5ea;
}

.chip.red {
    color: #8c2525;
    background: #fde6e6;
}

.chip.amber {
    color: #754800;
    background: #fff1cf;
}

.chip.blue {
    color: #17439a;
    background: #e3ecff;
}

.chip.purple {
    color: #4a3886;
    background: #ede8ff;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.tabs button {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    background: #ffffff;
    color: var(--muted);
}

.tabs button.active {
    color: #ffffff;
    border-color: var(--accent);
    background: var(--accent);
}

.chart-bars {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) 4fr auto;
    gap: 10px;
    align-items: center;
}

.bar-row .bar {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf2;
}

.bar-row .bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}

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

.item-card {
    padding: 14px;
}

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

.item-card p {
    margin-top: 6px;
}

.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.roadmap-column {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 220px;
    border-left: 4px solid var(--line-strong);
    padding-left: 12px;
}

.roadmap-column:nth-child(2) {
    border-color: var(--amber);
}

.roadmap-column:nth-child(3) {
    border-color: var(--green);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 16, 22, .56);
}

.modal {
    width: min(980px, 100%);
    max-height: min(92vh, 920px);
    overflow: auto;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.modal-head,
.modal-body,
.modal-actions {
    padding: 18px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--line);
}

.close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-size: 20px;
    line-height: 1;
}

.split {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 16px;
}

.check-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.check-item input {
    width: 18px;
    height: 18px;
}

.comment {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.comment strong {
    display: block;
}

.history {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.empty {
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, .6);
    text-align: center;
}

.login-page,
.public-page {
    min-height: 100vh;
    padding: 28px;
}

.login-page {
    display: grid;
    place-items: center;
}

.login-box {
    width: min(430px, 100%);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.login-brand img {
    width: 150px;
    max-height: 44px;
    object-fit: contain;
}

.public-page {
    background: #f8fafc;
}

.public-header {
    display: grid;
    gap: 18px;
    max-width: 1120px;
    margin: 0 auto 22px;
    padding: 8vh 0 18px;
}

.public-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-brand img {
    width: 138px;
    max-height: 40px;
    object-fit: contain;
}

.public-title {
    display: grid;
    gap: 10px;
}

.public-title h1 {
    font-size: clamp(34px, 7vw, 70px);
    max-width: 940px;
}

.public-title p {
    max-width: 740px;
    color: #4d5b68;
    font-size: 17px;
}

.public-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 1120px;
    margin: 0 auto;
}

.public-section {
    padding: 18px;
}

.notice {
    min-height: 42px;
    display: none;
    align-items: center;
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    color: #613800;
    background: #fff1cf;
}

.notice.show {
    display: flex;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
    max-width: min(420px, calc(100vw - 36px));
    border-radius: 8px;
    padding: 12px 14px;
    color: #ffffff;
    background: var(--ink);
    box-shadow: var(--shadow);
}

.color-dot {
    width: 14px;
    height: 14px;
    display: inline-block;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}

.nowrap {
    white-space: nowrap;
}

.hide {
    display: none !important;
}

@media (max-width: 1180px) {
    .grid.metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

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

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

    .grid.metrics,
    .grid.two,
    .grid.three,
    .roadmap-grid,
    .split,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .toolbar,
    .topbar,
    .item-card .row {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar .filters,
    .toolbar input,
    .toolbar select,
    .actions .btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .main,
    .login-page,
    .public-page {
        padding: 18px 14px 34px;
    }

    .metric strong {
        font-size: 25px;
    }

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

    .bar-row .bar {
        grid-column: 1 / -1;
        order: 3;
    }
}
