:root {
    --bg: #04060b;
    --bg-elevated: #080c13;
    --panel: #0a0f18;
    --panel-soft: #0d131d;
    --line: #161d29;
    --line-strong: #1f2836;
    --text: #e6edf7;
    --text-dim: #8b98ad;
    --text-faint: #5b6779;
    --accent: #38bdf8;
    --accent-deep: #0ea5e9;
    --danger: #f43f5e;
    --warn: #f59e0b;
    --ok: #22c55e;
    --radius: 14px;
    --shell: 248px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.micro {
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
}

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
}

.auth-brand {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 520px at 18% 12%, rgba(56, 189, 248, .16), transparent 62%),
        radial-gradient(700px 620px at 82% 88%, rgba(14, 165, 233, .10), transparent 60%),
        linear-gradient(160deg, #060a11 0%, #04060b 70%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 56px 60px;
    border-right: 1px solid var(--line);
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(700px 500px at 30% 30%, #000 20%, transparent 78%);
    pointer-events: none;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}

.brand-shield {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(150deg, rgba(56, 189, 248, .22), rgba(56, 189, 248, .04));
    border: 1px solid rgba(56, 189, 248, .32);
    box-shadow: 0 0 34px rgba(56, 189, 248, .18);
}

.brand-shield svg {
    width: 24px;
    height: 24px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 1.7;
}

.brand-name {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.brand-sub {
    font-size: 10px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.auth-headline {
    position: relative;
    max-width: 460px;
}

.auth-headline h1 {
    font-size: 42px;
    line-height: 1.08;
    letter-spacing: -.03em;
    font-weight: 700;
}

.auth-headline h1 span {
    color: var(--accent);
}

.auth-headline p {
    margin-top: 18px;
    color: var(--text-dim);
    font-size: 15px;
}

.auth-facts {
    position: relative;
    display: flex;
    gap: 40px;
}

.auth-facts div strong {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 40px;
    background: var(--bg-elevated);
}

.auth-card {
    width: 100%;
    max-width: 372px;
}

.auth-card h2 {
    font-size: 24px;
    letter-spacing: -.02em;
    margin-top: 10px;
}

.auth-card > p {
    color: var(--text-dim);
    margin-top: 8px;
    margin-bottom: 30px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
}

.field input {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .16s, box-shadow .16s;
}

.field input:focus {
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, .12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    border: 1px solid rgba(56, 189, 248, .38);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(56, 189, 248, .22), rgba(56, 189, 248, .08));
    color: #eaf7ff;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    transition: transform .12s, box-shadow .16s, border-color .16s;
}

.btn:hover {
    border-color: rgba(56, 189, 248, .7);
    box-shadow: 0 8px 26px rgba(56, 189, 248, .16);
}

.btn:active {
    transform: translateY(1px);
}

.btn-ghost {
    width: auto;
    background: var(--panel);
    border-color: var(--line-strong);
    color: var(--text-dim);
}

.btn-danger {
    background: linear-gradient(180deg, rgba(244, 63, 94, .22), rgba(244, 63, 94, .07));
    border-color: rgba(244, 63, 94, .4);
    color: #ffe9ee;
}

.alert {
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(244, 63, 94, .09);
    border-color: rgba(244, 63, 94, .3);
    color: #ffc7d1;
}

.alert-info {
    background: rgba(56, 189, 248, .08);
    border-color: rgba(56, 189, 248, .26);
    color: #cbeeff;
}

.auth-note {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 12.5px;
}

.auth-note code {
    color: var(--accent);
    background: rgba(56, 189, 248, .1);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 12px;
}

.shell {
    display: grid;
    grid-template-columns: var(--shell) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--line);
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand-mark {
    padding: 0 8px 20px;
    border-bottom: 1px solid var(--line);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-group .micro {
    padding: 0 10px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 9px;
    color: var(--text-dim);
    border: 1px solid transparent;
    transition: background .14s, color .14s, border-color .14s;
}

.nav-item svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    flex: none;
}

.nav-item:hover {
    background: var(--panel);
    color: var(--text);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, .16), rgba(56, 189, 248, .03));
    border-color: rgba(56, 189, 248, .24);
    color: #dff3ff;
}

.sidebar-foot {
    margin-top: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 7px;
}

.dot-ok {
    background: var(--ok);
    box-shadow: 0 0 9px rgba(34, 197, 94, .8);
}

.dot-off {
    background: var(--danger);
    box-shadow: 0 0 9px rgba(244, 63, 94, .7);
}

.dot-busy {
    background: var(--warn);
    box-shadow: 0 0 9px rgba(245, 158, 11, .7);
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 64px;
    border-bottom: 1px solid var(--line);
    background: rgba(6, 9, 15, .82);
    backdrop-filter: blur(9px);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.searchbar {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 8px 13px;
    width: 340px;
}

.searchbar svg {
    width: 15px;
    height: 15px;
    stroke: var(--text-faint);
    fill: none;
    stroke-width: 1.7;
    flex: none;
}

.searchbar input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-size: 13px;
}

.userchip {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-left: 20px;
    border-left: 1px solid var(--line);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(150deg, rgba(56, 189, 248, .26), rgba(56, 189, 248, .05));
    border: 1px solid rgba(56, 189, 248, .3);
    color: #dff3ff;
}

.userchip-meta strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.content {
    padding: 24px 26px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.kpi {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    position: relative;
    overflow: hidden;
    transition: border-color .16s, transform .16s;
}

.kpi:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
}

.kpi::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, .55), transparent);
    opacity: .55;
}

