/* ==========================================================================
   DGA CRM design system
   Themes: data-theme="light|dark" · Accents: data-accent · Sidebar: data-sidebar="dark|light|brand"
   Density: data-density="comfortable|compact" · RTL via dir="rtl" (logical properties throughout)
   ========================================================================== */

:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Devanagari', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --accent: #4f46e5;
  --accent-hover: color-mix(in srgb, var(--accent) 88%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 85%, #000);
  --on-accent: #ffffff;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --hover: #f3f4f8;
  --border: #e6e8ef;
  --border-strong: #d4d8e2;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8a94a8;

  --success: #10b981; --success-soft: #ecfdf5; --success-text: #047857;
  --warning: #f59e0b; --warning-soft: #fffbeb; --warning-text: #b45309;
  --danger: #ef4444;  --danger-soft: #fef2f2;  --danger-text: #b91c1c;
  --info: #0ea5e9;    --info-soft: #f0f9ff;    --info-text: #0369a1;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .18), 0 8px 16px -8px rgba(16, 24, 40, .08);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 62px;
  --content-pad: 28px;
  --control-h: 40px;
  --cell-py: 12px;

  --sidebar-bg: #0e1424;
  --sidebar-bg-2: #141b2e;
  --sidebar-text: #c7cede;
  --sidebar-muted: #6f7a93;
  --sidebar-hover: rgba(255, 255, 255, .06);
  --sidebar-active-bg: color-mix(in srgb, var(--accent) 26%, transparent);
  --sidebar-active-text: #ffffff;
  --sidebar-border: rgba(255, 255, 255, .06);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #121829;
  --surface-2: #161d31;
  --surface-3: #1b2339;
  --hover: #1a2136;
  --border: #242d45;
  --border-strong: #313b57;
  --text: #e7ebf3;
  --text-2: #a9b3c7;
  --text-3: #6f7a93;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 28%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
  --success-soft: rgba(16, 185, 129, .12); --success-text: #34d399;
  --warning-soft: rgba(245, 158, 11, .12); --warning-text: #fbbf24;
  --danger-soft: rgba(239, 68, 68, .12);  --danger-text: #f87171;
  --info-soft: rgba(14, 165, 233, .12);   --info-text: #38bdf8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  --sidebar-bg: #0a0f1d;
  --sidebar-bg-2: #0f1526;
  color-scheme: dark;
}

