/* ═══ Credential Vault — Base Styles v3 ═══ */
/* Direction: Light theme */

/* ── Reset & Tokens ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Layout */
  --sidebar-w: 220px;

  /* Core palette — light */
  --bg:         #F8FAFC;
  --sidebar-bg: #F1F5F9;
  --sidebar-border: #E2E8F0;
  --card:       #FFFFFF;
  --card-hover: #F8FAFC;
  --surface:    #F1F5F9;
  --border:     #E2E8F0;
  --border-2:   #CBD5E1;

  /* Accent system — blue */
  --accent:     #3B82F6;
  --accent-lt:  #EFF6FF;
  --accent-mid: #BFDBFE;
  --green:      #059669;
  --green-lt:   #D1FAE5;
  --red:        #DC2626;
  --red-lt:     #FEE2E2;
  --orange:     #D97706;
  --orange-lt:  #FEF3C7;
  --blue:       #2563EB;
  --blue-lt:    #DBEAFE;
  --purple:     #7C3AED;
  --purple-lt:  #F5F3FF;
  --teal:       #0D9488;
  --teal-lt:    #CCFBF1;

  /* Text */
  --text:       #1E293B;
  --text-2:     #475569;
  --muted:      #64748B;
  --muted-2:    #94A3B8;
  --sidebar-text: #374151;
  --sidebar-muted: #6B7280;

  /* Typography */
  --sans:  'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Syne', sans-serif;
  --mono:  'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Shadows — light */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg:  0 10px 25px rgba(0,0,0,0.10), 0 4px 10px rgba(0,0,0,0.06);
  --shadow-modal: 0 20px 50px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.08);

  /* Radius */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 18px;
}

