/* ==========================================================================
   MoreData Admin — design system
   Light theme on :root, dark theme on body.dark-theme (toggled in parent.js)
   ========================================================================== */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-ring: rgba(37, 99, 235, 0.25);

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-on-primary: #ffffff;

  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.25);

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;
}

body.dark-theme {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --primary-ring: rgba(59, 130, 246, 0.35);

  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #161d2d;
  --surface-hover: #1c2436;
  --border: #232c3f;
  --border-strong: #334055;

  --text: #f3f4f6;
  --text-2: #c2c8d3;
  --text-3: #8b95a7;

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { 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);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; }

.material-symbols-rounded {
  font-size: 20px;
  line-height: 1;
  user-select: none;
  vertical-align: middle;
}

.clickable { cursor: pointer; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.6);
}

.brand-text { display: flex; flex-direction: column; white-space: nowrap; transition: opacity 0.2s; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }

.sidebar.collapsed .brand-text { opacity: 0; pointer-events: none; }

.sidebar-content {
  flex: 1;
  padding: 16px 12px;
  overflow: hidden auto;
  scrollbar-width: thin;
}

.menu-section {
  padding: 0 10px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  white-space: nowrap;
  transition: opacity 0.2s;
}
.sidebar.collapsed .menu-section { opacity: 0; }

.menu-list, .submenu-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.menu-link, .submenu-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.menu-link:hover, .submenu-link:hover { background: var(--surface-hover); color: var(--text); }

.menu-link.active, .submenu-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.menu-link.active > .material-symbols-rounded:first-child { font-variation-settings: "FILL" 1; }

.menu-label { transition: opacity 0.2s; }
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-chevron { opacity: 0; pointer-events: none; }

.menu-chevron { margin-left: auto; font-size: 18px; transition: transform 0.2s, opacity 0.2s; }
.menu-chevron-open { transform: rotate(180deg); }