/* Accent palette */
[data-accent="indigo"]  { --accent: #4f46e5; }
[data-accent="blue"]    { --accent: #2563eb; }
[data-accent="sky"]     { --accent: #0284c7; }
[data-accent="cyan"]    { --accent: #0891b2; }
[data-accent="teal"]    { --accent: #0d9488; }
[data-accent="emerald"] { --accent: #059669; }
[data-accent="green"]   { --accent: #16a34a; }
[data-accent="amber"]   { --accent: #d97706; }
[data-accent="orange"]  { --accent: #ea580c; }
[data-accent="rose"]    { --accent: #e11d48; }
[data-accent="pink"]    { --accent: #db2777; }
[data-accent="fuchsia"] { --accent: #c026d3; }
[data-accent="violet"]  { --accent: #7c3aed; }
[data-accent="slate"]   { --accent: #475569; }
[data-theme="dark"][data-accent="slate"] { --accent: #94a3b8; --on-accent: #0b1020; }

/* Sidebar styles */
[data-sidebar="light"] {
  --sidebar-bg: var(--surface);
  --sidebar-bg-2: var(--surface-2);
  --sidebar-text: var(--text-2);
  --sidebar-muted: var(--text-3);
  --sidebar-hover: var(--hover);
  --sidebar-active-bg: var(--accent-soft);
  --sidebar-active-text: var(--accent-text);
  --sidebar-border: var(--border);
}
[data-sidebar="brand"] {
  --sidebar-bg: color-mix(in srgb, var(--accent) 92%, #000);
  --sidebar-bg-2: color-mix(in srgb, var(--accent) 80%, #000);
  --sidebar-text: rgba(255, 255, 255, .86);
  --sidebar-muted: rgba(255, 255, 255, .55);
  --sidebar-hover: rgba(255, 255, 255, .1);
  --sidebar-active-bg: rgba(255, 255, 255, .18);
  --sidebar-active-text: #fff;
  --sidebar-border: rgba(255, 255, 255, .12);
}

[data-density="compact"] {
  --content-pad: 18px;
  --control-h: 34px;
  --cell-py: 8px;
  --topbar-h: 54px;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 2px 6px; border-radius: 5px; color: var(--text); }
pre { background: var(--surface-3); padding: 14px; border-radius: var(--radius); overflow: auto; }
::selection { background: var(--accent-soft-2); }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.icon-sm .icon, .icon.icon-sm { width: 15px; height: 15px; }
[hidden] { display: none !important; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }

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

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-inline-end: 1px solid var(--sidebar-border);
  transition: width .2s ease, transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ec4899));
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--accent) 60%, transparent);
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; background: transparent; }
.brand-name { font-weight: 700; font-size: 16px; color: var(--sidebar-active-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
[data-sidebar="light"] .brand-name { color: var(--text); }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-section { margin-bottom: 6px; }
.nav-section-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--sidebar-muted); padding: 14px 12px 6px; white-space: nowrap;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-weight: 500; font-size: 13.5px;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  transition: background .15s, color .15s;
  border: 0; background: none; width: 100%; text-align: start; font-family: inherit;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-active-text); text-decoration: none; }
.nav-link .icon { width: 19px; height: 19px; flex: 0 0 19px; opacity: .9; }
.nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.nav-link.active::before {
  content: ''; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
[dir="rtl"] .nav-link.active::before { border-radius: 3px 0 0 3px; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.nav-caret { transition: transform .2s; width: 15px !important; height: 15px !important; opacity: .6; }
.nav-group.open > .nav-link .nav-caret { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 4px; }
.nav-group.open > .nav-sub { display: block; }
.nav-sub a {
  display: flex; align-items: center; padding: 7px 12px 7px 40px; border-radius: 8px;
  color: var(--sidebar-text); opacity: .85; font-size: 13px; white-space: nowrap;
}
[dir="rtl"] .nav-sub a { padding: 7px 43px 7px 12px; }
.nav-sub a:hover { background: var(--sidebar-hover); opacity: 1; text-decoration: none; color: var(--sidebar-active-text); }
.nav-sub a.active { color: var(--sidebar-active-text); opacity: 1; font-weight: 600; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--sidebar-text); }
.sidebar-user:hover { background: var(--sidebar-hover); text-decoration: none; }
.sidebar-user .name { color: var(--sidebar-active-text); font-weight: 600; font-size: 13px; line-height: 1.2; }
[data-sidebar="light"] .sidebar-user .name { color: var(--text); }
.sidebar-user .role { font-size: 11.5px; color: var(--sidebar-muted); }

.app-main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; transition: margin .2s ease; }

/* Collapsed sidebar (desktop) */
@media (min-width: 992px) {
  .sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .app-main { margin-inline-start: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .brand-name, .sidebar-collapsed .brand-sub, .sidebar-collapsed .nav-label,
  .sidebar-collapsed .nav-caret, .sidebar-collapsed .nav-section-title, .sidebar-collapsed .sidebar-user > div,
  .sidebar-collapsed .nav-badge { display: none; }
  .sidebar-collapsed .nav-link { justify-content: center; padding: 10px; }
  .sidebar-collapsed .nav-section { border-top: 1px solid var(--sidebar-border); padding-top: 6px; }
  .sidebar-collapsed .nav-section:first-child { border-top: 0; }
  .sidebar-collapsed .nav-group.open > .nav-sub { display: none; }
  .sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-collapsed .sidebar-user { justify-content: center; }
  .sidebar-collapsed .sidebar:hover { width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  .sidebar-collapsed .sidebar:hover .brand-name, .sidebar-collapsed .sidebar:hover .nav-label,
  .sidebar-collapsed .sidebar:hover .nav-caret, .sidebar-collapsed .sidebar:hover .nav-section-title,
  .sidebar-collapsed .sidebar:hover .sidebar-user > div, .sidebar-collapsed .sidebar:hover .nav-badge { display: revert; }
  .sidebar-collapsed .sidebar:hover .nav-link { justify-content: flex-start; padding: 9px 12px; }
  .sidebar-collapsed .sidebar:hover .sidebar-brand { justify-content: flex-start; padding: 0 18px; }
  .sidebar-collapsed .sidebar:hover .nav-group.open > .nav-sub { display: block; }
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--content-pad);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-search {
  display: flex; align-items: center; gap: 10px;
  height: 38px; min-width: 280px; max-width: 420px; flex: 0 1 420px;
  padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-3);
  cursor: pointer; font-size: 13.5px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search kbd { margin-inline-start: auto; }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  background: var(--surface); color: var(--text-3);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-grid; place-items: center;
  border: 0; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.icon-btn .icon { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: 6px; inset-inline-end: 6px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 10px; cursor: pointer; border: 0; background: none; color: var(--text); font-family: inherit; }
.topbar-user:hover { background: var(--hover); }
.topbar-user .u-name { font-weight: 600; font-size: 13px; }
.mobile-only { display: none; }

.content { padding: var(--content-pad); flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; }
.content-narrow { max-width: 980px; }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 750; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.page-subtitle { color: var(--text-2); margin-top: 4px; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumbs { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-2); }
.breadcrumbs .icon { width: 13px; height: 13px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--text-3); }
.card-subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 16px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-flush .card-body { padding: 0; }
.card + .card { margin-top: 20px; }
.card-hover { transition: box-shadow .2s, transform .2s, border-color .2s; }
.card-hover:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat-card { padding: 18px 20px; position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.stat-icon.green { background: var(--success-soft); color: var(--success-text); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning-text); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger-text); }
.stat-icon.blue { background: var(--info-soft); color: var(--info-text); }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-meta { margin-top: 8px; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 1px 7px; border-radius: 20px; }
.trend.up { color: var(--success-text); background: var(--success-soft); }
.trend.down { color: var(--danger-text); background: var(--danger-soft); }
.trend .icon { width: 13px; height: 13px; }

/* ------------------------------------------------------------------ grid & utilities */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; }
.grid-sidebar-left { grid-template-columns: 300px minmax(0, 1fr); }
.widgets-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.w-full { grid-column: span 12; } .w-half { grid-column: span 6; } .w-third { grid-column: span 4; } .w-two-thirds { grid-column: span 8; } .w-quarter { grid-column: span 3; }

.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .justify-center { justify-content: center; }
.flex-1 { flex: 1; min-width: 0; } .flex-wrap { flex-wrap: wrap; } .shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 24px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 20px; } .mt-5 { margin-top: 28px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 20px; } .mb-5 { margin-bottom: 28px; }
.ms-auto { margin-inline-start: auto; } .me-2 { margin-inline-end: 8px; }
.p-0 { padding: 0 !important; } .p-3 { padding: 12px; } .p-4 { padding: 20px; }
.text-muted { color: var(--text-3) !important; } .text-secondary { color: var(--text-2) !important; }
.text-success { color: var(--success-text) !important; } .text-danger { color: var(--danger-text) !important; } .text-warning { color: var(--warning-text) !important; } .text-accent { color: var(--accent-text) !important; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; } .text-lg { font-size: 16px; } .text-xl { font-size: 20px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.text-end { text-align: end; } .text-start { text-align: start; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.w-100 { width: 100%; } .d-block { display: block; } .d-none { display: none; } .d-inline-flex { display: inline-flex; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.link-muted { color: var(--text-2); }
.link-muted:hover { color: var(--accent-text); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--control-h); padding: 0 16px;
  border-radius: 9px; border: 1px solid transparent;
  font-family: inherit; font-size: 13.5px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.07) saturate(1.1); color: var(--on-accent); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--hover); color: var(--text); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-soft:hover { background: var(--accent-soft-2); color: var(--accent-text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger-text); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5b; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs .icon { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 11px; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: 32px; } .btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn.loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-accent) var(--on-accent) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn-secondary.loading::after, .btn-ghost.loading::after, .btn-soft.loading::after { border-color: var(--text-2) var(--text-2) transparent transparent; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-start-start-radius: 9px; border-end-start-radius: 9px; }
.btn-group .btn:last-child { border-start-end-radius: 9px; border-end-end-radius: 9px; }
.btn-group .btn + .btn { margin-inline-start: -1px; }
.btn-group .btn.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--border-strong); z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ badges & chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge-gray { background: var(--surface-3); color: var(--text-2); }
.badge-blue, .badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-green, .badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-amber, .badge-warning, .badge-yellow { background: var(--warning-soft); color: var(--warning-text); }
.badge-red, .badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-accent, .badge-indigo, .badge-purple { background: var(--accent-soft); color: var(--accent-text); }
.badge-dot { background: color-mix(in srgb, var(--bc) 13%, transparent); color: color-mix(in srgb, var(--bc) 80%, var(--text)); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--bc); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500;
  background: color-mix(in srgb, var(--tc, #64748b) 12%, transparent);
  color: color-mix(in srgb, var(--tc, #64748b) 80%, var(--text));
  border: 1px solid color-mix(in srgb, var(--tc, #64748b) 22%, transparent);
}
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 20px; font-size: 12.5px; background: var(--surface); color: var(--text-2); cursor: pointer; }
.chip:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 600; }
.chip .count { font-size: 11px; background: var(--surface-3); padding: 0 6px; border-radius: 10px; }
.chip.active .count { background: var(--surface); }

/* ------------------------------------------------------------------ avatar */
.avatar {
  --av: var(--accent);
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: color-mix(in srgb, var(--av) 16%, var(--surface));
  color: color-mix(in srgb, var(--av) 85%, var(--text));
  font-weight: 700; font-size: 12.5px; overflow: hidden; letter-spacing: .02em;
  border: 2px solid var(--surface);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
td > .avatar, td > .avatar + span, .avatar + .text-sm { vertical-align: middle; } /* picture and name on one line */
.avatar-xs { width: 22px; height: 22px; font-size: 9px; border-width: 1px; }
.avatar-sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-inline-start: -8px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-name { font-weight: 600; color: var(--text); }
a.person-name:hover, .person a:hover .person-name { color: var(--accent-text); }
.person-sub { font-size: 12px; color: var(--text-3); }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 18px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
.form-group { margin-bottom: 16px; min-width: 0; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-help { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.form-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 8px 0 14px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); grid-column: span 12; }
.form-control {
  display: block; width: 100%;
  height: var(--control-h); padding: 0 12px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-xs);
}
.form-control:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.form-control::placeholder { color: var(--text-3); }
.form-control[disabled], .form-control[readonly] { background: var(--surface-2); color: var(--text-2); }
textarea.form-control { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select.form-control {
  appearance: none; -webkit-appearance: none;
  padding-inline-end: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
[dir="rtl"] select.form-control { background-position: left 10px center; }
select.form-control[multiple] { height: auto; min-height: 90px; padding: 6px; background-image: none; }
.form-control-sm { height: 32px; font-size: 13px; padding: 0 10px; border-radius: 8px; }
.form-color { padding: 4px; width: 64px; }
.is-invalid, .form-control.is-invalid { border-color: var(--danger) !important; }
.field-error { color: var(--danger-text); font-size: 12px; margin-top: 4px; }
.field-error:empty { display: none; }
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { border-radius: 0; flex: 1; min-width: 0; }
.input-group > :first-child { border-start-start-radius: 9px; border-end-start-radius: 9px; }
.input-group > :last-child { border-start-end-radius: 9px; border-end-end-radius: 9px; }
.input-group > * + * { margin-inline-start: -1px; }
.input-addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.input-group .btn { border-radius: 0; height: auto; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.input-icon .form-control { padding-inline-start: 36px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 23px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 17px; height: 17px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(17px); }
[dir="rtl"] .switch input:checked + span::before { transform: translateX(-17px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .title { font-weight: 600; }
.switch-row .desc { font-size: 12.5px; color: var(--text-3); }

.radio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.radio-card { position: relative; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card .rc-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 11px; background: var(--surface); transition: .15s; height: 100%; }
.radio-card:hover .rc-body { border-color: var(--border-strong); }
.radio-card input:checked + .rc-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.radio-card .rc-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.radio-card .rc-desc { font-size: 12px; color: var(--text-3); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--sw); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); transition: .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--sw); transform: scale(1.08); }

/* Searchable select enhancement */
.ss { position: relative; }
.ss-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: start; }
.ss-toggle .ss-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ss-toggle .ss-placeholder { color: var(--text-3); }
.ss-toggle .ss-chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; padding: 4px 0; }
.ss-multi .ss-toggle { height: auto; min-height: var(--control-h); }
.ss-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 600; padding: 2px 4px 2px 8px; border-radius: 6px; }
.ss-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }
.ss-menu { position: absolute; z-index: 60; top: calc(100% + 4px); inset-inline: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg); overflow: hidden; }
.ss-search { padding: 8px; border-bottom: 1px solid var(--border); }
.ss-search input { height: 34px; }
.ss-options { max-height: 260px; overflow-y: auto; padding: 4px; }
.ss-option { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ss-option:hover, .ss-option.focus { background: var(--hover); }
.ss-option.selected { color: var(--accent-text); font-weight: 600; }
.ss-option.selected::after { content: '✓'; }
.ss-option .ss-sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.ss-empty { padding: 12px; color: var(--text-3); font-size: 13px; text-align: center; }
.ss-create { border-top: 1px solid var(--border); padding: 8px 12px; font-size: 13px; color: var(--accent-text); cursor: pointer; font-weight: 600; }
.ss-create:hover { background: var(--hover); }

/* Rich text editor */
.rte { border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); overflow: hidden; }
.rte:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rte-toolbar button { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; font-weight: 700; font-family: inherit; display: inline-grid; place-items: center; }
.rte-toolbar button:hover { background: var(--hover); color: var(--text); }
.rte-toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.rte-content { min-height: 180px; padding: 14px; outline: none; line-height: 1.6; overflow-y: auto; max-height: 520px; }
.rte-content:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.rte-source { width: 100%; min-height: 180px; border: 0; padding: 14px; font-family: var(--mono); font-size: 12.5px; background: var(--surface); color: var(--text); resize: vertical; outline: none; }

.merge-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.merge-fields button { font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border: 1px dashed var(--border-strong); border-radius: 6px; background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.merge-fields button:hover { border-color: var(--accent); color: var(--accent-text); }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 12px; padding: 22px;
  text-align: center; color: var(--text-3); cursor: pointer; transition: .15s; background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone .icon { width: 28px; height: 28px; margin-bottom: 6px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: start; font-weight: 600; font-size: 12px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table td { padding: var(--cell-py) 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.selected { background: var(--accent-soft); }
.table .col-check { width: 40px; padding-inline-end: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: end; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table-sm td { padding: 8px 12px; } .table-sm th { padding: 8px 12px; }
.table-borderless td, .table-borderless th { border: 0; background: transparent; }
.sort-link { color: inherit; } .sort-link.active { color: var(--accent-text); } .sort-link:hover { color: var(--text); text-decoration: none; }
.row-actions { display: inline-flex; gap: 2px; opacity: .55; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }
.table-link { font-weight: 600; color: var(--text); }
.table-link:hover { color: var(--accent-text); }

/* Table toolbar / filters */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input-icon { flex: 0 1 300px; }
.toolbar .form-control { height: 36px; font-size: 13.5px; }
.toolbar select.form-control { width: auto; min-width: 140px; }
.bulk-bar { display: none; align-items: center; gap: 10px; padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--accent-text); flex-wrap: wrap; }
.bulk-bar.show { display: flex; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px 0; }
.pagination-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination-info { font-size: 12.5px; color: var(--text-3); padding: 12px 16px; }
.pagination-wrap .pagination-info { padding: 0; }
.pagination { display: flex; gap: 4px; align-items: center; }
.pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 13px; color: var(--text-2); border: 1px solid transparent; }
.pagination a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.pagination .active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.pagination .disabled { opacity: .35; }
.pagination .icon { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ detail lists */
.detail-list { display: flex; flex-direction: column; }
.detail-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.detail-row:last-child { border-bottom: 0; }
.detail-label { width: 40%; max-width: 170px; color: var(--text-3); flex-shrink: 0; }
.detail-value { flex: 1; min-width: 0; word-break: break-word; font-weight: 500; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kv .k { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.kv .v { font-weight: 600; }

/* Profile header */
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-head .title { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin: 0; }
.profile-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; margin-top: 6px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-meta .icon { width: 15px; height: 15px; color: var(--text-3); }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 14px; font-weight: 600; font-size: 13.5px; color: var(--text-2);
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab .icon { width: 16px; height: 16px; }
.tab .count { font-size: 11px; background: var(--surface-3); color: var(--text-2); padding: 1px 7px; border-radius: 10px; }
.tab.active .count { background: var(--accent-soft); color: var(--accent-text); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.card > .tabs { padding: 0 12px; }
.pills { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 10px; }
.pill { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; border: 0; background: none; font-family: inherit; }
.pill:hover { color: var(--text); text-decoration: none; }
.pill.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Settings layout */
.settings-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 1px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: 13.5px; }
.settings-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.settings-nav a.active { background: var(--surface); color: var(--accent-text); font-weight: 600; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.settings-nav .icon { width: 17px; height: 17px; }
.settings-nav .nav-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 14px 12px 6px; }

/* ------------------------------------------------------------------ dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; z-index: 70; top: calc(100% + 6px); inset-inline-end: 0;
  min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: none; transform-origin: top right;
  animation: pop .12s ease-out;
}
.dropdown-menu.left { inset-inline-end: auto; inset-inline-start: 0; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 6px); }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--text); font-size: 13.5px; font-family: inherit; text-align: start; cursor: pointer; white-space: nowrap;
}
.dropdown-item:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.dropdown-item .icon { width: 16px; height: 16px; color: var(--text-3); }
.dropdown-item.danger { color: var(--danger-text); }
.dropdown-item.danger .icon { color: var(--danger-text); }
.dropdown-item.active { color: var(--accent-text); font-weight: 600; }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-header { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }

/* Notifications dropdown */
.notif-menu { width: 380px; padding: 0; max-width: calc(100vw - 24px); }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; }
.notif-item:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .ni-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.notif-item .ni-title { font-weight: 600; line-height: 1.35; }
.notif-item .ni-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.notif-foot { padding: 10px; text-align: center; font-size: 13px; font-weight: 600; }

/* ------------------------------------------------------------------ modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto;
  animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-width: 620px;
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: rise .18s ease-out;
}
.modal-sm { max-width: 440px; } .modal-lg { max-width: 860px; } .modal-xl { max-width: 1140px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 700; margin: 0; }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.modal-body .modal-footer { margin: 22px -22px -22px; }
.modal-body .page-header { display: none; }
.modal-body .card { border: 0; box-shadow: none; }
.modal-body .card-body { padding: 0; }
.modal-body .card-footer { margin: 16px -22px -22px; border-radius: 0 0 var(--radius-xl) var(--radius-xl); justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* Confirm dialog */
.confirm-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--danger-soft); color: var(--danger-text); display: grid; place-items: center; margin-bottom: 14px; }
.confirm-icon .icon { width: 24px; height: 24px; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .4); animation: fade .15s; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100vw); background: var(--surface); z-index: 101; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .2s ease-out; }
.drawer .modal-body { overflow-y: auto; flex: 1; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 200; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 40px); }
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 300px; max-width: 420px; padding: 14px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; animation: rise .2s ease-out;
}
.toast .t-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.toast .t-icon .icon { width: 16px; height: 16px; }
.toast.success .t-icon { background: var(--success-soft); color: var(--success-text); }
.toast.error .t-icon { background: var(--danger-soft); color: var(--danger-text); }
.toast.info .t-icon { background: var(--info-soft); color: var(--info-text); }
.toast.warning .t-icon { background: var(--warning-soft); color: var(--warning-text); }
.toast .t-body { flex: 1; padding-top: 3px; }
.toast .t-close { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 2px; }
.toast.hide { animation: fadeout .25s forwards; }
@keyframes fadeout { to { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------ alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 11px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert-info { background: var(--info-soft); color: var(--info-text); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert ol, .alert ul { margin: 6px 0 0; padding-inline-start: 18px; }

/* ------------------------------------------------------------------ empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .empty-icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty-state .empty-icon .icon { width: 28px; height: 28px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--text-3); max-width: 420px; margin: 0 auto 16px; }

/* ------------------------------------------------------------------ progress */
.progress { height: 7px; background: var(--surface-3); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 10px; transition: width .4s; }
.progress-bar.green { background: var(--success); } .progress-bar.amber { background: var(--warning); } .progress-bar.red { background: var(--danger); }
.progress-ring { --p: 0; --c: var(--accent); width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.progress-ring::before { content: ''; grid-area: 1/1; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); }
.progress-ring span { grid-area: 1/1; z-index: 1; }

/* ------------------------------------------------------------------ timeline / feed */
.timeline { position: relative; padding-inline-start: 26px; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; inset-inline-start: -24px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl-dot.gray { border-color: var(--border-strong); } .tl-dot.green { border-color: var(--success); } .tl-dot.red { border-color: var(--danger); } .tl-dot.amber { border-color: var(--warning); }
.tl-title { font-size: 13.5px; }
.tl-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
a.list-item { color: var(--text); }
a.list-item:hover { background: var(--hover); text-decoration: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notes */
.note { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
.note.pinned { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: color-mix(in srgb, var(--warning) 5%, var(--surface)); }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; }
.note-head strong { color: var(--text); font-weight: 600; }
.note-body { font-size: 13.5px; line-height: 1.6; word-break: break-word; }

/* Files grid */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); position: relative; }
.file-thumb { height: 100px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .icon { width: 32px; height: 32px; }
.file-info { padding: 9px 11px; }
.file-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); display: block; }
.file-meta { font-size: 11px; color: var(--text-3); }
.file-card .file-actions { position: absolute; top: 6px; inset-inline-end: 6px; display: none; gap: 4px; }
.file-card:hover .file-actions { display: flex; }

/* ------------------------------------------------------------------ kanban */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.kanban-col { flex: 0 0 300px; background: var(--surface-3); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); border: 1px solid var(--border); }
.kanban-head { padding: 12px 14px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.kanban-head .k-title { font-weight: 700; font-size: 13.5px; flex: 1; display: flex; align-items: center; gap: 8px; }
.kanban-head .k-count { font-size: 11.5px; font-weight: 700; background: var(--surface); padding: 1px 8px; border-radius: 10px; color: var(--text-2); }
.kanban-head .k-sum { font-size: 12px; color: var(--text-3); width: 100%; margin-top: -2px; }
.kanban-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 10px; }
.kanban-body.drag-over { background: var(--accent-soft); border-radius: 0 0 14px 14px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 12px; cursor: grab; box-shadow: var(--shadow-xs); transition: box-shadow .15s, transform .15s; }
.kanban-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.kanban-card.dragging { opacity: .5; transform: rotate(2deg); }
.kanban-card .kc-title { font-weight: 600; font-size: 13.5px; color: var(--text); display: block; margin-bottom: 4px; }
.kanban-card .kc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 8px; }
.kanban-card .kc-meta .icon { width: 13px; height: 13px; }
.kanban-card .kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .14; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart-tooltip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 8px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; z-index: 5; box-shadow: var(--shadow); transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; }
.chart-tooltip.show { opacity: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-fig { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.donut-center { font-size: 20px; font-weight: 750; color: var(--text); font-family: var(--font); text-align: center; line-height: 1.1; max-width: 220px; word-break: break-word; }
.donut-sub { font-size: 12px; fill: var(--text-3); font-family: var(--font); }
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-list .bl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; }
.bar-list .bl-bar { grid-column: span 2; height: 7px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-list .bl-bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }

/* ------------------------------------------------------------------ command palette */
.cmdk-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); display: flex; justify-content: center; padding: 12vh 16px 16px; animation: fade .12s; }
.cmdk { width: 100%; max-width: 640px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; align-self: flex-start; animation: rise .15s; }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmdk-input input { flex: 1; border: 0; outline: none; font-size: 16px; background: transparent; color: var(--text); font-family: inherit; }
.cmdk-input .icon { color: var(--text-3); width: 20px; height: 20px; }
.cmdk-results { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; color: var(--text); cursor: pointer; }
.cmdk-item:hover, .cmdk-item.focus { background: var(--accent-soft); text-decoration: none; color: var(--text); }
.cmdk-item .ci-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.cmdk-item .ci-icon .icon { width: 16px; height: 16px; }
.cmdk-item .ci-title { font-weight: 600; font-size: 13.5px; }
.cmdk-item .ci-sub { font-size: 12px; color: var(--text-3); }
.cmdk-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }

/* ------------------------------------------------------------------ auth pages */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--surface); }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 48px;
  background: radial-gradient(1200px 600px at 10% 10%, color-mix(in srgb, var(--accent) 85%, #fff) 0%, transparent 60%),
              linear-gradient(135deg, color-mix(in srgb, var(--accent) 95%, #000) 0%, #0b1020 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent); }
.auth-side > * { position: relative; z-index: 1; }
.auth-side h2 { color: #fff; font-size: 34px; letter-spacing: -.03em; line-height: 1.15; max-width: 480px; }
.auth-side p { color: rgba(255,255,255,.78); max-width: 460px; font-size: 15px; }
.auth-features { display: grid; gap: 14px; margin-top: 28px; }
.auth-features div { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.9); }
.auth-features .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.14); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 26px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.auth-brand .brand-name { color: var(--text); font-size: 18px; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; font-size: 12.5px; color: var(--text-3); gap: 10px; flex-wrap: wrap; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }

/* Installer */
.install-page { background: var(--bg); min-height: 100vh; }
.install-wrap { max-width: 860px; margin: 0 auto; padding: 40px 16px; }
.existing-opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; background: var(--surface); }
.existing-opt:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.existing-opt input { margin-top: 4px; }
.install-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.install-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.install-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.install-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-3); padding: 6px 12px 6px 6px; border-radius: 30px; background: var(--surface); border: 1px solid var(--border); }
.install-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 11px; }
.install-steps li.active { color: var(--accent-text); border-color: var(--accent); }
.install-steps li.active span { background: var(--accent); color: #fff; }
.install-steps li.done span { background: var(--success); color: #fff; }
.install-card { padding: 28px; }
.install-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 22px; flex-wrap: wrap; }
.req-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.req-list li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; background: var(--surface-2); font-size: 13.5px; }
.req-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.req-list .ok .req-icon { background: var(--success-soft); color: var(--success-text); }
.req-list .fail .req-icon { background: var(--danger-soft); color: var(--danger-text); }
.req-list .warn .req-icon { background: var(--warning-soft); color: var(--warning-text); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.preset-card { position: relative; cursor: pointer; }
.preset-card input { position: absolute; opacity: 0; }
.preset-body { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); height: 100%; transition: .15s; }
.preset-card:hover .preset-body { border-color: var(--border-strong); }
.preset-card input:checked + .preset-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.preset-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; margin-bottom: 4px; }
.preset-name { font-weight: 700; }
.preset-desc { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.module-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.module-chip { cursor: pointer; }
.module-chip input { display: none; }
.module-chip span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 30px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 500; transition: .15s; }
.module-chip span .icon { width: 15px; height: 15px; }
.module-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.install-done { text-align: center; padding: 20px 0; }
.done-icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; background: var(--success-soft); color: var(--success-text); font-size: 34px; font-weight: 800; }
.install-foot { text-align: center; font-size: 12px; margin-top: 20px; }

