:root {
    --bg: #0f172a;
    --panel: rgba(30, 41, 59, 0.92);
    --panel-strong: #111c31;
    --panel-soft: #1e293b;
    --panel-border: rgba(148, 163, 184, 0.14);
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #facc15;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.4);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 28%),
        radial-gradient(circle at right 10%, rgba(34, 197, 94, 0.12), transparent 22%),
        linear-gradient(160deg, #081120 0%, #0f172a 42%, #10192d 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

button {
    border: 0;
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    background: rgba(15, 23, 42, 0.74);
    border-right: 1px solid rgba(148, 163, 184, 0.08);
    backdrop-filter: blur(18px);
}

.brand-card,
.user-chip,
.metric-card,
.panel,
.auth-card,
.summary-card,
.info-card,
.table-card,
.tab-card,
.stat-card {
    border: 1px solid var(--panel-border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.brand-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: 28px;
}

.brand-card__icon,
.avatar-circle,
.metric-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
}

.brand-card__icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.4));
    color: #dbeafe;
}

.brand-card p,
.eyebrow,
.sidebar-footer,
.muted,
.stat-label,
.table-empty,
.helper-text,
.meta-list,
.auth-copy p,
.topbar-user__meta span {
    color: var(--text-muted);
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0.04));
    transform: translateX(3px);
}

.sidebar-link--ghost {
    margin-top: 14px;
    background: rgba(15, 23, 42, 0.54);
}

.sidebar-footer {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.status-dot--success { background: var(--success); }
.status-dot--warning { background: var(--warning); }
.status-dot--danger { background: var(--danger); }

.app-main {
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.topbar h1,
.auth-copy h1,
.page-title {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.75rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.avatar-circle {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    color: white;
    font-weight: 800;
}

.content {
    display: grid;
    gap: 24px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.flash-success { background: rgba(34, 197, 94, 0.14); }
.flash-error { background: rgba(239, 68, 68, 0.14); }
.flash-info { background: rgba(59, 130, 246, 0.14); }

.grid-cards,
.summary-grid,
.profile-grid,
.dashboard-grid {
    display: grid;
    gap: 18px;
}

.dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-card,
.summary-card,
.info-card,
.table-card,
.tab-card,
.auth-card,
.panel,
.stat-card {
    border-radius: var(--radius-lg);
}

.metric-card {
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.metric-card:hover {
    transform: translateY(-6px);
    border-color: rgba(59, 130, 246, 0.34);
    box-shadow: 0 26px 80px rgba(15, 23, 42, 0.52);
}

.metric-card::after {
    content: '';
    position: absolute;
    inset: auto -40px -40px auto;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
}

.metric-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.metric-card__icon {
    width: 52px;
    height: 52px;
    background: rgba(59, 130, 246, 0.14);
    color: #bfdbfe;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    margin: 18px 0 4px;
}

.metric-label,
.stat-label {
    font-size: 0.95rem;
}

.panel,
.table-card,
.info-card,
.summary-card,
.tab-card,
.stat-card {
    padding: 22px;
}

.panel-head,
.section-head,
.table-toolbar,
.inline-form,
.filter-grid,
.auth-actions,
.profile-tabs,
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.panel-head,
.section-head,
.table-toolbar {
    justify-content: space-between;
}

.button,
.button-secondary,
.button-danger,
.button-ghost,
.button-success,
.button-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: 14px;
    font-weight: 700;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.button:hover,
.button-secondary:hover,
.button-danger:hover,
.button-ghost:hover,
.button-success:hover,
.button-warning:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.button { background: linear-gradient(135deg, var(--accent), #2563eb); color: white; }
.button-secondary { background: rgba(59, 130, 246, 0.12); color: #bfdbfe; }
.button-danger { background: rgba(239, 68, 68, 0.16); color: #fecaca; }
.button-success { background: rgba(34, 197, 94, 0.16); color: #bbf7d0; }
.button-warning { background: rgba(250, 204, 21, 0.16); color: #fde68a; }
.button-ghost { background: rgba(148, 163, 184, 0.12); color: var(--text); }

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    vertical-align: top;
}

th {
    color: #cbd5e1;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-success { background: rgba(34, 197, 94, 0.16); color: #bbf7d0; }
.badge-warning { background: rgba(250, 204, 21, 0.16); color: #fde68a; }
.badge-danger { background: rgba(239, 68, 68, 0.16); color: #fecaca; }
.badge-neutral { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }

.auth-main {
    display: block;
    max-width: 100%;
}

.content-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-layout {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: stretch;
}

.auth-layout--compact {
    width: min(520px, 100%);
    grid-template-columns: 1fr;
}

.auth-copy,
.auth-card {
    padding: 34px;
}

.auth-copy {
    border-radius: 32px;
    background:
        linear-gradient(150deg, rgba(59, 130, 246, 0.18), rgba(15, 23, 42, 0.42)),
        rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.12);
    position: relative;
    overflow: hidden;
}

.auth-copy::after {
    content: '';
    position: absolute;
    width: 240px;
    height: 240px;
    right: -60px;
    bottom: -60px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.24), transparent 70%);
}

.auth-card form,
.form-grid,
.filters-form,
.settings-grid {
    display: grid;
    gap: 14px;
}

.form-grid.two-columns,
.summary-grid,
.profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-text {
    font-size: 0.88rem;
}

.meta-list {
    display: grid;
    gap: 12px;
}

.meta-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.search-results,
.requests-grid,
.stats-line,
.log-preview {
    display: grid;
    gap: 14px;
}

.search-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.46);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.search-card:hover {
    transform: translateY(-3px);
    border-color: rgba(59, 130, 246, 0.35);
}

.search-card__head,
.list-inline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.empty-state {
    padding: 32px;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    border-radius: 22px;
    color: var(--text-muted);
}

.tabs-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

.tab-button.is-active {
    background: rgba(59, 130, 246, 0.18);
    color: white;
}

.tab-pane {
    display: none;
}

.tab-pane.is-active {
    display: block;
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.1);
}

.pagination .is-active {
    background: rgba(59, 130, 246, 0.18);
    color: white;
}

.truncate-cell {
    max-width: 360px;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .sidebar-footer {
        position: static;
        margin-top: 20px;
    }

    .auth-layout,
    .form-grid.two-columns,
    .summary-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-main,
    .sidebar,
    .auth-copy,
    .auth-card,
    .panel,
    .table-card,
    .info-card,
    .summary-card,
    .tab-card,
    .metric-card,
    .stat-card {
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    th,
    td {
        padding: 12px 10px;
    }
}
