:root {
  --bg: #070b12;
  --bg-deep: #05080d;
  --bg-elev: #0d1420;
  --bg-soft: #111b2a;
  --panel: rgba(14, 22, 35, .88);
  --panel-strong: #101b2b;
  --line: rgba(148, 163, 184, .16);
  --line-strong: rgba(148, 163, 184, .27);
  --text: #f5f8fc;
  --muted: #8d9ab0;
  --muted-strong: #bac5d5;
  --accent: #ef476f;
  --accent-2: #ff7b72;
  --blue: #4cc9f0;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 520px at 0% -10%, rgba(76, 201, 240, .13), transparent 58%),
    radial-gradient(780px 460px at 100% 0%, rgba(239, 71, 111, .12), transparent 62%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar {
  background: linear-gradient(180deg, rgba(12, 20, 33, .98), rgba(7, 12, 20, .98));
  border-right: 1px solid var(--line);
  padding: 28px 18px 20px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 10px 30px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(145deg, var(--blue), #3478ff 48%, var(--accent));
  display: grid; place-items: center; font-weight: 900; letter-spacing: -.06em;
  box-shadow: 0 12px 28px rgba(76, 201, 240, .22), inset 0 1px rgba(255,255,255,.35);
}
.brand strong { display: block; font-size: 1.02rem; letter-spacing: -.02em; }
.brand span { display: block; color: var(--muted); font-size: .73rem; margin-top: 3px; }
.nav { display: grid; gap: 5px; }
.nav-group {
  margin: 18px 10px 6px; font-size: .65rem; letter-spacing: .13em;
  text-transform: uppercase; color: #64748b; font-weight: 800;
}
.nav-group:first-child { margin-top: 0; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 12px 13px; border-radius: 12px;
  color: var(--muted); font-size: .9rem; border: 1px solid transparent; transition: .18s ease;
}
.nav a::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #42516a; transition: .18s ease; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav a.active {
  color: #fff; border-color: rgba(76, 201, 240, .24);
  background: linear-gradient(90deg, rgba(76, 201, 240, .14), rgba(239, 71, 111, .08));
  box-shadow: inset 3px 0 var(--blue);
}
.nav a.active::before { background: var(--blue); box-shadow: 0 0 0 4px rgba(76,201,240,.12); }
.sidebar-footer { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; line-height: 1.5; }
.sidebar-footer strong { color: var(--muted-strong); font-weight: 650; }

.content { width: 100%; max-width: 1640px; padding: 34px clamp(22px, 4vw, 58px) 52px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: clamp(1.55rem, 2vw, 2rem); letter-spacing: -.045em; line-height: 1.1; }
.topbar p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.user-chip { display: inline-flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted-strong); font-size: .78rem; background: rgba(255,255,255,.025); }
.user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.12); }

