:root {
    --bg: #071018;
    --bg-soft: #0d1a26;
    --panel: rgba(12, 22, 34, 0.92);
    --panel-strong: rgba(8, 16, 26, 0.96);
    --surface: rgba(255, 255, 255, 0.04);
    --border: rgba(120, 149, 177, 0.18);
    --border-strong: rgba(120, 149, 177, 0.34);
    --text: #edf6ff;
    --muted: #8fa7c2;
    --accent: #53c7ff;
    --accent-strong: #29e2a1;
    --warning: #ffcf68;
    --danger: #ff7186;
    --ok: #41dc94;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --radius-small: 12px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 0%, rgba(41, 226, 161, 0.12), transparent 24%),
        radial-gradient(circle at 100% 0%, rgba(83, 199, 255, 0.16), transparent 22%),
        linear-gradient(180deg, #061019 0%, #09141f 52%, #060e16 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

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

button,
input,
select {
    font: inherit;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px;
    border-right: 1px solid var(--border);
    background: rgba(4, 10, 18, 0.84);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-top,
.sidebar-footer {
    display: grid;
    gap: 14px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.brand h1,
.page-header h2,
.stat-value,
.hero-price,
.metric-value,
.login-card h1,
.panel-header h3,
.section-title {
    margin: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2af0a7, #55c5ff);
    color: #041018;
    font-weight: 700;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.68rem;
}

.nav-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--ok);
    box-shadow: 0 0 0 6px rgba(65, 220, 148, 0.14);
}

.nav-scroll {
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    min-width: 0;
}

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

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

.nav-label {
    margin: 0;
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.nav-item,
.button,
.ghost-button {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.nav-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 0 10px;
    align-items: center;
    min-width: 0;
}

.nav-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    grid-row: 1 / span 2;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.nav-item-title {
    font-weight: 600;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.nav-item-subtitle {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.nav-item:hover,
.nav-item.active,
.button:hover,
.ghost-button:hover {
    background: rgba(83, 199, 255, 0.11);
    border-color: rgba(83, 199, 255, 0.36);
    transform: translateY(-1px);
}

.nav-item.active {
    box-shadow: inset 0 0 0 1px rgba(83, 199, 255, 0.16);
}

.nav-item.active .nav-icon {
    background: rgba(83, 199, 255, 0.14);
    border-color: rgba(83, 199, 255, 0.32);
}

.sidebar-note {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.logout-form {
    margin: 0;
}

.content {
    min-width: 0;
    padding: 22px;
    width: min(100%, 1480px);
    margin-inline: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 18px;
    min-width: 0;
}

.page-header h2 {
    font-size: 1.6rem;
}

.session-user,
.muted,
.table-note,
.mini-note,
.status-note {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.flash.success {
    border-color: rgba(65, 220, 148, 0.35);
}

.flash.error {
    border-color: rgba(255, 113, 134, 0.45);
}

.flash.info {
    border-color: rgba(83, 199, 255, 0.38);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.panel,
.login-card,
.hero-card,
.mini-card,
.table-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel,
.hero-card,
.table-card {
    padding: 16px;
}

.hero-card {
    background:
        linear-gradient(135deg, rgba(83, 199, 255, 0.12), rgba(41, 226, 161, 0.08)),
        var(--panel-strong);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
}

.hero-grid > *,
.metric-grid > *,
.content-grid > *,
.split-grid > *,
.panel-header > * {
    min-width: 0;
}

.hero-price {
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    overflow-wrap: anywhere;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.pill.ok {
    border-color: rgba(65, 220, 148, 0.4);
    color: #bff2d7;
}

.pill.warn {
    border-color: rgba(255, 207, 104, 0.42);
    color: #ffe6aa;
}

.pill.danger {
    border-color: rgba(255, 113, 134, 0.45);
    color: #ffd0d7;
}

.pill.info {
    border-color: rgba(83, 199, 255, 0.4);
    color: #cceeff;
}

.compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.mini-card {
    padding: 12px;
}

.stat-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    font-size: 1.12rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.stat-subtext {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr);
    gap: 16px;
    margin-bottom: 16px;
}

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

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

.panel-header.tight {
    margin-bottom: 10px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.toolbar.compact {
    margin-bottom: 10px;
}

.filter-form,
.inline-form,
.button-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.button-grid {
    align-items: stretch;
}

.button,
.ghost-button {
    color: var(--text);
    cursor: pointer;
    max-width: 100%;
}

.button {
    min-width: 0;
}

.button.secondary {
    background: rgba(255, 255, 255, 0.02);
}

.button.danger {
    background: rgba(255, 113, 134, 0.1);
    border-color: rgba(255, 113, 134, 0.3);
}

.button.success {
    background: rgba(65, 220, 148, 0.1);
    border-color: rgba(65, 220, 148, 0.32);
}

.button.small,
.ghost-button.small {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.84rem;
}

.ghost-button {
    display: inline-flex;
    justify-content: center;
}

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

.settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
    display: grid;
    gap: 6px;
}

label span {
    color: var(--muted);
    font-size: 0.85rem;
}

input,
select {
    width: 100%;
    max-width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
}

.table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
}

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

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    vertical-align: top;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

th {
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table-card table {
    min-width: 100%;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.metric {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.metric-value {
    font-size: 1.1rem;
    overflow-wrap: anywhere;
}

.metric-label {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.78rem;
}

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

.detail-list,
.timeline {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.detail-list li,
.timeline li {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow-wrap: anywhere;
}

.timeline strong {
    display: block;
    margin-bottom: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.72rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.badge.ok {
    border-color: rgba(65, 220, 148, 0.36);
}

.badge.warn {
    border-color: rgba(255, 207, 104, 0.36);
}

.badge.danger {
    border-color: rgba(255, 113, 134, 0.38);
}

.table-inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.note-banner {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 207, 104, 0.28);
    background: rgba(255, 207, 104, 0.08);
    color: #ffe7af;
    overflow-wrap: anywhere;
}

.log-view {
    margin: 0;
    padding: 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.84rem;
    line-height: 1.45;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
    padding: 28px;
}

.login-card .button {
    width: 100%;
}

@media (max-width: 1400px) {
    .app-shell {
        grid-template-columns: 256px minmax(0, 1fr);
    }

    .content {
        width: 100%;
    }
}

@media (max-width: 1180px) {
    .hero,
    .content-grid,
    .split-grid {
        grid-template-columns: 1fr;
    }

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

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

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

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 20;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 14px 16px;
        gap: 12px;
    }

    .content {
        padding: 16px;
    }

    .sidebar-top {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .nav-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 4px;
        margin: 0 -2px;
        max-width: 100%;
    }

    .nav {
        display: flex;
        gap: 12px;
        min-width: max-content;
    }

    .nav-section {
        display: flex;
        gap: 10px;
        align-items: stretch;
    }

    .nav-label {
        display: none;
    }

    .nav-item {
        min-width: 188px;
        padding: 10px 12px;
    }

    .sidebar-footer {
        gap: 10px;
    }

    .sidebar-note {
        display: none;
    }

    .page-header {
        align-items: start;
        flex-direction: column;
    }

    .session-user {
        font-size: 0.88rem;
    }

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

@media (max-width: 760px) {
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    table {
        min-width: 0;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 10px;
    }

    tr {
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.025);
        padding: 10px;
    }

    td {
        border: 0;
        padding: 7px 0;
        min-height: 26px;
    }

    td::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 0.74rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        margin-bottom: 3px;
    }

    .sidebar-top {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .nav-scroll {
        margin: 0 -2px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
    }

    .nav {
        display: flex;
        gap: 10px;
        min-width: max-content;
    }

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

    .brand {
        gap: 10px;
    }

    .brand h1 {
        font-size: 1rem;
    }

    .nav-item {
        min-width: 112px;
        grid-template-columns: 28px minmax(0, 1fr);
        padding: 8px 10px;
        gap: 0 8px;
    }

    .nav-icon {
        width: 28px;
        height: 28px;
        border-radius: 9px;
    }

    .nav-icon svg {
        width: 14px;
        height: 14px;
    }

    .nav-item-subtitle {
        display: none;
    }

    .nav-item-title {
        font-size: 0.82rem;
    }

    .metric-grid,
    .button-grid {
        grid-template-columns: 1fr;
    }

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

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

    .hero-card,
    .panel,
    .table-card {
        padding: 14px;
    }

    .content {
        padding: 14px;
    }

    .logout-form .button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .sidebar {
        padding: 12px;
    }

    .content {
        padding: 12px;
    }

    .page-header h2 {
        font-size: 1.3rem;
    }

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

    .nav {
        gap: 8px;
    }

    .nav-section {
        gap: 8px;
    }

    .nav-item {
        min-width: 96px;
    }

    .hero-price {
        font-size: 1.45rem;
    }

    .table-inline-actions,
    .filter-form,
    .toolbar,
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .button,
    .ghost-button {
        width: 100%;
    }
}
