/* ============================================================
   SBM Portal — Component Library
   Corporate / Fintech Design System
   ============================================================ */

/* ── Grid helpers ─────────────────────────────────────────── */
/*
 * .card-grid  —  generic responsive card grid.
 *   Used wherever a set of cards should flow into columns.
 *   Pair with a scoped modifier class to set grid-template-columns.
 *   e.g. <div class="card-grid my-modifier-grid">
 */
.card-grid {
  display: grid;
  gap: var(--sp-5);   /* 1.25 rem — matches Tailwind gap-5 */
}

/* Convenience column presets */
.grid-cols-auto-sm { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid-cols-auto-md { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-cols-auto-lg { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-2  { grid-template-columns: repeat(2, 1fr); }
.grid-3  { grid-template-columns: repeat(3, 1fr); }
.grid-4  { grid-template-columns: repeat(4, 1fr); }

/* ── App Shell ────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--dur-slow) var(--ease-out);
}
.app-shell.collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}
.app-shell.no-sidebar {
  grid-template-columns: 1fr;
  grid-template-areas: "topbar" "main";
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: width var(--dur-slow) var(--ease-out);
}

[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right-color: var(--clr-border);
}

.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: -.02em;
  color: var(--clr-text);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-logo .logo-mark {
  width: 30px;
  height: 30px;
  background: var(--clr-primary);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 2px 8px var(--clr-primary-glow);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--clr-text-faint);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  white-space: nowrap;
  overflow: hidden;
}

.nav-section-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
  overflow: hidden;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-section-header:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
}
.nav-section-header.active { color: var(--clr-primary); }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  line-height: 1.4;
}
.nav-item:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--clr-primary-dim);
  color: var(--clr-primary);
  border-color: rgba(59,130,246,.15);
  font-weight: 500;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--clr-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

/* Sub-nav items (indented) */
.nav-sub-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  padding-left: calc(var(--sp-3) + 26px);
  border-radius: var(--radius);
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
}
.nav-sub-item:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  text-decoration: none;
}
.nav-sub-item.active {
  color: var(--clr-primary);
  background: var(--clr-primary-dim);
  border-color: rgba(59,130,246,.12);
  font-weight: 500;
}

/* Sidebar security posture */
.sidebar-posture {
  margin: 0 var(--sp-2) var(--sp-3);
  padding: var(--sp-3);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.sidebar-posture-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  gap: var(--sp-2);
}
.sidebar-posture-label { color: var(--clr-text-muted); }

/* Sidebar user footer */
.sidebar-footer {
  padding: var(--sp-3) var(--sp-3);
  border-top: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-footer .avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--clr-primary-dim);
  border: 2px solid var(--clr-primary);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--clr-primary);
}
.sidebar-footer .user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  truncate: true;
}
.sidebar-footer .user-role {
  font-size: 11px;
  color: var(--clr-text-muted);
  line-height: 1.2;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-5);
  position: sticky;
  top: 0;
  z-index: 90;
}

[data-theme="light"] .topbar {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

/* ── Icon button ──────────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-color: var(--clr-border);
}
.icon-btn.active {
  background: var(--clr-primary-dim);
  color: var(--clr-primary);
  border-color: rgba(59,130,246,.2);
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  grid-area: main;
  overflow-y: auto;
  padding: var(--sp-8);
  animation: fadeIn var(--dur-slow) var(--ease-out);
  background: var(--clr-bg);
}

.page-header { margin-bottom: var(--sp-8); }
.page-header h1 { font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--sp-2); }
.page-header p  { color: var(--clr-text-muted); font-size: var(--text-sm); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  padding: 0 var(--sp-4);
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  outline: none;
  letter-spacing: -.01em;
}
.btn:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 2px; }
.btn:disabled      { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-sm  { height: 30px; padding: 0 var(--sp-3); font-size: var(--text-xs); }
.btn-lg  { height: 42px; padding: 0 var(--sp-6); font-size: var(--text-base); }
.btn-xl  { height: 48px; padding: 0 var(--sp-8); font-size: var(--text-lg); }
.btn-icon-only { width: 36px; height: 36px; padding: 0; }
.btn-icon-only.btn-sm { width: 30px; height: 30px; }
.btn-icon-only.btn-lg { width: 42px; height: 42px; }

/* Variants */
.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
  box-shadow: 0 1px 3px rgba(59,130,246,.3);
}
.btn-primary:hover {
  background: var(--clr-primary-hover);
  border-color: var(--clr-primary-hover);
  box-shadow: 0 4px 12px rgba(59,130,246,.35);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-color: var(--clr-border);
}
.btn-secondary:hover {
  background: var(--clr-surface-3);
  border-color: var(--clr-border-light);
  text-decoration: none;
  color: var(--clr-text);
}

