:root {
    --bg: #07101d;
    --bg-soft: #0b1525;
    --panel: rgba(15, 27, 45, .88);
    --panel-strong: #101c2f;
    --panel-light: #15243a;
    --border: rgba(148, 163, 184, .15);
    --border-strong: rgba(148, 163, 184, .28);
    --text: #f7f9fc;
    --muted: #8fa2bb;
    --muted-2: #687b93;
    --teal: #4cb9ca;
    --teal-dark: #258da1;
    --purple: #6d5ab7;
    --success: #2dc98a;
    --warning: #f7b955;
    --danger: #f16d7a;
    --info: #5ea6ef;
    --shadow: 0 24px 60px rgba(0, 0, 0, .28);
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar: 264px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 8% 0%, rgba(52, 183, 204, .15), transparent 28rem),
        radial-gradient(circle at 96% 4%, rgba(109, 90, 183, .18), transparent 32rem),
        linear-gradient(145deg, #07101d 0%, #08111e 55%, #090e1b 100%);
}
body::before {
    position: fixed;
    inset: 0;
    pointer-events: none;
    content: "";
    opacity: .18;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }
svg { display: block; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    padding: 18px 14px;
    border-right: 1px solid var(--border);
    background: rgba(6, 14, 26, .9);
    backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
}
.brand {
    height: 76px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 12px;
}
.brand img { width: 174px; height: auto; }
.brand-word {
    font-size: 22px;
    letter-spacing: .11em;
    font-weight: 700;
    background: linear-gradient(90deg, var(--teal), #7e71c8);
    -webkit-background-clip: text;
    color: transparent;
}
.brand-tagline { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav-label {
    margin: 18px 12px 7px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.nav { display: grid; gap: 4px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #9fb0c6;
    transition: .18s ease;
}
.nav-link svg { width: 19px; height: 19px; }
.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.045);
    border-color: rgba(255,255,255,.06);
}
.nav-link.active {
    color: #fff;
    border-color: rgba(80, 191, 207, .2);
    background: linear-gradient(90deg, rgba(62, 177, 195, .17), rgba(109, 90, 183, .12));
    box-shadow: inset 3px 0 0 var(--teal);
}
.nav-badge {
    margin-left: auto;
    padding: 3px 7px;
    font-size: 10px;
    color: var(--teal);
    border: 1px solid rgba(76,185,202,.25);
    background: rgba(76,185,202,.09);
    border-radius: 999px;
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}
.avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    background: linear-gradient(145deg, rgba(76,185,202,.28), rgba(109,90,183,.35));
    border: 1px solid rgba(255,255,255,.12);
}
.user-mini strong { display: block; font-size: 13px; }
.user-mini span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.main { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
    position: sticky;
    z-index: 25;
    top: 0;
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 16, 29, .68);
    backdrop-filter: blur(20px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.topbar-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-toggle { display: none; }

.content {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 28px 30px 54px;
}
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}
.page-head h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.btn {
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    min-height: 40px;
    padding: 9px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    background: rgba(255,255,255,.04);
    transition: .18s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.07); }