/* ── Base ── */
html { scroll-behavior: smooth; font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ────────────────────────────────────────────
   SIDEBAR LAYOUT
   ──────────────────────────────────────────── */
.sidebar-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}
.sidebar-logo .logo-sub {
  font-size: 0.58rem;
  color: var(--sidebar-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-section {
  padding: 16px 12px 4px;
}
.sidebar-section-label {
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.sidebar-link.active {
  background: var(--accent-lt);
  color: var(--accent);
  border: 1px solid var(--accent-mid);
}
.sidebar-link .sl-icon {
  width: 20px; text-align: center;
  font-size: 0.85rem;
  opacity: 0.8;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}
.sidebar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.78rem; color: var(--text); font-weight: 600; }
.sidebar-user-role { font-size: 0.62rem; color: var(--muted); }

/* Main content area when sidebar is present */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

/* ────────────────────────────────────────────
   TOP HEADER (inside main-content)
   ──────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: rgba(248,250,252,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* Standalone header (no sidebar) */
.header-standalone {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.header-standalone .logo {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.logo {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.header-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.user-pill span { color: var(--text-2); font-weight: 600; }

.logout-btn, .logout, .nav-link {
  padding: 5px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  font-family: var(--sans);
}
.logout-btn:hover, .logout:hover { color: var(--red); border-color: rgba(220,38,38,0.4); background: var(--red-lt); }
.nav-link:hover { color: var(--accent); border-color: var(--accent-mid); background: var(--accent-lt); }

.nav-links { display: flex; gap: 8px; align-items: center; }

.admin-tag {
  background: var(--accent-lt);
  border: 1px solid var(--accent-mid);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.58rem;
  padding: 2px 10px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: 8px;
}

/* ────────────────────────────────────────────
   PAGE CONTAINER
   ──────────────────────────────────────────── */
.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 28px 80px;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.page-header .subtitle, .subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0;
}

/* ────────────────────────────────────────────
   STATS BAR
   ──────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.15s;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-n {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.stat-l {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat.accent-stat { border-left: 3px solid var(--accent); }
.stat.accent-stat .stat-n { color: var(--accent); }
.stat.green-stat  { border-left: 3px solid var(--green); }
.stat.green-stat  .stat-n { color: var(--green); }
.stat.blue-stat   { border-left: 3px solid var(--blue); }
.stat.blue-stat   .stat-n { color: var(--blue); }
.stat.red-stat    { border-left: 3px solid var(--red); }
.stat.red-stat    .stat-n { color: var(--red); }
.stat.orange-stat { border-left: 3px solid var(--orange); }
.stat.orange-stat .stat-n { color: var(--orange); }

/* ────────────────────────────────────────────
   TOOLBAR
   ──────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-wrap input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 14px 9px 36px;
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
  box-shadow: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  font-family: var(--sans);
}
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}
.search-icon, .si {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
  font-size: 0.85rem;
}
.filter-sel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 14px;
  color: var(--text);
  font-size: 0.84rem;
  outline: none;
  cursor: pointer;
  box-shadow: none;
  font-family: var(--sans);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.filter-sel:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-lt); }

/* ────────────────────────────────────────────
   BUTTONS
   ──────────────────────────────────────────── */
.add-btn, .new-key-btn {
  padding: 9px 20px;
  border-radius: var(--r);
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.add-btn:hover, .new-key-btn:hover {
  background: var(--blue);
  box-shadow: 0 4px 14px rgba(59,130,246,0.32);
  transform: translateY(-1px);
}

.btn {
  padding: 9px 20px;
  border-radius: var(--r);
  border: none;
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.22);
}
.btn-primary:hover { background: var(--blue); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text-2); border-color: var(--border-2); background: var(--card); }

.btn-save {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5,150,105,0.20);
}
.btn-save:hover { background: #047857; transform: translateY(-1px); }

.btn-skip {
  background: var(--orange-lt);
  color: var(--orange);
  border: 1px solid rgba(217,119,6,0.25);
}
.btn-skip:hover { background: #FDE68A; }

.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid rgba(220,38,38,0.25);
}
.btn-danger:hover { background: #FECACA; }

.lock-filter-btn {
  padding: 9px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.lock-filter-btn.locked {
  background: var(--accent-lt);
  border-color: var(--accent-mid);
  color: var(--accent);
}

/* Card action buttons */
.c-btn {
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
}
.c-btn-edit   { background: var(--blue-lt);   border-color: rgba(37,99,235,0.2);  color: var(--blue); }
.c-btn-del    { background: var(--red-lt);    border-color: rgba(220,38,38,0.2);  color: var(--red); }
.c-btn-done   { background: var(--surface);   border-color: var(--border);        color: var(--muted); font-size: 0.68rem; }
.c-btn-done-on{ background: var(--green-lt);  border-color: rgba(5,150,105,0.25); color: var(--green); font-size: 0.68rem; font-weight: 700; }
.c-btn-run    { background: var(--accent-lt); border-color: var(--accent-mid);    color: var(--accent); font-weight: 700; }

/* ────────────────────────────────────────────
   FORM FIELDS
   ──────────────────────────────────────────── */
.f { margin-bottom: 14px; }
.f label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.f input,
.f select,
.f textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.86rem;
  padding: 9px 12px;
  outline: none;
  font-family: var(--sans);
  transition: border-color 0.18s, box-shadow 0.18s;
  box-shadow: none;
}
.f input:focus,
.f select:focus,
.f textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}
.f input::placeholder { color: var(--muted-2); }
.f textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ────────────────────────────────────────────
   SECTION HEADINGS
   ──────────────────────────────────────────── */
.sec-heading, .sec-title {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple);
  padding: 14px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-heading::after, .sec-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ────────────────────────────────────────────
   MODAL / OVERLAY
   ──────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 660px;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: mi 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mi {
  from { transform: scale(0.92) translateY(16px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.m-top {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}
.m-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}
.m-close {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.m-close:hover { background: var(--red-lt); border-color: rgba(220,38,38,0.3); color: var(--red); }
.m-body  { padding: 20px 22px; }
.m-foot  {
  padding: 12px 22px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--card);
}
.mf-btn { padding: 9px 20px; border-radius: var(--r); border: none; font-family: var(--serif); font-size: 0.88rem; font-weight: 700; cursor: pointer; transition: all 0.18s; }
.mf-cancel { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.mf-cancel:hover { color: var(--text-2); border-color: var(--border-2); }
.mf-save { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.22); }
.mf-save:hover { background: var(--blue); }

/* ────────────────────────────────────────────
   LOCATION CHECKBOXES
   ──────────────────────────────────────────── */
.loc-check {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
  user-select: none;
  transition: all 0.15s;
}
.loc-check:hover { border-color: var(--teal); color: var(--teal); }
.loc-check:has(input:checked) {
  background: var(--teal-lt);
  border-color: rgba(13,148,136,0.3);
  color: var(--teal);
  font-weight: 600;
}
.loc-check input { accent-color: var(--teal); cursor: pointer; width: auto; margin: 0; }

/* ────────────────────────────────────────────
   SECURITY QUESTION BLOCKS
   ──────────────────────────────────────────── */
.sq-block {
  background: var(--purple-lt);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 9px;
}
.sq-select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 100%;
  padding: 9px 12px;
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-family: var(--sans);
}

/* ────────────────────────────────────────────
   VISA BADGES
   ──────────────────────────────────────────── */
.visa-badge {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 0.04em;
}
.vb-f1     { background: var(--blue-lt);   color: var(--blue);   border: 1px solid rgba(37,99,235,0.2); }
.vb-h1b    { background: var(--purple-lt); color: var(--purple); border: 1px solid rgba(124,58,237,0.2); }
.vb-b1     { background: var(--orange-lt); color: var(--orange); border: 1px solid rgba(217,119,6,0.2); }
.vb-canada { background: var(--red-lt);    color: var(--red);    border: 1px solid rgba(220,38,38,0.2); }
.vb-other  { background: var(--surface);   color: var(--muted);  border: 1px solid var(--border); }

/* ────────────────────────────────────────────
   PILL BADGES / STATUS
   ──────────────────────────────────────────── */
.pill { font-family: var(--mono); font-size: 0.6rem; padding: 2px 9px; border-radius: 99px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; }
.p-pending     { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.p-in_progress { background: var(--blue-lt);  color: var(--blue);   border: 1px solid rgba(37,99,235,0.2); }
.p-review_needed { background: var(--purple-lt); color: var(--purple); border: 1px solid rgba(124,58,237,0.25); }
.p-completed   { background: var(--green-lt); color: var(--green);  border: 1px solid rgba(5,150,105,0.2); }
.p-failed      { background: var(--red-lt);   color: var(--red);    border: 1px solid rgba(220,38,38,0.2); }

.mono-cell { font-family: var(--mono); font-size: 0.72rem; color: var(--text-2); }

/* ────────────────────────────────────────────
   TOAST
   ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: var(--text);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--r);
  padding: 11px 18px;
  font-size: 0.8rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.td { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.toast.err .td { background: #f87171; }
.toast.err { border-color: rgba(220,38,38,0.3); }

/* ────────────────────────────────────────────
   TABLES
   ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--card);
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.table-wrap th {
  background: var(--surface);
  padding: 10px 16px;
  text-align: left;
  font-family: var(--sans);
  font-size: 0.59rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.table-wrap td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--surface); }

/* ────────────────────────────────────────────
   TABS
   ──────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 8px 18px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  position: relative;
  bottom: -1px;
}
.tab:hover:not(.active) { color: var(--text); background: var(--surface); }
.tab.active {
  background: var(--card);
  border-color: var(--border);
  border-bottom-color: var(--card);
  color: var(--accent);
  font-weight: 700;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Two-tier tab bar: group row above the sub-tab (.tabs) row. */
.tab-groups {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tgroup {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.tgroup:hover:not(.active) { color: var(--text); border-color: var(--muted); }
.tgroup.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* Sub-tabs not in the active group are hidden (admin_tabs.js). !important beats
   the inline `display:inline-flex` on the Priority/Payroll link-tabs. */
.tab.tg-hidden { display: none !important; }

/* ────────────────────────────────────────────
   EMPTY STATE
   ──────────────────────────────────────────── */
.empty { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty-icon { font-size: 2.6rem; margin-bottom: 14px; opacity: 0.45; }
.empty h3 { font-family: var(--serif); font-size: 1.2rem; color: var(--text-2); margin-bottom: 8px; }
.empty-row { text-align: center; color: var(--muted-2); padding: 28px; font-size: 0.82rem; }

/* ────────────────────────────────────────────
   PANELS & CARDS
   ──────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.panel-title {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Grid cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-2);
}

.status-strip { height: 3px; }
.ss-pending    { background: var(--muted-2); }
.ss-in_progress{ background: var(--blue); }
.ss-review_needed{ background: var(--purple); }
.ss-completed  { background: var(--green); }
.ss-failed     { background: var(--red); }

.card-body   { padding: 16px 18px 12px; }
.card-top    { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.card-label  { font-family: var(--serif); font-size: 0.98rem; font-weight: 700; color: var(--text); }

.status-badge { font-family: var(--mono); font-size: 0.58rem; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; flex-shrink: 0; margin-left: 6px; font-weight: 600; }
.sb-pending    { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.sb-in_progress{ background: var(--blue-lt);  color: var(--blue);  border: 1px solid rgba(37,99,235,0.2); }
.sb-review_needed{ background: var(--purple-lt); color: var(--purple); border: 1px solid rgba(124,58,237,0.25); }
.sb-completed  { background: var(--green-lt); color: var(--green); border: 1px solid rgba(5,150,105,0.2); }
.sb-failed     { background: var(--red-lt);   color: var(--red);   border: 1px solid rgba(220,38,38,0.2); }

.card-user { font-family: var(--mono); font-size: 0.72rem; color: var(--blue); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row  { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-top: 1px solid var(--border); }
.cr-icon   { width: 20px; height: 20px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; flex-shrink: 0; }
.cr-label  { font-size: 0.65rem; color: var(--muted); min-width: 62px; }
.cr-val    { font-family: var(--mono); font-size: 0.72rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-sec       { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.card-sec-title { font-size: 0.59rem; color: var(--muted-2); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 5px; }
.sec-qa  { display: flex; gap: 6px; font-size: 0.68rem; padding: 2px 0; }
.sec-q   { color: var(--muted); flex-shrink: 0; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-a   { font-family: var(--mono); color: var(--purple); font-size: 0.7rem; }

.card-footer { padding: 10px 18px 14px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-top: 1px solid var(--border); }
.card-date   { font-size: 0.65rem; color: var(--muted); }
.card-btns   { display: flex; gap: 6px; }

.days-counter { font-family: var(--mono); font-size: 0.68rem; font-weight: 600; padding: 3px 9px; border-radius: var(--r-sm); display: inline-flex; align-items: center; gap: 4px; }
.days-active  { background: var(--accent-lt); color: var(--accent); border: 1px solid var(--accent-mid); }
.days-done    { background: var(--green-lt);  color: var(--green);  border: 1px solid rgba(5,150,105,0.25); }

/* ────────────────────────────────────────────
   TARGET URL BAR
   ──────────────────────────────────────────── */
.target-bar {
  background: var(--blue-lt);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--r);
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 0.82rem;
  color: var(--blue);
}

/* ────────────────────────────────────────────
   QUICK ADD — Specific styles
   ──────────────────────────────────────────── */
.qa-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}
.qa-page h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.qa-cols {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
}
.qa-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.qa-panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qa-panel-title {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.qa-panel-body { padding: 18px; }

.qa-textarea {
  width: 100%;
  min-height: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.qa-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-lt); }
.qa-textarea::placeholder { color: var(--muted-2); }

.qa-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.qa-hint {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.6;
}
.qa-hint strong { color: var(--text-2); }

/* Preview card in right panel */
.qa-preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
}
.qa-preview-card .f input,
.qa-preview-card .f select {
  background: var(--card);
}
.qa-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.qa-sq-block {
  background: var(--purple-lt);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.qa-sq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qa-actions {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}

/* Saved list */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--green-lt);
  border: 1px solid rgba(5,150,105,0.2);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
}
.saved-item .check { color: var(--green); font-weight: 700; margin-right: 4px; }
.saved-item .label { font-weight: 600; color: var(--text); }
.saved-item .user  { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

/* Counter badge */
.counter-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}
.counter-badge.active { background: var(--accent-lt); color: var(--accent); border: 1px solid var(--accent-mid); }
.counter-badge.done   { background: var(--green-lt);  color: var(--green);  border: 1px solid rgba(5,150,105,0.25); }

/* Status message */
.status-msg {
  margin-top: 10px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 500;
}
.status-msg.error   { background: var(--red-lt);   border: 1px solid rgba(220,38,38,0.25);  color: var(--red); }
.status-msg.success { background: var(--green-lt); border: 1px solid rgba(5,150,105,0.25);  color: var(--green); }

.empty-preview {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

/* ────────────────────────────────────────────
   DATE RANGE PICKER
   ──────────────────────────────────────────── */
.dr-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--surface);
  min-height: 38px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.dr-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.dr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 20px;
  background: var(--blue-lt);
  color: var(--blue);
  font-size: 0.72rem;
  border: 1px solid rgba(37,99,235,0.25);
  font-family: var(--mono);
}
.dr-chip-x {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}
.dr-chip-x:hover { color: var(--red); }
.dr-add {
  align-self: flex-start;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.dr-add:hover { border-color: var(--blue); color: var(--blue); }
.dr-cal-wrap {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
  padding: 12px;
  width: 240px;
}
.dr-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}
.dr-nav button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-size: 1.15rem;
  padding: 0 6px;
  line-height: 1;
}
.dr-hint { font-size: 0.67rem; color: var(--muted); margin-bottom: 8px; text-align: center; }
.dr-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 8px;
}
.dr-dh { font-size: 0.58rem; color: var(--muted); text-align: center; padding: 3px 0; font-family: var(--mono); }
.dr-day {
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 4px 0;
  text-align: center;
  color: var(--text);
  transition: background 0.1s;
  font-family: var(--mono);
}
.dr-day:hover { background: var(--blue-lt); color: var(--blue); }
.dr-cal-foot { text-align: right; }
.dr-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  padding: 3px 10px;
  cursor: pointer;
}
.dr-cancel:hover { color: var(--text); border-color: var(--muted); }

