:root {
    --bg: #05070a;
    --panel: rgba(18, 22, 28, 0.9);
    --panel-strong: #10151c;
    --line: rgba(255, 255, 255, 0.08);
    --text: #edf2f8;
    --muted: #95a1b2;
    --accent: #4496f3;
    --accent-dark: #2e78cd;
    --danger: #c54848;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(68, 150, 243, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(68, 150, 243, 0.08), transparent 24%),
        linear-gradient(180deg, #06080c 0%, #0b1016 100%);
}

body {
    line-height: 1.45;
}

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

code, textarea, input, select {
    font-family: "SFMono-Regular", Consolas, monospace;
}

.shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 22px 18px;
    background:
        linear-gradient(180deg, rgba(11, 14, 19, 0.98), rgba(7, 10, 14, 0.98));
    color: #eef4fb;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar h1 {
    margin: 8px 0 2px;
    font-size: 1.2rem;
    line-height: 1.2;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4496f3, #2f6fca);
    color: #f8fbff;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-nav a {
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(237, 242, 248, 0.72);
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon {
    width: 18px;
    height: 18px;
    color: currentColor;
    flex: 0 0 18px;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active {
    background: rgba(68, 150, 243, 0.16);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.nav-link-logout {
    color: rgba(237, 242, 248, 0.58);
}

.content {
    padding: 22px;
    display: grid;
    gap: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 18px;
    padding: 16px;
    backdrop-filter: blur(18px);
}

.panel-danger {
    border-color: rgba(181, 63, 43, 0.2);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.panel h2,
.panel h1 {
    margin: 0;
    font-size: 1rem;
}

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

.range-form {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.range-form label {
    min-width: 150px;
}

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

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

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

.full-width {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
}

label span {
    font-weight: 600;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(8, 12, 17, 0.92);
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: #728095;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.button:hover {
    filter: brightness(0.98);
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #f8fbff;
}

.button-danger {
    background: linear-gradient(135deg, var(--danger), #7f2a1d);
    color: #fff;
}

.button-small {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.button-block {
    width: 100%;
}

.flash {
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.flash-success {
    background: rgba(68, 150, 243, 0.14);
    border: 1px solid rgba(68, 150, 243, 0.26);
}

.flash-error {
    background: rgba(197, 72, 72, 0.14);
    border: 1px solid rgba(197, 72, 72, 0.24);
}

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

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

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    vertical-align: middle;
}

tr.row-active td {
    background: rgba(68, 150, 243, 0.12);
}

tr.row-active td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

tr.row-active td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

th {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(68, 150, 243, 0.16);
    color: #7fbaff;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-muted {
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.inline-form {
    display: inline;
}

.link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.link-list a {
    color: #7fbaff;
    font-weight: 700;
}

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

.metric-tile {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top right, rgba(68, 150, 243, 0.14), transparent 34%),
        rgba(15, 20, 26, 0.9);
    box-shadow: var(--shadow);
}

.metric-icon {
    width: 20px;
    height: 20px;
    color: #7fbaff;
}

.metric-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.metric-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 14px;
    align-items: start;
}

.panel-chart {
    grid-row: span 2;
}

.chart-wrap {
    width: 100%;
    overflow-x: auto;
}

.line-chart {
    width: 100%;
    min-width: 640px;
    height: auto;
}

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

.chart-axis-label {
    fill: #95a1b2;
    font-size: 12px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
}

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

.stack-list,
.quick-grid {
    display: grid;
    gap: 10px;
}

.stack-card,
.quick-card {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.stack-card:hover,
.quick-card:hover {
    background: rgba(68, 150, 243, 0.08);
}

.stack-title,
.quick-title {
    font-weight: 700;
}

.stack-meta,
.quick-meta,
.empty-state {
    color: var(--muted);
    font-size: 0.9rem;
}

.quick-icon {
    width: 18px;
    height: 18px;
    color: #7fbaff;
}

.quick-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.user-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.user-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: rgba(9, 13, 18, 0.76);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

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

.checkbox input {
    width: auto;
}

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

.auth-card {
    width: min(480px, 100%);
    padding: 24px;
    border-radius: 20px;
    background: rgba(16, 21, 28, 0.9);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card h1 {
    margin: 14px 0 8px;
}

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

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

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

@media (max-width: 720px) {
    .content {
        padding: 14px;
    }

    .panel {
        padding: 14px;
    }

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

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