:root {
    --bg: #191919;
    --surface: #202020;
    --surface-soft: #252525;
    --surface-strong: #2b2b2b;
    --line: #303030;
    --line-soft: #2a2a2a;
    --ink: #ebebeb;
    --muted: #9b9b9b;
    --muted-strong: #b5b5b5;
    --accent: #5f9cf7;
    --accent-gold: #f3c969;
    --accent-green: #77d3a2;
    --accent-purple: #b98ae5;
    --shadow: 0 22px 44px rgba(0, 0, 0, 0.28);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(95, 156, 247, 0.08), transparent 28%),
        radial-gradient(circle at bottom right, rgba(185, 138, 229, 0.08), transparent 24%),
        linear-gradient(180deg, #171717 0%, var(--bg) 100%);
    font-family: var(--font-body);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 78%);
}

a {
    color: inherit;
}

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

[hidden] {
    display: none !important;
}

button,
input {
    font: inherit;
}

.auth-shell,
.app-shell {
    position: relative;
    z-index: 1;
}

.auth-shell {
    display: grid;
    place-items: center;
    padding: 32px;
}

.auth-card,
.panel,
.metric-card,
.sidebar,
.brand-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(38, 38, 38, 0.96), rgba(28, 28, 28, 0.96));
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 460px);
    padding: 32px;
    border-radius: var(--radius-xl);
    display: grid;
    gap: 20px;
    animation: rise-in 320ms ease-out;
}

.auth-card h1,
.sidebar h1,
.brand-card h1,
.panel h3 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

.auth-card h1,
.brand-card h1 {
    font-size: clamp(2rem, 6vw, 2.85rem);
}

.eyebrow {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    font-weight: 600;
}

.auth-copy,
.sidebar-copy,
.metric-note,
.meta-block,
.status-note,
.auth-switch {
    color: var(--muted);
    line-height: 1.5;
}

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

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

.field span {
    font-size: 0.9rem;
    color: var(--muted);
}

.field input {
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: #161616;
    color: var(--ink);
}

.field input:focus {
    outline: none;
    border-color: rgba(95, 156, 247, 0.45);
    box-shadow: 0 0 0 3px rgba(95, 156, 247, 0.14);
}

.primary-button,
.ghost-button,
.ghost-link,
.section-link,
.page-link {
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.primary-button {
    background: #f5f5f5;
    color: #171717;
    padding: 12px 16px;
    font-weight: 700;
}

.primary-button:hover,
.ghost-button:hover,
.ghost-link:hover,
.section-link:hover,
.page-link:hover {
    transform: translateY(-1px);
}

.ghost-button,
.ghost-link {
    background: #242424;
    border-color: var(--line);
    color: var(--muted-strong);
    padding: 11px 15px;
    text-decoration: none;
}

.ghost-button:hover,
.ghost-link:hover {
    background: #2a2a2a;
    color: var(--ink);
}

.form-error,
.status-error {
    color: #f0b4a1;
    background: rgba(124, 56, 36, 0.24);
    border: 1px solid rgba(201, 88, 36, 0.3);
    padding: 12px 14px;
    border-radius: var(--radius-md);
}

.status-success {
    color: #b7ead0;
    background: rgba(47, 93, 69, 0.26);
    border: 1px solid rgba(119, 211, 162, 0.24);
    padding: 12px 14px;
    border-radius: var(--radius-md);
}

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

.dashboard-shell {
    display: block;
    min-height: 100vh;
}

.sidebar {
    margin: 20px 0 20px 20px;
    border-radius: var(--radius-xl);
    padding: 24px 20px;
    display: grid;
    align-content: space-between;
    gap: 24px;
    background: linear-gradient(180deg, rgba(30, 30, 30, 0.98), rgba(24, 24, 24, 0.98));
}

.section-nav {
    display: grid;
    gap: 10px;
}

.section-link {
    text-align: left;
    padding: 12px 14px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    text-decoration: none;
}

.section-link.is-active {
    background: #2a2a2a;
    border-color: var(--line);
    color: var(--ink);
    font-weight: 600;
}

.content {
    padding: 20px;
    display: grid;
    align-content: start;
    gap: 16px;
}

.dashboard-content {
    max-width: 100%;
}

.panel,
.metric-card,
.brand-card {
    border-radius: var(--radius-xl);
    padding: 20px;
}

.dashboard-header {
    display: grid;
    grid-template-columns: minmax(220px, 290px) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.brand-card {
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 28px 24px;
}

.dashboard-header-main {
    display: grid;
    gap: 16px;
    align-content: start;
}

.dashboard-header > .brand-card {
    gap: 10px;
    padding: 20px 20px 18px;
}

.dashboard-header > .brand-card h1 {
    font-size: clamp(1.9rem, 5vw, 2.7rem);
    line-height: 0.98;
}

.dashboard-header > .brand-card .sidebar-copy {
    font-size: 0.98rem;
    line-height: 1.42;
}

.dashboard-header .dashboard-header-main {
    gap: 12px;
}

.dashboard-page-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 999px;
    background: #242424;
    border: 1px solid var(--line);
}

.page-link {
    padding: 10px 16px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.page-link.is-active {
    background: #2f2f2f;
    border-color: var(--line);
    color: var(--ink);
    font-weight: 600;
}

.dashboard-header .dashboard-page-nav {
    gap: 8px;
    padding: 6px;
}

.dashboard-header .page-link {
    padding: 8px 14px;
}

.topbar,
.dashboard-toolbar,
.panel-heading,
.actions-row,
.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.session-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 15px;
    border-radius: 999px;
    background: #242424;
    border: 1px solid var(--line);
    color: var(--muted-strong);
}

.dashboard-header .session-badge,
.dashboard-header .ghost-button,
.dashboard-header .ghost-link,
.dashboard-header .toggle-option {
    padding: 9px 14px;
}

.dashboard-header .primary-button {
    padding: 10px 16px;
}

.session-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-green);
}