/* ────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid  { grid-template-columns: 1fr; }
  .g2, .g3, .two-col { grid-template-columns: 1fr; }
  .qa-cols { grid-template-columns: 1fr; }
}

/* ────────────────────────────────────────────
   UTILITIES
   ──────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-mono   { font-family: var(--mono); }
.fw-bold     { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.25s ease both; }

/* ────────────────────────────────────────────
   TRIAL / UPGRADE UI COMPONENTS
   ──────────────────────────────────────────── */

/* VSW trial banner */
.vsw-trial-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--r); margin-bottom: 24px;
  font-size: 0.82rem; font-weight: 500; line-height: 1.5;
}
.vsw-trial-banner.active  { background: var(--green-lt);  border: 1px solid rgba(5,150,105,0.2);  color: var(--green);  }
.vsw-trial-banner.warning { background: var(--orange-lt); border: 1px solid rgba(217,119,6,0.25); color: var(--orange); }
.vsw-trial-banner.expired { background: var(--red-lt);    border: 1px solid rgba(220,38,38,0.2);  color: var(--red);    }
.vsw-trial-banner.paid    { background: var(--blue-lt);   border: 1px solid rgba(37,99,235,0.2);  color: var(--blue);   }
.vsw-trial-banner-icon { font-size: 1rem; flex-shrink: 0; }
.vsw-trial-banner-text { flex: 1; }