.submenu-list {
  margin: 2px 0 4px 22px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.submenu-link { padding: 7px 12px; font-size: 13.5px; }
.sidebar.collapsed .submenu-list { display: none; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .menu-link { width: 100%; border: 0; background: none; text-align: left; }
.sidebar-footer .menu-link:hover { background: var(--danger-soft); color: var(--danger); }

.sidebar-backdrop { display: none; }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.25s ease;
}
.main.sidebar-collapsed { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-crumb { color: var(--text-3); font-weight: 500; }
.topbar-spacer { flex: 1; }

.content {
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ---------- Page ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title { font-size: 22px; font-weight: 700; line-height: 1.25; }
.page-subtitle { margin-top: 4px; color: var(--text-3); }

.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn .material-symbols-rounded { font-size: 18px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--text-on-primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn-block { width: 100%; height: 42px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .material-symbols-rounded { font-size: 18px; }
.icon-btn.danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

/* Legacy button classes */
.com-buttton, .comp-export-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border: 0; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 500;
}

/* ---------- Form controls ---------- */
.field { margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }

.input, .select, .vas-select-fields-mini {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .vas-select-fields-mini:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input.form-invalid { border-color: var(--danger); }
.input.form-invalid:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

.select, .vas-select-fields-mini {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  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='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.vas-select-fields-mini { width: auto; min-width: 150px; height: 38px; }

.input-group { position: relative; }
.input-group .input { padding-right: 42px; }
.input-group .input-addon {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; background: none; color: var(--text-3); border-radius: 6px;
}
.input-group .input-addon:hover { color: var(--text); background: var(--surface-hover); }

.invalid-feedback, .card-modal-error {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
}

/* Custom dropdown (dropdown-select directive) */
dropdown-select { display: inline-block; }
.dropdown { position: relative; }

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.dropdown-trigger:hover { background: var(--surface-hover); }
.dropdown.open .dropdown-trigger { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

.dropdown-label { color: var(--text-3); padding-right: 8px; border-right: 1px solid var(--border); }
.dropdown-value { font-weight: 500; }
.dropdown-chevron { font-size: 18px; color: var(--text-3); transition: transform 0.2s; }
.dropdown.open .dropdown-chevron { transform: rotate(180deg); }

.dropdown-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 100%;
  width: max-content;
  padding: 4px;
  list-style: none;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.14s ease;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 160px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
}
.dropdown-option:hover { background: var(--surface-hover); color: var(--text); }
.dropdown-option.selected { color: var(--text); font-weight: 500; }
.dropdown-option-text { flex: 1; }
.dropdown-check { font-size: 18px; color: var(--primary); }

/* Search */
.search-container { width: 280px; max-width: 100%; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-box .material-symbols-rounded {
  position: absolute; left: 10px; color: var(--text-3); font-size: 18px; pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------- Tables ---------- */
.sup-table-responsive {
  position: relative;
  width: 100%;
  overflow-x: auto;
  min-height: 240px;
}

.sup-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.sup-table thead th {
  position: sticky;
  top: 0;
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sup-table tbody td {
  padding: 13px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

.sup-table tbody tr:last-child td { border-bottom: 0; }
.sup-table tbody tr { transition: background 0.12s; }
.sup-table tbody tr:hover td { background: var(--surface-hover); }

.cell-muted { color: var(--text-3) !important; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.cell-strong { font-weight: 600; }
.cell-actions { display: flex; align-items: center; gap: 2px; }

.customers-loading-wrapper {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.table-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 48px 16px;
  text-align: center;
}
.table-empty-icon {
  font-size: 28px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  margin-bottom: 8px;
  border-radius: 50%;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.table-empty-title { font-weight: 600; }
.table-empty-subtitle { color: var(--text-3); font-size: 13px; }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.table-pagination-controls { display: flex; gap: 6px; }
.table-pagination-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.table-pagination-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.table-pagination-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card-action-disabled { color: var(--text-3); opacity: 0.4; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-hover);
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.success-badge { color: var(--success); background: var(--success-soft); }
.error-badge   { color: var(--danger);  background: var(--danger-soft); }
.warning-badge { color: var(--warning); background: var(--warning-soft); }
.info-badge    { color: var(--info);    background: var(--info-soft); }

.chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* ---------- Stat / card-type grid ---------- */
.card-type-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card-type-item {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-type-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

.card-type-icon-wrap {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
}

.card-type-name { flex: 1; font-size: 16px; font-weight: 600; }

.card-type-edit-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-3);
}
.card-type-edit-btn:hover { color: var(--primary); border-color: var(--primary); }
.card-type-edit-btn .material-symbols-rounded { font-size: 17px; }

.card-type-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
}
.card-type-stat { padding: 12px 14px; background: var(--surface-2); }
.card-type-stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.card-type-stat-value { font-size: 16px; font-weight: 600; min-height: 22px; font-variant-numeric: tabular-nums; }

/* Shimmer */
.shimmer {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border) 37%, var(--surface-hover) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.shimmer-text  { width: 80px; height: 14px; }
.shimmer-badge { width: 64px; height: 20px; border-radius: 999px; }
.shimmer-icon  { width: 42px; height: 42px; border-radius: 10px; }
.shimmer-title { width: 100px; height: 16px; }
.shimmer-label { width: 60px; height: 11px; margin-bottom: 6px; }

/* ---------- Modals ---------- */
.card-modal-overlay, .popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.15s ease;
}
.card-modal-overlay.ng-hide, .popup-overlay.ng-hide { display: none !important; }

.card-modal {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.18s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.card-modal-header { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 0; }
.card-modal-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
}
.card-modal-icon-danger { color: var(--danger); background: var(--danger-soft); }
.card-modal-header-text { flex: 1; min-width: 0; }
.card-modal-title { font-size: 16px; font-weight: 600; }
.card-modal-subtitle { margin-top: 2px; font-size: 13px; color: var(--text-3); }
.card-modal-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: none; color: var(--text-3);
}
.card-modal-close:hover { background: var(--surface-hover); color: var(--text); }

.card-modal-body { padding: 20px; }
.card-modal-field { margin-bottom: 16px; }
.card-modal-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }

.card-modal-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card-modal-input::placeholder { color: var(--text-3); }
.card-modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

.card-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.card-modal-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 500;
  transition: background 0.15s, filter 0.15s;
}
.card-modal-btn .material-symbols-rounded { font-size: 18px; }
.card-modal-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.card-modal-btn-primary { background: var(--primary); color: #fff; }
.card-modal-btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.card-modal-btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.card-modal-btn-secondary:hover { background: var(--surface-hover); }
.card-modal-btn-danger { background: var(--danger); color: #fff; }
.card-modal-btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

/* Segmented control */
.segmented-control {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.segmented-option {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-weight: 500;
}
.segmented-option.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* File drop */
.file-drop-zone {
  padding: 28px 16px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
.file-drop-icon { font-size: 34px; color: var(--primary); margin-bottom: 6px; }
.file-drop-title { font-weight: 600; }
.file-drop-subtitle { font-size: 13px; color: var(--text-3); }
.file-drop-selected { display: flex; align-items: center; justify-content: center; gap: 8px; }
.file-drop-selected .material-symbols-rounded:first-child { color: var(--primary); }
.file-drop-filename { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-drop-remove { color: var(--text-3); border-radius: 6px; padding: 2px; }
.file-drop-remove:hover { color: var(--danger); background: var(--danger-soft); }
.file-drop-hint { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.sample-csv-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-weight: 500; cursor: pointer; }
.sample-csv-link .material-symbols-rounded { font-size: 16px; }
.sample-csv-link:hover { text-decoration: underline; }

/* ---------- Settings ---------- */
.settings-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.settings-tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 0; border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-weight: 500;
}
.settings-tab-btn .material-symbols-rounded { font-size: 18px; }
.settings-tab-btn:hover { color: var(--text); }
.settings-tab-btn.active { background: var(--primary-soft); color: var(--primary); }

.settings-tab-panel { display: flex; flex-direction: column; gap: 12px; }
.settings-tab-panel.ng-hide { display: none !important; }

.settings-section-label {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.settings-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.settings-card-icon-wrap {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 10px;
}
.settings-icon-blue  { color: var(--primary); background: var(--primary-soft); }
.settings-icon-green { color: var(--success); background: var(--success-soft); }
.settings-icon-purple { color: var(--violet); background: var(--violet-soft); }

.settings-card-body {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.settings-card-info { flex: 1 1 260px; min-width: 0; }
.settings-card-title-row { display: flex; align-items: center; gap: 8px; }
.settings-card-title { font-weight: 600; font-size: 15px; }
.settings-card-desc { margin-top: 2px; color: var(--text-3); font-size: 13px; }
.settings-card-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.settings-status-pill {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.pill-on  { color: var(--success); background: var(--success-soft); }
.pill-off { color: var(--text-3); background: var(--surface-hover); }

.settings-toggle { position: relative; display: inline-flex; cursor: pointer; }
.settings-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.settings-toggle-track {
  position: relative;
  width: 42px; height: 24px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.2s;
}
.settings-toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.settings-toggle input:checked ~ .settings-toggle-track { background: var(--primary); }
.settings-toggle input:checked ~ .settings-toggle-track .settings-toggle-thumb { transform: translateX(18px); }
.settings-toggle input:focus-visible ~ .settings-toggle-track { box-shadow: 0 0 0 3px var(--primary-ring); }

.settings-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border: 0; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-weight: 500;
  transition: background 0.15s;
}
.settings-action-btn .material-symbols-rounded { font-size: 18px; }
.settings-action-btn:hover:not(:disabled) { background: var(--primary-hover); }
.settings-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.settings-action-btn-green { background: var(--success); }
body:not(.dark-theme) .settings-action-btn-green:hover:not(:disabled) { background: #047857; }
body.dark-theme .settings-action-btn-green { color: #052e1f; }

.settings-ussd-chip {
  padding: 1px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; font-weight: 600;
}
.settings-ussd-chip-green { color: var(--success); background: var(--success-soft); }

.settings-provider-active {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 13px; color: var(--text-2);
}
.settings-provider-active .material-symbols-rounded { font-size: 18px; color: var(--success); font-variation-settings: "FILL" 1; }

.settings-provider-select-wrap { position: relative; display: flex; align-items: center; }
.settings-provider-select-icon { position: absolute; left: 10px; font-size: 18px; color: var(--text-3); pointer-events: none; }
.settings-provider-select {
  height: 38px;
  min-width: 200px;
  padding: 0 34px 0 36px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface) 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='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; -webkit-appearance: none;
  outline: none;
}
.settings-provider-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------- Auth ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--primary-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--violet-soft), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-title { font-size: 22px; font-weight: 700; }
.auth-subtitle { margin: 4px 0 24px; color: var(--text-3); }
.auth-footer { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ---------- Toasts ---------- */
.notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  width: 380px;
  max-width: calc(100vw - 32px);
}

.notifications .toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

.toast .column { display: flex; align-items: flex-start; gap: 12px; }
.toast .column i { font-size: 18px; margin-top: 1px; }
.toast .column span { font-size: 14px; font-weight: 500; }
.toast > .fa-xmark { color: var(--text-3); cursor: pointer; padding: 2px; }
.toast > .fa-xmark:hover { color: var(--text); }

.toast::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 3px; width: 100%;
  animation: toast-progress 5s linear forwards;
}
@keyframes toast-progress { to { width: 0; } }

.toast.success .column i { color: var(--success); }
.toast.error   .column i { color: var(--danger); }
.toast.warning .column i { color: var(--warning); }
.toast.info    .column i { color: var(--info); }
.toast.success::after { background: var(--success); }
.toast.error::after   { background: var(--danger); }
.toast.warning::after { background: var(--warning); }
.toast.info::after    { background: var(--info); }

/* ---------- Utilities ---------- */
.mobile-only { display: none !important; }
.text-muted { color: var(--text-3); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .mobile-only { display: inline-grid !important; }
  .sidebar-collapse-btn { display: none; }

  .sidebar { width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  .sidebar.collapsed { width: var(--sidebar-w); transform: translateX(-100%); box-shadow: none; }
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .menu-label,
  .sidebar.collapsed .menu-section { opacity: 1; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 14, 22, 0.5);
    animation: fade-in 0.2s ease;
  }
  .sidebar-backdrop.ng-hide { display: none !important; }

  .main, .main.sidebar-collapsed { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px; }

  .page-title { font-size: 20px; }
  .page-header { align-items: flex-start; }
  .search-container { width: 100%; }
  .panel-toolbar-group dropdown-select { margin-left: auto; }
  .panel-toolbar-group { width: 100%; }
  .settings-card { flex-direction: column; }
  .settings-provider-select { min-width: 0; width: 100%; }
  .settings-provider-select-wrap { flex: 1; }
  .auth-card { padding: 24px; }
}

@media (min-width: 769px) {
  .sidebar-collapse-btn .material-symbols-rounded { transition: transform 0.25s; }
  .main.sidebar-collapsed .sidebar-collapse-btn .material-symbols-rounded { transform: rotate(180deg); }
}