.header-meta {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
}

.dashboard-header .header-meta {
    padding: 10px 14px;
}

.toggle-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 15px;
    border-radius: 999px;
    background: #242424;
    border: 1px solid var(--line);
    color: var(--muted-strong);
    cursor: pointer;
}

.toggle-option input {
    margin: 0;
    accent-color: var(--accent);
}

.section-banner {
    display: flex;
    justify-content: flex-start;
}

.compact-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 190px)) minmax(0, 1fr);
    gap: 14px;
    align-items: end;
}

.dashboard-header .compact-filters {
    grid-template-columns: repeat(2, minmax(0, 180px)) minmax(0, 1fr);
    gap: 12px;
}

.dashboard-header .compact-filters .field {
    gap: 6px;
}

.dashboard-header .compact-filters .field input {
    padding: 11px 13px;
}

.dashboard-header .actions-row {
    gap: 10px;
    justify-content: flex-start;
}

.pill-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #2b2b2b;
    border: 1px solid var(--line);
}

.dashboard-header .pill-title {
    padding: 8px 14px;
}

.pill-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    position: relative;
}

.pill-icon::before,
.pill-icon::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    background: rgba(255, 255, 255, 0.45);
    transform-origin: left top;
}

.pill-icon::before {
    width: 2px;
    height: 6px;
    transform: translate(-1px, -100%) rotate(0deg);
}

.pill-icon::after {
    width: 6px;
    height: 2px;
    transform: translate(0, -1px) rotate(38deg);
}

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

.compact-metrics .metric-card {
    min-height: 150px;
}

.metric-card {
    background: linear-gradient(180deg, rgba(39, 39, 39, 0.98), rgba(30, 30, 30, 0.98));
}

.metric-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin-bottom: 10px;
}

.metric-value {
    font-size: clamp(2rem, 4vw, 3rem);
    font-family: var(--font-display);
    line-height: 1;
    margin-bottom: 10px;
}