.kpi.kpi-danger::after {
    background: linear-gradient(90deg, transparent, rgba(244, 63, 94, .55), transparent);
}

.kpi.kpi-ok::after {
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, .55), transparent);
}

.kpi-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-top: 10px;
    line-height: 1;
}

.kpi-note {
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 7px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    align-items: start;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}

.card-body {
    padding: 6px 0;
}

.card-empty {
    padding: 30px 18px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
}

.row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(22, 29, 41, .6);
    transition: background .14s;
}

.row:last-child {
    border-bottom: none;
}

.row:hover {
    background: var(--panel-soft);
}

.row-main {
    min-width: 0;
    flex: 1;
}

.row-main strong {
    font-size: 13.5px;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-main span {
    font-size: 12px;
    color: var(--text-faint);
}

.row-side {
    text-align: right;
    flex: none;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.tag-high {
    background: rgba(244, 63, 94, .12);
    border-color: rgba(244, 63, 94, .32);
    color: #ff9fb0;
}

.tag-medium {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .3);
    color: #fbc971;
}

.tag-low {
    background: rgba(56, 189, 248, .1);
    border-color: rgba(56, 189, 248, .28);
    color: #9adcfb;
}

.tag-ok {
    background: rgba(34, 197, 94, .1);
    border-color: rgba(34, 197, 94, .28);
    color: #86efac;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px 18px;
}

.quick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 18px 10px;
    border-radius: 11px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--text-dim);
    font-size: 12.5px;
    font-weight: 500;
    text-align: center;
    transition: border-color .16s, color .16s, transform .16s;
}

.quick svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
}

.quick:hover {
    border-color: rgba(56, 189, 248, .35);
    color: #dff3ff;
    transform: translateY(-2px);
}

.footnote {
    text-align: center;
    color: var(--text-faint);
    font-size: 11.5px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.page-head h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-top: 4px;
}

.page-head p {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 5px;
    max-width: 620px;
}

.head-actions {
    display: flex;
    gap: 9px;
    flex: none;
}

.toolbar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 18px;
}

.toolbar .field {
    margin-bottom: 0;
    flex: 1;
    min-width: 170px;
}

.toolbar .btn {
    width: auto;
    flex: none;
}

.field select,
.field textarea {
    width: 100%;
    background: var(--panel-soft);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .16s, box-shadow .16s;
}

.field textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.6;
}

.field select:focus,
.field textarea:focus {
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, .12);
}

.field-note {
    color: var(--text-faint);
    font-size: 11.5px;
    margin-top: 6px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 18px;
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

.form-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 18px 18px;
}

.form-foot .btn {
    width: auto;
}

.checklist {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 210px;
    overflow-y: auto;
    padding: 4px;
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 9px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--text-dim);
    cursor: pointer;
}

.check:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

.check input {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    flex: none;
}

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

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    text-align: left;
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(22, 29, 41, .55);
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data tbody tr:hover {
    background: var(--panel-soft);
}

table.data td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table.data td.tight {
    width: 1%;
    white-space: nowrap;
}

.cell-main {
    display: block;
    font-weight: 600;
    color: var(--text);
}

.cell-sub {
    display: block;
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 2px;
}

.mono {
    font-family: "JetBrains Mono", "Consolas", monospace;
    letter-spacing: .04em;
}

.link {
    color: var(--accent);
}

.link:hover {
    text-decoration: underline;
}

.btn-sm {
    width: auto;
    padding: 7px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.inline-form {
    display: inline-block;
}

.detail-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    align-items: start;
}

.profile {
    padding: 20px 18px;
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.profile .avatar {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    font-size: 21px;
    margin: 0 auto 12px;
}

.profile h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.profile span {
    color: var(--text-faint);
    font-size: 12px;
}

.meta {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 9px 12px;
    padding: 16px 18px;
    font-size: 12.5px;
}

.meta dt {
    color: var(--text-faint);
}

.meta dd {
    color: var(--text);
    word-break: break-word;
}

.segments {
    display: flex;
    gap: 3px;
    margin-top: 8px;
}

.seg {
    flex: 1;
    height: 7px;
    border-radius: 3px;
    background: #141b26;
    border: 1px solid #1c2532;
}

.seg-on {
    background: rgba(56, 189, 248, .55);
    border-color: rgba(56, 189, 248, .7);
}

.seg-warn {
    background: rgba(245, 158, 11, .6);
    border-color: rgba(245, 158, 11, .75);
}

.seg-danger {
    background: rgba(244, 63, 94, .62);
    border-color: rgba(244, 63, 94, .8);
}

.points-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.points-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.03em;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-note {
    padding: 14px 18px;
    color: var(--text-dim);
    font-size: 12.5px;
    line-height: 1.6;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
}

.tabs {
    display: flex;
    gap: 6px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.tab {
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--panel-soft);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    border-color: rgba(56, 189, 248, .38);
    background: rgba(56, 189, 248, .12);
    color: #dff3ff;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 12px;
}

.pager-links {
    display: flex;
    gap: 8px;
}

.body-text {
    padding: 18px;
    white-space: pre-wrap;
    line-height: 1.7;
    color: #cdd8e6;
    font-size: 13.5px;
}

.backlink {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 600;
}

.backlink:hover {
    color: var(--accent);
}

.officer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    padding: 16px 18px;
}

.officer {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border-radius: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

@media (max-width: 1180px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

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

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

    .auth-brand {
        display: none;
    }

    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .searchbar {
        width: auto;
        flex: 1;
    }

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

    .checklist {
        grid-template-columns: 1fr;
    }

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