.btn-outline {
  background: transparent;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}
.btn-outline:hover {
  background: var(--clr-primary-dim);
  text-decoration: none;
  color: var(--clr-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  text-decoration: none;
}

.btn-danger {
  background: var(--clr-danger);
  color: #fff;
  border-color: var(--clr-danger);
  box-shadow: 0 1px 3px rgba(239,68,68,.3);
}
.btn-danger:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(239,68,68,.35);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.btn-success { background: var(--clr-success); color: #052e16; border-color: var(--clr-success); }
.btn-warning { background: var(--clr-warning); color: #1c0f00; border-color: var(--clr-warning); }

.btn .btn-spinner {
  width: 14px; height: 14px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  animation: slideUp var(--dur-slow) var(--ease-out) both;
}

[data-theme="light"] .card {
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--clr-border);
}
.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.3;
}
.card-subtitle { font-size: var(--text-sm); color: var(--clr-text-muted); margin-top: var(--sp-1); }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--clr-border);
}

/* Variants */
.card-elevated { box-shadow: var(--shadow); }
.card-primary  {
  border-color: rgba(59,130,246,.25);
  background: linear-gradient(135deg, var(--clr-surface) 0%, var(--clr-primary-dim) 100%);
}
.card-glass {
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] .card-glass {
  background: rgba(255,255,255,.7);
}
.card-clickable {
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
}
.card-clickable:hover {
  border-color: var(--clr-border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Stat card */
.stat-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.stat-card .stat-icon-wrap {
  width: 40px; height: 40px;
  border-radius: var(--radius-lg);
  display: grid; place-items: center;
  background: var(--clr-primary-dim);
  color: var(--clr-primary);
}
.stat-card .stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1;
}
.stat-card .stat-label { font-size: var(--text-sm); color: var(--clr-text-muted); }
.stat-card .stat-change {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-xs); font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-full);
}
.stat-card .stat-change.up   { background: var(--clr-success-dim); color: var(--clr-success); }
.stat-card .stat-change.down { background: var(--clr-danger-dim);  color: var(--clr-danger); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: .01em;
}

.badge-default  { background: var(--clr-surface-3);    color: var(--clr-text-muted); border-color: var(--clr-border-light); }
.badge-primary  { background: var(--clr-primary-dim);  color: var(--clr-primary);    border-color: rgba(59,130,246,.2); }
.badge-success  { background: var(--clr-success-dim);  color: var(--clr-success);    border-color: rgba(34,197,94,.2); }
.badge-warning  { background: var(--clr-warning-dim);  color: var(--clr-warning);    border-color: rgba(245,158,11,.2); }
.badge-danger   { background: var(--clr-danger-dim);   color: var(--clr-danger);     border-color: rgba(239,68,68,.2); }
.badge-info     { background: var(--clr-info-dim);     color: var(--clr-info);       border-color: rgba(6,182,212,.2); }

