/* ============================================================
   WP Guard — prototype design system
   ============================================================ */

:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --border: #e6e8f0;
  --border-strong: #d5d9e6;
  --text: #171c2e;
  --text-2: #5a6178;
  --text-3: #8b91a7;
  --primary: #6366f1;
  --primary-strong: #4f46e5;
  --primary-soft: #eef0fe;
  --ok: #16a34a;      --ok-soft: #e9f8ef;
  --warn: #d97706;    --warn-soft: #fdf3e3;
  --danger: #dc2626;  --danger-soft: #fdeaea;
  --info: #0284c7;    --info-soft: #e7f4fb;
  --sidebar: #101425;
  --sidebar-2: #181d33;
  --sidebar-text: #9aa1bd;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(23, 28, 46, .05), 0 4px 16px rgba(23, 28, 46, .05);
  --shadow-lg: 0 8px 40px rgba(23, 28, 46, .16);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
.icon { flex: none; vertical-align: -3px; }

/* ---------------------------------------------------------- App shell */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex: none;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh;
  z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 10px 18px; color: #fff;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .45);
}
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-name em { font-style: normal; color: #a5b4fc; }

.side-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #565d7c;
  padding: 8px 12px 6px;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.side-link:hover { background: var(--sidebar-2); color: #e3e6f2; }
.side-link.is-active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .08));
  color: #fff;
}
.side-link.is-active .icon { color: #a5b4fc; }
.side-count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: rgba(255, 255, 255, .09); color: #c3c8dd;
  padding: 1px 7px; border-radius: 20px;
}

