/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: #0f172a; background: #f1f5f9;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: #0ea5e9; text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }

/* ─── Auth split layout ─── */
.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-shell-solo { grid-template-columns: 1fr; }
.auth-aside {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #8b5cf6 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center;
  padding: 48px 56px; position: relative; overflow: hidden;
}
.auth-aside::before, .auth-aside::after {
  content: ""; position: absolute; border-radius: 50%; opacity: .25;
  background: radial-gradient(circle, #fff, transparent 70%);
}
.auth-aside::before { width: 360px; height: 360px; top: -120px; right: -120px; }
.auth-aside::after  { width: 280px; height: 280px; bottom: -100px; left: -90px; }
.auth-aside .brand {
  position: relative; z-index: 1; font-size: 28px; font-weight: 700;
  letter-spacing: -0.5px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.auth-aside .brand-mark {
  width: 40px; height: 40px; background: rgba(255,255,255,.2); border-radius: 10px;
  display: grid; place-items: center; font-size: 22px;
}
.auth-aside h1 {
  position: relative; z-index: 1; font-size: 36px; line-height: 1.15;
  margin: 0 0 14px; font-weight: 700; letter-spacing: -0.5px;
}
.auth-aside p { position: relative; z-index: 1; font-size: 16px; opacity: .92; max-width: 420px; margin: 0 0 22px; }
.auth-aside .aside-features-label {
  position: relative; z-index: 1; text-transform: uppercase;
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px;
  opacity: .8; margin: 0 0 10px;
}
.auth-aside ul { position: relative; z-index: 1; list-style: none; padding: 0; margin: 0; max-width: 460px; }
.auth-aside ul li { padding: 8px 0; display: flex; align-items: center; gap: 10px; opacity: .94; }
.auth-aside ul li::before { content: "✓"; width: 22px; height: 22px; background: rgba(255,255,255,.25); border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.auth-aside .aside-link { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; margin-top: 26px; padding: 10px 18px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); border-radius: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; letter-spacing: .2px; transition: background .15s, transform .15s; }
.auth-aside .aside-link:hover { background: rgba(255,255,255,.22); transform: translateY(-1px); }

.auth-main {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 32px; background: #fff; min-height: 100vh;
}
.auth-card {
  width: 100%; max-width: 420px;
}
.auth-card h2 { font-size: 26px; margin: 0 0 6px; font-weight: 700; color: #0f172a; }
.auth-card .auth-sub { color: #64748b; margin: 0 0 28px; font-size: 14px; }
.auth-foot { text-align: center; color: #64748b; margin-top: 22px; font-size: 14px; }
.auth-foot a { font-weight: 600; }

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  /* Form-first on mobile: auth card appears above the fold so the user can
     sign in without scrolling, and the branding aside sits below as reference. */
  .auth-main  { order: 1; min-height: auto; padding: 30px 22px 40px; }
  .auth-aside { order: 2; padding: 36px 28px 40px; min-height: auto; }
  .auth-aside h1 { font-size: 24px; }
  .auth-aside ul { display: block; }
}

/* ─── Forms ─── */
.field { display: block; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.field .hint { color: #94a3b8; font-size: 12px; margin-top: 4px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid #cbd5e1; background: #fff; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}
.textarea { resize: vertical; min-height: 90px; }
.input.with-action { padding-right: 44px; }
.input-wrap { position: relative; }
.input-action {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 6px 8px; color: #64748b; cursor: pointer;
  font-size: 13px; border-radius: 6px;
}
.input-action:hover { background: #f1f5f9; color: #0f172a; }

/* Floating labels for auth pages (login / register / OTP / captcha row).
   The label sits centered inside the field by default and animates up onto the
   top border on focus or when the field has value. Requires: input placeholder
   set to a single space so :placeholder-shown accurately reflects empty state. */
.field-float { position: relative; margin-bottom: 16px; }
.field-float > .input { padding: 16px 12px 8px 12px; }
.field-float > .input.with-action { padding-right: 44px; }
.field-float > label {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  background: #fff; padding: 0 6px; color: #94a3b8;
  font-size: 14px; font-weight: 500;
  pointer-events: none; transition: top .18s ease, font-size .18s ease, color .18s ease, font-weight .18s ease;
  margin: 0;
}
.field-float > .input:focus ~ label,
.field-float > .input:not(:placeholder-shown) ~ label,
.field-float > input:focus ~ label,
.field-float > input:not(:placeholder-shown) ~ label {
  top: 0; font-size: 12px; color: #0369a1; font-weight: 600;
}
.field-float > .hint { color: #94a3b8; font-size: 12px; margin-top: 4px; }
/* Captcha input keeps its border on the parent row, so undo the input's own
   border/background here and let the floating label ride on top. */
.captcha-row .field-float > input {
  border: 0; background: transparent; outline: none; width: 100%;
  padding: 16px 12px 8px 12px; font-size: 14px; font-family: inherit;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .08s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease, opacity .15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: #fff; border-color: rgba(99,102,241,.4);
  box-shadow:
    0 1px 0 rgba(255,255,255,.25) inset,
    0 1px 2px rgba(15,23,42,.06),
    0 8px 18px -10px rgba(99,102,241,.55);
}
.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255,255,255,.25) inset,
    0 2px 4px rgba(15,23,42,.08),
    0 12px 26px -10px rgba(99,102,241,.65);
}
.btn-block { width: 100%; }
.btn-secondary {
  background: #fff; color: #334155; border-color: #e2e8f0;
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 1px 2px rgba(15,23,42,.04);
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; border-color: rgba(220,38,38,.45); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 8px 18px -10px rgba(220,38,38,.55); }
.btn-danger:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ─── Captcha ─── */
.captcha-row {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid #cbd5e1; background: #fff; border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.captcha-row > *:last-child { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.captcha-row:focus-within { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
.captcha-row > input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.captcha-code {
  display: flex; align-items: center; padding: 0 16px;
  background: linear-gradient(135deg, rgba(16,185,129,.14) 0%, rgba(16,185,129,.05) 100%);
  border-left: 1px solid #cbd5e1;
  font-family: "Courier New", monospace; font-size: 20px; font-weight: 800;
  letter-spacing: 6px; color: #047857; user-select: none;
}
.captcha-reload {
  display: grid; place-items: center; width: 40px; background: transparent;
  border: 0; border-left: 1px solid #cbd5e1; color: #64748b; cursor: pointer;
  transition: color .2s, background .2s;
}
.captcha-reload:hover { color: #047857; background: rgba(16,185,129,.08); }
.captcha-reload svg { transition: transform .3s; }
.captcha-reload:hover svg { transform: rotate(180deg); }

/* ─── Alerts ─── */
.alert { border-radius: 8px; padding: 12px 14px; margin: 0 0 16px; font-size: 14px; line-height: 1.5; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ─── OTP boxes ─── */
.otp-row { display: flex; gap: 10px; justify-content: center; margin: 18px 0 6px; }
.otp-row input {
  width: 48px; height: 56px; text-align: center; font-size: 24px; font-weight: 700;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
}
.otp-row input:focus { outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
@media (max-width: 420px) {
  .otp-row { gap: 6px; }
  .otp-row input { width: 42px; height: 52px; font-size: 22px; }
}

/* ─── Help icon + tooltip ─── */
.help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: #cbd5e1; color: #fff;
  font: 700 italic 11px/1 "Times New Roman", serif;
  margin-left: 6px; cursor: help; vertical-align: middle;
  position: relative; user-select: none; transition: background .15s;
}
.help-icon::before { content: "i"; }
.help-icon:hover, .help-icon:focus { background: #0ea5e9; outline: none; }
.help-tooltip {
  visibility: hidden; opacity: 0;
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translateX(-50%);
  background: #0f172a; color: #fff;
  padding: 10px 14px; border-radius: 8px;
  font: 400 12px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-style: normal; letter-spacing: 0;
  width: 280px; max-width: 90vw; white-space: normal; text-align: left;
  z-index: 100; pointer-events: none;
  transition: opacity .15s, visibility .15s;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.help-tooltip code {
  background: rgba(255,255,255,.16); padding: 1px 5px; border-radius: 3px;
  font-family: "SF Mono","Courier New",monospace; font-size: 11px;
}
.help-tooltip::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #0f172a;
}
.help-icon:hover .help-tooltip, .help-icon:focus .help-tooltip {
  visibility: visible; opacity: 1;
}
@media (max-width: 540px) { .help-tooltip { width: 220px; } }

/* ─── IPTV Settings sticky save bar ─── */
.iptv-savebar {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  margin: 14px -14px -14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-top: 1px solid #e6eaf0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, .15);
}
.iptv-savebar .btn-primary { padding: 11px 22px; font-size: 14.5px; }
@media (max-width: 760px) {
  .iptv-savebar { margin: 14px 0 0; border-radius: 12px; padding: 12px 14px; box-shadow: 0 -6px 18px -10px rgba(15,23,42,.18); }
}
@media (max-width: 480px) {
  .iptv-savebar .btn { flex: 1 1 auto; }
}

/* ─── Tabs (segmented control on a track) ─── */
.tabs-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px; margin-bottom: 18px;
  background: #eef2f7;
  border: 1px solid #d8dfe8; border-radius: 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset;
}
.tab-btn {
  position: relative; padding: 9px 14px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: #475569; white-space: nowrap;
  background: #fff; border: 1px solid #d8dfe8;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 1px 1px rgba(15,23,42,.03);
  transition: color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px; border-radius: 9px;
}
.tab-btn:hover {
  color: #0f172a; background: #f8fafc; border-color: #cbd5e1;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 2px 4px rgba(15,23,42,.05);
}
.tab-btn:active { transform: scale(.98); }
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  border-color: rgba(99,102,241,.6);
  box-shadow:
    0 1px 0 rgba(255,255,255,.25) inset,
    0 2px 4px rgba(15,23,42,.08),
    0 8px 18px -8px rgba(99,102,241,.55);
}
.tab-btn.active:hover { color: #fff; filter: brightness(1.04); }
.tab-btn.active::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.25);
  flex-shrink: 0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: tabFade .18s ease; }
@keyframes tabFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Advance Setting dropdown ── */
.tabs-nav-wrap { position: relative; margin-bottom: 18px; }
.tabs-nav-wrap > .tabs-nav { margin-bottom: 0; }
.tab-dropdown-trigger .tab-dropdown-caret {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; margin-left: 2px; font-size: 11px;
  border-radius: 5px; background: rgba(15,23,42,.05); color: inherit;
  transition: transform .22s cubic-bezier(.16,1,.3,1), background .15s;
}
.tab-dropdown-trigger.active .tab-dropdown-caret { background: rgba(255,255,255,.22); }
.tab-dropdown-trigger[aria-expanded="true"] .tab-dropdown-caret { transform: rotate(180deg); }
.tab-dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px;
  padding: 6px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.7) inset,
    0 1px 2px rgba(15,23,42,.05),
    0 16px 32px -10px rgba(15,23,42,.18);
  z-index: 30;
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top left;
  pointer-events: none;
  transition: opacity .15s ease, transform .2s cubic-bezier(.16,1,.3,1);
}
.tab-dropdown-menu.open {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}
.tab-dropdown-item {
  display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; border: 1px solid transparent;
  background: transparent; cursor: pointer; text-align: left;
  font-size: 13.5px; font-weight: 500; color: #334155; font-family: inherit;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab-dropdown-item .ico { font-size: 15px; text-align: center; }
.tab-dropdown-item:hover { background: #f1f5f9; color: #0f172a; }
.tab-dropdown-item.active {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: #fff; border-color: rgba(99,102,241,.5);
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 12px -6px rgba(99,102,241,.5);
}

@media (max-width: 540px) {
  .tab-dropdown-menu { min-width: 220px; left: 6px !important; right: 6px; max-width: calc(100vw - 28px); }
}

@media (max-width: 720px) {
  .tabs-nav {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 8px; scrollbar-color: #6366f1 #e2e8f0; scrollbar-width: thin;
  }
  .tabs-nav::-webkit-scrollbar { height: 5px; display: block; }
  .tabs-nav::-webkit-scrollbar-track {
    background: #e2e8f0; border-radius: 999px; margin: 0 6px;
  }
  .tabs-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #0ea5e9, #6366f1); border-radius: 999px;
  }
  .tab-btn { padding: 8px 12px; font-size: 13px; flex: 0 0 auto; justify-content: center; }
  .tab-btn span:first-child { font-size: 14px; }
}
@media (max-width: 480px) {
  .tabs-nav { gap: 4px; padding: 4px; }
  .tab-btn {
    padding: 8px 10px; font-size: 12px; border: 1px solid #e2e8f0;
    border-radius: 999px; margin: 0; background: #fff;
  }
  .tab-btn.active {
    background: linear-gradient(135deg,#0ea5e9,#6366f1);
    color: #fff; border-color: transparent;
  }
  .tab-btn.active:hover { color: #fff; }
  .tab-btn.active::before { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.2); }
}

/* ─── Toggle switch ─── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 12px;
  transition: background-color .2s;
}
.toggle-switch .slider:before {
  content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s;
}
.toggle-switch input:checked + .slider { background: #0ea5e9; }
.toggle-switch input:focus + .slider { box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }

/* ─── Code block ─── */
.code-block {
  background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 8px;
  font-family: "SF Mono", "Courier New", monospace; font-size: 13px;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.6;
  border: 1px solid #1e293b;
}

/* ─── App shell (after login) ─── */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ─── 2026-09-08 LIGHT SIDEBAR (matches Account & Security aesthetic) ───
   Same palette + language as the rest of the app: white/slate, refined typography,
   subtle borders, active state = 2px left rail + slight background tint.
   Inspired by GitHub, Stripe, and Notion admin sidebars.
*/
.sidebar {
  background: #ffffff;
  color: #475569;
  padding: 18px 0 28px;
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  border-right: 1px solid #e2e8f0;
}

/* Brand row */
.sidebar .brand {
  padding: 4px 20px 18px;
  font-weight: 700; color: #0f172a;
  font-size: 15px; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.sidebar nav { padding: 14px 12px 4px; display: flex; flex-direction: column; gap: 3px; }

/* ── Nav link — visible pill by default, tinted on hover/active ── */
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 7px;
  color: #475569; font-size: 13.5px; font-weight: 500;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.sidebar nav a > span:first-child {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; font-size: 14px;
  flex-shrink: 0;
}
.sidebar nav a::before {
  content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px;
  width: 2px; border-radius: 0 2px 2px 0;
  background: transparent; transition: background .12s ease;
}
.sidebar nav a:hover {
  background: #eef2f7;
  border-color: #e2e8f0;
  color: #0f172a; text-decoration: none;
}
.sidebar nav a.active {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a; font-weight: 600;
}
.sidebar nav a.active::before { background: #0f172a; }
.sidebar nav a.locked { opacity: .5; }
.sidebar nav a.locked:hover { background: transparent; cursor: not-allowed; color: #475569; }
.sidebar nav a.locked .lock { margin-left: auto; opacity: .8; font-size: 12px; }

/* ── Section divider label ── */
.sidebar nav .nav-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  color: #94a3b8; padding: 20px 14px 6px 14px;
  font-weight: 600;
}
.sidebar nav .nav-title::before { display: none; }

/* ── Collapsible dropdown (IPTV list etc.) ── */
.sidebar nav .nav-dropdown { margin: 0; padding: 0; }
.sidebar nav .nav-dropdown > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; margin: 0; border-radius: 7px;
  background: #f8fafc; border: 1px solid #eef2f7;
  color: #475569; font-size: 13.5px; font-weight: 600;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.sidebar nav .nav-dropdown > summary::-webkit-details-marker { display: none; }
.sidebar nav .nav-dropdown > summary::before { display: none; }
.sidebar nav .nav-dropdown > summary:hover {
  background: #eef2f7;
  border-color: #e2e8f0;
  color: #0f172a;
}
.sidebar nav .nav-dropdown-caret {
  display: inline-block; width: 12px; height: 12px;
  font-size: 10px; line-height: 12px; text-align: center; color: #94a3b8;
  background: none; border-radius: 0;
  transition: transform .18s cubic-bezier(.16,1,.3,1);
}
.sidebar nav .nav-dropdown > summary:hover .nav-dropdown-caret { color: #475569; background: none; }
.sidebar nav .nav-dropdown[open] > summary .nav-dropdown-caret { transform: rotate(180deg); }
.sidebar nav .nav-dropdown-items {
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 0 6px 8px; margin: 2px 0 0 10px;
  border-left: 1px solid #e2e8f0;
  animation: navDrop .18s cubic-bezier(.16,1,.3,1);
}
.sidebar nav .nav-dropdown-items a { padding: 7px 10px; font-size: 12.5px; }
.sidebar nav .nav-dropdown-items a::before { left: -8px; }
@keyframes navDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sidebar nav .nav-dropdown-sm { font-size: 11.5px; text-transform: none; letter-spacing: 0; }

/* Auto reminder ON/OFF badge in sidebar */
.nav-title-row { display: flex; align-items: center; justify-content: space-between; padding-right: 14px; }
.nav-ar-badge {
  display: none; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700;
  letter-spacing: 0; text-transform: none; flex-shrink: 0; line-height: 1.5;
  cursor: pointer; border: none; outline: none; transition: filter .15s, transform .1s;
}
.nav-ar-badge:hover { filter: brightness(.92); transform: scale(1.06); }
.nav-ar-badge:active { transform: scale(.97); }
.nav-ar-badge.on  { display: inline-flex; background: #dcfce7; color: #15803d; }
.nav-ar-badge.on::before  { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
.nav-ar-badge.off { display: inline-flex; background: #fee2e2; color: #b91c1c; }
.nav-ar-badge.off::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #ef4444; flex-shrink: 0; }

/* Subtle scrollbar for the sidebar */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

.app-main { background: #f1f5f9; min-height: 100vh; min-width: 0; overflow-x: hidden; }
.topbar { background: #fff; padding: 14px 28px; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 18px; font-weight: 700; color: #0f172a; margin: 0; flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
/* ─── Upgrade CTA (topbar) ─── */
.topbar .upgrade-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px 7px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 50%, #f59e0b 100%);
  color: #422006; font-weight: 700; font-size: 13px; letter-spacing: .1px;
  text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(180, 83, 9, .25);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .55) inset,
    0 -1px 0 rgba(180, 83, 9, .08) inset,
    0 1px 2px rgba(180, 83, 9, .12),
    0 6px 14px -8px rgba(217, 119, 6, .55);
  transition: transform .15s ease, box-shadow .18s ease, filter .18s ease;
}
.topbar .upgrade-btn:hover {
  text-decoration: none; transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .55) inset,
    0 -1px 0 rgba(180, 83, 9, .08) inset,
    0 2px 4px rgba(180, 83, 9, .14),
    0 10px 22px -10px rgba(217, 119, 6, .7);
}
.topbar .upgrade-btn:active { transform: translateY(0); }
.topbar .upgrade-btn.is-active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}
.topbar .upgrade-btn-ico {
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(255, 255, 255, .55);
  color: #b45309;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset;
}
.topbar .upgrade-btn.is-active .upgrade-btn-ico { background: rgba(255,255,255,.22); color: #fff; }

/* ─── User chip + dropdown ─── */
.topbar .user-chip-wrap { position: relative; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px;
  background: #f8fafc; border: 1px solid #e7ecf3; border-radius: 999px;
  cursor: pointer; font: inherit; color: inherit; text-align: left;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.topbar .user-chip:hover {
  background: #fff; border-color: #cbd5e1;
  box-shadow: 0 1px 0 #fff inset, 0 4px 12px -6px rgba(15,23,42,.18);
}
.topbar .user-chip-wrap.open .user-chip {
  background: #fff; border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(99,102,241,.10), 0 6px 16px -8px rgba(15,23,42,.22);
}
.topbar .user-chip .avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg,#0ea5e9,#6366f1);
  color: #fff; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 4px 10px -4px rgba(99,102,241,.55);
}
.topbar .user-chip .meta { font-size: 13px; line-height: 1.2; }
.topbar .user-chip .meta strong { display: block; color: #0f172a; }
.topbar .user-chip .meta span { color: #64748b; font-size: 11.5px; }
.topbar .user-chip-caret {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 7px; background: #f1f5f9; color: #475569;
  transition: transform .22s cubic-bezier(.16,1,.3,1), background .18s ease, color .18s ease;
}
.topbar .user-chip:hover .user-chip-caret { background: #e2e8f0; color: #0f172a; }
.topbar .user-chip-wrap.open .user-chip-caret {
  transform: rotate(180deg);
  background: linear-gradient(135deg,#0ea5e9,#6366f1); color: #fff;
}

/* ── Backdrop (mobile sheet only) ── */
.topbar .user-chip-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.45); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; z-index: 70;
  transition: opacity .22s ease;
}

/* ── Dropdown panel (desktop) ── */
.topbar .user-chip-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 240px; padding: 6px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,1) inset,
    0 1px 2px rgba(15,23,42,.06),
    0 12px 28px -8px rgba(15,23,42,.18),
    0 24px 48px -16px rgba(15,23,42,.14);
  z-index: 80;
  opacity: 0; transform: translateY(-6px) scale(.96); transform-origin: top right;
  pointer-events: none;
  transition: opacity .18s ease, transform .22s cubic-bezier(.16,1,.3,1);
}
.topbar .user-chip-wrap.open .user-chip-menu {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}

/* ── Sheet header (mobile) ── */
.topbar .user-chip-menu-head { display: none; }
.topbar .user-chip-menu-handle {
  display: block; width: 36px; height: 4px; border-radius: 4px;
  background: #cbd5e1; margin: 8px auto 12px;
}
.topbar .user-chip-menu-user {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 14px; border-bottom: 1px solid #f1f5f9; margin-bottom: 8px;
}
.topbar .user-chip-menu-user .avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg,#0ea5e9,#6366f1); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 14px -6px rgba(99,102,241,.55);
}
.topbar .user-chip-menu-user .meta { font-size: 14px; line-height: 1.25; min-width: 0; }
.topbar .user-chip-menu-user .meta strong { display: block; color: #0f172a; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.topbar .user-chip-menu-user .meta span { color: #64748b; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 220px; }

/* ── Menu items ── */
.topbar .user-chip-menu-item {
  display: grid; grid-template-columns: 32px 1fr auto;
  align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: #0f172a; font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.topbar .user-chip-menu-item .ico {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; background: #f1f5f9; font-size: 15px;
  transition: background .15s ease;
}
.topbar .user-chip-menu-item .arr {
  color: #cbd5e1; font-size: 14px;
  transform: translateX(-4px); opacity: 0;
  transition: transform .18s ease, opacity .18s ease, color .15s ease;
}
.topbar .user-chip-menu-item:hover {
  background: #f8fafc; text-decoration: none;
}
.topbar .user-chip-menu-item:hover .ico { background: #e2e8f0; }
.topbar .user-chip-menu-item:hover .arr { transform: translateX(0); opacity: 1; color: #64748b; }
.topbar .user-chip-menu-item--danger { color: #b91c1c; }
.topbar .user-chip-menu-item--danger .ico { background: #fef2f2; }
.topbar .user-chip-menu-item--danger:hover { background: #fef2f2; color: #991b1b; }
.topbar .user-chip-menu-item--danger:hover .ico { background: #fee2e2; }

/* ── Mobile: bottom sheet ── */
@media (max-width: 640px) {
  .topbar .user-chip { padding: 4px 8px 4px 4px; }
  .topbar .user-chip .meta { display: none; }
  .topbar .user-chip-caret { width: 20px; height: 20px; }

  .topbar .user-chip-backdrop { display: block; }
  .topbar .user-chip-wrap.open .user-chip-backdrop { opacity: 1; pointer-events: auto; }

  .topbar .user-chip-menu {
    position: fixed; top: auto; right: 0; left: 0; bottom: 0;
    min-width: 0; width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 0 12px 18px;
    transform: translateY(100%) scale(1);
    transform-origin: bottom center;
    box-shadow: 0 -10px 30px -8px rgba(15,23,42,.25), 0 -1px 0 rgba(15,23,42,.04);
    z-index: 80;
  }
  .topbar .user-chip-wrap.open .user-chip-menu {
    transform: translateY(0); opacity: 1; pointer-events: auto;
  }
  .topbar .user-chip-menu-head { display: block; }
  .topbar .user-chip-menu-item { padding: 14px 12px; font-size: 15px; }
  .topbar .user-chip-menu-item .ico { width: 36px; height: 36px; font-size: 16px; }
  .topbar .user-chip-menu-item .arr { opacity: 1; transform: translateX(0); color: #cbd5e1; }
}

.app-content { padding: 28px; max-width: 1200px; }
.card { background: #fff; border-radius: 12px; padding: 22px; box-shadow: 0 1px 3px rgba(15,23,42,.05); margin-bottom: 18px; }
.card h2 { margin: 0 0 14px; font-size: 18px; }

/* ─── Utility grids ─── */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 540px) { .row2 { grid-template-columns: 1fr; } }

/* ─── Hamburger + backdrop (mobile sidebar drawer) ─── */
.hamburger {
  display: none; place-items: center; width: 42px; height: 42px;
  padding: 0;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 11px;
  font-size: 20px; line-height: 1; cursor: pointer;
  color: #334155; flex-shrink: 0;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 1px 2px rgba(15,23,42,.04);
}
.hamburger:hover {
  background: #fff; border-color: #cbd5e1; color: #0f172a;
  box-shadow: 0 1px 0 #fff inset, 0 4px 12px -6px rgba(15,23,42,.18);
}
.hamburger:active { transform: scale(.96); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45);
  z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s;
  backdrop-filter: blur(2px);
}

/* ─── Responsive table (cards on phone) ─── */
.responsive-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.responsive-table thead { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.responsive-table th, .responsive-table td { padding: 12px 14px; }
.responsive-table tbody tr { border-top: 1px solid #e2e8f0; }
.responsive-table td[data-label]::before { display: none; }
@media (max-width: 640px) {
  .responsive-table { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: block; }
  .responsive-table tr {
    display: block; padding: 14px; border: 1px solid #e2e8f0; border-radius: 12px;
    margin-bottom: 12px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.04);
  }
  .responsive-table td { display: block; padding: 6px 0; border: 0; text-align: left !important; }
  .responsive-table td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px;
    text-transform: uppercase; letter-spacing: .5px; color: #94a3b8;
    margin-bottom: 3px; font-weight: 700;
  }
  .responsive-table td.actions {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 0;
    margin-top: 8px; border-top: 1px solid #f1f5f9;
  }
  .responsive-table td.actions .btn { flex: 1 0 auto; min-width: 80px; text-align: center; }
}

/* ─── App shell mobile ─── */
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100vh; height: 100dvh;
    width: 280px; max-width: 85vw;
    transform: translateX(-100%); transition: transform .25s ease;
    z-index: 50; box-shadow: 4px 0 30px rgba(0,0,0,.25);
    padding: 20px 0 32px; overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
  .sidebar nav a { padding: 11px 14px; font-size: 14.5px; }
  .sidebar-backdrop { display: block; }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .hamburger { display: grid; }

  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar h1 { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .user-chip { padding: 4px 8px 4px 4px; gap: 8px; }
  .topbar .user-chip .avatar { width: 34px; height: 34px; font-size: 14px; }
  .topbar .upgrade-btn { padding: 7px 12px 7px 8px; gap: 6px; font-size: 12.5px; }
  .topbar .upgrade-btn-ico { width: 20px; height: 20px; }

  .app-content { padding: 18px 14px; }
  .card { padding: 16px; }
  .card h2 { font-size: 16px; }
}

/* ─── Even smaller phones ─── */
@media (max-width: 480px) {
  .topbar .upgrade-btn { padding: 7px; gap: 0; }
  .topbar .upgrade-btn-lbl { display: none; }
  .topbar .upgrade-btn-ico { background: transparent; color: #fff; box-shadow: none; }
  .topbar .upgrade-btn {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #fff;
  }
}
@media (max-width: 380px) {
  .topbar h1 { font-size: 14px; }
  .auth-card h2 { font-size: 22px; }
  .app-content { padding: 14px 12px; }
}