.badge-solid-primary  { background: var(--clr-primary);  color: #fff; }
.badge-solid-success  { background: var(--clr-success);  color: #052e16; }
.badge-solid-warning  { background: var(--clr-warning);  color: #1c0f00; }
.badge-solid-danger   { background: var(--clr-danger);   color: #fff; }
.badge-solid-info     { background: var(--clr-info);     color: #0a1a22; }

/* ── Form Inputs ──────────────────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label  { font-size: var(--text-sm); font-weight: 500; color: var(--clr-text); }
.form-label .required { color: var(--clr-danger); margin-left: 2px; }
.form-hint   { font-size: var(--text-xs); color: var(--clr-text-muted); }
.form-error  { font-size: var(--text-xs); color: var(--clr-danger); display: flex; align-items: center; gap: 4px; }

.input {
  width: 100%;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  color: var(--clr-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 0 var(--sp-3);
  height: 36px;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  line-height: 1;
}
[data-theme="light"] .input { background: #ffffff; }
.input::placeholder    { color: var(--clr-text-faint); }
.input:hover           { border-color: var(--clr-border-light); }
.input:focus           { border-color: var(--clr-primary); box-shadow: 0 0 0 3px var(--clr-primary-dim); }
.input.error           { border-color: var(--clr-danger); box-shadow: 0 0 0 3px var(--clr-danger-dim); }
.input:disabled        { opacity: .5; cursor: not-allowed; }
.input-sm              { height: 30px; font-size: var(--text-xs); padding: 0 var(--sp-2); }
.input-lg              { height: 42px; font-size: var(--text-base); padding: 0 var(--sp-4); }

.input-wrapper { position: relative; }
.input-wrapper .input-icon-left,
.input-wrapper .input-icon-right {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--clr-text-faint); pointer-events: none;
}
.input-wrapper .input-icon-left  { left: var(--sp-3); }
.input-wrapper .input-icon-right { right: var(--sp-3); }
.input-wrapper .input.has-left   { padding-left:  calc(var(--sp-3) + 20px + var(--sp-2)); }
.input-wrapper .input.has-right  { padding-right: calc(var(--sp-3) + 20px + var(--sp-2)); }

textarea.input {
  height: auto;
  min-height: 90px;
  padding: var(--sp-2) var(--sp-3);
  resize: vertical;
  line-height: 1.6;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-8);
  cursor: pointer;
}

/* Toggle */
.toggle-wrapper { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.toggle-track {
  position: relative; width: 40px; height: 22px;
  background: var(--clr-surface-3); border-radius: var(--radius-full);
  border: 1px solid var(--clr-border); transition: all var(--dur-base);
}
.toggle-track.on { background: var(--clr-primary); border-color: var(--clr-primary); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform var(--dur-base) var(--ease-snap);
}
.toggle-track.on .toggle-thumb { transform: translateX(18px); }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  background: var(--clr-surface);
}
[data-theme="light"] .table-wrapper { background: #fff; box-shadow: var(--shadow-sm); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
  white-space: nowrap;
}
[data-theme="light"] .table th { background: var(--clr-surface-2); }
.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--clr-surface-2); }
[data-theme="light"] .table tbody tr:hover { background: var(--clr-surface-2); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  line-height: 1.5;
}
.alert-icon { flex-shrink: 0; margin-top: 2px; }
.alert-title { font-weight: 600; margin-bottom: var(--sp-1); }

.alert-info    { background: var(--clr-info-dim);    border-color: rgba(6,182,212,.2);    color: var(--clr-info); }
.alert-success { background: var(--clr-success-dim); border-color: rgba(34,197,94,.2);    color: var(--clr-success); }
.alert-warning { background: var(--clr-warning-dim); border-color: rgba(245,158,11,.2);   color: var(--clr-warning); }
.alert-danger  { background: var(--clr-danger-dim);  border-color: rgba(239,68,68,.2);    color: var(--clr-danger); }

/* ── Modals / Dialogs ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn var(--dur-base) var(--ease-out);
}
.modal {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--dur-slow) var(--ease-out);
}
[data-theme="light"] .modal { background: #fff; }
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-6) var(--sp-5);
  border-bottom: 1px solid var(--clr-border);
}
.modal-title  { font-size: var(--text-lg); font-weight: 600; letter-spacing: -.02em; }
.modal-body   { padding: var(--sp-6); }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  border-top: 1px solid var(--clr-border);
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  width: 360px;
  max-width: calc(100vw - var(--sp-8));
}
.toast {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  pointer-events: all;
  animation: slideDown var(--dur-slow) var(--ease-out);
  font-size: var(--text-sm);
}
[data-theme="light"] .toast { background: #fff; }
.toast-success { border-left: 3px solid var(--clr-success); }
.toast-error   { border-left: 3px solid var(--clr-danger); }
.toast-warning { border-left: 3px solid var(--clr-warning); }
.toast-info    { border-left: 3px solid var(--clr-info); }
.toast-icon    { flex-shrink: 0; margin-top: 1px; }
.toast-title   { font-weight: 600; line-height: 1.3; }
.toast-message { color: var(--clr-text-muted); line-height: 1.4; margin-top: 2px; font-size: var(--text-xs); }

/* ── Dropdown Menus ───────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-flex;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  min-width: 180px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-1);
  z-index: 200;
  animation: slideDown var(--dur-base) var(--ease-out);
}
[data-theme="light"] .dropdown-menu { background: #fff; }
.dropdown-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  font-size: var(--text-sm); color: var(--clr-text);
  cursor: pointer; transition: background var(--dur-fast);
  border: none; background: none; width: 100%; text-align: left;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--clr-surface-2); text-decoration: none; color: var(--clr-text); }
.dropdown-item.danger { color: var(--clr-danger); }
.dropdown-item.danger:hover { background: var(--clr-danger-dim); }
.dropdown-separator {
  height: 1px; background: var(--clr-border);
  margin: var(--sp-1) 0;
}
.dropdown-label {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--clr-text-faint);
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress {
  height: 6px; background: var(--clr-surface-3);
  border-radius: var(--radius-full); overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--clr-primary);
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease-out);
}
.progress-bar.success { background: var(--clr-success); }
.progress-bar.warning { background: var(--clr-warning); }
.progress-bar.danger  { background: var(--clr-danger); }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--sp-4);
  padding: var(--sp-16) var(--sp-8); text-align: center;
  color: var(--clr-text-muted);
}
.empty-state-icon {
  width: 52px; height: 52px;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  display: grid; place-items: center;
  color: var(--clr-text-faint);
}
.empty-state-title { font-size: var(--text-base); font-weight: 600; color: var(--clr-text); }
.empty-state-text  { font-size: var(--text-sm); max-width: 320px; line-height: 1.6; }

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
  display: inline-block;
  border: 2px solid var(--clr-surface-3);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; }
.spinner-md { width: 24px; height: 24px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: var(--sp-6);
}
.tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--clr-text-muted);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  text-decoration: none;
}
.tab:hover { color: var(--clr-text); text-decoration: none; }
.tab.active { color: var(--clr-primary); border-bottom-color: var(--clr-primary); font-weight: 600; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: var(--sp-1);
}
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 var(--sp-2);
  border-radius: var(--radius); border: 1px solid var(--clr-border);
  background: var(--clr-surface-2); color: var(--clr-text-muted);
  font-size: var(--text-sm); cursor: pointer;
  transition: all var(--dur-fast); text-decoration: none;
}
.page-btn:hover  { border-color: var(--clr-border-light); color: var(--clr-text); text-decoration: none; }
.page-btn.active { background: var(--clr-primary); border-color: var(--clr-primary); color: #fff; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: calc(100% + 6px);
  white-space: nowrap;
  background: var(--clr-surface-4);
  color: var(--clr-text);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-base);
  z-index: 500;
}
[data-tooltip]:hover::after { opacity: 1; }