.btn-primary {
    border-color: rgba(76,185,202,.35);
    background: linear-gradient(135deg, #278fa4, #5e55aa);
    box-shadow: 0 10px 24px rgba(45, 142, 164, .18);
}
.btn-primary:hover { background: linear-gradient(135deg, #2ba0b7, #6c60bd); }
.btn-danger { color: #ffc8cd; border-color: rgba(241,109,122,.25); background: rgba(241,109,122,.08); }
.btn-success { color: #a5f1d2; border-color: rgba(45,201,138,.25); background: rgba(45,201,138,.09); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 11px; }
.link-danger { color: #ff9da7; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 144px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(18,32,52,.88), rgba(12,23,39,.84));
    box-shadow: 0 18px 42px rgba(0,0,0,.14);
}
.stat-card::after {
    content: "";
    position: absolute;
    width: 110px;
    height: 110px;
    right: -42px;
    top: -45px;
    border-radius: 50%;
    background: var(--glow, rgba(76,185,202,.12));
    filter: blur(4px);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 13px;
    color: var(--accent, var(--teal));
    background: color-mix(in srgb, var(--accent, var(--teal)) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent, var(--teal)) 24%, transparent);
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-value { margin-top: 18px; font-size: 30px; font-weight: 800; letter-spacing: -.05em; }
.stat-note { margin-top: 6px; color: var(--muted); font-size: 11px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 18px; }
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 18px 48px rgba(0,0,0,.12);
    backdrop-filter: blur(18px);
}
.card-header {
    min-height: 65px;
    padding: 16px 19px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.card-body { padding: 19px; }
.card-body.flush { padding: 0; }

.table-wrap { width: 100%; overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
.table th {
    padding: 12px 15px;
    text-align: left;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    background: rgba(255,255,255,.015);
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 14px 15px;
    border-bottom: 1px solid rgba(148,163,184,.095);
    vertical-align: middle;
    font-size: 13px;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255,255,255,.022); }
.cell-title { font-weight: 750; color: #eef4fc; }
.cell-subtitle { margin-top: 4px; color: var(--muted); font-size: 11px; }
.cell-actions { display: flex; justify-content: flex-end; gap: 7px; }
.code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    color: #cde9ef;
    word-break: break-all;
}
.copy-group { display: flex; align-items: center; gap: 8px; }
.copy-button { color: var(--muted); border: 0; background: transparent; cursor: pointer; padding: 4px; }
.copy-button:hover { color: #fff; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 25px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: #c4d0df;
    background: rgba(255,255,255,.04);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { color: #74e3b4; border-color: rgba(45,201,138,.2); background: rgba(45,201,138,.07); }
.badge-danger { color: #ff929d; border-color: rgba(241,109,122,.2); background: rgba(241,109,122,.07); }
.badge-warning { color: #f7c86e; border-color: rgba(247,185,85,.2); background: rgba(247,185,85,.07); }
.badge-info { color: #82bdf7; border-color: rgba(94,166,239,.2); background: rgba(94,166,239,.07); }
.badge-muted { color: #9aaac0; }

.filters {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.search-box { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--muted); }
.search-box .input { padding-left: 39px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-section + .form-section { margin-top: 22px; }
.form-section-title { margin: 0 0 13px; font-size: 14px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.label { color: #cbd6e4; font-size: 12px; font-weight: 750; }
.label-hint { color: var(--muted); font-weight: 500; }
.input, .select, .textarea {
    width: 100%;
    min-height: 43px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    padding: 10px 12px;
    color: var(--text);
    background: rgba(5,13,24,.72);
    outline: none;
    transition: .15s ease;
}
.textarea { min-height: 118px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
    border-color: rgba(76,185,202,.65);
    box-shadow: 0 0 0 3px rgba(76,185,202,.09);
}
.input::placeholder, .textarea::placeholder { color: #53657b; }
.select { appearance: auto; }
.field-error { color: #ff9da7; font-size: 11px; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.5; }
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #cbd6e4;
    font-size: 12px;
}
.checkbox input { width: 17px; height: 17px; accent-color: var(--teal); }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 18px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    margin-bottom: 18px;
    border-radius: 13px;
    border: 1px solid var(--border);
    font-size: 13px;
}
.alert svg { flex: 0 0 auto; width: 18px; margin-top: 1px; }
.alert-success { color: #b7f4d9; border-color: rgba(45,201,138,.25); background: rgba(45,201,138,.08); }
.alert-error { color: #ffd0d5; border-color: rgba(241,109,122,.25); background: rgba(241,109,122,.08); }
.alert ul { margin: 7px 0 0; padding-left: 18px; }

.empty {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 260px;
    padding: 35px;
}
.empty-icon {
    width: 58px; height: 58px;
    display: grid; place-items: center;
    margin-bottom: 14px;
    border-radius: 18px;
    color: var(--teal);
    background: rgba(76,185,202,.08);
    border: 1px solid rgba(76,185,202,.2);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty h3 { margin: 0; font-size: 16px; }
.empty p { max-width: 430px; margin: 8px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.detail {
    padding: 14px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.022);
    border-radius: 12px;
}
.detail-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.detail-value { margin-top: 7px; font-size: 13px; font-weight: 700; }

.activity-list { display: grid; }
.activity-item {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 11px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: 0; }
.activity-dot {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 10px;
    color: var(--teal);
    background: rgba(76,185,202,.07);
    border: 1px solid rgba(76,185,202,.15);
}
.activity-dot svg { width: 14px; height: 14px; }
.activity-text { font-size: 12px; line-height: 1.45; color: #d9e3ee; }
.activity-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }

.progress {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
}
.progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--purple));
}
.mono-box {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #07101d;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    color: #bcdbe1;
    line-height: 1.65;
    overflow: auto;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 18px;
    border-top: 1px solid var(--border);
}
.pagination-info { color: var(--muted); font-size: 11px; }
.pagination-links { display: flex; align-items: center; gap: 5px; }
.page-link {
    min-width: 34px; height: 34px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--muted);
    font-size: 11px;
}
.page-link:hover { color: #fff; border-color: var(--border-strong); }
.page-link.active { color: #fff; border-color: rgba(76,185,202,.35); background: rgba(76,185,202,.12); }
.page-link.disabled { pointer-events: none; opacity: .35; }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, .8fr) minmax(520px, 1.2fr);
}
.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 45px;
    background: rgba(6,14,26,.88);
}
.auth-box { width: min(440px, 100%); }
.auth-brand { margin-bottom: 44px; }
.auth-brand img { width: 190px; }
.auth-eyebrow { color: var(--teal); font-size: 10px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.auth-box h1 { margin: 10px 0 8px; font-size: 31px; letter-spacing: -.05em; }
.auth-lead { margin: 0 0 27px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.auth-fields { display: grid; gap: 15px; }
.auth-submit { width: 100%; margin-top: 4px; min-height: 46px; }
.auth-footer { margin-top: 25px; color: var(--muted-2); font-size: 10px; text-align: center; }
.auth-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 52px;
    background-image:
        linear-gradient(to top, rgba(5,10,19,.9), rgba(5,10,19,.05) 70%),
        url('/assets/fidder-hero.jpg');
    background-position: center;
    background-size: cover;
}
.auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(76,185,202,.05), rgba(109,90,183,.12));
}
.visual-copy { position: relative; z-index: 1; max-width: 600px; }
.visual-copy h2 { margin: 0; max-width: 580px; font-size: 35px; letter-spacing: -.05em; line-height: 1.13; }
.visual-copy p { max-width: 520px; margin: 13px 0 0; color: #b6c3d2; font-size: 13px; line-height: 1.7; }
.visual-features { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }
.visual-chip { padding: 8px 11px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; background: rgba(0,0,0,.18); backdrop-filter: blur(12px); font-size: 10px; color: #d9e4ed; }

.overlay { display: none; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    :root { --sidebar: 250px; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; }
    .mobile-toggle { display: inline-flex; }
    .overlay {
        position: fixed; z-index: 35; inset: 0;
        background: rgba(0,0,0,.55);
        backdrop-filter: blur(4px);
    }
    body.sidebar-open .overlay { display: block; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}
@media (max-width: 680px) {
    .content { padding: 20px 16px 40px; }
    .topbar { height: 68px; padding: 0 16px; }
    .topbar h1 { font-size: 17px; }
    .topbar-subtitle { display: none; }
    .topbar-right .user-mini { display: none; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .stats-grid, .grid-2, .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 130px; }
    .field.full { grid-column: auto; }
    .auth-form-side { padding: 30px 19px; }
    .pagination { align-items: flex-start; flex-direction: column; }
}