/* Module manager cards */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.module-card { display: flex; flex-direction: column; padding: 18px; gap: 12px; }
.module-card .m-head { display: flex; gap: 12px; align-items: flex-start; }
.module-card .m-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.module-card .m-icon .icon { width: 22px; height: 22px; }
.module-card .m-title { font-weight: 700; font-size: 15px; }
.module-card .m-desc { font-size: 12.5px; color: var(--text-2); flex: 1; }
.module-card .m-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.module-card.inactive .m-icon { background: var(--surface-3); color: var(--text-3); }

/* Portal / public pages */
.public-page { background: var(--bg); min-height: 100vh; }
.public-wrap { max-width: 980px; margin: 0 auto; padding: 32px 16px; }
.portal-top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.portal-top-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 20px; }
.portal-content { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }
.portal-shell.has-nav { max-width: 1280px; margin: 0 auto; display: flex; align-items: flex-start; gap: 8px; }
.portal-shell.has-nav .portal-content { flex: 1; min-width: 0; margin: 0; }
.portal-nav { width: 220px; flex-shrink: 0; position: sticky; top: 64px; padding: 28px 0 28px 20px; display: flex; flex-direction: column; gap: 2px; }
.portal-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 14px; }
.portal-nav a .icon { width: 18px; height: 18px; opacity: .8; }
.portal-nav a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.portal-nav a.active { color: var(--accent-text); background: var(--accent-soft); }
.portal-menu-btn { display: none; }
@media (max-width: 860px) {
  .portal-menu-btn { display: inline-flex; }
  .portal-nav { display: none; position: fixed; top: 64px; left: 0; bottom: 0; z-index: 30; background: var(--surface); border-right: 1px solid var(--border); padding: 16px; width: 250px; overflow-y: auto; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.15)); }
  body.portal-nav-open .portal-nav { display: flex; }
}