.compact-value {
    font-size: clamp(1.18rem, 2vw, 1.75rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

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

.dashboard-page,
.admin-panels {
    display: grid;
    gap: 16px;
}

.ring-panel,
.histogram-panel {
    min-height: clamp(280px, 34vw, 380px);
}

.dashboard-shell[data-dashboard-page="releases"] .histogram-panel {
    min-height: 250px;
}

.dashboard-shell[data-dashboard-page="arch-reviews"] .arch-review-chart-panel {
    min-height: 290px;
}

.wide-ring-panel .ring-layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 28px;
}

.chart-row,
.table-row {
    display: block;
}

.table-panel {
    width: 100%;
}

.ring-layout {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    margin-top: 18px;
}

.chart-wrap {
    position: relative;
    min-height: clamp(220px, 28vw, 320px);
    margin-top: 18px;
}

.dashboard-shell[data-dashboard-page="releases"] .chart-wrap {
    min-height: 190px;
    margin-top: 12px;
}

.dashboard-shell[data-dashboard-page="arch-reviews"] .arch-review-chart-wrap {
    min-height: 220px;
}

.chart-wrap-scrollable {
    overflow: hidden;
}

.chart-legend-note {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 12px;
    align-items: center;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    min-width: 0;
}

.chart-legend-swatch {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex: 0 0 auto;
    border: 0;
}

.chart-legend-label {
    color: var(--muted-strong);
    font-size: 0.9rem;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
}

.chart,
.donut-chart {
    width: 100%;
    height: auto;
}

.chart-scrollable {
    display: block;
    max-width: none;
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
    stroke-dasharray: 1 6;
}

.chart-axis {
    fill: #c9c9c9;
    font-size: 12px;
}

.chart-link {
    fill: var(--accent);
    cursor: pointer;
}

.chart-value {
    fill: #f3f7ff;
    font-size: 12px;
    font-weight: 600;
}

.chart-value-stack {
    fill: #b8d0ea;
    font-size: 11px;
    font-weight: 500;
    stroke: rgba(22, 24, 29, 0.92);
    stroke-width: 3px;
    paint-order: stroke fill;
}

.dashboard-shell[data-dashboard-page="releases"] .chart-axis {
    font-size: 11px;
}

.dashboard-shell[data-dashboard-page="releases"] .chart-value {
    font-size: 11px;
}

.chart-bar {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.chart-bar-segment {
    stroke: rgba(28, 28, 28, 0.85);
    stroke-width: 1;
}

.chart-bar-stack-outline {
    stroke: rgba(255, 255, 255, 0.16);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point {
    fill: var(--accent);
    stroke: rgba(15, 15, 15, 0.9);
    stroke-width: 1.5;
}

.donut-track {
    fill: none;
    stroke: #2f2f2f;
    stroke-width: 18;
}

.donut-segment {
    fill: none;
    stroke-width: 18;
    stroke-linecap: butt;
    transform: rotate(-90deg);
    transform-origin: 160px 160px;
}

.donut-total {
    fill: #f1f1f1;
    font-size: 44px;
    font-weight: 700;
}

.donut-total-label {
    fill: #9a9a9a;
    font-size: 18px;
}

.donut-legend {
    display: grid;
    gap: 12px;
}

.legend-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: #252525;
    border: 1px solid var(--line-soft);
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-swatch-empty {
    background: #5d5d5d;
}

.legend-label {
    color: var(--muted-strong);
}

.legend-value {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.table-wrap {
    overflow: auto;
    margin-top: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line-soft);
    padding: 14px 12px;
    font-size: 0.94rem;
}

th {
    color: var(--muted);
    font-weight: 500;
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.sort-button::after {
    content: "↕";
    color: #6f6f6f;
    font-size: 0.8rem;
}

.sort-button.is-active::after {
    color: var(--ink);
}

.sort-button.is-active[data-direction="asc"]::after {
    content: "↑";
}

.sort-button.is-active[data-direction="desc"]::after {
    content: "↓";
}

td {
    color: #dddddd;
}

.issue-link {
    color: var(--accent);
    text-decoration: none;
}

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

thead th {
    position: sticky;
    top: 0;
    background: rgba(33, 33, 33, 0.98);
    z-index: 1;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #d6d6d6;
    text-align: center;
    font-size: 1rem;
}

.empty-state[hidden] {
    display: none !important;
}

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

.dataset-panel {
    display: grid;
    gap: 18px;
}

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

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

.stack-section > .panel {
    display: grid;
    gap: 16px;
}

.issue-type-metrics {
    grid-template-columns: minmax(0, 280px);
}

.sort-button::after {
    content: "<>";
}

.sort-button.is-active[data-direction="asc"]::after {
    content: "^";
}

.sort-button.is-active[data-direction="desc"]::after {
    content: "v";
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1280px) {
    .dashboard-header,
    .ring-layout {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        margin: 20px 20px 0;
    }

    .insights-grid,
    .metrics-grid,
    .admin-metrics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .auth-shell,
    .content {
        padding: 16px;
    }

    .sidebar {
        margin: 16px 16px 0;
    }

    .compact-filters {
        grid-template-columns: 1fr;
    }

    .actions-row {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .primary-button,
    .ghost-button,
    .ghost-link {
        width: 100%;
        text-align: center;
    }

    .ring-panel,
    .histogram-panel {
        min-height: auto;
    }
}
