/* ============================================================
   TryVue Admin Console — Enterprise Design System
   ============================================================ */
:root {
  --bg: #0a0b0f;
  --bg-elev: #12141b;
  --bg-elev-2: #171a23;
  --surface: #1b1f2a;
  --surface-hover: #222735;
  --border: #262b38;
  --border-soft: #1e2330;
  --text: #e8eaf0;
  --text-dim: #9aa1b3;
  --text-faint: #626a7e;
  --brand: #6d5efc;
  --brand-2: #8b7bff;
  --brand-glow: rgba(109, 94, 252, 0.35);
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --pink: #f472b6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, 0.75);
  --sidebar-w: 258px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(109, 94, 252, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.07), transparent 55%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #384152; }

/* ---------- Boot ---------- */
.boot {
  height: 100vh; display: flex; flex-direction: column; gap: 22px;
  align-items: center; justify-content: center;
}
.boot__logo {
  font-weight: 800; font-size: 26px; letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--brand-2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.boot__spinner, .spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.12); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login__card {
  width: 100%; max-width: 400px;
  background: linear-gradient(180deg, rgba(27,31,42,.9), rgba(18,20,27,.9));
  border: 1px solid var(--border);
  border-radius: 20px; padding: 38px 34px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  animation: fadeIn .4s ease;
}
.login__brand {
  display: flex; align-items: center; gap: 11px; margin-bottom: 6px;
}
.login__mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--cyan));
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 8px 26px -8px var(--brand-glow);
}
.login__title { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.login__sub { color: var(--text-dim); margin: 14px 0 26px; font-size: 13.5px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 7px; letter-spacing: .2px;
}
.input, .select, textarea.input {
  width: 100%; background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 14px; transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
textarea.input { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa1b3' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: #333a4a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px -10px var(--brand-glow);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { color: var(--red); border-color: rgba(248,113,113,.25); }
.btn--danger:hover { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface); }
.btn--sm { padding: 6px 11px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--full-login { width: 100%; padding: 12px; margin-top: 6px; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px;
}
.sidebar__mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--cyan));
  display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 6px 18px -6px var(--brand-glow);
}
.sidebar__name { font-weight: 800; font-size: 16px; letter-spacing: -.3px; }
.sidebar__tag { font-size: 10px; color: var(--text-faint); font-weight: 600; letter-spacing: .8px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav__group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--text-faint); font-weight: 700; padding: 16px 10px 7px; }
.nav__item {
  display: flex; align-items: center; gap: 11px; padding: 9.5px 11px;
  border-radius: 10px; color: var(--text-dim); font-weight: 500; font-size: 13.5px;
  transition: all .13s; border: 1px solid transparent;
}
.nav__item:hover { background: var(--surface); color: var(--text); }
.nav__item.active {
  background: linear-gradient(90deg, rgba(109,94,252,.16), rgba(109,94,252,.04));
  color: #fff; border-color: rgba(109,94,252,.25);
}
.nav__item.active .nav__icon { color: var(--brand-2); }
.nav__icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav__badge { margin-left: auto; font-size: 11px; background: var(--surface); padding: 1px 7px; border-radius: 20px; color: var(--text-dim); }

.sidebar__foot { border-top: 1px solid var(--border-soft); padding-top: 14px; margin-top: 8px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.userchip__av { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--pink), var(--brand)); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.userchip__meta { min-width: 0; }
.userchip__email { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.userchip__role { font-size: 10.5px; color: var(--text-faint); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 30px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 20;
  background: rgba(10,11,15,.72); backdrop-filter: blur(14px);
}
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.topbar__crumb { color: var(--text-faint); font-size: 12.5px; }
.topbar__spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.content { padding: 26px 30px 60px; animation: fadeIn .3s ease; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1150px) { .grid--4 { grid-template-columns: repeat(2, 1fr); } .grid--3 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid--4, .grid--2 { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.card__title { font-size: 15px; font-weight: 700; }
.card__body { padding: 20px; }

/* Stat card */
.stat { padding: 20px; position: relative; overflow: hidden; }
.stat__icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 14px; background: rgba(109,94,252,.14); color: var(--brand-2);
}
.stat__icon.c-green { background: rgba(52,211,153,.14); color: var(--green); }
.stat__icon.c-cyan { background: rgba(34,211,238,.14); color: var(--cyan); }
.stat__icon.c-amber { background: rgba(251,191,36,.14); color: var(--amber); }
.stat__icon.c-pink { background: rgba(244,114,182,.14); color: var(--pink); }
.stat__label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.stat__value { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__meta { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.stat__meta b.up { color: var(--green); }
.stat__meta b.down { color: var(--red); }

/* ---------- Table ---------- */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-faint); font-weight: 700; padding: 12px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.02); }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; border: 1px solid transparent; white-space: nowrap;
}
.badge--green { color: var(--green); background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.2); }
.badge--amber { color: var(--amber); background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.2); }
.badge--red { color: var(--red); background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.2); }
.badge--gray { color: var(--text-dim); background: var(--surface); border-color: var(--border); }
.badge--brand { color: var(--brand-2); background: rgba(109,94,252,.12); border-color: rgba(109,94,252,.2); }
.badge--cyan { color: var(--cyan); background: rgba(34,211,238,.12); border-color: rgba(34,211,238,.2); }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 340px; }
.search .input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.page-desc { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: 220px; }
.chart-bars { display: flex; align-items: flex-end; gap: 5px; height: 180px; padding-top: 10px; }
.chart-bar { flex: 1; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 5px 5px 0 0; min-height: 3px; transition: opacity .15s; position: relative; }
.chart-bar:hover { opacity: .8; }
.chart-x { display: flex; gap: 5px; margin-top: 8px; }
.chart-x span { flex: 1; text-align: center; font-size: 10px; color: var(--text-faint); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,6,10,.7); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 100; padding: 20px; animation: fadeIn .18s ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); animation: fadeIn .22s ease;
}
.modal--wide { max-width: 720px; }
.modal__head { display: flex; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--bg-elev-2); z-index: 2; }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__close { margin-left: auto; background: transparent; border: none; color: var(--text-dim); font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal__close:hover { background: var(--surface); color: var(--text); }
.modal__body { padding: 24px; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--border-soft); position: sticky; bottom: 0; background: var(--bg-elev-2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Toggle ---------- */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { display: none; }
.switch__track { position: absolute; inset: 0; background: var(--border); border-radius: 20px; transition: .18s; }
.switch__track::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .18s; }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.switch-row:last-child { border-bottom: none; }
.switch-row__label { font-size: 13.5px; font-weight: 500; }
.switch-row__desc { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty__icon { font-size: 38px; margin-bottom: 12px; opacity: .5; }
.loading-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 50px; color: var(--text-dim); }
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-elev-2); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 11px; padding: 13px 18px; box-shadow: var(--shadow-lg); min-width: 260px; animation: fadeIn .2s ease; font-size: 13.5px; }
.toast--ok { border-left-color: var(--green); }
.toast--err { border-left-color: var(--red); }
.muted { color: var(--text-dim); }
.mt-20 { margin-top: 20px; }
.mono { font-family: var(--mono); }
.sep { height: 1px; background: var(--border-soft); margin: 18px 0; }
.err-banner { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); color: var(--red); padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-dim); font-weight: 500; }
.kv dd { font-weight: 500; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.tab:hover { color: var(--text); }