.grid { display: grid; gap: 18px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); }
.card {
  position: relative; overflow: hidden; background: linear-gradient(145deg, rgba(17, 28, 44, .94), rgba(10, 17, 28, .94));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card::after { content: ''; position: absolute; width: 150px; height: 150px; right: -80px; top: -90px; background: rgba(76,201,240,.06); filter: blur(16px); border-radius: 50%; pointer-events: none; }
.card h3 { letter-spacing: -.025em; }
.stat-card { min-height: 142px; }
.stat-card .stat-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--blue); background: rgba(76,201,240,.12); font-weight: 800; font-size: .78rem; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 650; }
.stat-value { font-size: 2.1rem; font-weight: 780; margin-top: 18px; letter-spacing: -.06em; }
.stat-hint { color: var(--muted); font-size: .76rem; margin-top: 4px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 11px; border-bottom: 1px solid rgba(148,163,184,.12); font-size: .88rem; white-space: nowrap; }
th { color: var(--muted); font-weight: 700; font-size: .67rem; text-transform: uppercase; letter-spacing: .1em; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.025); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; padding: 11px 15px; cursor: pointer; background: linear-gradient(135deg, #f05278, #d93662); color: #fff; font-weight: 750; font-size: .86rem; box-shadow: 0 9px 22px rgba(217,54,98,.18); transition: transform .18s ease, filter .18s ease; }
.btn:hover { filter: brightness(1.09); transform: translateY(-1px); }
.btn.secondary { background: rgba(76, 201, 240, .12); color: #bdefff; box-shadow: none; border: 1px solid rgba(76,201,240,.18); }
.btn.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--muted-strong); box-shadow: none; }
.btn.danger { background: rgba(190, 37, 70, .24); color: #ffb0bf; border: 1px solid rgba(251,113,133,.2); box-shadow: none; }
.btn.sm { padding: 8px 10px; font-size: .78rem; }

.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--muted-strong); font-size: .8rem; font-weight: 650; }
input, select, textarea { width: 100%; background: rgba(5, 10, 17, .72); color: var(--text); border: 1px solid var(--line-strong); border-radius: 11px; padding: 12px 13px; transition: .18s ease; }
input::placeholder, textarea::placeholder { color: #56657b; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(76,201,240,.7); box-shadow: 0 0 0 4px rgba(76,201,240,.11); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hint { color: var(--muted); font-size: .82rem; line-height: 1.6; margin: 0 0 14px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }

.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: .7rem; font-weight: 750; letter-spacing: .02em; }
.badge.ok { background: rgba(52,211,153,.13); color: #6ee7b7; }
.badge.warn { background: rgba(251,191,36,.13); color: #fcd34d; }
.badge.danger { background: rgba(251,113,133,.13); color: #fda4af; }
.badge.muted { background: rgba(141,154,176,.13); color: #b4bfd0; }
.flash { margin-bottom: 18px; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line); font-size: .87rem; }
.flash.ok { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.3); color: #a7f3d0; }
.flash.error { background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.3); color: #fecdd3; }

.preview-shell { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: #070b12; }
.preview-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.preview-logo { font-weight: 800; letter-spacing: .02em; }
.preview-pill { padding: 6px 12px; border-radius: 999px; border: 1px solid currentColor; font-size: .72rem; font-weight: 700; }
.preview-body { padding: 18px; min-height: 140px; }
.preview-hero { height: 90px; border-radius: 12px; background: linear-gradient(120deg, rgba(255,255,255,.06), transparent), center/cover no-repeat #151f2e; margin-bottom: 14px; }
.preview-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.preview-card { border: 1px solid #2a3548; border-radius: 10px; padding: 12px; font-size: .75rem; color: var(--muted); }
.preview-card strong { display: block; color: var(--text); margin-bottom: 4px; font-size: .82rem; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 48px; height: 42px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.theme-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(5,10,17,.42); cursor: pointer; transition: .15s ease; }
.theme-card input { display: none; }
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.selected { border-color: var(--theme-accent, var(--accent)); box-shadow: 0 0 0 1px var(--theme-accent, var(--accent)); }
.theme-swatch { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.theme-meta { display: grid; gap: 2px; min-width: 0; }
.theme-meta strong { font-size: .9rem; }
.theme-meta small { color: var(--muted); font-size: .75rem; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after { content: ''; position: absolute; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.login-wrap::before { width: 520px; height: 520px; left: -220px; bottom: -260px; background: rgba(76,201,240,.1); }
.login-wrap::after { width: 470px; height: 470px; right: -180px; top: -220px; background: rgba(239,71,111,.11); }
.login-card { width: min(920px, 100%); display: grid; grid-template-columns: .9fr 1.1fr; background: rgba(13,20,32,.88); border: 1px solid var(--line-strong); border-radius: 24px; overflow: hidden; box-shadow: 0 30px 100px rgba(0,0,0,.45); position: relative; z-index: 1; backdrop-filter: blur(18px); }
.login-side { padding: 42px; background: linear-gradient(155deg, rgba(76,201,240,.14), rgba(239,71,111,.1) 58%, rgba(9,16,26,.2)); border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; min-height: 470px; }
.login-side h2 { margin: 44px 0 12px; font-size: clamp(1.7rem, 3vw, 2.45rem); line-height: 1.04; letter-spacing: -.06em; }
.login-side p { margin: 0; max-width: 260px; color: var(--muted-strong); line-height: 1.65; font-size: .9rem; }
.login-side .brand { padding: 0; }
.login-side .brand span { color: #b5c4d8; }
.login-note { color: var(--muted); font-size: .76rem; }
.login-form { padding: 48px clamp(26px, 5vw, 60px); display: flex; flex-direction: column; justify-content: center; }
.login-form h1 { margin: 0 0 8px; font-size: 1.55rem; letter-spacing: -.04em; }
.login-form > p { margin: 0 0 28px; color: var(--muted); font-size: .88rem; }
.login-form .form-grid { grid-template-columns: 1fr; gap: 18px; }
.login-form .btn { width: 100%; margin-top: 4px; padding: 13px; }

@media (max-width: 1180px) { .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding-bottom: 16px; }
  .nav { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
  .nav-group { display: none; }
  .nav a { white-space: nowrap; padding: 10px 12px; }
  .sidebar-footer { display: none; }
  .content { padding: 28px 22px 42px; }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .content { padding: 24px 15px 34px; }
  .topbar { align-items: flex-start; margin-bottom: 22px; }
  .topbar-meta { display: none; }
  .grid.stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 17px; border-radius: 15px; }
  .stat-card { min-height: 124px; }
  .stat-value { font-size: 1.7rem; margin-top: 15px; }
  .stat-icon { width: 28px; height: 28px; font-size: .68rem; }
  .form-grid { grid-template-columns: 1fr; }
  .preview-cards { grid-template-columns: 1fr; }
  .login-wrap { padding: 14px; }
  .login-card { display: block; border-radius: 19px; }
  .login-side { min-height: 0; padding: 26px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-side h2 { margin-top: 28px; font-size: 1.7rem; }
  .login-note { margin-top: 28px; }
  .login-form { padding: 30px 25px 34px; }
}