/* Org usage meter */
.org-usage-meter { margin-bottom: 16px; }
.org-usage-meter-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.72rem; color: var(--muted); margin-bottom: 5px; font-weight: 600;
}
.org-usage-meter-label span:last-child { font-family: var(--mono); font-weight: 700; }
.org-usage-bar { height: 8px; background: var(--surface); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.org-usage-bar-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.org-usage-bar-fill.ok     { background: var(--green);  }
.org-usage-bar-fill.warn   { background: var(--orange); }
.org-usage-bar-fill.danger { background: var(--red);    }

/* Org upgrade banner (shown at 80 %+ usage) */
.org-upgrade-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 16px; border-radius: var(--r); margin-bottom: 16px;
  background: var(--orange-lt); border: 1px solid rgba(217,119,6,0.25); color: var(--orange);
  font-size: 0.8rem; line-height: 1.5;
}
.org-upgrade-banner.danger { background: var(--red-lt); border-color: rgba(220,38,38,0.2); color: var(--red); }
.org-upgrade-banner-text { flex: 1; }
.org-upgrade-banner-cta {
  font-size: 0.75rem; padding: 4px 12px; border-radius: var(--r-sm);
  border: none; cursor: pointer; font-weight: 600; white-space: nowrap;
  background: var(--orange); color: #fff; text-decoration: none;
}
.org-upgrade-banner.danger .org-upgrade-banner-cta { background: var(--red); }