.side-card {
  margin: auto 4px 14px; padding: 14px;
  background: var(--sidebar-2); border: 1px solid #232946;
  border-radius: 12px;
}
.side-card-title { display: flex; align-items: center; gap: 7px; color: #dfe3f3; font-weight: 600; font-size: 13px; }
.side-card p { font-size: 12px; color: #7c84a3; margin: 6px 0 10px; }

.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 2px; border-top: 1px solid #20263f;
}
.side-user-meta { min-width: 0; }
.side-user-meta strong { display: block; color: #e8eaf4; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta span { font-size: 11.5px; color: #666e8f; }
.side-user-out { margin-left: auto; color: #666e8f; padding: 6px; border-radius: 8px; }
.side-user-out:hover { color: #fca5a5; background: var(--sidebar-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ------------------------------------------------------------- Topbar */

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topsearch {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; width: 340px; max-width: 45vw;
  color: var(--text-3);
}
.topsearch input { border: 0; outline: 0; background: none; flex: 1; font-size: 13.5px; color: var(--text); }
.topsearch input::placeholder { color: var(--text-3); }
.topsearch kbd {
  font-family: var(--font); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px;
  background: #fff;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text-2);
  position: relative; transition: background .15s;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary-strong); }
.icon-btn.has-dot::after {
  content: ''; position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: 10px;
  font-weight: 600; font-size: 13px; color: var(--text);
}
.user-btn:hover { background: var(--primary-soft); }

/* ------------------------------------------------------------ Content */

.content { padding: 26px 28px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* -------------------------------------------------------------- Cards */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14.5px; font-weight: 700; }
.card-head .spacer { margin-left: auto; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }

/* --------------------------------------------------------- Stat cards */

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.stat-top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-ic {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
}
.stat-ic.tone-indigo { background: var(--primary-soft); color: var(--primary-strong); }
.stat-ic.tone-ok     { background: var(--ok-soft); color: var(--ok); }
.stat-ic.tone-warn   { background: var(--warn-soft); color: var(--warn); }
.stat-ic.tone-danger { background: var(--danger-soft); color: var(--danger); }
.stat-ic.tone-info   { background: var(--info-soft); color: var(--info); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-note { font-size: 12.5px; color: var(--text-3); }
.stat-note .up { color: var(--ok); font-weight: 600; }
.stat-note .down { color: var(--danger); font-weight: 600; }

/* -------------------------------------------------------------- Table */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  padding: 12px 13px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td { padding: 13px 11px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #fafbfe; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tbl .cell-main .t { min-width: 0; }
.tbl .cell-main strong { display: block; font-weight: 600; color: var(--text); white-space: nowrap; }
.tbl .cell-main span { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .muted { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.row-link { cursor: pointer; }

/* ------------------------------------------------------------- Badges */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 3px 9px; border-radius: 20px;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok      { background: var(--ok-soft); color: #15803d; }
.badge-warn    { background: var(--warn-soft); color: #b45309; }
.badge-danger  { background: var(--danger-soft); color: #b91c1c; }
.badge-neutral { background: #eef0f6; color: var(--text-2); }
.badge-info    { background: var(--info-soft); color: #075985; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  padding: 2.5px 9px; border-radius: 7px; border: 1px solid transparent;
}
.chip-indigo { background: var(--primary-soft); color: var(--primary-strong); border-color: #dfe1fd; }
.chip-blue   { background: #e7f2fd; color: #1d6fb8; border-color: #d2e7fa; }
.chip-teal   { background: #e6f7f4; color: #0f766e; border-color: #ccefe9; }
.chip-amber  { background: #fdf3e3; color: #b45309; border-color: #fae5c5; }
.chip-purple { background: #f3edfd; color: #7c3aed; border-color: #e7dcfb; }
.chip-neutral{ background: #eef0f6; color: var(--text-2); border-color: var(--border); }

/* ------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border-radius: 10px; padding: 9px 16px;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 10px rgba(99, 102, 241, .35); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-outline { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-soft); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: #eef0f6; color: var(--text); }
.btn-danger { background: var(--danger-soft); color: #b91c1c; }
.btn-danger:hover { background: #fbdcdc; }
.btn-light { background: rgba(255, 255, 255, .1); color: #dfe3f3; }
.btn-light:hover { background: rgba(255, 255, 255, .18); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* -------------------------------------------------------------- Forms */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, .select, textarea.input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.input::placeholder { color: var(--text-3); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b91a7' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.input-group .input { padding-left: 36px; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 22px;
  background: #d7dae6; transition: background .18s; cursor: pointer;
}
.switch .track::before {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(16px); }

.setting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .t { flex: 1; min-width: 0; }
.setting-row .t strong { display: block; font-size: 13.5px; font-weight: 600; }
.setting-row .t p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------------------------------------ Avatars */

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; flex: none; letter-spacing: .02em;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-more {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #eef0f6; color: var(--text-2);
  font-size: 11px; font-weight: 700; border: 2px solid var(--surface); margin-left: -8px;
}
.site-tile {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; font-weight: 800; flex: none;
  border: 1px solid transparent;
}

/* ----------------------------------------------------------- Dropdown */

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 210px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all .15s; z-index: 60;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text); width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.item-danger { color: #b91c1c; }
.dropdown-item.item-danger:hover { background: var(--danger-soft); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.dropdown-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 700; padding: 10px 12px 8px;
}
.dropdown-notif { min-width: 320px; }
.notif { display: flex; gap: 11px; padding: 10px 12px; border-radius: 10px; }
.notif:hover { background: var(--bg); }
.notif-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.notif-ic.tone-danger  { background: var(--danger-soft); color: var(--danger); }
.notif-ic.tone-warning { background: var(--warn-soft); color: var(--warn); }
.notif-ic.tone-info    { background: var(--info-soft); color: var(--info); }
.notif-ic.tone-success { background: var(--ok-soft); color: var(--ok); }
.notif strong { font-size: 13px; display: block; }
.notif p { font-size: 12.5px; color: var(--text-2); margin: 1px 0 2px; }
.notif time { font-size: 11.5px; color: var(--text-3); }
.dropdown-foot {
  display: block; width: 100%; text-align: center;
  padding: 9px; margin-top: 4px; border-top: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--primary-strong);
}
.dropdown-foot:hover { background: var(--primary-soft); border-radius: 0 0 10px 10px; }

/* -------------------------------------------------------------- Modal */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 20, 37, .55);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: all .18s; z-index: 100;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98); transition: transform .18s;
  max-height: 88vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: none; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px 0;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-head .modal-x { margin-left: auto; }
.modal-body { padding: 16px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 4px 22px 20px; }

/* -------------------------------------------------------------- Tabs */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary-strong); border-color: var(--primary); }

/* Segmented filters */
.seg { display: inline-flex; background: #eef0f6; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.seg button.is-active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(23, 28, 46, .12); }

/* ------------------------------------------------------------- Feed */

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.feed-ic.tone-ok     { background: var(--ok-soft); color: var(--ok); }
.feed-ic.tone-danger { background: var(--danger-soft); color: var(--danger); }
.feed-ic.tone-warn   { background: var(--warn-soft); color: var(--warn); }
.feed-ic.tone-info   { background: var(--info-soft); color: var(--info); }
.feed-ic.tone-indigo { background: var(--primary-soft); color: var(--primary-strong); }
.feed-body { min-width: 0; flex: 1; }
.feed-body strong { font-weight: 600; }
.feed-body p { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.feed-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------- Toasts */

.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 9px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #171c2e; color: #eef0f6;
  padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: toast-in .22s ease; max-width: 360px;
}
.toast .icon { color: #a5b4fc; }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------ Progress bars */

.bar { height: 7px; background: #eef0f6; border-radius: 7px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 7px; background: var(--primary); }
.bar > span.ok { background: var(--ok); }
.bar > span.warn { background: var(--warn); }
.bar > span.danger { background: var(--danger); }

/* -------------------------------------------------------- Empty state */

.empty { text-align: center; padding: 42px 20px; color: var(--text-3); }
.empty .icon { color: var(--border-strong); margin-bottom: 10px; }
.empty strong { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 3px; }

/* -------------------------------------------------------- Login page */

.auth-body {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(700px 500px at 85% -10%, rgba(99, 102, 241, .18), transparent 60%),
    radial-gradient(600px 500px at -10% 110%, rgba(139, 92, 246, .14), transparent 60%),
    #0e1222;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  padding: 34px 34px 28px;
}
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 6px; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.auth-title { text-align: center; font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-top: 14px; }
.auth-sub { text-align: center; color: var(--text-2); font-size: 13px; margin: 5px 0 22px; }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 18px; }
.auth-foot a { font-weight: 600; }
.auth-hint {
  margin-top: 20px; padding: 11px 14px; border-radius: 10px;
  background: var(--primary-soft); border: 1px dashed #c9ccfb;
  font-size: 12.5px; color: #4645b8; text-align: center;
}
.auth-steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.auth-steps span { width: 26px; height: 4px; border-radius: 4px; background: #e6e8f0; }
.auth-steps span.on { background: var(--primary); }

.turnstile {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 15px; background: #fafbfe;
}
.turnstile .spin {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 3px solid #dfe1fd; border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
.turnstile.done .spin { display: none; }
.turnstile .tick { display: none; color: var(--ok); }
.turnstile.done .tick { display: block; }
.turnstile .t { flex: 1; font-size: 13px; font-weight: 600; color: var(--text-2); }
.turnstile .cf { font-size: 10.5px; color: var(--text-3); text-align: right; line-height: 1.3; }
@keyframes spin { to { transform: rotate(360deg); } }

.otp-row { display: flex; gap: 8px; justify-content: center; margin: 6px 0 16px; }
.otp {
  width: 46px; height: 52px; text-align: center; font-size: 20px; font-weight: 700;
  border: 1px solid var(--border-strong); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.otp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }

.method {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 10px; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.method:hover { border-color: var(--primary); background: var(--primary-soft); }
.method .m-ic {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--primary-soft); color: var(--primary-strong);
  display: grid; place-items: center;
}
.method strong { display: block; font-size: 13.5px; }
.method span { font-size: 12px; color: var(--text-3); }
.method .icon-chev { margin-left: auto; color: var(--text-3); }

/* -------------------------------------------------------- Utilities */

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-tight { display: flex; align-items: center; gap: 4px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }
.only-mobile { display: none; }
.code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px;
  background: #f1f2f8; border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px;
}

.scrim {
  position: fixed; inset: 0; background: rgba(16, 20, 37, .5);
  opacity: 0; visibility: hidden; transition: all .2s; z-index: 45;
}

/* ------------------------------------------- Locale & theme switchers */

.locale-controls { display: flex; align-items: center; gap: 6px; }
.lang-seg {
  display: inline-flex; border: 1px solid var(--border-strong);
  border-radius: 9px; overflow: hidden; background: var(--surface);
}
.lang-seg a {
  padding: 5px 10px; font-size: 11.5px; font-weight: 700;
  color: var(--text-3); letter-spacing: .04em;
}
.lang-seg a:hover { color: var(--text); }
.lang-seg a.is-active { background: var(--primary-soft); color: var(--primary-strong); }
.theme-btn .theme-moon { display: none; }
[data-theme="dark"] .theme-btn .theme-sun { display: none; }
[data-theme="dark"] .theme-btn .theme-moon { display: block; }

/* On the auth screen the switchers sit centered below the card,
   floating over the dark hero backdrop */
.auth-wrap { width: 100%; max-width: 420px; }
.auth-locale { justify-content: center; margin-top: 18px; }
.auth-locale .lang-seg { border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); }
.auth-locale .lang-seg a { color: #aab1cc; }
.auth-locale .lang-seg a.is-active { background: rgba(99, 102, 241, .38); color: #fff; }
.auth-locale .icon-btn { color: #aab1cc; }
.auth-locale .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* Success state of the forgot-password simulation */
.auth-sent-ic {
  width: 56px; height: 56px; border-radius: 16px; margin: 4px auto 14px;
  background: var(--ok-soft); color: var(--ok);
  display: grid; place-items: center;
}

/* "Viewing as user" prototype banner */
.view-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 28px; font-size: 12.5px; font-weight: 500;
  background: var(--warn-soft); color: #8a5a06;
  border-bottom: 1px solid #f3e3c2;
}
.view-banner a { font-weight: 700; margin-left: auto; white-space: nowrap; }
[data-theme="dark"] .view-banner { background: rgba(245, 158, 11, .12); color: #fbbf24; border-color: rgba(245, 158, 11, .25); }

/* ----------------------------------------------------------- Dark theme */

[data-theme="dark"] {
  --bg: #0d1120;
  --surface: #161b30;
  --border: #232946;
  --border-strong: #303757;
  --text: #e8eaf4;
  --text-2: #a3aac6;
  --text-3: #6f7695;
  --primary-soft: rgba(99, 102, 241, .16);
  --ok-soft: rgba(34, 197, 94, .14);
  --warn-soft: rgba(245, 158, 11, .14);
  --danger-soft: rgba(239, 68, 68, .14);
  --info-soft: rgba(14, 165, 233, .14);
  --sidebar: #0a0d1b;
  --sidebar-2: #141931;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .5);
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .topbar { background: rgba(13, 17, 32, .85); }
[data-theme="dark"] .topsearch kbd { background: var(--surface); }
[data-theme="dark"] .tbl tbody tr:hover { background: rgba(255, 255, 255, .025); }
[data-theme="dark"] .seg { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .seg button.is-active { background: #2b3252; color: var(--text); box-shadow: none; }
[data-theme="dark"] .btn-ghost:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
[data-theme="dark"] .btn-outline { border-color: var(--border-strong); }
[data-theme="dark"] .badge-ok      { color: #4ade80; }
[data-theme="dark"] .badge-warn    { color: #fbbf24; }
[data-theme="dark"] .badge-danger  { color: #f87171; }
[data-theme="dark"] .badge-info    { color: #38bdf8; }
[data-theme="dark"] .badge-neutral { background: rgba(255, 255, 255, .08); color: var(--text-2); }
[data-theme="dark"] .chip-indigo { background: var(--primary-soft); color: #a5b4fc; border-color: rgba(99, 102, 241, .35); }
[data-theme="dark"] .chip-blue   { background: rgba(59, 130, 246, .14); color: #7cb8f7; border-color: rgba(59, 130, 246, .3); }
[data-theme="dark"] .chip-teal   { background: rgba(20, 184, 166, .14); color: #4fd1c5; border-color: rgba(20, 184, 166, .3); }
[data-theme="dark"] .chip-amber  { background: rgba(245, 158, 11, .14); color: #fbbf24; border-color: rgba(245, 158, 11, .3); }
[data-theme="dark"] .chip-purple { background: rgba(139, 92, 246, .14); color: #c4b5fd; border-color: rgba(139, 92, 246, .3); }
[data-theme="dark"] .chip-neutral{ background: rgba(255, 255, 255, .07); color: var(--text-2); border-color: var(--border); }
[data-theme="dark"] .stat-ic.tone-indigo, [data-theme="dark"] .feed-ic.tone-indigo, [data-theme="dark"] .notif-ic.tone-info { color: #a5b4fc; }
[data-theme="dark"] .stat-ic.tone-ok, [data-theme="dark"] .feed-ic.tone-ok, [data-theme="dark"] .notif-ic.tone-success { color: #4ade80; }
[data-theme="dark"] .stat-ic.tone-warn, [data-theme="dark"] .feed-ic.tone-warn, [data-theme="dark"] .notif-ic.tone-warning { color: #fbbf24; }
[data-theme="dark"] .stat-ic.tone-danger, [data-theme="dark"] .feed-ic.tone-danger, [data-theme="dark"] .notif-ic.tone-danger { color: #f87171; }
[data-theme="dark"] .stat-ic.tone-info, [data-theme="dark"] .feed-ic.tone-info { color: #38bdf8; }
[data-theme="dark"] .bar { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .code { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .avatar-more { background: rgba(255, 255, 255, .08); color: var(--text-2); }
[data-theme="dark"] .toast { background: #2a3050; border: 1px solid #363d63; }
[data-theme="dark"] .turnstile { background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .otp { background: var(--surface); color: var(--text); }
[data-theme="dark"] .auth-hint { border-color: rgba(99, 102, 241, .4); color: #a5b4fc; }
[data-theme="dark"] .switch .track { background: #3a4166; }
[data-theme="dark"] .switch input:checked + .track { background: var(--primary); }
[data-theme="dark"] .icon-btn.has-dot::after { border-color: var(--surface); }
[data-theme="dark"] .avatar-stack .avatar, [data-theme="dark"] .avatar-more { border-color: var(--surface); }
[data-theme="dark"] .empty .icon { color: var(--border-strong); }
[data-theme="dark"] .input, [data-theme="dark"] .select { background-color: rgba(255, 255, 255, .04); }
[data-theme="dark"] .auth-card { background: var(--surface); }
[data-theme="dark"] .method { background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .method:hover { background: var(--primary-soft); }
[data-theme="dark"] .dropdown-foot:hover { background: var(--primary-soft); }

/* Base .otp needs a surface background so dark mode can restyle it */
.otp { background: var(--surface); color: var(--text); }

/* Themeable SVG chart parts (dashboard) */
.ch-grid { stroke: var(--border); }
.ch-txt { fill: var(--text-3); }
.ch-dot { stroke: var(--surface); }

/* ---------------------------------------------------------- Responsive */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; visibility: visible; }
  .only-mobile { display: grid; }
  .only-desktop { display: none; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 12px 16px; }
  .topsearch { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .page-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .otp { width: 40px; height: 48px; }
}
