/* ==========================================================================
   AgentCause — Vibrant theme
   Loaded last on every layout. Tenant branding may override --primary,
   --primary-2, --sidebar-bg and --sidebar-text from an inline :root block.
   ========================================================================== */

:root {
  /* Brand */
  --violet: #18a7a0;
  --violet-600: #13908a;
  --pink: #0e7482;
  --orange: #f97316;
  --cyan: #06b6d4;
  --emerald: #10b981;
  --amber: #f59e0b;
  --sky: #0ea5e9;
  --rose: #f43f5e;

  --primary: var(--violet);
  --primary-2: var(--pink);
  --primary-hover: var(--violet-600);
  --primary-light: color-mix(in srgb, var(--primary) 12%, transparent);
  --primary-ring: color-mix(in srgb, var(--primary) 32%, transparent);
  --grad: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  --grad-soft: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), color-mix(in srgb, var(--primary-2) 12%, transparent));
  --grad-hero: radial-gradient(1200px 600px at 10% -10%, #2fb5ad 0%, transparent 60%),
               radial-gradient(900px 500px at 100% 0%, #0f8a9a 0%, transparent 55%),
               radial-gradient(800px 600px at 50% 120%, #34c3a8 0%, transparent 60%),
               linear-gradient(135deg, #0b4a47 0%, #831843 100%);

  /* Surfaces */
  --bg: #f4f8f7;
  --content-bg: var(--bg);
  --card: #ffffff;
  --surface-2: #eff6f5;
  --text: #0f2a2a;
  --text-2: #33504e;
  --muted: #5f7674;
  --muted-light: #9db1af;
  --border: #e2ebea;
  --border-light: #eef4f3;

  --shadow-xs: 0 1px 2px rgba(15, 42, 42, .06);
  --shadow-sm: 0 1px 3px rgba(15, 42, 42, .06), 0 4px 14px rgba(16, 118, 112, .05);
  --shadow-md: 0 8px 30px rgba(16, 118, 112, .10), 0 2px 6px rgba(15, 42, 42, .05);
  --shadow-glow: 0 8px 24px color-mix(in srgb, var(--primary) 35%, transparent);
  --card-shadow: var(--shadow-sm);
  --card-shadow-lg: var(--shadow-md);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  /* Sidebar */
  --sidebar-width: 268px;
  --sidebar-bg: linear-gradient(180deg, #062e2c 0%, #0a3d3a 55%, #0b4a47 100%);
  --sidebar-text: #cfe6e3;
  --sidebar-muted: #8fb3af;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-border: rgba(255, 255, 255, .08);

  --header-bg: rgba(244, 248, 247, .78);

  /* Bootstrap bridge */
  --bs-primary: var(--violet);
  --bs-primary-rgb: 124, 58, 237;
  --bs-success-rgb: 16, 185, 129;
  --bs-info-rgb: 14, 165, 233;
  --bs-warning-rgb: 245, 158, 11;
  --bs-danger-rgb: 244, 63, 94;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 124, 58, 237;
  --bs-link-hover-color: var(--primary-hover);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
  --bs-emphasis-color: var(--text);
  --bs-tertiary-bg: var(--surface-2);
  --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: 14px;
  --bs-focus-ring-color: var(--primary-ring);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071413;
  --card: #0d1f1e;
  --surface-2: #132a28;
  --text: #e7f3f1;
  --text-2: #c3d9d6;
  --muted: #8fa9a6;
  --muted-light: #5f7a77;
  --border: #1f3735;
  --border-light: #18302e;
  --header-bg: rgba(7, 20, 19, .72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, .45);
  --primary-light: color-mix(in srgb, var(--primary) 22%, transparent);
  --sidebar-bg: linear-gradient(180deg, #06201e 0%, #072624 60%, #082b29 100%);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-emphasis-color: #fff;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--text); letter-spacing: -0.015em; font-weight: 700; }
a { color: var(--primary); text-decoration-thickness: from-font; text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }
:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.text-primary { color: var(--primary) !important; }
.bg-primary { background: var(--grad) !important; }
.bg-light:not([class*="bg-opacity"]) { background: var(--surface-2) !important; }
.bg-white:not([class*="bg-opacity"]) { background: var(--card) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }
hr { border-color: var(--border); opacity: 1; }
code { color: var(--pink); }
kbd { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; font-size: 11px; padding: 1px 6px; box-shadow: none; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--card); color: var(--primary); padding: 8px 14px; border-radius: 10px; box-shadow: var(--shadow-md); }
.skip-link:focus { left: 12px; }

* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  width: var(--sidebar-width); min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 0;
  color: var(--sidebar-text);
  overflow: hidden;
  box-shadow: 4px 0 30px rgba(6, 46, 44, .18);
}
.sidebar::before {
  content: ""; position: absolute; inset: -120px -80px auto auto; width: 260px; height: 260px; pointer-events: none;
  background: radial-gradient(circle, rgba(15, 138, 154, .35), transparent 65%);
}
.sidebar::after {
  content: ""; position: absolute; inset: auto auto -140px -100px; width: 300px; height: 300px; pointer-events: none;
  background: radial-gradient(circle, rgba(24, 167, 160, .45), transparent 65%);
}
.sidebar > * { position: relative; z-index: 1; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px; border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none; color: #fff;
}
.sidebar-brand:hover { color: #fff; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; font-size: 19px;
  background: linear-gradient(135deg, #6ccfc9, #0f8a9a 60%, #34c3a8);
  box-shadow: 0 6px 20px rgba(15, 138, 154, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.sidebar-brand .brand-mark i { color: #fff; font-size: 19px; }
.sidebar-logo { max-height: 34px; max-width: 150px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tag { font-size: 11.5px; color: var(--sidebar-muted); font-weight: 500; }
.brand-text--logo { gap: 7px; padding: 4px 0; }

.sidebar-scroll { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px 16px; scrollbar-color: rgba(255,255,255,.18) transparent; }

.nav-group { margin-top: 6px; }
.nav-group-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: 0; padding: 10px 10px 6px; cursor: pointer;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--sidebar-muted); border-radius: 8px;
}
.nav-group-toggle:hover { color: #fff; }
.nav-group-toggle i { font-size: 10px; transition: transform .2s ease; opacity: .7; }
.nav-group.collapsed .nav-group-toggle i { transform: rotate(-90deg); }
.nav-group.collapsed > ul { display: none !important; }

.sidebar .nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  margin: 2px 0; padding: 8px 10px; border-radius: 12px;
  color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .nav-link:hover .nav-icon { transform: scale(1.06); }
.nav-icon {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13.5px;
  background: rgba(255, 255, 255, .06); color: var(--tone, #9fe1dd);
  transition: transform .15s ease, background .15s ease;
}
.sidebar .nav-link i { width: auto; opacity: 1; }
.nav-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-ext { font-size: 10px; opacity: .5; }

.tone-violet  { --tone: #9fe1dd; --tone-solid: #2fb5ad; }
.tone-pink    { --tone: #9fdde3; --tone-solid: #0f8a9a; }
.tone-cyan    { --tone: #67e8f9; --tone-solid: #06b6d4; }
.tone-amber   { --tone: #fcd34d; --tone-solid: #f59e0b; }
.tone-emerald { --tone: #6ee7b7; --tone-solid: #10b981; }
.tone-sky     { --tone: #7dd3fc; --tone-solid: #0ea5e9; }
.tone-rose    { --tone: #fda4af; --tone-solid: #f43f5e; }

.sidebar .nav-link.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(135deg, rgba(47, 181, 173, .55), rgba(15, 138, 154, .38));
  box-shadow: 0 6px 18px rgba(24, 167, 160, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.sidebar .nav-link.active .nav-icon { background: var(--tone-solid, var(--primary)); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.sidebar .nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #9fe1dd, #6fd8c0);
}

.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-border); margin-top: 0; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-mail { color: var(--sidebar-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.sidebar-logout { width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .08); color: var(--sidebar-text); display: grid; place-items: center; transition: background .15s; }
.sidebar-logout:hover { background: rgba(244, 63, 94, .85); color: #fff; }

/* ---------- Content + header ---------- */
.content { margin-left: var(--sidebar-width); min-height: 100vh; background: var(--bg); position: relative; }
body:not(.has-sidebar) .content { margin-left: 0; }
.content::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 340px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 240px at 85% -40px, color-mix(in srgb, var(--primary-2) 14%, transparent), transparent 70%),
    radial-gradient(700px 260px at 20% -80px, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%);
}
/* Above the decorative ::before, without a z-index: a z-index here makes every
   page block a stacking context, which trapped modals under their backdrop. */
.content > * { position: relative; }

.content-header {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 32px; min-height: 68px;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-title, .content-header h1 { font-size: 17px; font-weight: 700; margin: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-heading { min-width: 0; line-height: 1.2; }
.header-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content:has(.page-header) .header-subtitle { display: none; }
.header-new-btn { display: inline-flex; align-items: center; border-radius: 10px; padding: 6px 12px; font-weight: 600; }
.header-new-btn::after { margin-left: 6px; }
.content-body { padding: 28px 32px 48px; max-width: 1600px; }

.user-menu { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); display: grid; place-items: center;
  box-shadow: var(--shadow-xs); transition: color .15s, border-color .15s, transform .15s; cursor: pointer;
}
.icon-btn:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); transform: translateY(-1px); }
.sidebar-toggle { display: none; }

.global-search {
  position: relative; align-items: center; width: 320px; height: 40px; padding: 0 10px 0 38px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.global-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.global-search > i { position: absolute; left: 14px; color: var(--muted-light); font-size: 13px; }
.global-search-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13.5px; min-width: 0; }
.global-search-input::placeholder { color: var(--muted-light); }

.user-avatar {
  width: 40px; height: 40px; border-radius: 12px; border: 0; padding: 0;
  display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(135deg, #2fb5ad, #0f8a9a 60%, #34c3a8); color: #fff;
  font-weight: 700; font-size: 14px; letter-spacing: .02em; cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 138, 154, .35);
}
.user-avatar.sm { width: 34px; height: 34px; font-size: 12px; border-radius: 10px; box-shadow: none; cursor: default; }
.user-avatar.dropdown-toggle::after { display: none; }
.dropdown-header-user { display: flex; align-items: center; gap: 10px; padding: 8px 14px 4px; }
.dropdown-header-user > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.dropdown-header-user small { color: var(--muted); font-size: 12px; }

.badge-notification {
  position: absolute; top: -4px; right: -4px; display: none;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: linear-gradient(135deg, var(--rose), var(--orange)); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--card);
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.025em; margin: 0; color: var(--text); }
.page-subtitle { color: var(--muted); margin: 4px 0 0; font-size: 14.5px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  --bs-card-bg: var(--card); --bs-card-border-color: var(--border); --bs-card-cap-bg: transparent;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card-header, .card-footer { background: transparent; border-color: var(--border-light); padding: 16px 20px; color: var(--text); }
.card-header { font-weight: 700; }
.card-header h5, .card-header h6, .card-title { font-weight: 700; color: var(--text); }
.card-header i.fas, .card-header i.fa, .card-title i.fas { color: var(--primary); }
.card-body { padding: 20px; }
a.card:hover, .card.hover-lift:hover, .card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ---------- Stat cards ---------- */
.stat-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px; padding: 20px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--stat, var(--primary)) 16%, transparent), transparent 70%);
  pointer-events: none;
}
.stat-card-icon {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 15px; display: grid; place-items: center;
  font-size: 21px; color: #fff !important;
  background: linear-gradient(135deg, var(--stat-a, #2fb5ad), var(--stat-b, #0f8a9a));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--stat-a, #2fb5ad) 40%, transparent);
}
.stat-card-icon i { color: #fff !important; }
.stat-card:has(.stat-card-icon.primary), .stat-card-icon.primary { --stat-a: #2fb5ad; --stat-b: #0f8a9a; --stat: #2fb5ad; }
.stat-card:has(.stat-card-icon.success), .stat-card-icon.success { --stat-a: #10b981; --stat-b: #06b6d4; --stat: #10b981; }
.stat-card:has(.stat-card-icon.info),    .stat-card-icon.info    { --stat-a: #0ea5e9; --stat-b: #6366f1; --stat: #0ea5e9; }
.stat-card:has(.stat-card-icon.warning), .stat-card-icon.warning { --stat-a: #f59e0b; --stat-b: #f97316; --stat: #f59e0b; }
.stat-card:has(.stat-card-icon.danger),  .stat-card-icon.danger  { --stat-a: #f43f5e; --stat-b: #0f8a9a; --stat: #f43f5e; }
.stat-card-value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; }
.stat-card-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-card-link { font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none; }
.stat-card-link:hover { color: var(--primary-2); }

/* ---------- Buttons ---------- */
.btn { border-radius: 11px; font-weight: 600; letter-spacing: -0.005em; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary, .btn-primary:disabled, .btn-primary.disabled {
  --bs-btn-bg: var(--primary); --bs-btn-border-color: transparent; --bs-btn-color: #fff;
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--grad); color: #fff; border-color: transparent; filter: brightness(1.06) saturate(1.05);
  box-shadow: var(--shadow-glow); transform: translateY(-1px);
}
.btn-primary:active, .btn-primary.active, .btn-check:checked + .btn-primary { background: var(--grad); color: #fff; filter: brightness(.96); }
.btn-outline-primary {
  --bs-btn-color: var(--primary); --bs-btn-border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  --bs-btn-hover-bg: var(--primary-light); --bs-btn-hover-color: var(--primary); --bs-btn-hover-border-color: var(--primary);
  --bs-btn-active-bg: var(--primary); --bs-btn-active-border-color: var(--primary); --bs-btn-active-color: #fff;
  color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); background: transparent;
}
.btn-outline-primary:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.btn-secondary:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--primary-light)); color: var(--text); border-color: var(--border); }
.btn-outline-secondary, .btn-light, .btn-ghost {
  --bs-btn-color: var(--text-2); --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--text);
  background: var(--card); color: var(--text-2); border-color: var(--border);
}
.btn-outline-secondary:hover, .btn-light:hover, .btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { --bs-btn-bg: var(--emerald); --bs-btn-border-color: var(--emerald); --bs-btn-hover-bg: #059669; --bs-btn-hover-border-color: #059669; box-shadow: 0 4px 12px rgba(16, 185, 129, .28); }
.btn-danger { --bs-btn-bg: var(--rose); --bs-btn-border-color: var(--rose); --bs-btn-hover-bg: #e11d48; --bs-btn-hover-border-color: #e11d48; box-shadow: 0 4px 12px rgba(244, 63, 94, .25); }
.btn-warning { --bs-btn-bg: var(--amber); --bs-btn-border-color: var(--amber); --bs-btn-color: #1c1733; --bs-btn-hover-bg: #fbbf24; }
.btn-info { --bs-btn-bg: var(--sky); --bs-btn-border-color: var(--sky); --bs-btn-color: #fff; --bs-btn-hover-bg: #0284c7; --bs-btn-hover-color: #fff; }
.btn-outline-danger { --bs-btn-color: var(--rose); --bs-btn-border-color: color-mix(in srgb, var(--rose) 45%, transparent); --bs-btn-hover-bg: var(--rose); --bs-btn-hover-border-color: var(--rose); }
.btn-outline-success { --bs-btn-color: var(--emerald); --bs-btn-border-color: color-mix(in srgb, var(--emerald) 45%, transparent); --bs-btn-hover-bg: var(--emerald); --bs-btn-hover-border-color: var(--emerald); }
.btn-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.btn-sm { border-radius: 9px; }
.btn-lg { border-radius: 14px; }
.btn-close:focus { box-shadow: 0 0 0 .25rem var(--primary-ring); }

/* ---------- Forms ---------- */
.form-control, .form-select, .textarea {
  background-color: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 11px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control::placeholder { color: var(--muted-light); }
.form-control:hover, .form-select:hover { border-color: color-mix(in srgb, var(--primary) 28%, var(--border)); }
.form-control:focus, .form-select:focus, .textarea:focus {
  background-color: var(--card); color: var(--text);
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring);
}
.form-label { font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.form-text { color: var(--muted); }
.input-group-text { background: var(--surface-2); border-color: var(--border); color: var(--muted); }
.form-check-input { border-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--primary-ring); border-color: var(--primary); }
.form-range::-webkit-slider-thumb { background: var(--primary); }
.form-range::-moz-range-thumb { background: var(--primary); }

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border-light);
  --bs-table-hover-bg: color-mix(in srgb, var(--primary) 5%, transparent); --bs-table-hover-color: var(--text);
  --bs-table-striped-bg: color-mix(in srgb, var(--primary) 3%, transparent);
  color: var(--text); margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: 13px 16px; border-bottom-color: var(--border-light); }
.table thead th, .table > thead > tr > th {
  background: color-mix(in srgb, var(--surface-2) 80%, transparent); color: var(--muted);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 1px solid var(--border) !important; white-space: nowrap;
}
.table-hover > tbody > tr { transition: background-color .12s ease; }
.table-hover > tbody > tr:hover > * { background-color: color-mix(in srgb, var(--primary) 5%, transparent); }
.table a:not(.btn) { font-weight: 600; text-decoration: none; }
.table-light { --bs-table-bg: var(--surface-2); --bs-table-color: var(--muted); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: 11.5px; padding: .42em .72em; border-radius: 999px; letter-spacing: .01em; }
.badge.bg-primary, .badge.text-bg-primary { background: color-mix(in srgb, var(--primary) 14%, transparent) !important; color: var(--primary) !important; }
.badge.bg-success, .badge.text-bg-success { background: color-mix(in srgb, var(--emerald) 16%, transparent) !important; color: #047857 !important; }
.badge.bg-danger,  .badge.text-bg-danger  { background: color-mix(in srgb, var(--rose) 15%, transparent) !important; color: #be123c !important; }
.badge.bg-warning, .badge.text-bg-warning { background: color-mix(in srgb, var(--amber) 20%, transparent) !important; color: #b45309 !important; }
.badge.bg-info,    .badge.text-bg-info    { background: color-mix(in srgb, var(--sky) 16%, transparent) !important; color: #0369a1 !important; }
.badge.bg-secondary, .badge.text-bg-secondary, .badge.bg-light { background: var(--surface-2) !important; color: var(--muted) !important; }
.badge.bg-dark { background: #1f3735 !important; color: #fff !important; }
:root[data-theme="dark"] .badge.bg-success { color: #6ee7b7 !important; }
:root[data-theme="dark"] .badge.bg-danger  { color: #fda4af !important; }
:root[data-theme="dark"] .badge.bg-warning { color: #fcd34d !important; }
:root[data-theme="dark"] .badge.bg-info    { color: #7dd3fc !important; }
:root[data-theme="dark"] .badge.bg-primary { color: #9fe1dd !important; }

/* ---------- Alerts ---------- */
.alert { border: 1px solid transparent; border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow-xs); }
.alert-success { background: color-mix(in srgb, var(--emerald) 10%, var(--card)); border-color: color-mix(in srgb, var(--emerald) 28%, transparent); color: #065f46; }
.alert-danger  { background: color-mix(in srgb, var(--rose) 9%, var(--card));    border-color: color-mix(in srgb, var(--rose) 28%, transparent);    color: #9f1239; }
.alert-warning { background: color-mix(in srgb, var(--amber) 12%, var(--card));  border-color: color-mix(in srgb, var(--amber) 32%, transparent);  color: #92400e; }
.alert-info    { background: var(--grad-soft), var(--card); border-color: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--text-2); }
.alert-info a:not(.btn), .alert-info strong { color: var(--primary); }
:root[data-theme="dark"] .alert-success { color: #a7f3d0; }
:root[data-theme="dark"] .alert-danger  { color: #fecdd3; }
:root[data-theme="dark"] .alert-warning { color: #fde68a; }
:root[data-theme="dark"] .alert-info    { color: var(--text-2); }
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ---------- Dropdowns, modals, tabs, pagination ---------- */
.dropdown-menu {
  --bs-dropdown-bg: var(--card); --bs-dropdown-color: var(--text); --bs-dropdown-border-color: var(--border);
  --bs-dropdown-link-color: var(--text-2); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-hover-color: var(--text);
  --bs-dropdown-link-active-bg: var(--primary); --bs-dropdown-divider-bg: var(--border);
  border-radius: 14px; padding: 6px; box-shadow: var(--shadow-md); min-width: 220px;
}
.dropdown-item { border-radius: 9px; padding: 8px 12px; font-size: 14px; }
.dropdown-item i { color: var(--muted); width: 18px; }
.dropdown-item.text-danger i { color: inherit; }

.modal-content { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 30px 80px rgba(15, 42, 42, .3); }
.modal-header, .modal-footer { border-color: var(--border-light); padding: 18px 22px; }
.modal-title { font-weight: 700; }
.modal-backdrop { --bs-backdrop-bg: #140e2e; --bs-backdrop-opacity: .55; }

.nav-tabs { border-bottom: 1px solid var(--border); gap: 4px; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; border-radius: 0; padding: 10px 14px; }
.nav-tabs .nav-link:hover { color: var(--text); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--primary); background: transparent; border-bottom-color: var(--primary); }
.nav-pills .nav-link { border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--grad); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent); }

.pagination { --bs-pagination-color: var(--text-2); --bs-pagination-bg: var(--card); --bs-pagination-border-color: var(--border);
  --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-hover-color: var(--primary); --bs-pagination-active-bg: var(--primary);
  --bs-pagination-active-border-color: var(--primary); --bs-pagination-focus-box-shadow: 0 0 0 4px var(--primary-ring); gap: 4px; }
.page-link { border-radius: 9px !important; font-weight: 600; }

.list-group { --bs-list-group-bg: var(--card); --bs-list-group-color: var(--text); --bs-list-group-border-color: var(--border-light);
  --bs-list-group-action-hover-bg: var(--surface-2); --bs-list-group-active-bg: var(--primary); --bs-list-group-active-border-color: var(--primary); }

.progress { --bs-progress-bg: var(--surface-2); border-radius: 999px; }
.progress-bar { background: var(--grad); border-radius: 999px; }
.progress-bar.bg-success { background: linear-gradient(90deg, #10b981, #06b6d4) !important; }
.progress-bar.bg-warning { background: linear-gradient(90deg, #f59e0b, #f97316) !important; }
.progress-bar.bg-danger  { background: linear-gradient(90deg, #f43f5e, #0f8a9a) !important; }

.tooltip { --bs-tooltip-bg: #0f2a2a; --bs-tooltip-border-radius: 8px; }
.toast { border-radius: 14px; border-color: var(--border); background: var(--card); box-shadow: var(--shadow-md); }

/* ---------- Empty states ---------- */
.empty-state-icon {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 22px; display: grid; place-items: center;
  font-size: 30px; color: #fff; background: var(--grad); box-shadow: var(--shadow-glow);
}
.empty-state-icon i { color: #fff !important; }

/* ---------- Responsive: drawer navigation ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: min(86vw, var(--sidebar-width)); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 1035; background: rgba(20, 14, 46, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .content { margin-left: 0; }
  .sidebar-toggle { display: grid; }
  .content-header { padding: 12px 16px; }
  .content-body { padding: 20px 16px 40px; }
  .page-title { font-size: 23px; }
  /* undo the legacy icon-rail rules from ui-kit.css */
  .sidebar .nav-link span.nav-text, .sidebar-brand span.brand-text, .sidebar-brand span.brand-name, .sidebar-brand span.brand-tag { display: revert; }
  .sidebar-brand span.aswato-logo { display: inline-flex; }
  .sidebar-brand span.brand-text--logo { display: flex; }
  .sidebar .nav-link { justify-content: flex-start; padding: 8px 10px; }
}
@media (min-width: 992px) { .sidebar-backdrop { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Specificity fixes over legacy ui-kit.css ---------- */
.sidebar .sidebar-brand .brand-name { color: #fff; font-size: 17px; font-weight: 800; }
.sidebar .sidebar-brand .brand-tag { color: var(--sidebar-muted); font-size: 11.5px; font-weight: 500; }
.sidebar .nav-link.active, .sidebar .nav-link.active .nav-text { color: #fff; }
.sidebar .nav-link .nav-icon i, .sidebar .nav-link.active .nav-icon i { color: inherit; opacity: 1; font-size: 13.5px; }
.stat-card > * { position: relative; z-index: 1; }
.stat-card::after { z-index: 0; }
.stat-card .stat-card-icon { background: linear-gradient(135deg, var(--stat-a, #2fb5ad), var(--stat-b, #0f8a9a)); color: #fff; }
.content:has(.page-header) .header-title,
.content:has(.hero-banner) .header-title { display: none; }

/* ---------- Dashboard hero ---------- */
.hero-banner {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 30px 34px; border-radius: var(--radius-lg); color: #fff;
  background: var(--grad-hero);
  box-shadow: 0 20px 50px rgba(24, 167, 160, .28);
}
.hero-banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1px); background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); mask-image: linear-gradient(90deg, transparent 30%, #000);
}
.hero-eyebrow { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.78); }
.hero-title { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; color: #fff !important; }
.hero-sub { margin: 6px 0 18px; color: rgba(255,255,255,.85); font-size: 15px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn-light { background: #fff; color: #0b4a47; border: 0; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.hero-actions .btn-light:hover { background: #fff; color: #831843; transform: translateY(-1px); }
.btn-glass { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255,255,255,.24); color: #fff; border-color: rgba(255,255,255,.45); }
.hero-art { display: flex; align-items: center; gap: 20px; flex: 0 0 auto; }
.hero-orb {
  width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center; font-size: 40px; color: #fff;
  background: linear-gradient(135deg, rgba(255,255,255,.32), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.35); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 18px 40px rgba(0,0,0,.2);
  animation: ac-float 5s ease-in-out infinite;
}
.hero-wave { display: flex; align-items: center; gap: 5px; height: 64px; }
.hero-wave span { display: block; width: 6px; border-radius: 6px; background: linear-gradient(180deg, #fff, rgba(255,255,255,.4)); animation: ac-wave 1.4s ease-in-out infinite; }
.hero-wave span:nth-child(1) { height: 22px; animation-delay: -.2s; }
.hero-wave span:nth-child(2) { height: 40px; animation-delay: -.5s; }
.hero-wave span:nth-child(3) { height: 58px; animation-delay: -.1s; }
.hero-wave span:nth-child(4) { height: 34px; animation-delay: -.7s; }
.hero-wave span:nth-child(5) { height: 50px; animation-delay: -.3s; }
.hero-wave span:nth-child(6) { height: 28px; animation-delay: -.9s; }
.hero-wave span:nth-child(7) { height: 16px; animation-delay: -.4s; }
@keyframes ac-wave { 0%, 100% { transform: scaleY(.55); } 50% { transform: scaleY(1); } }
@keyframes ac-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@media (max-width: 767.98px) { .hero-art { display: none; } .hero-banner { padding: 24px; } .hero-title { font-size: 24px; } }

/* Legacy ui-kit.css marks these !important; match it so the dark sidebar stays legible. */
:root { --sidebar-active: linear-gradient(135deg, rgba(47, 181, 173, .6), rgba(15, 138, 154, .42)); --sidebar-active-text: #fff; }
.sidebar .nav-link:hover { background: var(--sidebar-hover) !important; color: #fff !important; }
.sidebar .nav-link.active { background: var(--sidebar-active) !important; color: #fff !important; border-left: 0 !important; padding-left: 10px !important; }

/* Legacy ui-kit.css forces a 68px icon rail below 992px with !important; use the drawer instead. */
@media (max-width: 991.98px) {
  :root { --sidebar-width: 268px; }
  .content { margin-left: 0 !important; }
  .sidebar .nav-link { justify-content: flex-start; padding: 8px 10px !important; }
  .sidebar .nav-link i { font-size: 13.5px !important; }
  .sidebar-brand { justify-content: flex-start; }
  .sidebar .sidebar-brand .brand-mark i { font-size: 19px !important; }
  .user-menu { gap: 8px; }
}
@media (min-width: 992px) { .content { margin-left: var(--sidebar-width) !important; } }
@media (max-width: 575.98px) {
  .icon-btn, .user-avatar { width: 38px; height: 38px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .alert { padding: 12px 14px; }
}
/* Dark-mode header: keep the frosted look (legacy rule makes it opaque) */
[data-theme="dark"] .content-header { background: var(--header-bg) !important; border-color: color-mix(in srgb, var(--border) 70%, transparent) !important; }

/* Contacts toolbar */
.contacts-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.contacts-search { flex: 1 1 260px; max-width: 420px; }
.contacts-search .form-control { min-width: 0; }

/* Page headers that wrap title + actions in one inner flex row */
.page-header > div:only-child { flex: 1 1 auto; }

/* Platform Setup */
.setup-progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,.25); overflow: hidden; max-width: 520px; }
.setup-progress > span { display: block; height: 100%; border-radius: inherit; background: #fff; box-shadow: 0 0 12px rgba(255,255,255,.6); }
.setup-index ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; padding: 10px; }
.setup-index-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.setup-index-link:hover { background: var(--surface-2); color: var(--text); }
.setup-num { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.setup-index-link.status-done .setup-num { background: var(--emerald); color: #fff; }
.setup-index-link.status-partial .setup-num { background: var(--amber); color: #0f2a2a; }
.setup-step { scroll-margin-top: 90px; }
.setup-step:target { box-shadow: 0 0 0 3px var(--primary-ring), var(--shadow-md); }

/* ==========================================================================
   UI polish (2026-11): select arrows, tables, chips, language button
   ========================================================================== */

/* Select arrows. ui-kit.css sets `background: … !important`, which wiped
   Bootstrap's chevron on every <select>: put it back, in both themes. */
/* Every state: a focus/hover rule elsewhere uses the `background` shorthand,
   which would turn the chevron back into a repeated pattern. */
.form-select, select.form-control, select.select,
.form-select:hover, .form-select:focus, .form-select:active,
select.form-control:hover, select.form-control:focus {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b6787' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3.5 6 4.5 4.5L12.5 6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 14px 14px !important;
  padding-right: 38px !important;
  cursor: pointer;
}
.form-select:hover, .form-select:focus, select.form-control:hover, select.form-control:focus {
  background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 14px 14px !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237c3aed' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3.5 6 4.5 4.5L12.5 6'/%3e%3c/svg%3e") !important;
}
[data-theme="dark"] .form-select, [data-theme="dark"] select.form-control,
[data-theme="dark"] .form-select:focus, [data-theme="dark"] select.form-control:focus {
  background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 14px 14px !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cfcae9' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3.5 6 4.5 4.5L12.5 6'/%3e%3c/svg%3e") !important;
}
.form-select[multiple], .form-select[size]:not([size="1"]), select.form-control[multiple] {
  background-image: none !important; padding-right: 12px !important; cursor: default;
}
.form-select:disabled { cursor: not-allowed; opacity: .7; }
.form-select-sm { padding-right: 32px !important; background-position: right 10px center !important; }
.form-select option { color: var(--text); background: var(--card); }

/* Tables: headers on one line, cells breathe, never cut off (see ui.js wrapper). */
.table thead th { white-space: nowrap; vertical-align: middle; }
.table td { vertical-align: middle; }
.table-responsive { border-radius: inherit; }
.card > .table-responsive:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.table td.text-end .btn + .btn, .table td.text-end form + .btn, .table td.text-end .btn + form { margin-left: 4px; }
.table .btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .55rem; }

/* Soft badges */
.text-bg-success-soft { background: color-mix(in srgb, var(--emerald) 15%, transparent) !important; color: #047857 !important; }
.text-bg-secondary-soft { background: var(--surface-2) !important; color: var(--muted) !important; }
.text-bg-warning-soft { background: color-mix(in srgb, var(--amber) 18%, transparent) !important; color: #92400e !important; }
.text-bg-danger-soft { background: color-mix(in srgb, var(--rose) 15%, transparent) !important; color: #be123c !important; }
[data-theme="dark"] .text-bg-success-soft { color: #6ee7b7 !important; }
[data-theme="dark"] .text-bg-warning-soft { color: #fcd34d !important; }
[data-theme="dark"] .text-bg-danger-soft { color: #fda4af !important; }

/* Chips: compact facts in a cell (plan features, tags) */
.chip {
  display: inline-flex; align-items: center; gap: 5px; margin: 2px 4px 2px 0;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; line-height: 1.4; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-light);
}
.chip strong { color: var(--text); font-weight: 700; }
.chip-on { background: color-mix(in srgb, var(--emerald) 12%, transparent); color: #047857; border-color: transparent; }
.chip-off { background: transparent; color: var(--muted-light); border-style: dashed; }
.chip-off strong { color: var(--muted-light); }
[data-theme="dark"] .chip-on { color: #6ee7b7; }

/* Small key/value list inside a table cell */
.kv-mini { display: grid; grid-template-columns: auto auto; gap: 1px 10px; font-size: 12.5px; white-space: nowrap; }
.kv-mini dt { font-weight: 500; color: var(--muted); }
.kv-mini dd { margin: 0; font-weight: 600; color: var(--text-2); text-align: right; }

/* Plans list */
.plans-table .plans-features { min-width: 260px; max-width: 420px; white-space: normal; }

/* Page heading block */
.page-head h2 { font-weight: 800; letter-spacing: -.02em; }

/* Language button: globe, code and caret on one line */
.icon-btn.locale-btn {
  width: auto; min-width: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px !important;
}
.icon-btn.locale-btn i { margin: 0 !important; }
.icon-btn.locale-btn.dropdown-toggle::after { margin-left: 0; vertical-align: middle; border-top-width: .32em; opacity: .7; }

/* Forms: consistent rhythm */
.form-label { margin-bottom: .35rem; }
.form-text { font-size: 12.5px; margin-top: .3rem; }
.form-check-input { cursor: pointer; }
.form-check-label { cursor: pointer; }
.card-header { background: transparent; }

/* Filter bars: a small button next to normal inputs gets the inputs' height */
.align-items-end > [class*="col"] > .btn-sm.w-100,
.align-items-end > [class*="col"] > form > .btn-sm.w-100 { min-height: 40px; font-size: .875rem; border-radius: 11px; }

/* Icon-only action buttons in tables: same size and frame, colour by intent */
.table .btn-sm:has(> i:only-child) {
  width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--border) !important; background: var(--card); border-radius: 9px;
}
.table .btn-sm:has(> i:only-child):hover:not(:disabled) { border-color: currentColor !important; background: color-mix(in srgb, currentColor 8%, var(--card)); transform: translateY(-1px); }
.table .btn-outline-primary:has(> i:only-child) { color: var(--primary); }
.table .btn-outline-success:has(> i:only-child) { color: var(--emerald); }
.table .btn-outline-warning:has(> i:only-child) { color: #d97706; }
.table .btn-outline-danger:has(> i:only-child) { color: var(--rose); }
.table .btn-outline-secondary:has(> i:only-child) { color: var(--muted); }
.table td .d-inline + .btn, .table td .btn + .d-inline { margin-left: 4px; }

/* Page header with a breadcrumb: breadcrumb on its own line, title below it on the left */
.page-header > nav:first-child { flex: 0 0 100%; margin-bottom: -8px; }
.page-header > nav:first-child + .page-title,
.page-header > nav:first-child + h1,
.page-header > nav:first-child + h2 { margin-right: auto; }

/* Toggle buttons (btn-check): the chosen option is clearly filled */
.btn-check:checked + .btn-outline-primary, .btn-outline-primary.active, .btn-outline-primary:active {
  background: var(--grad) !important; color: #fff !important; border-color: transparent !important; box-shadow: var(--shadow-glow);
}
.btn-check:checked + .btn-outline-secondary, .btn-outline-secondary.active {
  background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important;
}
.btn-check:focus-visible + .btn { box-shadow: 0 0 0 4px var(--primary-ring) !important; }

/* Phones: table rows become labelled cards (labels set by actions.js) */
@media (max-width: 575.98px) {
  table.table-stack > thead { display: none; }
  table.table-stack, table.table-stack > tbody, table.table-stack > tbody > tr, table.table-stack > tbody > tr > td { display: block; width: 100%; }
  .table-responsive:has(> table.table-stack) { overflow-x: visible; }
  table.table-stack > tbody > tr { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
  table.table-stack > tbody > tr:last-child { border-bottom: 0; }
  table.table-stack > tbody > tr > td {
    display: grid; grid-template-columns: minmax(84px, 38%) minmax(0, 1fr); column-gap: 14px; justify-items: end; align-items: start;
    padding: 5px 0 !important; border: 0 !important; text-align: right !important; background: transparent !important;
  }
  table.table-stack > tbody > tr > td > * { grid-column: 2; max-width: 100%; }
  table.table-stack > tbody > tr > td > .usage-line, table.table-stack > tbody > tr > td > .progress { width: 100%; }
  table.table-stack > tbody > tr > td::before {
    content: attr(data-label); grid-column: 1; grid-row: 1 / span 20; justify-self: start; text-align: left;
    font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 2px;
  }
  table.table-stack > tbody > tr > td:first-child { display: block; justify-items: normal; text-align: left !important; padding-bottom: 8px !important; }
  table.table-stack > tbody > tr > td:first-child::before { display: none; }
  table.table-stack > tbody > tr > td:first-child > * { max-width: none; }
  table.table-stack > tbody > tr > td:not([data-label]), table.table-stack > tbody > tr > td[data-label=""] { display: block; justify-items: normal; text-align: right !important; }
  table.table-stack > tbody > tr > td:not([data-label])::before, table.table-stack > tbody > tr > td[data-label=""]::before { display: none; }
  table.table-stack > tbody > tr > td[colspan] { display: block; text-align: center !important; }
  table.table-stack .kv-mini { min-width: 0; }
  table.table-stack .plans-features { min-width: 0; max-width: none; }
  table.table-stack .progress { min-width: 120px; }
}

/* Calendar on phones: section tabs scroll sideways, the calendar toolbar wraps */
@media (max-width: 767.98px) {
  .sched-sidebar .sched-nav-item { flex: 0 0 auto; white-space: nowrap; }
  .fc .fc-toolbar.fc-header-toolbar { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .fc .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
  .fc .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk:nth-child(2) { order: -1; flex: 1 0 100%; text-align: center; }
  .fc .fc-toolbar-title { font-size: 17px !important; }
  .fc .fc-button { padding: .3rem .55rem !important; font-size: 13px !important; }
  .fc .fc-button-group { flex-wrap: nowrap; }
}

/* Phones: rows of buttons/badges wrap instead of pushing the page sideways */
@media (max-width: 575.98px) {
  .d-flex.gap-1:not(.flex-nowrap), .d-flex.gap-2:not(.flex-nowrap), .d-flex.gap-3:not(.flex-nowrap) { flex-wrap: wrap; }
  .btn-group:not(.flex-nowrap) { flex-wrap: wrap; }
}

/* ---------- Top bar on phones: keep room for the page title / greeting ---------- */
@media (max-width: 575.98px) {
  .content-header { gap: 8px; }
  .content-header .user-menu { gap: 6px; flex-shrink: 0; }
  .content-header .dark-mode-btn { display: none; }
  .content-header .locale-btn span { display: none; }
  .content-header .locale-btn { padding-left: 8px !important; padding-right: 8px !important; }
  .content-header .locale-btn.dropdown-toggle::after { display: none; }
  .header-new-btn.dropdown-toggle::after { display: none; }
  .header-new-btn { padding: 6px 10px; }
  .header-title { font-size: 15px; }
  .header-subtitle { font-size: 11.5px; }
}

/* ---------- Settings tabs (one set for every settings page) ---------- */
.settings-tabs { border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.settings-tabs-main, .settings-tabs-sub { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.settings-tabs-main::-webkit-scrollbar, .settings-tabs-sub::-webkit-scrollbar { display: none; }
.settings-tab {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: var(--text-muted, #6b7280); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.settings-tab i { font-size: 13px; opacity: .8; }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.settings-tabs-sub { padding: 10px 0 12px; gap: 6px; }
.settings-subtab {
  flex-shrink: 0; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap;
  color: var(--text-muted, #6b7280); text-decoration: none; background: transparent; border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.settings-subtab:hover { color: var(--text); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.settings-subtab.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.settings-tab:focus-visible, .settings-subtab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- Settings: title, then one row of tabs (sub-pages in a small menu) ---------- */
.content:has(.settings-head) .header-title { display: none; }
.content:has(.settings-head) .page-title:not(.settings-head .page-title) { font-size: 1.25rem !important; }
.settings-tab-wrap { display: inline-flex; align-items: center; flex-shrink: 0; position: relative; }
.settings-tab-more {
  border: 0; background: transparent; color: var(--text-muted, #6b7280); width: 26px; height: 26px; margin-left: -6px;
  border-radius: 6px; display: grid; place-items: center; font-size: 10px; cursor: pointer; transition: background .15s, color .15s;
}
.settings-tab-more:hover, .settings-tab-more[aria-expanded="true"] { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.settings-tab-more.active { color: var(--primary); }
.settings-tab-more:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.settings-tab-wrap .dropdown-menu .dropdown-item.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--brand-700, #107670); font-weight: 600; }

/* ---------- Bell panel ---------- */
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1060; width: min(360px, calc(100vw - 32px));
  background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(15, 42, 42, .14);
  overflow: hidden;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-mark-all { border: 0; background: none; color: var(--primary); font-size: 13px; font-weight: 600; padding: 2px 4px; border-radius: 6px; }
.notif-mark-all:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.notif-list { list-style: none; margin: 0; padding: 4px; max-height: 360px; overflow-y: auto; }
.notif-item { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; color: var(--text) !important; text-decoration: none !important; }
.notif-item:hover, .notif-item:focus-visible { background: var(--surface-2); }
.notif-item.is-urgent { border-left: 3px solid #dc2626; padding-left: 9px; }
.notif-msg { font-size: 14px; line-height: 1.35; }
.notif-when { font-size: 12px; color: var(--muted); }
.notif-empty { padding: 20px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.notif-foot { display: block; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--primary) !important; text-decoration: none !important; }
@media (max-width: 575.98px) { .notif-panel { position: fixed; left: 16px; right: 16px; top: 64px; width: auto; } }
.sidebar .nav-count { background: #dc2626 !important; color: #fff !important; font-size: 11px; font-weight: 700; min-width: 20px; padding: 3px 6px; position: relative; z-index: 1; }