/* Dashboard upgrade nudge (direct / non-org users) */
.upgrade-nudge {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-radius: var(--r);
  background: var(--accent-lt); border: 1px solid var(--accent-mid);
  font-size: 0.82rem; color: var(--blue); margin-bottom: 18px;
}
.upgrade-nudge-text { flex: 1; line-height: 1.5; }
.upgrade-nudge-cta {
  font-size: 0.75rem; padding: 5px 14px; border-radius: var(--r-sm);
  border: none; cursor: pointer; font-weight: 600; white-space: nowrap;
  background: var(--accent); color: #fff; text-decoration: none; display: inline-block;
}

/* VSW upgrade modal (overlay) */
.upgrade-modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.upgrade-modal.hidden { display: none; }
.upgrade-modal-inner {
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); padding: 32px 28px;
  max-width: 560px; width: 100%; box-shadow: var(--shadow-modal);
  position: relative;
}
.upgrade-modal-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--muted); font-size: 0.78rem;
  padding: 4px 10px; cursor: pointer; line-height: 1;
}
.upgrade-modal-close:hover { color: var(--text); }
.upgrade-plan-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-top: 20px;
}

/* ── Org panel table — responsive column hiding (5A) ─────────────────────── */
@media (max-width: 1024px) {
  .sa-keys-table { font-size: 0.85rem; }
  .sa-keys-table th:nth-child(n+6),
  .sa-keys-table td:nth-child(n+6) { display: none; }
}
@media (max-width: 768px) {
  .sa-keys-table th:nth-child(n+4),
  .sa-keys-table td:nth-child(n+4) { display: none; }
}

/* ── VSW slot skeleton loader (5B) ───────────────────────────────────────── */
.skeleton-row {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}
.skeleton-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 18px 16px;
  margin-bottom: 12px;
}
.skeleton-title {
  height: 14px; width: 40%; margin-bottom: 14px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── VSW auto-refresh timer (5C) ─────────────────────────────────────────── */
#auto-timer {
  font-size: 0.78rem;
  color: var(--accent, #2563eb);
  font-weight: 600;
  padding: 4px 12px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 20px;
  display: inline-block;
  min-width: 120px;
  text-align: center;
}

/* ── Org panel empty-state CTA ───────────────────────────────────────────── */
.empty-state-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 20px;
  background: var(--accent, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.empty-state-cta:hover { opacity: 0.9; }