/* Document (invoice/estimate) preview */
.doc { background: #fff; color: #0f172a; border-radius: 14px; box-shadow: var(--shadow); padding: 48px; max-width: 900px; margin: 0 auto; border: 1px solid var(--border); }
[data-theme="dark"] .doc { background: #fff; color: #0f172a; }
.doc h1, .doc h2, .doc h3 { color: #0f172a; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.doc-logo { max-height: 60px; max-width: 220px; }
.doc-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); margin: 0; text-align: end; }
.doc-meta { text-align: end; font-size: 13px; color: #475569; line-height: 1.8; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; font-size: 13.5px; line-height: 1.65; }
.doc-parties .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8; margin-bottom: 6px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-table th { background: var(--doc-accent, #1c9a86); color: #fff; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; text-align: start; padding: 10px 12px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-table td { padding: 12px; border-bottom: 1px solid #cbd5e1; vertical-align: top; }
.doc-table .num { text-align: end; white-space: nowrap; }
.doc-table .item-desc { font-size: 12.5px; color: #64748b; margin-top: 3px; }
.doc-totals { margin-inline-start: auto; width: 320px; max-width: 100%; margin-top: 16px; font-size: 13.5px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 7px 0; }
.doc-totals .grand { border-top: 2px solid #0f172a; margin-top: 6px; padding-top: 11px; font-size: 17px; font-weight: 800; }
.doc-totals .due { color: #b91c1c; font-weight: 700; }
.doc-notes { margin-top: 32px; font-size: 13px; color: #475569; line-height: 1.65; }
.doc-notes h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.doc-stamp { display: inline-block; padding: 6px 14px; border: 2.5px solid; border-radius: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; transform: rotate(-6deg); }
.doc-stamp.paid { color: #059669; border-color: #059669; }
.doc-stamp.overdue { color: #dc2626; border-color: #dc2626; }
.doc-stamp.unpaid, .doc-stamp.partial { color: #d97706; border-color: #d97706; }

/* Line items editor */
.items-table td { vertical-align: top; }
.items-table .form-control { height: 36px; font-size: 13.5px; }
.items-table textarea.form-control { min-height: 36px; height: 36px; padding: 7px 10px; }
.items-table .drag { cursor: grab; color: var(--text-3); }
.totals-box { width: 380px; max-width: 100%; margin-inline-start: auto; }
.totals-box .t-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; }
.totals-box .t-row.grand { font-size: 18px; font-weight: 800; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-inline-start: 1px solid var(--border); }
.cal-dow { padding: 8px; font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); text-align: center; }
.cal-day { min-height: 118px; padding: 6px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); position: relative; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { color: var(--text-3); }
.cal-day.today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.cal-add { position: absolute; top: 6px; inset-inline-end: 6px; opacity: 0; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-event { display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--ec, var(--accent)) 14%, transparent); color: color-mix(in srgb, var(--ec, var(--accent)) 80%, var(--text)); border-inline-start: 3px solid var(--ec, var(--accent)); font-weight: 500; }
.cal-event:hover { text-decoration: none; filter: brightness(.95); }
.cal-more { font-size: 11px; color: var(--text-3); padding: 0 6px; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--hover) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: 11.5px; font-weight: 500; padding: 5px 8px; border-radius: 6px;
  white-space: nowrap; z-index: 80; pointer-events: none;
}
.table-wrap:has([data-tip]:hover) { overflow: visible; } /* the tooltip must not be cut off by the scrolling table box */

/* Pjax loading bar */
.loading-bar { position: fixed; top: 0; inset-inline-start: 0; height: 3px; background: var(--accent); z-index: 300; width: 0; transition: width .3s ease, opacity .3s; box-shadow: 0 0 10px var(--accent); }

/* Onboarding checklist */
.checklist { display: grid; gap: 8px; }
.checklist a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--surface); }
.checklist a:hover { border-color: var(--accent); text-decoration: none; }
.checklist .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; }
.checklist .done .ck { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .done .ck-title { text-decoration: line-through; color: var(--text-3); }

/* Welcome banner */
.welcome { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 24px 28px; color: #fff; margin-bottom: 20px;
  background: radial-gradient(800px 300px at 90% -20%, color-mix(in srgb, var(--accent) 50%, #ec4899) 0%, transparent 60%), linear-gradient(120deg, color-mix(in srgb, var(--accent) 95%, #000), color-mix(in srgb, var(--accent) 70%, #0b1020)); }
.welcome h2 { color: #fff; margin: 0 0 4px; font-size: 22px; }
.welcome p { margin: 0; color: rgba(255,255,255,.8); }
.welcome .btn-secondary { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); box-shadow: none; }
.welcome .btn-secondary:hover { background: rgba(255,255,255,.24); }

/* Theme panel */
.theme-panel { width: 300px; padding: 14px; }
.theme-panel .tp-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 4px 0 8px; }
.theme-panel .tp-row { margin-bottom: 14px; }
.theme-panel .swatches { gap: 8px; }
.theme-panel .swatch span { width: 26px; height: 26px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .w-quarter { grid-column: span 6; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
  .w-half, .w-third, .w-two-thirds { grid-column: span 12; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
  :root { --content-pad: 16px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); width: 280px; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .app-main { margin-inline-start: 0 !important; }
  .mobile-only { display: inline-grid; }
  .desktop-only { display: none !important; }
  .topbar-search { min-width: 0; flex: 1; }
  .topbar-search span, .topbar-search kbd { display: none; }
  .topbar-search { flex: 0 0 38px; justify-content: center; padding: 0; border: 0; background: none; }
  .topbar-user .u-name { display: none; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav .nav-heading { display: none; }
  .settings-nav a { white-space: nowrap; }
  .grid-sidebar-left { grid-template-columns: minmax(0, 1fr); }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .w-quarter { grid-column: span 12; }
  .col-6, .col-4, .col-3, .col-8, .col-9 { grid-column: span 12; }
  .page-title { font-size: 19px; }
  .stat-value { font-size: 22px; }
  .doc { padding: 22px; }
  .doc-parties { grid-template-columns: minmax(0, 1fr); }
  .toolbar .input-icon { flex: 1 1 100%; }
  .modal-backdrop { padding: 12px; }
  .toasts { inset-inline: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .cal-day { min-height: 70px; }
  .cal-event { font-size: 10px; padding: 1px 3px; }
  .hide-sm { display: none !important; }
}

/* ------------------------------------------------------------------ misc utilities */
.btn-success-soft { background: var(--success-soft); color: var(--success-text); }
.btn-success-soft:hover { filter: brightness(.97); color: var(--success-text); }
.table tr.row-group td { background: var(--surface-2); font-size: 12px; color: var(--text-2); padding-top: 7px; padding-bottom: 7px; }
.table tr.row-muted td { opacity: .55; }
.color-dot { background-color: var(--accent); flex: none; }

/* ------------------------------------------------------------------ booking (slots / date strip) */
.bk-steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.bk-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); font-weight: 600; }
.bk-step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; }
.bk-step.active { color: var(--text); }
.bk-step.active .n, .bk-step.done .n { background: var(--accent); color: var(--on-accent); }
.bk-step + .bk-step::before { content: ""; width: 22px; height: 1px; background: var(--border-strong); }
.bk-services { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.bk-service { text-align: start; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg); padding: 16px; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.bk-service:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.bk-service.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bk-service .t { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.bk-service .m { font-size: 12.5px; color: var(--text-3); margin-top: 6px; display: flex; gap: 12px; }
.bk-service .d { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.bk-dates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.bk-date { flex: none; width: 64px; padding: 9px 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: center; cursor: pointer; font: inherit; color: var(--text); }
.bk-date .w { font-size: 11px; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.bk-date .d { font-size: 19px; font-weight: 700; line-height: 1.3; }
.bk-date .mo { font-size: 11px; color: var(--text-3); }
.bk-date.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.bk-date.active .w, .bk-date.active .mo { color: var(--on-accent); opacity: .85; }
.bk-date:disabled { opacity: .4; cursor: not-allowed; }
.bk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.bk-slot { padding: 9px 0; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); font: inherit; font-weight: 600; font-size: 13.5px; color: var(--accent-text); cursor: pointer; }
.bk-slot:hover { border-color: var(--accent); }
.bk-slot.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.bk-summary { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent-text); font-size: 13.5px; }

/* ------------------------------------------------------------------ campaign preview */
.cmp-preview { border-radius: 14px; min-height: 160px; font-size: 13.5px; }
.cmp-preview.email { border: 1px solid var(--border); background: #f8fafc; overflow: hidden; }
.cmp-preview.email .cmp-subj { padding: 10px 14px; font-weight: 700; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text); }
.cmp-preview.email .cmp-mail { padding: 14px; background: #fff; color: #0f172a; max-height: 460px; overflow: auto; margin: 10px; border-radius: 8px; }
.cmp-preview.email .cmp-mail img { max-width: 100%; height: auto; }
.cmp-preview.whatsapp { background: #e5ddd5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23d4ccc4'/%3E%3C/svg%3E"); padding: 16px 12px; }
.cmp-preview.sms { background: var(--surface-2); padding: 16px 12px; }
.cmp-bubble { max-width: 92%; padding: 8px 11px; border-radius: 10px; line-height: 1.45; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.cmp-preview.whatsapp .cmp-bubble { background: #dcf8c6; color: #111; border-top-right-radius: 2px; margin-inline-start: auto; }
.cmp-preview.sms .cmp-bubble { background: var(--accent); color: var(--on-accent); margin-inline-start: auto; border-bottom-right-radius: 3px; }

/* ------------------------------------------------------------------ help center */
.kb-hero { text-align: center; padding: 28px 16px 32px; margin-bottom: 20px; border-radius: 18px; background: linear-gradient(135deg, var(--accent-soft), transparent 70%); }
.kb-hero h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.02em; }
.kb-hero p { color: var(--text-2); margin: 0 0 20px; }
.kb-search { position: relative; max-width: 560px; margin: 0 auto; }
.kb-search .icon { position: absolute; top: 50%; inset-inline-start: 16px; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; }
.kb-search input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); padding: 0 16px 0 46px; font: inherit; font-size: 15px; color: var(--text); box-shadow: var(--shadow-sm); }
.kb-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.kb-body { font-size: 15px; line-height: 1.75; color: var(--text); }
.kb-body h2 { font-size: 20px; margin: 28px 0 10px; } .kb-body h3 { font-size: 17px; margin: 22px 0 8px; }
.kb-body img { max-width: 100%; height: auto; border-radius: 10px; }
.kb-body ul, .kb-body ol { padding-inline-start: 22px; }
.kb-body blockquote { margin: 16px 0; padding: 10px 16px; border-inline-start: 3px solid var(--accent); background: var(--surface-2); border-radius: 6px; }
.kb-feedback { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ automation builder */
.wf-flow { max-width: 820px; margin: 0 auto; }
.wf-node { position: relative; padding-top: 28px; }
.wf-connector { position: absolute; top: 0; left: 50%; width: 2px; height: 28px; background: var(--border-strong); }
.wf-connector::after { content: ''; position: absolute; bottom: -2px; left: -4px; border: 5px solid transparent; border-top-color: var(--border-strong); }
.wf-node > .dropdown { display: block !important; text-align: center; }
.wf-icon { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.wf-icon .icon { width: 16px; height: 16px; }
.wf-icon-trigger { background: var(--warning-soft); color: var(--warning-text); }
.wf-trigger { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.wf-cond { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.wf-cond .form-control { flex: 1; min-width: 140px; }
.wf-and { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); width: 58px; }
.wf-merge { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.wf-merge .chip { font-size: 11px; padding: 2px 8px; }
.wf-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.wf-summary { display: flex; flex-direction: column; gap: 14px; }
.wf-step { display: flex; gap: 12px; align-items: flex-start; }
.wf-log { margin: 10px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 12px; white-space: pre-wrap; max-height: 220px; overflow: auto; }
.min-w-0 { min-width: 0; }

/* ------------------------------------------------------------------ calendar */
.me-auto { margin-inline-end: auto; }
.cal-card { overflow: hidden; }
.cal-body { min-height: 420px; transition: opacity .15s; }
.cal-body.loading { opacity: .55; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-head div { padding: 9px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(112px, auto); }
.cal-day { border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; min-width: 0; cursor: pointer; transition: background .12s; }
.cal-day:nth-child(7n) { border-inline-end: 0; }
.cal-day:hover { background: var(--hover); }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { opacity: .45; }
.cal-num { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: var(--text-2); }
.cal-day.today .cal-num span, .cal-wday.today .cal-wday-head strong { background: var(--accent); color: var(--on-accent); border-radius: 50%; min-width: 24px; height: 24px; display: inline-grid; place-items: center; }
.cal-evs { display: flex; flex-direction: column; gap: 3px; }
.cal-ev { display: block; font-size: 12px; line-height: 1.35; padding: 2px 7px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--text)); border-inline-start: 3px solid var(--c); }
.cal-ev:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 24%, transparent); color: var(--text); }
.cal-ev[draggable="true"] { cursor: grab; }
.cal-more { font: inherit; font-size: 11.5px; font-weight: 600; color: var(--text-3); background: none; border: 0; text-align: start; padding: 1px 7px; cursor: pointer; }
.cal-more:hover { color: var(--accent-text); }
.drop { background: var(--accent-soft) !important; outline: 2px dashed var(--accent); outline-offset: -3px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 460px; }
.cal-wday { border-inline-end: 1px solid var(--border); padding: 8px; min-width: 0; cursor: pointer; }
.cal-wday:last-child { border-inline-end: 0; }
.cal-wday:hover { background: var(--hover); }
.cal-wday-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 12px; color: var(--text-3); text-transform: uppercase; font-weight: 600; }
.cal-wday-head strong { font-size: 15px; color: var(--text); }
.cal-wday .cal-ev { white-space: normal; padding: 5px 8px; }
.cal-empty { color: var(--text-3); font-size: 12px; padding: 4px 2px; }
.cal-agenda { padding: 6px 0; }
.cal-agenda-day { padding: 14px 18px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); }
.cal-agenda-day.today { color: var(--accent-text); }
.cal-agenda-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; color: var(--text); border-bottom: 1px solid var(--border); }
.cal-agenda-item:hover { background: var(--hover); text-decoration: none; }
.cal-agenda-item .t { width: 78px; flex: none; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.cal-agenda-item .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-agenda-item .k { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 760px) {
  .cal-month { grid-auto-rows: minmax(64px, auto); }
  .cal-ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; border: 0; background: var(--c); }
  .cal-ev b { display: none; }
  .cal-more { font-size: 10px; padding: 0; }
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-wday { border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .cal-wday .cal-ev { font-size: 12px; height: auto; padding: 5px 8px; background: color-mix(in srgb, var(--c) 14%, transparent); border-inline-start: 3px solid var(--c); }
}

/* ==========================================================================
   DGA brand theme + premium motion layer
   ========================================================================== */
[data-accent="dga"] {
  --accent: #1c9a86;
  --accent-2: #2bb8a3;
  --on-accent: #ffffff;
  --sidebar-bg: #06080b;
  --sidebar-bg-2: #0c1015;
  --sidebar-active-bg: linear-gradient(90deg, rgba(47, 179, 159, .28), rgba(47, 179, 159, .06));
}
[data-theme="dark"][data-accent="dga"] {
  --bg: #07090c; --surface: #0e1216; --surface-2: #12171c; --surface-3: #171d23; --hover: #151b21;
  --border: #1f272e; --border-strong: #2a343c; --accent-text: #6ee0d0;
}
:root { --accent-2: color-mix(in srgb, var(--accent) 55%, #fff); --grad: linear-gradient(135deg, var(--accent), var(--accent-2)); --ease: cubic-bezier(.2, .8, .2, 1); }

/* brand marks & logos */
.brand-mark-dga { background: #06080b !important; padding: 0; overflow: hidden; box-shadow: 0 0 0 1px rgba(95, 216, 200, .35), 0 6px 18px -4px rgba(47, 179, 159, .55); }
.brand-mark-dga img { background: transparent; border-radius: 50%; }
.sidebar-brand .brand-mark { animation: brandGlow 4s ease-in-out infinite; }
@keyframes brandGlow { 0%, 100% { box-shadow: 0 0 0 1px rgba(95, 216, 200, .25), 0 6px 18px -6px rgba(47, 179, 159, .5); } 50% { box-shadow: 0 0 0 1px rgba(95, 216, 200, .55), 0 8px 26px -4px rgba(47, 179, 159, .75); } }
.powered-by { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: inherit; opacity: .75; text-decoration: none; }
.powered-by img { width: 16px; height: 16px; border-radius: 50%; }
.powered-by:hover { opacity: 1; text-decoration: none; }

/* primary buttons: gradient + light sweep */
.btn-primary { background: var(--grad); position: relative; overflow: hidden; }
.btn-primary::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-18deg); transition: left .6s var(--ease); pointer-events: none; }
.btn-primary:hover::after { left: 120%; }
.btn { transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s, color .2s; }
.btn:active { transform: scale(.97); }

/* page entrance: sections fade up one after another */
/* fill-mode backwards: nothing is left applied after the animation, so no stacking context traps dropdowns */
.content > * { animation: fadeUp .5s var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: .05s; } .content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; } .content > *:nth-child(5) { animation-delay: .2s; } .content > *:nth-child(n+6) { animation-delay: .25s; }
.stats-grid > *, .grid > .stat-card, .widgets-grid > * { animation: fadeUp .55s var(--ease) backwards; }
.stats-grid > *:nth-child(2), .widgets-grid > *:nth-child(2) { animation-delay: .06s; } .stats-grid > *:nth-child(3), .widgets-grid > *:nth-child(3) { animation-delay: .12s; }
.stats-grid > *:nth-child(4), .widgets-grid > *:nth-child(4) { animation-delay: .18s; } .stats-grid > *:nth-child(n+5), .widgets-grid > *:nth-child(n+5) { animation-delay: .24s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* stat cards: lift, glow and animated gradient edge */
.stat-card { transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.stat-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); background-size: 200% 100%; opacity: .9; transform: scaleX(.18); transform-origin: left; transition: transform .45s var(--ease); }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 18px 36px -18px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.stat-card:hover::before { transform: scaleX(1); animation: gradFlow 2.5s linear infinite; }
.stat-icon { transition: transform .35s var(--ease); }
.stat-card:hover .stat-icon { transform: rotate(-8deg) scale(1.08); }
@keyframes gradFlow { to { background-position: -200% 0; } }
.card-hover:hover { box-shadow: 0 14px 30px -16px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow); }

/* welcome banner: moving aurora + sparkles */
.welcome { background: linear-gradient(120deg, #05080a 0%, color-mix(in srgb, var(--accent) 70%, #05080a) 55%, color-mix(in srgb, var(--accent-2) 70%, #05080a) 100%); background-size: 220% 220%; animation: auroraShift 14s ease-in-out infinite; }
.welcome::before, .welcome::after { content: ''; position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; pointer-events: none; }
.welcome::before { width: 260px; height: 260px; right: -60px; top: -120px; background: var(--accent-2); animation: floatOrb 9s ease-in-out infinite; }
.welcome::after { width: 180px; height: 180px; right: 28%; bottom: -130px; background: var(--accent); animation: floatOrb 11s ease-in-out infinite reverse; }
.welcome > * { position: relative; z-index: 1; }
.welcome .sparkle { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px 3px rgba(255,255,255,.7); animation: twinkle 3s ease-in-out infinite; z-index: 0; }
@keyframes auroraShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes floatOrb { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-30px, 20px); } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1); } }

/* sidebar: glowing active item */
.nav-link { transition: background .2s, color .2s, padding .2s; }
.nav-link.active { background: var(--sidebar-active-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.nav-link.active .icon { color: var(--accent-2); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent)); }
.nav-link.active::before { background: var(--grad); box-shadow: 0 0 12px var(--accent); }

/* glass topbar */
.topbar { backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); background: color-mix(in srgb, var(--surface) 82%, transparent); }

/* modals & dropdowns pop in */
.modal { animation: rise .28s var(--ease); }
.dropdown-menu { animation: pop .16s var(--ease); }
.kanban-card { transition: transform .2s var(--ease), box-shadow .2s; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kanban-card.dragging { transform: rotate(2deg) scale(1.02); box-shadow: var(--shadow-lg); }
.table tbody tr { transition: background .15s; }

/* login page aurora */
.auth-side { background: #05080a !important; }
.auth-side .aurora { position: absolute; inset: 0; overflow: hidden; z-index: 0 !important; pointer-events: none; }
.auth-side .aurora i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.auth-side .aurora i:nth-child(1) { width: 420px; height: 420px; background: #23a893; top: -120px; left: -80px; animation: floatOrb 12s ease-in-out infinite; }
.auth-side .aurora i:nth-child(2) { width: 360px; height: 360px; background: #5fd8c8; bottom: -140px; right: -60px; animation: floatOrb 15s ease-in-out infinite reverse; opacity: .35; }
.auth-side .aurora i:nth-child(3) { width: 240px; height: 240px; background: #0e6f64; top: 40%; left: 45%; animation: floatOrb 10s ease-in-out infinite; opacity: .5; }
.auth-logo { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: #06080b; box-shadow: 0 0 0 1px rgba(95,216,200,.4), 0 0 32px -4px rgba(47,179,159,.8); animation: brandGlow 4s ease-in-out infinite; overflow: hidden; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.auth-side h2 { background: linear-gradient(90deg, #fff, #9ff0e4, #fff); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent !important; animation: textShine 6s linear infinite; }
.auth-features div { animation: fadeUp .6s var(--ease) both; }
.auth-features div:nth-child(2) { animation-delay: .12s; } .auth-features div:nth-child(3) { animation-delay: .24s; }
.auth-features .icon { background: rgba(47,179,159,.18) !important; color: #7fe6d8; }
.auth-card { animation: fadeUp .6s var(--ease) both; }
@keyframes textShine { to { background-position: 200% center; } }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); opacity: .8; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------------ print */
@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .page-actions, .no-print, .toasts, .btn { display: none !important; }
  .app-main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .doc { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
}

/* ------------------------------------------------------------------ platform, updates, security (v1.2) */
.platform-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 20px; font-size: 13px; position: relative; z-index: 30; }
.platform-bar .icon { width: 16px; height: 16px; vertical-align: -3px; }
.platform-bar form { margin: 0; }
.platform-bar .btn { background: rgba(255, 255, 255, .18); color: inherit; border: 1px solid rgba(255, 255, 255, .35); }
.platform-bar .btn:hover { background: rgba(255, 255, 255, .3); }
.platform-bar.is-support { background: linear-gradient(90deg, #b45309, #d97706); color: #fff; }
.platform-bar.is-update { background: var(--grad, var(--accent)); color: var(--on-accent); }
.update-hero { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); }
.update-hero.is-done { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); background: linear-gradient(135deg, var(--success-soft), transparent 60%), var(--surface); }
.update-version { padding: 12px 0; border-top: 1px dashed var(--border); }
.update-notes { margin: 6px 0 0; padding-inline-start: 18px; color: var(--text-2); line-height: 1.7; }
.health-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.health-row:last-child { border-bottom: 0; }
.health-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.health-dot .icon { width: 14px; height: 14px; }
.health-row.ok .health-dot { background: var(--success-soft); color: var(--success-text); }
.health-row.bad .health-dot { background: var(--warning-soft); color: var(--warning-text); }
.health-row.bad { font-weight: 600; }
.new-login-card { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); background: linear-gradient(135deg, var(--success-soft), transparent 70%), var(--surface); }
.login-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.login-grid code, .recovery-codes code { font-size: 14px; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.recovery-codes code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; text-align: center; letter-spacing: .04em; }
.twofa-steps { padding-inline-start: 20px; margin: 0; line-height: 1.7; }
.twofa-steps > li { margin-bottom: 18px; }
.twofa-qr { background: #fff; border-radius: 12px; padding: 12px; display: inline-block; margin: 10px 0 6px; border: 1px solid var(--border); }
.twofa-qr svg { display: block; width: 200px; height: 200px; }
.otp-input { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.steps-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.steps-inline b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; margin-inline-end: 4px; }
.steps-inline .icon { width: 14px; height: 14px; color: var(--text-3); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.code-box { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.code-box code { flex: 1; font-size: 12px; overflow-wrap: anywhere; }
.fw-400 { font-weight: 400 !important; }
.preset-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.preset-grid.compact .preset-desc { display: none; }
@media (max-width: 640px) { .platform-bar { padding: 8px 14px; } .platform-bar .btn { width: 100%; justify-content: center; } }

/* Dropdowns inside page content are placed with position:fixed (app.js) so tables, cards and banners never clip them */
.dropdown-menu.is-fixed { position: fixed; inset: auto; z-index: 300; }

/* ------------------------------------------------------------------ v1.2.1: denser layout — more fits on one screen */
:root { --content-pad: 22px; --topbar-h: 56px; --control-h: 37px; --cell-py: 10px; --sidebar-w: 240px; }
[data-density="compact"] { --content-pad: 16px; --control-h: 33px; --cell-py: 7px; --topbar-h: 50px; }
body { font-size: 13.5px; }
.nav-link { padding: 7px 11px; font-size: 13px; gap: 11px; }
.nav-link .icon { width: 17px; height: 17px; }
.nav-section-title { padding: 12px 12px 4px; font-size: 10px; }
.sidebar-nav { padding: 8px 10px 16px; }
.page-title { font-size: 20px; }
.page-header { margin-bottom: 16px; }
.card-header { padding: 13px 18px; }
.card-title { font-size: 14px; }
.card-body { padding: 16px 18px; }
.card-footer { padding: 12px 18px; }
.card + .card { margin-top: 16px; }
.grid { gap: 16px; }
.widgets-grid { gap: 16px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; }
.stat-card { padding: 14px 16px; }
.stat-value { font-size: 23px; }
.stat-meta { margin-top: 6px; font-size: 12px; }
.topbar-search { height: 36px; }
.welcome { padding: 18px 22px; margin-bottom: 16px; }
.welcome h2 { font-size: 19px; }
.welcome p { font-size: 13px; }

/* Dashboard hero quick actions */
.hero-action { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); color: #fff; font-size: 12.5px; font-weight: 600; transition: background .2s, transform .2s var(--ease); }
.hero-action:hover { background: rgba(255, 255, 255, .24); color: #fff; text-decoration: none; transform: translateY(-1px); }
.hero-action .icon { width: 15px; height: 15px; }
@media (max-width: 640px) { .hero-action span { display: none; } }

/* Dashboard setup strip (progress ring + step chips) */
.setup-strip { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.setup-ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.setup-ring::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.setup-ring span { position: relative; font-size: 11.5px; font-weight: 700; }
.setup-text { min-width: 140px; }
.setup-steps { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.setup-step { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--border); font-size: 12.5px; color: var(--text); background: var(--surface-2); transition: border-color .2s, transform .2s var(--ease); }
.setup-step:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.setup-step .icon { width: 14px; height: 14px; color: var(--text-3); }
.setup-step.done { color: var(--text-3); background: transparent; text-decoration: line-through; }
.setup-step.done .icon { color: var(--success); }
@media (max-width: 900px) { .setup-steps { justify-content: flex-start; } }

/* Dashboard KPI cards: a colour per metric, gradient icon tile, soft wave */
.kpi { --tone: var(--accent); border-color: color-mix(in srgb, var(--tone) 18%, var(--border));
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--tone) 13%, transparent) 0%, transparent 55%), var(--surface); }
.kpi.tone-green { --tone: #10b981; } .kpi.tone-red { --tone: #ef4444; } .kpi.tone-amber { --tone: #f59e0b; }
.kpi.tone-blue { --tone: #0ea5e9; } .kpi.tone-violet { --tone: #8b5cf6; } .kpi.tone-pink { --tone: #ec4899; }
.kpi .stat-top { justify-content: flex-start; gap: 10px; margin-bottom: 10px; }
.kpi .stat-icon { width: 34px; height: 34px; border-radius: 10px; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--tone), color-mix(in srgb, var(--tone) 55%, #000)); box-shadow: 0 6px 14px -6px var(--tone); }
.kpi .stat-icon .icon { width: 17px; height: 17px; }
.kpi .stat-label { font-weight: 600; font-size: 12.5px; }
.kpi .stat-value, .kpi .stat-meta { position: relative; z-index: 1; }
.kpi::before { background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 45%, #fff)); }
.kpi-wave { position: absolute; inset: auto 0 0 0; width: 100%; height: 42px; fill: color-mix(in srgb, var(--tone) 10%, transparent); pointer-events: none; transform-origin: bottom; transition: transform .5s var(--ease); }
.kpi:hover .kpi-wave { transform: scaleY(1.35); }
.kpi:hover { box-shadow: 0 18px 36px -18px color-mix(in srgb, var(--tone) 65%, transparent), var(--shadow); border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); }
.kpi-grid.kpi-cols-1 { grid-template-columns: 1fr; } .kpi-grid.kpi-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-grid.kpi-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi-grid.kpi-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid.kpi-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .kpi-grid.kpi-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1180px) { .kpi-grid.kpi-cols-5, .kpi-grid.kpi-cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpi-grid[class*="kpi-cols-"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 340px) { .kpi-grid[class*="kpi-cols-"] { grid-template-columns: 1fr; } }
.stats-grid > .card + .card, .kpi-grid > .card + .card, .grid > .card + .card { margin-top: 0; }
.nav-sub-badge { display: inline-block; margin-inline-start: 6px; padding: 0 7px; border-radius: 10px; font-size: 10px; font-weight: 700; line-height: 17px; background: #ef4444; color: #fff; vertical-align: 1px; animation: badgePulse 2s ease-in-out infinite; }
@keyframes badgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); } 50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); } }
.platform-bar.is-update .btn-update-now { background: #fff; color: var(--accent-text); border-color: #fff; font-weight: 700; }
.platform-bar.is-update .btn-update-now:hover { background: rgba(255, 255, 255, .88); }
@media (prefers-reduced-motion: reduce) { .nav-sub-badge { animation: none; } }
.platform-bar.is-billing { background: linear-gradient(90deg, #0369a1, #0ea5e9); color: #fff; }
.platform-bar.is-billing-late { background: linear-gradient(90deg, #b91c1c, #ef4444); color: #fff; }
.platform-bar.is-billing .btn-update-now, .platform-bar.is-billing-late .btn-update-now { background: #fff; border-color: #fff; color: #0f172a; font-weight: 700; }
details.paid-claim { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
details.paid-claim > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
details.paid-claim > summary::-webkit-details-marker { display: none; }
details.paid-claim > summary .icon { width: 17px; height: 17px; color: var(--success); }
.claim-list { display: grid; gap: 12px; }
.claim-alert .btn { box-shadow: none; }

/* ------------------------------------------------------------------ invoice page & document on phones */
.doc-table-wrap { overflow-x: auto; }
.upi-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.upi-qr { border: 1px solid var(--border); border-radius: 12px; padding: 6px; background: #fff; flex-shrink: 0; }
.upi-qr svg { display: block; width: 160px; height: 160px; }
.pay-buttons { min-width: 260px; }
@media (max-width: 640px) {
  .pay-buttons { min-width: 0; width: 100%; }
  .pay-buttons form { flex-wrap: wrap; }
  .pay-buttons form .form-control { width: 100% !important; }
  .upi-box { flex-direction: column; align-items: flex-start; }
  .doc { padding: 18px !important; }
  .doc-head { gap: 14px; margin-bottom: 20px; }
  .doc-head > div:last-child { width: 100%; }
  .doc-title, .doc-meta { text-align: start; }
  .doc-title { font-size: 24px; }
  .doc-table thead { display: none; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table tr { padding: 10px 0; border-bottom: 1px solid #eef2f7; }
  .doc-table td { border: 0; padding: 2px 0; }
  .doc-table td:first-child { display: none; }
  .doc-table td.num { display: flex; justify-content: space-between; gap: 12px; text-align: start; white-space: normal; }
  .doc-table td.num::before { content: attr(data-label); color: #94a3b8; font-size: 12px; }
  .doc-totals { width: 100%; }
}
/* Top-bar menus (palette, language, notifications, profile) on phones: full width under the bar, never off-screen */
@media (max-width: 640px) {
  .topbar .dropdown-menu { position: fixed; left: 8px !important; right: 8px !important; top: calc(var(--topbar-h) + 6px); min-width: 0 !important; width: auto !important; max-width: none !important; max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto; }
  .platform-bar { font-size: 12.5px; }
  .platform-bar > span { flex: 1 1 100%; }
}

/* ---------- AI Assistant (WhatsApp chats, test bot) ---------- */
.ai-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ai-step { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 14px; color: inherit; text-decoration: none; background: var(--surface-2); }
.ai-step span { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }
.ai-step span svg { width: 16px; height: 16px; }
.ai-step.done span { background: var(--success-soft); color: var(--success-text); }
.ai-step b { display: block; font-size: 14px; } .ai-step small { color: var(--text-3); font-size: 12px; line-height: 1.4; display: block; margin-top: 2px; }
.ai-thread { display: flex; flex-direction: column; gap: 8px; padding: 18px; max-height: 64vh; overflow-y: auto; background: var(--surface-2, var(--bg)); border-radius: var(--radius, 12px) var(--radius, 12px) 0 0; }
.ai-thread.ai-phone { min-height: 380px; }
.ai-bubble { max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; }
.ai-bubble.in { align-self: flex-start; background: var(--surface, #fff); border-top-left-radius: 4px; }
.ai-bubble.out { align-self: flex-end; background: #d9fdd3; color: #0f172a; border-top-right-radius: 4px; }
.ai-bubble.out.human { background: #e0ecff; }
.ai-bubble.typing .ai-text { letter-spacing: 3px; opacity: .6; }
.ai-text { white-space: pre-wrap; }
.ai-meta { font-size: 11px; color: #64748b; margin-top: 3px; text-align: right; }
.ai-note { align-self: center; font-size: 12px; color: var(--text-3); background: var(--surface, #fff); padding: 5px 12px; border-radius: 999px; text-align: center; }
.ai-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.ai-compose textarea { resize: none; min-height: 42px; }
@media (max-width: 640px) { .ai-steps { grid-template-columns: 1fr; } .ai-bubble { max-width: 90%; } .ai-thread { padding: 12px; } }

/* ---------- Reviews & feedback ---------- */
.survey-card { margin-top: 24px; } .survey-card .card-body { padding: 28px; }
.survey-title { font-size: 21px; font-weight: 800; margin: 6px 0 18px; line-height: 1.3; }
.nps-scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 6px; }
.nps-opt input { position: absolute; opacity: 0; pointer-events: none; }
.nps-opt span { display: grid; place-items: center; height: 44px; border-radius: 10px; border: 1px solid var(--border); font-weight: 700; cursor: pointer; transition: .15s; background: var(--surface); }
.nps-opt span:hover { border-color: var(--accent); }
.nps-low input:checked + span { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
.nps-mid input:checked + span { background: #fef3c7; border-color: #f59e0b; color: #b45309; }
.nps-high input:checked + span { background: #dcfce7; border-color: #22c55e; color: #15803d; }
.nps-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 6px; }
@media (max-width: 480px) { .nps-scale { grid-template-columns: repeat(6, 1fr); } .survey-card .card-body { padding: 18px; } }
.stars { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; } .stars .off { color: var(--border-strong); }
.review-item { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: 0; }
.review-reply { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--accent); font-size: 14px; }
.nps-big { font-size: 40px; font-weight: 800; line-height: 1; }
.nps-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin-top: 10px; }
.nps-bar i { display: block; }

/* ---------- Attendance ---------- */
.att-box { text-align: center; padding: 6px 0; }
.att-clock { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.att-btn { min-width: 190px; justify-content: center; }
.att-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.att-stats b { display: block; font-size: 18px; } .att-stats span { font-size: 11px; color: var(--text-3); }
.att-grid th, .att-grid td { padding: 6px 4px !important; text-align: center; font-size: 12px; }
.att-grid th small { display: block; font-weight: 400; color: var(--text-3); font-size: 10px; }
.att-grid .att-name { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; padding-left: 12px !important; }
.att-off { background: var(--surface-2); } .att-today { color: var(--accent-text); }
.att-cell a { text-decoration: none; }
.att-code { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 700; font-size: 11px; position: relative; }
.att-present, .att-wfh { background: var(--success-soft); color: var(--success-text); }
.att-half { background: var(--warning-soft); color: var(--warning-text); }
.att-leave { background: var(--info-soft); color: var(--info-text); }
.att-absent { background: var(--danger-soft); color: var(--danger-text); } .att-absent.faint { opacity: .45; }
.att-holiday { background: #f3e8ff; color: #7e22ce; }
.att-empty { color: var(--text-3); }
.att-code.is-late::after, .att-late-dot { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
.att-code.is-late::after { position: absolute; top: -2px; right: -2px; }
.kb-guide { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; color: var(--text-2); }
.kb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.kb-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.kb-box { min-height: 460px; font-size: 14px; line-height: 1.65; resize: vertical; font-family: inherit; }
.kb-chip.done { border-color: var(--success); background: var(--success-soft); color: var(--success-text); }
.kb-chip.done::before { content: '✓ '; }
/* Review helper + poster */
.rv-stars { color: #f59e0b; font-size: 26px; letter-spacing: 4px; }
.rv-steps { font-size: 13px; color: var(--text-2); padding-left: 18px; margin: 12px 0 16px; line-height: 1.7; }
.rv-list { display: flex; flex-direction: column; gap: 12px; }
.rv-item { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface-2); }
.rv-item textarea { background: var(--surface); resize: vertical; font-size: 15px; }
.rv-loading { text-align: center; color: var(--text-3); padding: 24px 0; }
.rv-own { margin-top: 14px; }
.rv-poster { max-width: 560px; margin: 0 auto 40px; background: #fff; color: #0f172a; border: 3px solid #0f172a; border-radius: 28px; padding: 40px 32px; text-align: center; }
.rv-poster h1 { font-size: 40px; margin: 6px 0; font-weight: 800; letter-spacing: -1px; }
.rv-poster p { font-size: 20px; margin: 4px 0 18px; color: #334155; }
.rv-poster-logo { max-height: 80px; max-width: 260px; }
.rv-poster-name { font-size: 26px; font-weight: 800; }
.rv-poster-stars { color: #f59e0b; font-size: 40px; letter-spacing: 6px; margin-top: 10px; }
.rv-poster-qr svg { width: 300px; height: 300px; padding: 12px; border: 2px solid #e2e8f0; border-radius: 16px; }
.rv-poster-sub { font-size: 16px !important; }
.rv-poster-foot { font-size: 13px; color: #64748b; margin-top: 10px; }
@media print { .rv-poster { border-width: 2px; margin: 0 auto; } body.public-page { background: #fff; } }
.rv-loading .spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: rvspin .8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes rvspin { to { transform: rotate(360deg); } }
/* ✨ Write with AI under text boxes */
.ai-assist { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.ai-assist-btn, .ai-assist-undo { border: 1px solid var(--border); background: var(--surface); color: var(--accent-text); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; cursor: pointer; line-height: 1.6; }
.ai-assist-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.ai-assist-btn:disabled { opacity: .7; cursor: wait; }
.ai-assist-undo { color: var(--text-2); font-weight: 500; }
.ai-balance { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.ai-balance-amount { font-size: 24px; font-weight: 800; line-height: 1.3; }
.ai-balance-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 640px) { .ai-balance-side { align-items: stretch; width: 100%; } }
/* Invoice / quote bottom: notes + terms left, payment details + signature right */
.doc-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; margin-top: 28px; align-items: start; }
.doc-bottom .doc-notes { margin-top: 0; }
.doc-bottom .doc-notes h4:first-child, .doc-pay h4 { margin-top: 0; }
.doc-side { display: flex; flex-direction: column; gap: 18px; }
.doc-pay { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; font-size: 13px; color: #334155; line-height: 1.6; }
.doc-pay h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8; margin-bottom: 6px; }
.doc-pay p { margin: 0; }
.doc-sign { display: flex; flex-direction: column; align-items: center; width: 220px; margin-inline-start: auto; }
.doc-sign img { max-height: 64px; max-width: 200px; object-fit: contain; margin-bottom: 4px; }
.doc-sign-line { width: 100%; border-top: 1px solid #cbd5e1; padding-top: 5px; text-align: center; font-size: 12px; color: #64748b; }
.doc-sign-line b { display: block; color: #334155; font-size: 12.5px; }
@media (max-width: 720px) { .doc-bottom { grid-template-columns: 1fr; } .doc-sign { margin-inline: auto; } }
/* Pay button: long gateway labels wrap instead of being cut on phones */
.pay-btn { height: auto; min-height: 48px; white-space: normal; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; text-align: center; }
.pay-btn span { overflow-wrap: anywhere; }
/* Notes & files folders */
.folder-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.folder-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.folder-chip .icon { width: 14px; height: 14px; }
.folder-chip span { font-size: 11px; background: var(--surface-3); border-radius: 999px; padding: 0 7px; color: var(--text-3); }
.folder-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.note-form { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface-2); }
.note-form-row { display: grid; grid-template-columns: 1fr 240px; gap: 8px; margin-bottom: 8px; }
.note-title { font-weight: 700; margin: 6px 0 2px; }
.note-secret { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.note-secret code { background: var(--surface-3); padding: 4px 10px; border-radius: 8px; font-size: 13px; }
@media (max-width: 640px) { .note-form-row { grid-template-columns: 1fr; } }
/* Record page with the tab list on the left (customers) */
.record-tabs-v { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
.card.record-tabs-v > .tabs { grid-row: 1 / span 40; flex-direction: column; gap: 2px; border-bottom: 0; border-right: 1px solid var(--border); padding: 10px 8px; overflow: visible; align-self: stretch; }
.record-tabs-v > .tabs .tab { width: 100%; justify-content: flex-start; border-bottom: 0; border-left: 3px solid transparent; border-radius: 0 8px 8px 0; padding: 9px 12px; }
.record-tabs-v > .tabs .tab .count { margin-left: auto; }
.record-tabs-v > .tabs .tab.active { border-left-color: var(--accent); background: var(--accent-soft); }
.record-tabs-v > .tab-pane { grid-column: 2; min-width: 0; }
@media (max-width: 900px) {
  .record-tabs-v { grid-template-columns: minmax(0, 1fr); }
  .card.record-tabs-v > .tabs { grid-row: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 12px; }
  .record-tabs-v > .tabs .tab { width: auto; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; }
  .record-tabs-v > .tabs .tab.active { border-bottom-color: var(--accent); background: none; }
  .record-tabs-v > .tab-pane { grid-column: 1; }
}
/* Attendance v2 */
.att-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.att-cal-h { font-size: 11px; color: var(--text-3); text-align: center; font-weight: 600; }
.att-cal-d { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); text-decoration: none; background: var(--surface); }
.att-cal-d b { font-size: 14px; } .att-cal-d small { font-size: 11px; font-weight: 700; }
.att-cal-d.is-today { outline: 2px solid var(--accent); }
.att-cal-d.att-present { background: var(--success-soft); color: var(--success-text); }
.att-cal-d.att-half { background: var(--warning-soft); color: var(--warning-text); }
.att-cal-d.att-leave { background: var(--info-soft); color: var(--info-text); }
.att-cal-d.att-absent { background: var(--danger-soft); color: var(--danger-text); }
.att-cal-d.att-holiday { background: #f3e8ff; color: #7e22ce; }
.att-cal-d.att-off, .att-cal-d.att-unpaid { background: var(--surface-2); color: var(--text-3); }
.att-qr { display: flex; justify-content: center; } .att-qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--border); }
.att-code { font-size: 28px; font-weight: 800; letter-spacing: 6px; font-family: ui-monospace, monospace; }
.att-unpaid { background: var(--surface-3); color: var(--text-2); }
.att-pre, .att-cal-d.att-pre { background: #ecfdf5; color: #047857; }

.record-tabs-v > .tabs .side-actions { display: flex; flex-direction: column; gap: 6px; padding: 2px 4px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.record-tabs-v > .tabs .side-actions .btn { width: 100%; justify-content: flex-start; }
.tabs .side-actions { display: flex; gap: 6px; }
.rp-table td, .rp-table th { padding: 8px 10px; }
.rp-table input { max-width: 140px; margin-left: auto; text-align: right; }

/* ------------------------------------------------------------------ Dues (Invoices → Dues: outstanding receivables) */
.dues-bar { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.dues-seg { display: block; height: 100%; min-width: 4px; }
.dues-current { background: var(--info); }
.dues-b30 { background: var(--warning); }
.dues-b60 { background: color-mix(in srgb, var(--warning) 45%, var(--danger)); }
.dues-b90 { background: var(--danger); }
.dues-b90p { background: color-mix(in srgb, var(--danger) 65%, #000); }
.dues-opening { background: var(--text-3); }
.dues-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.dues-legend b { color: var(--text); font-weight: 600; margin-inline-start: 6px; }
.dues-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 6px; }
.dues-table tr.dues-row { cursor: pointer; }
.dues-table .dues-tg { width: 36px; padding-inline-end: 0; }
.dues-table [data-dues-toggle] .icon { transition: transform .2s var(--ease, ease); }
.dues-table tr.dues-row.open [data-dues-toggle] .icon { transform: rotate(90deg); }
[dir="rtl"] .dues-table [data-dues-toggle] .icon { transform: scaleX(-1); }
[dir="rtl"] .dues-table tr.dues-row.open [data-dues-toggle] .icon { transform: rotate(90deg); }
.dues-table tr.dues-row.open > td, .dues-table tr.dues-sub > td { background: var(--surface-2); }
.dues-table tr.dues-sub > td { padding-top: 0; }
.dues-table tr.dues-sub .table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.dues-table tr.dues-sub .table tr:last-child td { border-bottom: 0; }
.dues-actions { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.dues-wa { color: #25d366 !important; }
.dues-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dues-kpi { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.dues-kpi span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.dues-kpi b { font-size: 16px; }
.dues-print .table { font-size: 12.5px; }
.dues-print .table th, .dues-print .table td { padding: 6px 8px; }
.dues-print tr.dues-print-sub td { font-size: 11.5px; color: var(--text-2); padding-top: 2px; padding-bottom: 2px; }
@media (max-width: 640px) { .dues-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .dues-print .table { font-size: 10.5px; } .dues-print .table tr { break-inside: avoid; } .dues-kpi { padding: 6px 8px; } }

/* Discount at payment time: live "balance after this entry" / allocation preview (record & receive payment modals) */
.paydisc-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.paydisc-summary b { color: var(--text); font-weight: 700; }
.paydisc-summary .paydisc-after { margin-left: auto; }
.paydisc-summary.is-settled { background: var(--success-soft); border-color: color-mix(in srgb, var(--success-text) 25%, transparent); }
.paydisc-summary.is-settled .paydisc-after b { color: var(--success-text); }
.paydisc-summary.is-over { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger-text) 25%, transparent); color: var(--danger-text); }
.paydisc-summary.is-over b { color: var(--danger-text); }
.paydisc-totals { display: grid; gap: 6px; border-top: 1px solid var(--border); font-size: 13px; }
.paydisc-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.paydisc-totals > div span { color: var(--text-2); }
@media (max-width: 560px) { .paydisc-summary .paydisc-after { margin-left: 0; width: 100%; } }
.dues-table > thead > tr > th, .dues-table > tbody > tr > td, .dues-table > tfoot > tr > td { padding-inline: 10px; }
.dues-table > thead > tr > th.dues-group { text-align: center; padding-bottom: 4px; }
.dues-table > thead > tr:last-child > th { padding-top: 4px; }
.dues-table .dues-cust { min-width: 180px; }
.dues-table { font-size: 13px; }
.dues-table > thead > tr > th, .dues-table > tbody > tr > td, .dues-table > tfoot > tr > td { padding-inline: 8px; }
.dues-gap { display: inline-block; width: 32px; flex: none; }
.rp-table .paydisc-row-after { margin-top: 2px; min-height: 1em; font-weight: 500; }
.rp-table input[data-alloc], .rp-table input[data-alloc-disc] { max-width: 118px; }
@media (max-width: 640px) {
  .dues-table .dues-tg { display: none; }
  .dues-table .dues-cust { min-width: 0; }
  .dues-table td.num div { white-space: normal; }
  .dues-table .dues-actions { display: grid; grid-template-columns: repeat(2, 32px); gap: 4px; }
  .dues-table tr.dues-sub > td:first-child { display: none; }
}
.dues-table tr.dues-sub .table-wrap { contain: inline-size; } /* the invoice list scrolls inside the row instead of widening the table */
.dues-table .dues-cust { min-width: 150px; }
.dues-table .dues-tg { width: 30px; }
.dues-table .dues-actions .btn-icon { width: 28px; height: 28px; }
.dues-table .dues-gap { width: 28px; }
@media (max-width: 1440px) { .dues-table .dues-hide-md { display: none; } }
.dues-print .table th.dues-group { text-align: center; padding-bottom: 2px; }
.dues-print .table th { white-space: normal; }
@page dues { size: A4 landscape; margin: 10mm; }
@media print { .dues-print { page: dues; } }

/* ------------------------------------------------------------------ classic (Tally-style) documents: invoice / quotation / receipt, black & white */
.doc.doc-classic { color: #000; padding: 30px; font-size: 12.5px; line-height: 1.45; border-radius: 6px; }
.doc-classic b { color: #000; }
.doc-classic .dc-titlebar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.doc-classic .dc-title { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: .06em; text-align: center; color: #000; }
.doc-classic .dc-copy { justify-self: end; font-size: 10.5px; font-style: italic; color: #333; white-space: nowrap; }
.doc-classic .dc-sheet { border: 1.5px solid #000; }
.doc-classic .dc-sheet > :last-child { border-bottom: 0; }
.doc-classic .dc-row { display: grid; grid-template-columns: minmax(0, 56fr) minmax(0, 44fr); border-bottom: 1px solid #000; }
.doc-classic .dc-row.dc-one { grid-template-columns: minmax(0, 1fr); }
.doc-classic .dc-row.dc-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc-classic .dc-row > .dc-cell + .dc-cell { border-inline-start: 1px solid #000; }
.doc-classic .dc-cell { padding: 8px 10px; min-width: 0; overflow-wrap: anywhere; }
.doc-classic .dc-seller { display: flex; gap: 14px; align-items: flex-start; }
.doc-classic .dc-logo { max-width: 110px; max-height: 72px; object-fit: contain; flex-shrink: 0; }
.doc-classic .dc-name { font-size: 15px; font-weight: 800; color: #000; margin-bottom: 2px; }
.doc-classic .dc-name-sm { font-size: 13.5px; }
.doc-classic .dc-lbl { display: block; font-size: 11px; font-style: italic; color: #444; margin-bottom: 2px; }
.doc-classic .dc-split { display: flex; justify-content: space-between; gap: 10px; }
.doc-classic .dc-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 0; }
.doc-classic .dc-meta > div { padding: 5px 8px; border-bottom: 1px solid #000; min-width: 0; overflow-wrap: anywhere; }
.doc-classic .dc-meta > div:nth-child(even) { border-inline-start: 1px solid #000; }
.doc-classic .dc-meta > div.dc-last { border-bottom: 0; }
.doc-classic .dc-meta span { display: block; font-size: 10.5px; color: #444; }
.doc-classic .dc-meta b { font-size: 13px; }
.doc-classic .dc-scroll { overflow-x: auto; }
.doc-classic .dc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-classic .dc-table th { background: #eee; color: #000; font-size: 11px; font-weight: 700; text-align: center; padding: 6px; border: 1px solid #000; line-height: 1.25; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-classic .dc-table td { padding: 5px 7px; border: 1px solid #000; vertical-align: top; }
.doc-classic .dc-table tr > :first-child { border-inline-start: 0; }
.doc-classic .dc-table tr > :last-child { border-inline-end: 0; }
.doc-classic .dc-table thead tr:first-child > * { border-top: 0; }
.doc-classic .dc-table .r { text-align: end; white-space: nowrap; }
.doc-classic .dc-table .c { text-align: center; white-space: nowrap; }
.doc-classic .dc-table .dc-total td { font-weight: 700; }
.doc-classic .dc-desc { font-size: 11.5px; color: #444; margin-top: 1px; }
.doc-classic .dc-items tbody tr:last-child td { padding-bottom: 28px; }
.doc-classic .dc-hsn { font-size: 11.5px; }
.doc-classic .dc-hsn td { padding: 3px 7px; }
.doc-classic .dc-bank.dc-sep { border-top: 1px solid #000; margin: 8px -10px 0; padding: 7px 10px 0; }
.doc-classic .dc-totals { padding: 0; display: flex; flex-direction: column; }
.doc-classic .dc-tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 40%); }
.doc-classic .dc-tr > span { padding: 2px 10px; }
.doc-classic .dc-tr > span + span { text-align: end; border-inline-start: 1px solid #000; white-space: nowrap; }
.doc-classic .dc-tr:first-child > span { padding-top: 6px; }
.doc-classic .dc-tr.b { font-weight: 700; }
.doc-classic .dc-tr.big { font-size: 15px; font-weight: 800; border-top: 1px solid #000; }
.doc-classic .dc-tr.big > span { padding: 5px 10px; }
.doc-classic .dc-tr.big + .dc-tr:not(.dc-fill) { border-top: 1px solid #000; }
.doc-classic .dc-tr.dc-fill { flex: 1; min-height: 4px; }
.doc-classic .dc-taxwords { padding: 6px 10px; border-bottom: 1px solid #000; }
.doc-classic .dc-taxwords .dc-lbl { display: inline; }
.doc-classic .dc-text { font-size: 12px; }
.doc-classic .dc-text > b { display: block; margin-bottom: 2px; }
.doc-classic .dc-accept { min-height: 88px; display: flex; align-items: flex-end; }
.doc-classic .dc-sign { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; min-height: 104px; text-align: end; }
.doc-classic .dc-sign img { max-height: 56px; max-width: 200px; object-fit: contain; }
.doc-classic .dc-generated { text-align: center; font-size: 11px; font-style: italic; color: #444; margin-top: 6px; }
/* receipt voucher */
.doc-classic .dc-company { text-align: center; position: relative; }
.doc-classic .dc-company .dc-logo { position: absolute; inset-inline-start: 10px; top: 10px; max-width: 80px; max-height: 52px; }
.doc-classic .dc-company .dc-name { font-size: 17px; }
.doc-classic .dc-band { background: #eee; text-align: center; font-weight: 800; letter-spacing: .05em; padding: 5px; border-bottom: 1px solid #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-classic .dc-voucher { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; padding: 12px 14px; border-bottom: 1px solid #000; }
.doc-classic .dc-voucher > span { font-style: italic; color: #444; }
.doc-classic .dc-voucher > b { border-bottom: 1px solid #999; padding-bottom: 1px; }
.doc-classic .dc-amount { display: inline-block; border: 2px solid #000; padding: 6px 18px; font-size: 21px; font-weight: 800; margin: 4px 0 8px; }
@media (max-width: 720px) {
  .doc.doc-classic { padding: 12px !important; font-size: 12px; }
  .doc-classic .dc-titlebar { grid-template-columns: minmax(0, 1fr); text-align: center; gap: 2px; }
  .doc-classic .dc-copy { justify-self: center; }
  .doc-classic .dc-row, .doc-classic .dc-row.dc-three { grid-template-columns: minmax(0, 1fr); }
  .doc-classic .dc-row > .dc-cell + .dc-cell { border-inline-start: 0; border-top: 1px solid #000; }
  .doc-classic .dc-seller { flex-direction: column; gap: 8px; }
  .doc-classic .dc-items { min-width: 560px; }
  .doc-classic .dc-hsn { min-width: 520px; }
  .doc-classic .dc-company .dc-logo { position: static; display: block; margin: 0 auto 6px; }
  .doc-classic .dc-voucher { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .doc-classic .dc-voucher > b { margin-bottom: 6px; }
}
@media print {
  .doc.doc-classic { padding: 0; border-radius: 0; }
}
.dues-table tr.dues-row:not(.has-sub) { cursor: default; }
@media (max-width: 640px) { .dues-table .dues-cust { min-width: 0; } .dues-table .dues-actions .btn-icon, .dues-table .dues-gap { width: 32px; height: 32px; } }

/* Calendar: festivals & holidays (read-only labels, neutral) */
.cal-fests { display: flex; flex-direction: column; gap: 2px; margin-bottom: 3px; }
.cal-fest { display: block; font-size: 11.5px; line-height: 1.35; padding: 1px 6px; border-radius: 6px; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.cal-fest i { font-style: normal; }
.cal-day.other .cal-fest { opacity: .6; }
.cal-wday .cal-fests { margin-bottom: 6px; }
.cal-wday .cal-fest { white-space: normal; padding: 4px 8px; }
.cal-fest-emoji { flex: none; width: 18px; text-align: center; font-size: 14px; line-height: 1; }
.cal-agenda-item.cal-fest-item { cursor: default; }
.cal-agenda-item.cal-fest-item:hover { background: none; }
.cal-agenda-item.cal-fest-item .n { color: var(--text-2); }
.cal-fest-row .cal-fest-emoji { width: 24px; font-size: 18px; }
@media (max-width: 760px) {
  .cal-day .cal-fests { flex-direction: row; flex-wrap: wrap; }
  .cal-day .cal-fest { font-size: 0; padding: 0; border: 0; background: none; }
  .cal-day .cal-fest i { font-size: 12px; }
}
/* classic documents on phones: give the item description room (the table scrolls sideways inside its box) */
@media (max-width: 720px) {
  .doc-classic .dc-items { min-width: 660px; }
  .doc-classic .dc-items td:nth-child(2) { min-width: 170px; }
}
/* classic documents: the receipt amount never breaks inside the number; on phones the item rows and the receipt
   summary become label / value lines instead of hiding the amounts behind a sideways scroll */
.doc-classic .dc-row.dc-half { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.doc-classic .dc-amount { white-space: nowrap; overflow-wrap: normal; max-width: 100%; }
.doc-classic .dc-unit { display: none; }
@media (max-width: 720px) {
  .doc-classic .dc-row.dc-half { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .doc-classic .dc-items, .doc-classic .dc-kv, .doc-classic .dc-items td:nth-child(2) { min-width: 0; }
  .doc-classic .dc-items thead, .doc-classic .dc-kv thead, .doc-classic .dc-items .dc-unitcol { display: none; }
  .doc-classic .dc-items, .doc-classic .dc-items tbody, .doc-classic .dc-kv, .doc-classic .dc-kv tbody, .doc-classic .dc-kv tr { display: block; width: 100%; }
  .doc-classic .dc-items tr { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; padding: 7px 10px; border-bottom: 1px solid #000; }
  .doc-classic .dc-items td, .doc-classic .dc-kv td { border: 0; padding: 1px 0; }
  .doc-classic .dc-items tbody tr:last-child td { padding-bottom: 1px; }
  .doc-classic .dc-items td[data-label] { grid-column: 2; display: flex; justify-content: space-between; gap: 12px; }
  .doc-classic .dc-items td[data-label]::before, .doc-classic .dc-kv td::before { content: attr(data-label); color: #444; font-weight: 400; }
  .doc-classic .dc-items .dc-unit { display: inline; }
  .doc-classic .dc-kv tr { padding: 5px 10px; }
  .doc-classic .dc-kv td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
}
@media (max-width: 640px) { .doc-classic .dc-kv { border-bottom: 1px solid #000; } }

.ss-bulk { display: flex; gap: 6px; padding: 0 8px 6px; }
.ss-bulk button { background: none; border: 0; color: var(--accent-text); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.ss-bulk button:hover { text-decoration: underline; }

.list-search { flex: 0 0 220px; max-width: 100%; margin-right: 4px; }
.folder-bar .list-search { align-self: center; }
.nav-caret-btn { display: inline-flex; margin-left: auto; padding: 4px; border-radius: 6px; }
.nav-caret-btn:hover { background: var(--hover); }

.table-quick-search { display: flex; align-items: center; gap: 10px; padding: 10px 16px 0; }
.table-quick-search .input-icon { max-width: 280px; flex: 1; }

/* ---------------------------------------------------------------- WhatsApp inbox */
.wa-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; height: calc(100vh - 150px); min-height: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 12px); overflow: hidden; }
.wa-app:has(.wa-info:not([hidden])) { grid-template-columns: 320px minmax(0, 1fr) 280px; }
.wa-list { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.wa-list-head { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.wa-list-head .input-icon { flex: 1; }
.wa-boxes { display: flex; gap: 2px; padding: 6px 8px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.wa-box { border: 0; background: none; padding: 5px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.wa-box.active { background: var(--accent-soft); color: var(--accent-text); }
.wa-labels-bar { display: flex; gap: 4px; padding: 6px 8px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.wa-chats { flex: 1; overflow-y: auto; min-height: 0; }
.wa-chat { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.wa-chat:hover { background: var(--hover); }
.wa-chat.active { background: var(--accent-soft); }
.wa-chat.unread b { color: var(--text); }
.wa-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.wa-chat-main { min-width: 0; flex: 1; }
.wa-chat-top { display: flex; justify-content: space-between; gap: 8px; }
.wa-chat-top b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat-time { font-size: 11px; color: var(--text-3, var(--text-2)); white-space: nowrap; }
.wa-chat-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.wa-chat-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-unread { background: #25d366; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.wa-chat-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.wa-tag { font-size: 10.5px; background: var(--surface-2, var(--bg)); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text-2); }
.wa-tag.staff { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.wa-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.wa-empty { display: flex; align-items: center; justify-content: center; }
.wa-empty .icon { width: 48px; height: 48px; opacity: .3; }
.wa-thread-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.wa-peer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wa-peer-name { font-weight: 700; font-size: 15px; outline: none; border-radius: 4px; padding: 0 2px; }
.wa-peer-name:focus { background: var(--accent-soft); }
.wa-peer-sub { font-size: 12px; color: var(--text-2); }
.wa-head-actions { display: flex; gap: 6px; align-items: center; }
.wa-head-actions select { max-width: 160px; }
.wa-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #efeae2; background-image: radial-gradient(rgba(0,0,0,.03) 1px, transparent 1px); background-size: 14px 14px; }
[data-theme="dark"] .wa-messages { background: #0b141a; background-image: none; }
.wa-day { align-self: center; font-size: 11.5px; background: rgba(255,255,255,.85); color: #54656f; padding: 3px 10px; border-radius: 8px; margin: 8px 0; }
[data-theme="dark"] .wa-day { background: #182229; color: #8696a0; }
.wa-bubble { max-width: 70%; padding: 7px 10px 5px; border-radius: 10px; font-size: 14px; line-height: 1.45; background: #fff; color: #111b21; box-shadow: 0 1px .5px rgba(0,0,0,.13); align-self: flex-start; word-wrap: break-word; }
.wa-bubble.out { background: #d9fdd3; align-self: flex-end; }
.wa-bubble.failed { background: #fde8e8; }
[data-theme="dark"] .wa-bubble { background: #202c33; color: #e9edef; }
[data-theme="dark"] .wa-bubble.out { background: #005c4b; }
.wa-meta { font-size: 11px; color: #667781; text-align: right; margin-top: 3px; }
[data-theme="dark"] .wa-meta { color: #8696a0; }
.wa-ticks { font-weight: 700; letter-spacing: -2px; }
.wa-ticks.read { color: #53bdeb; }
.wa-ticks.fail { color: #d33; letter-spacing: 0; }
.wa-error { font-size: 11.5px; color: #b91c1c; margin-top: 4px; }
.wa-img { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; margin-bottom: 4px; }
.wa-doc { display: inline-block; background: rgba(0,0,0,.05); border-radius: 6px; padding: 6px 10px; margin-bottom: 4px; }
.wa-tpl-tag { font-size: 11px; color: #667781; margin-bottom: 2px; }
.wa-composer { border-top: 1px solid var(--border); padding: 8px 10px; background: var(--surface); }
.wa-compose-row { display: flex; gap: 6px; align-items: flex-end; }
.wa-compose-row textarea { flex: 1; resize: none; max-height: 160px; }
.wa-window-note { font-size: 12.5px; color: #92400e; background: #fef3c7; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-quick { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; max-height: 220px; overflow-y: auto; box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.12)); }
.wa-quick button { text-align: left; border: 0; background: none; padding: 8px 12px; font-size: 13px; cursor: pointer; display: flex; gap: 8px; }
.wa-quick button:hover { background: var(--hover); }
.wa-quick button span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-info { border-left: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.wa-info-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.wa-info-body { padding: 14px; }
.wa-info-section { margin-bottom: 16px; }
.wa-tpl-modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.wa-tpl-box { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; padding: 18px; max-height: 90vh; overflow-y: auto; }
.wa-tpl-preview { background: #d9fdd3; color: #111b21; border-radius: 10px; padding: 10px; font-size: 14px; min-height: 40px; white-space: pre-wrap; }
.wa-phone { background: #efeae2; border-radius: 14px; padding: 16px; min-height: 160px; }
.wa-phone-bubble { background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 14px; color: #111b21; box-shadow: 0 1px .5px rgba(0,0,0,.13); max-width: 92%; }
.wa-phone-header { font-weight: 700; margin-bottom: 4px; }
.wa-phone-header:empty, .wa-phone-footer:empty { display: none; }
.wa-phone-body { white-space: pre-wrap; line-height: 1.45; }
.wa-phone-footer { font-size: 12px; color: #667781; margin-top: 6px; }
.wa-phone-buttons div { background: #fff; color: #027eb5; text-align: center; border-radius: 8px; padding: 8px; margin-top: 4px; font-weight: 600; max-width: 92%; }
.wa-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.wa-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; position: relative; gap: 1px; }
.wa-bar span { display: block; border-radius: 3px 3px 0 0; min-height: 2px; }
.wa-bar .out { background: #25d366; } .wa-bar .in { background: #94a3b8; }
.wa-bar i { font-style: normal; font-size: 10px; text-align: center; color: var(--text-2); margin-top: 3px; }
.wa-legend { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.wa-legend.out { background: #25d366; } .wa-legend.in { background: #94a3b8; }
@media (max-width: 860px) {
  .wa-app, .wa-app:has(.wa-info:not([hidden])) { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .wa-thread, .wa-info { display: none; }
  .wa-app.wa-mobile-thread .wa-list, .wa-app.wa-mobile-thread .wa-empty { display: none; }
  .wa-app.wa-mobile-thread .wa-thread { display: flex; }
  .wa-app.wa-mobile-thread .wa-info:not([hidden]) { display: block; position: fixed; inset: 60px 0 0; z-index: 50; background: var(--surface); }
  .wa-bubble { max-width: 88%; }
}
@media (max-width: 1200px) and (min-width: 861px) {
  .wa-app:has(.wa-info:not([hidden])) { grid-template-columns: 320px minmax(0, 1fr); position: relative; }
  .wa-info { position: absolute; right: 0; top: 0; bottom: 0; width: 280px; background: var(--surface); box-shadow: -8px 0 24px rgba(0,0,0,.12); z-index: 5; }
}

.nav-sub-icon { width: 15px !important; height: 15px !important; flex: 0 0 15px; opacity: .55; margin-inline-end: 9px; }
.nav-sub a.active .nav-sub-icon { opacity: 1; }
.portal-nav-count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 1px 7px; }
.topbar-clock { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; padding: 0 10px; }
@media (max-width: 760px) { .auth-side { padding: 28px 20px; min-height: 0; } .auth-side h2 { font-size: 22px; } .auth-side .aurora { display: none; } }

.topbar-clock { background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.input-icon { position: relative; }
.pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-2); cursor: pointer; padding: 4px; display: inline-flex; }
.pw-eye.on { color: var(--accent-text); }
.pw-eye .icon { width: 18px; height: 18px; }
.auth-form .form-group { position: relative; }

.input-icon .pw-eye, .pw-wrap .pw-eye { position: absolute; inset-inline-start: auto; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 8px; }
.input-icon .pw-eye .icon, .pw-wrap .pw-eye .icon { position: static; transform: none; width: 18px; height: 18px; color: inherit; }
.input-icon:has(.pw-eye) .form-control, .pw-wrap .form-control { padding-inline-end: 42px; }
.pw-eye:hover { background: var(--hover); }

.sig-pad-wrap { position: relative; max-width: 600px; }
.sig-pad { width: 100%; height: 180px; background: #fff; border: 1px dashed #94a3b8; border-radius: 10px; touch-action: none; display: block; }
.sig-pad-wrap .sig-clear { position: absolute; right: 8px; top: 8px; }

/* ---------------------------------------------------------------- phone view: compact everything */
@media (max-width: 640px) {
  body { font-size: 12.5px; }
  .main-content, .page, .content { padding: 10px !important; }
  .page-header { margin-bottom: 10px; gap: 8px; }
  .page-title { font-size: 17px; gap: 6px; }
  .page-subtitle { font-size: 11.5px; }
  .page-actions .btn { padding: 6px 10px; font-size: 12px; }
  h1 { font-size: 18px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
  .card { border-radius: 10px; }
  .card-body { padding: 12px; }
  .card-header { padding: 10px 12px; }
  .card-title { font-size: 13.5px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-top { margin-bottom: 4px; }
  .stat-label { font-size: 11px; }
  .stat-icon { width: 26px; height: 26px; }
  .stat-icon .icon { width: 14px; height: 14px; }
  .stat-value { font-size: 17px; }
  .stat-meta, .text-xs { font-size: 10.5px; }
  .kpi-grid[class*="kpi-cols-"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .table th, .table td { padding: 7px 8px; font-size: 12px; }
  .table .nowrap { white-space: normal; }
  .btn { font-size: 12.5px; padding: 7px 11px; }
  .btn-sm { font-size: 11.5px; padding: 5px 8px; }
  .btn-lg { font-size: 14px; padding: 10px 14px; }
  .form-control, .form-label { font-size: 13px; }
  .form-control { padding: 8px 10px; }
  .form-grid { gap: 10px; }
  .toolbar { padding: 8px 10px; gap: 6px; }
  .tabs .tab { padding: 8px 10px; font-size: 12.5px; }
  .record-tabs-v { grid-template-columns: 1fr; }
  .card.record-tabs-v > .tabs { grid-row: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px; }
  .record-tabs-v > .tabs .tab { width: auto; border-left: 0; border-radius: 8px; white-space: nowrap; }
  .record-tabs-v > .tabs .side-actions { flex-direction: row; border-bottom: 0; padding: 0 4px 0 0; margin: 0 6px 0 0; border-right: 1px solid var(--border); }
  .record-tabs-v > .tabs .side-actions .btn { width: auto; }
  .detail-row { padding: 6px 0; } .detail-label { font-size: 11.5px; } .detail-value { font-size: 12.5px; }
  .badge { font-size: 10.5px; padding: 2px 6px; }
  .topbar { padding: 0 10px; height: 52px; }
  .topbar-clock { display: none; }
  .topbar .btn-primary.btn-sm span { display: none; }
  .modal { width: 100%; max-width: 100%; border-radius: 12px 12px 0 0; }
  .modal-body, .modal-footer { padding: 12px; }
  .list-item { padding: 8px 12px; }
  .welcome h2 { font-size: 18px; }
  .portal-content { padding: 14px 12px; }
  .dropdown-menu { font-size: 13px; }
  .wa-messages { padding: 10px; }
  .doc, .document { font-size: 12px; }
}
@media (max-width: 640px) {
  .setup-steps { flex-direction: column; align-items: stretch; gap: 6px; }
  .setup-steps > * { width: 100%; }
  .setup-steps .setup-step, .setup-steps a, .setup-steps span { white-space: normal; }
  .stat-card .stat-value { word-break: break-word; }
}
@media (max-width: 640px) {
  .card.setup-strip { flex-wrap: wrap !important; gap: 10px !important; }
  .card.setup-strip .setup-text { flex: 1 1 auto; }
  .card.setup-strip .setup-steps { flex: 1 1 100% !important; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; width: 100%; }
  .setup-strip .setup-steps > * { width: auto; }
  .setup-step { font-size: 11.5px; padding: 5px 9px; }
}

.topbar-clock { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); color: var(--text); border: 1.5px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 800; letter-spacing: .02em; }
.topbar-clock .icon { width: 16px; height: 16px; color: var(--accent-text); animation: clockTick 1s steps(1) infinite; }
@keyframes clockTick { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ------------------------------------------------------------------ App mode (home-screen install): native-style shell on phones */
.app-bottom-nav { display: none; }
@media (max-width: 991px) {
  .app-mode .app-bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 34;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(15,23,42,.06);
  }
  .app-mode .app-bottom-nav a, .app-mode .app-bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--text-3); font: inherit; font-size: 10.5px; font-weight: 600; text-decoration: none; border-radius: 10px;
  }
  .app-mode .app-bottom-nav .icon { width: 22px; height: 22px; }
  .app-mode .app-bottom-nav a.active { color: var(--accent-text); }
  .app-mode .app-bottom-nav a.active .icon { color: var(--accent); }
  .app-mode .content, .app-mode .app-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
  .app-mode .modal-backdrop, .app-mode .cmdk-backdrop { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .app-mode .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .app-mode .topbar { height: auto; min-height: var(--topbar-h); padding-top: 6px; padding-bottom: 6px; }
  .app-mode .content { padding-top: 14px; }
  .app-mode .welcome { margin-top: 4px; }
  .app-mode .topbar-clock, .app-mode [data-sidebar-toggle].icon-btn { display: none !important; }
  .app-mode .topbar-search { flex: 1; border: 1px solid var(--border); border-radius: 12px; justify-content: flex-start; padding: 0 12px; height: 38px; }
  .app-mode .topbar-search { flex: 0 0 40px; border: 1px solid var(--border); border-radius: 12px; justify-content: center; padding: 0; height: 38px; }
  .app-mode .topbar-search span, .app-mode .topbar-search kbd { display: none; }
  .app-mode .topbar { gap: 8px; }
  .app-mode .cmdk-backdrop { padding: 8px; align-items: flex-start; }
  .app-mode .cmdk { max-width: 100%; border-radius: 14px; }
  .app-mode .cmdk-results { max-height: calc(100vh - 140px); }
  .app-mode .cmdk-results * { white-space: normal; overflow-wrap: anywhere; }
  .app-mode .page-header { margin-bottom: 12px; }
  .app-mode .page-title { font-size: 20px; }
  .app-mode .page-subtitle { display: none; }
  .app-mode .page-actions .btn { padding: 8px 12px; font-size: 13px; }
  .app-mode .card, .app-mode .stat-card { border-radius: 14px; }
  .app-mode .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .app-mode .toolbar { gap: 6px; }
  .app-mode .toolbar .form-control, .app-mode .toolbar select { font-size: 13px; }
  .app-mode .table td, .app-mode .table th { padding: 10px 8px; font-size: 13px; }
  .app-mode .sidebar { width: 86vw; max-width: 320px; }
  .app-mode .modal { border-radius: 18px 18px 0 0; margin-top: auto; max-height: 92vh; }
}

/* find-anything deep link highlight */
.field-flash { animation: fieldFlash 3.5s ease-out; border-radius: 12px; }
@keyframes fieldFlash { 0% { box-shadow: 0 0 0 4px rgba(15,118,110,.45); background: rgba(15,118,110,.10); } 100% { box-shadow: 0 0 0 0 rgba(15,118,110,0); background: transparent; } }

/* GSTIN live check under GST number fields */
.gst-hint { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 0; }
.gst-hint:empty { display: none; }
.btn-xs { padding: 2px 8px; font-size: 12px; line-height: 1.4; }

/* (i) setup-guide buttons and the guide modal */
.guide-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: var(--accent-text); background: var(--accent-soft); vertical-align: middle; margin-inline-start: 4px; text-decoration: none !important; }
.guide-btn svg { width: 14px; height: 14px; stroke: currentColor; }
.guide-btn:hover, .guide-btn:focus-visible { background: var(--accent); color: #fff; }
.guide-btn::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); background: var(--text-1, #0f172a); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3; padding: 6px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.guide-btn::before { content: ''; position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--text-1, #0f172a); opacity: 0; transition: opacity .15s; pointer-events: none; }
.guide-btn:hover::after, .guide-btn:hover::before, .guide-btn:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); animation: guide-blink 1.2s ease-in-out 2; }
@keyframes guide-blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.guide-steps { padding-inline-start: 22px; margin: 0; }
.guide-steps li { margin-bottom: 12px; line-height: 1.5; }
.guide-steps li > div { color: var(--text-2); margin-top: 2px; }
.guide-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* control panel: client activity list */
.act-list { display: flex; flex-direction: column; }
.act-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: start; }
.act-row:last-child { border-bottom: 0; }
.act-who { font-weight: 600; color: var(--text-1); }
.act-when { white-space: nowrap; }
@media (max-width: 720px) { .act-row { grid-template-columns: 1fr; gap: 2px; } }

.guide-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.guide-ask svg { width: 16px; height: 16px; color: var(--accent-text); }

/* "+ Create new …" row at the top of dropdowns */
.ss-quick { padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border-bottom: 1px solid var(--border); cursor: pointer; }
.ss-quick:hover { background: var(--accent-soft-2); }

/* (?) field help next to labels */
.field-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-inline-start: 5px; border-radius: 50%; font-size: 10px; font-weight: 700; line-height: 1; color: var(--text-3); border: 1px solid var(--border-strong, var(--border)); cursor: help; vertical-align: 1px; user-select: none; }
.field-tip:hover, .field-tip:focus-visible, .field-tip.open { color: #fff; background: var(--accent); border-color: var(--accent); }
.field-tip-box { position: absolute; left: -12px; bottom: calc(100% + 8px); transform: translateY(4px); width: max-content; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: var(--text-1, #0f172a); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.45; text-align: start; white-space: normal; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 300; }
.field-tip:hover .field-tip-box, .field-tip:focus-visible .field-tip-box, .field-tip.open .field-tip-box { opacity: 1; transform: translateY(0); }
@media (max-width: 640px) { .field-tip-box { left: auto; right: -8px; transform: none; max-width: 240px; } .field-tip:hover .field-tip-box, .field-tip.open .field-tip-box { transform: none; } }

.help-moved { display: none !important; }

/* WhatsApp call panel (modules/whatsapp/assets/calls.js) */
.wa-call { position: fixed; right: 18px; bottom: 18px; z-index: 1000; width: 320px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 18px 48px rgba(0,0,0,.25); padding: 14px; }
.wa-call-head { display: flex; align-items: center; gap: 12px; }
.wa-call-title { font-weight: 700; font-size: 15px; }
.wa-call-sub { font-size: 12.5px; color: var(--text-3); }
.wa-call-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.wa-call-pulse, .wa-call-dot { width: 14px; height: 14px; border-radius: 50%; background: #22c55e; flex: none; }
.wa-call-pulse { animation: wa-pulse 1s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
@keyframes wa-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 14px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* file inputs: button and file name vertically centred inside the field */
input[type=file].form-control { height: auto; min-height: var(--control-h); padding: 6px 10px; line-height: 1.6; display: block; }
input[type=file].form-control::file-selector-button { margin: 0 10px 0 0; padding: 4px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2, #f1f5f9); color: var(--text-1); font: inherit; font-size: 13px; cursor: pointer; vertical-align: middle; }
input[type=file].form-control::file-selector-button:hover { background: var(--accent-soft); }

/* Topbar never wider than the screen (it pushed every page sideways on ~1000–1280px laptops):
   the search box shrinks, then turns into an icon; the clock and buttons never wrap or overflow. */
.topbar { min-width: 0; }
.topbar-search { min-width: 0; flex: 0 1 420px; }
.topbar-actions, .topbar-clock { flex-shrink: 0; }
.app-main { min-width: 0; }
@media (max-width: 1280px) {
  .topbar-search { flex: 0 0 38px; justify-content: center; padding: 0; }
  .topbar-search span, .topbar-search kbd { display: none; }
  .topbar-user .u-name { display: none; }
}
@media (max-width: 1100px) {
  .topbar-clock { padding: 5px 10px; font-size: 12.5px; }
  .topbar .btn-primary.btn-sm span { display: none; }
}

/* (?) help bubbles: out of the layout while closed — a hidden bubble near the right edge used to widen every form page */
.field-tip-box { display: none; }
.field-tip:hover .field-tip-box, .field-tip:focus-visible .field-tip-box, .field-tip.open .field-tip-box { display: block; }
.field-tip-box.flip { left: auto; right: -12px; }
.guide-btn:not(:hover):not(:focus-visible)::after { display: none; }
/* the magnifier in a list search box is a button: click = search */
.input-icon:has(input[name="q"]) > .icon { pointer-events: auto; cursor: pointer; }
.input-icon:has(input[name="q"]) > .icon:hover { color: var(--accent); }

/* serial number column + total of the selected rows */
.table .col-serial { width: 52px; white-space: nowrap; text-align: center; font-variant-numeric: tabular-nums; padding-inline: 8px; }
.table td.col-serial { color: var(--text-muted); }  /* the header keeps the same colour as every other heading */
.bulk-bar .bulk-totals { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.bulk-bar .bulk-totals b { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.bulk-bar .bulk-totals i { font-style: normal; font-weight: 600; opacity: .8; margin-inline-end: 4px; }
@media print { .col-serial { display: none; } }

.per-page { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-inline-start: auto; }
.per-page select { width: auto; min-width: 72px; padding-block: 4px; }
.pagination-wrap .pagination { margin-inline-start: auto; }
.pagination-wrap .pagination + .per-page { margin-inline-start: 12px; }

/* ---- Phones (1.6.16): dialogs are centred cards (no bottom sheet, no dark strip under them) ---- */
@media (max-width: 991px) {
  .modal-backdrop, .app-mode .modal-backdrop {
    align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }
  /* margin:auto centres a short dialog (delete / confirm) and lets a tall one (receive payment) scroll from its top */
  .modal, .app-mode .modal { margin: auto; width: 100%; max-height: none; border-radius: 16px; }
  .modal.modal-sm { max-width: 400px; }
}

/* ---- WhatsApp inbox on phones: nothing wider than the screen, long links wrap, a visible Back button ---- */
.wa-bubble { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.wa-bubble a { overflow-wrap: anywhere; }
.wa-img, .wa-messages img, .wa-messages video { max-width: 100%; height: auto; }
.wa-back { display: none; }
@media (max-width: 860px) {
  .wa-app, .wa-app:has(.wa-info:not([hidden])) { grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 100%; height: calc(100vh - 120px); height: calc(100dvh - 120px); }
  .app-mode .wa-app, .app-mode .wa-app:has(.wa-info:not([hidden])) { height: calc(100dvh - 190px - env(safe-area-inset-bottom)); min-height: 380px; }
  .wa-list, .wa-thread { min-width: 0; max-width: 100%; }
  .wa-boxes, .wa-labels-bar { max-width: 100%; }
  .wa-thread-head { flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  .wa-back { display: inline-flex; flex: none; }
  .wa-peer { flex: 1 1 0; min-width: 0; }
  .wa-peer > div { min-width: 0; }
  .wa-peer-name, .wa-peer-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wa-head-actions { flex: 1 1 100%; min-width: 0; }
  .wa-head-actions select { flex: 1 1 auto; min-width: 0; max-width: none; }
  .wa-messages { padding: 10px 8px; overflow-x: hidden; }
  .wa-bubble { max-width: 88%; }
  .wa-composer { padding: 8px; }
  .wa-compose-row, .wa-compose-row textarea { min-width: 0; }
}

/* ---- Phones: summary boxes and timelines wrap instead of pushing the page sideways (1.6.16) ---- */
.bk-summary { flex-wrap: wrap; }
.bk-summary > div { min-width: 0; }
.tl-title, .tl-item { min-width: 0; overflow-wrap: anywhere; }
code { overflow-wrap: anywhere; }
.alert > div { min-width: 0; overflow-wrap: anywhere; }
