/* ==========================================================================
   lnkys — design system
   One visual language for the public marketing site, the auth pages and the
   signed-in workspace/admin app, layered on top of Bootstrap 5.

   Structure of this file:
     1. Tokens (brand, neutrals, semantic, type, radius, elevation)
     2. Bootstrap variable bridge (so every stock Bootstrap component — and
        every existing page that uses one — picks up the tokens automatically)
     3. Base typography & elements
     4. Core components (buttons, forms, cards, tables, badges, alerts,
        dropdowns, modals, pagination, tabs, list groups, toasts)
     5. App patterns (page header, stat cards, toolbars, empty states,
        skeletons, copy chips, icon buttons)
     6. Marketing site (navbar, hero, product preview, features, workflow,
        pricing, FAQ, CTA, footer, auth)
     7. Analytics widgets (bar lists, trend chart, heatmap, engagement)
     8. Bilingual / RTL support
   Feature-specific sections (chat, live details, app shell, QR, Details
   page) follow further down and only consume the tokens defined here.

   Design direction: neutral, quiet surfaces; one confident indigo brand
   color used sparingly for actions and selection; cyan reserved as the
   second data color; gradients only on the brand mark and one CTA band.
   Corner radii are deliberately modest (6–14px) and shadows are neutral,
   not tinted, so data — not decoration — carries the interface.
   ========================================================================== */

/* ---- 1. Tokens ----------------------------------------------------------- */
:root {
  /* Brand — indigo. Token names predate this redesign and are referenced by
     pages/partials, so the names are kept and only the values are tuned. */
  --brand-25:  #f7f7ff;
  --brand-50:  #eef0ff;
  --brand-100: #e0e3ff;
  --brand-200: #c7cbfe;
  --brand-300: #a5abfc;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #262262;
  --brand-rgb: 79, 70, 229;

  /* Secondary data/accent color (second series in charts, info states). */
  --accent-50:  #ecfeff;
  --accent-500: #06b6d4;
  --accent-600: #0891b2;

  /* Semantic */
  --success-50:  #ecfdf3;
  --success-500: #12b76a;
  --success-600: #039855;
  --success-700: #027a48;
  --warning-50:  #fffaeb;
  --warning-500: #f79009;
  --warning-700: #b54708;
  --danger-50:   #fef3f2;
  --danger-500:  #f04438;
  --danger-600:  #d92d20;
  --danger-700:  #b42318;
  --amber-50:  #fffbeb;
  --amber-500: #f59e0b;
  --pink-50:   #fdf2f8;
  --pink-500:  #ec4899;

  /* Neutrals (slate-leaning grey). --ink-* names are used across pages. */
  --ink-950: #0b1220;
  --ink-900: #101828;
  --ink-800: #1d2939;
  --ink-700: #344054;
  --ink-600: #475467;
  --ink-500: #667085;
  --ink-400: #98a2b3;
  --ink-300: #d0d5dd;
  --ink-200: #e4e7ec;
  --ink-100: #f2f4f7;
  --ink-50:  #f9fafb;

  /* Surfaces & lines */
  --surface:        #ffffff;
  --surface-muted:  var(--ink-50);
  --surface-sunken: #f5f6f8;
  --page-bg:        #f7f8fa;
  --border:         var(--ink-200);
  --border-strong:  var(--ink-300);

  /* Text */
  --text:        var(--ink-900);
  --text-secondary: var(--ink-600);
  --text-muted:  var(--ink-500);

  /* Gradients — restrained: brand mark, primary CTA band, data fills only. */
  --gradient-brand: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-600) 55%, var(--brand-500) 100%);
  --gradient-soft:  linear-gradient(180deg, var(--brand-25) 0%, #ffffff 70%);

  /* Elevation — neutral, low. */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.18);
  --ring: 0 0 0 4px rgba(var(--brand-rgb), 0.16);
  --ring-danger: 0 0 0 4px rgba(240, 68, 56, 0.14);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: .12s;
  --dur: .2s;
}

/* ---- 2. Bootstrap bridge ------------------------------------------------- */
:root {
  --bs-primary: var(--brand-600);
  --bs-primary-rgb: 79, 70, 229;
  --bs-primary-text-emphasis: var(--brand-800);
  --bs-primary-bg-subtle: var(--brand-50);
  --bs-primary-border-subtle: var(--brand-200);
  --bs-success: var(--success-600);
  --bs-success-rgb: 3, 152, 85;
  --bs-danger: var(--danger-600);
  --bs-danger-rgb: 217, 45, 32;
  --bs-warning: var(--warning-500);
  --bs-warning-rgb: 247, 144, 9;
  --bs-info: var(--accent-600);
  --bs-info-rgb: 8, 145, 178;
  --bs-secondary-color: var(--ink-500);
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text);
  --bs-body-color-rgb: 16, 24, 40;
  --bs-body-bg: var(--page-bg);
  --bs-emphasis-color: var(--ink-950);
  --bs-secondary-bg: var(--ink-100);
  --bs-tertiary-bg: var(--ink-50);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: rgba(16, 24, 40, 0.08);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-sm: var(--radius-xs);
  --bs-border-radius-lg: var(--radius-md);
  --bs-border-radius-xl: var(--radius-lg);
  --bs-link-color: var(--brand-600);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: var(--brand-700);
  --bs-link-hover-color-rgb: 67, 56, 202;
  --bs-focus-ring-color: rgba(var(--brand-rgb), 0.25);
  --bs-code-color: var(--brand-700);
}

/* ---- 3. Base ------------------------------------------------------------- */
html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

html, body { height: 100%; }
html {
  /* Defensive backstop: nothing should be able to force the whole page to scroll sideways —
     tables, charts and code blocks scroll inside their own containers instead. */
  overflow-x: hidden;
}
body {
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  max-width: 100vw;
  overflow-x: hidden;
}
img, svg, table { max-width: 100%; }
pre, code { overflow-x: auto; }
code, kbd, pre, samp { font-family: var(--font-mono); }
code { font-size: 0.86em; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  line-height: 1.2;
}
h5, h6, .h5, .h6 { letter-spacing: -0.01em; }
.lead { color: var(--text-secondary); font-weight: 400; }
.text-muted { color: var(--text-muted) !important; }
.small, small { font-size: var(--text-sm); }
.fw-semibold { font-weight: 600 !important; }
.tabular, .table td, .kpi-value, .stat-card-value, .usage-tile-value, .stat-tile-value { font-variant-numeric: tabular-nums; }

a { color: var(--brand-600); text-decoration: none; transition: color var(--dur-fast) ease; }
a:hover { color: var(--brand-700); }

::selection { background: var(--brand-100); color: var(--brand-900); }

/* One consistent, visible keyboard focus indicator everywhere (mouse clicks don't show it). */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: var(--radius-xs); }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; }

hr { border-color: var(--border); opacity: 1; }

/* ---- 4. Components ------------------------------------------------------- */

/* Buttons — modest radius, solid fills, no lift-on-hover. Uses Bootstrap's own --bs-btn-*
   variables so every variant (sm/lg, outline, disabled, active) stays internally consistent. */
.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-font-size: 0.9rem;
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-focus-box-shadow: var(--ring);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  letter-spacing: -0.005em;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.btn.d-block, .btn.w-100 { display: flex; }
.btn-sm { --bs-btn-padding-x: 0.7rem; --bs-btn-padding-y: 0.32rem; --bs-btn-font-size: 0.8rem; --bs-btn-border-radius: var(--radius-sm); gap: 0.35rem; }
.btn-lg { --bs-btn-padding-x: 1.35rem; --bs-btn-padding-y: 0.72rem; --bs-btn-font-size: 1rem; --bs-btn-border-radius: var(--radius-md); }
.btn .ui-icon { flex: none; }

.btn-primary {
  --bs-btn-bg: var(--brand-600);
  --bs-btn-border-color: var(--brand-600);
  --bs-btn-hover-bg: var(--brand-700);
  --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-800);
  --bs-btn-active-border-color: var(--brand-800);
  --bs-btn-disabled-bg: var(--brand-300);
  --bs-btn-disabled-border-color: var(--brand-300);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-700);
  --bs-btn-border-color: var(--brand-200);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--brand-800);
  --bs-btn-hover-bg: var(--brand-50);
  --bs-btn-hover-border-color: var(--brand-300);
  --bs-btn-active-color: var(--brand-800);
  --bs-btn-active-bg: var(--brand-100);
  --bs-btn-active-border-color: var(--brand-300);
}
/* "Secondary" = the neutral white button used for most non-primary actions. */
.btn-outline-secondary, .btn-light, .btn-secondary {
  --bs-btn-color: var(--ink-700);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--ink-900);
  --bs-btn-hover-bg: var(--ink-50);
  --bs-btn-hover-border-color: var(--ink-300);
  --bs-btn-active-color: var(--ink-900);
  --bs-btn-active-bg: var(--ink-100);
  --bs-btn-active-border-color: var(--ink-300);
  --bs-btn-disabled-color: var(--ink-400);
  --bs-btn-disabled-bg: var(--surface);
  --bs-btn-disabled-border-color: var(--ink-200);
  box-shadow: var(--shadow-xs);
}
.btn-outline-danger {
  --bs-btn-color: var(--danger-700);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: #fecdca;
  --bs-btn-hover-color: var(--danger-700);
  --bs-btn-hover-bg: var(--danger-50);
  --bs-btn-hover-border-color: #fda29b;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--danger-600);
  --bs-btn-active-border-color: var(--danger-600);
}
.btn-danger {
  --bs-btn-bg: var(--danger-600);
  --bs-btn-border-color: var(--danger-600);
  --bs-btn-hover-bg: var(--danger-700);
  --bs-btn-hover-border-color: var(--danger-700);
}
.btn-outline-warning {
  --bs-btn-color: var(--warning-700);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: #fedf89;
  --bs-btn-hover-color: var(--warning-700);
  --bs-btn-hover-bg: var(--warning-50);
  --bs-btn-hover-border-color: #fec84b;
  --bs-btn-active-color: var(--warning-700);
  --bs-btn-active-bg: #fef0c7;
  --bs-btn-active-border-color: #fec84b;
}
.btn-outline-success {
  --bs-btn-color: var(--success-700);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: #a6f4c5;
  --bs-btn-hover-color: var(--success-700);
  --bs-btn-hover-bg: var(--success-50);
  --bs-btn-hover-border-color: #6ce9a6;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--success-600);
  --bs-btn-active-border-color: var(--success-600);
}
.btn-success {
  --bs-btn-bg: var(--success-600);
  --bs-btn-border-color: var(--success-600);
  --bs-btn-hover-bg: var(--success-700);
  --bs-btn-hover-border-color: var(--success-700);
}
.btn-outline-info {
  --bs-btn-color: var(--accent-600);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: #a5f0fc;
  --bs-btn-hover-color: #0e7490;
  --bs-btn-hover-bg: var(--accent-50);
  --bs-btn-hover-border-color: #67e3f9;
}
.btn-link { --bs-btn-color: var(--brand-600); --bs-btn-hover-color: var(--brand-700); text-decoration: none; font-weight: 600; }
/* Ghost — text-only button for low-emphasis actions inside tables/toolbars. */
.btn-ghost {
  --bs-btn-color: var(--ink-600);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--ink-900);
  --bs-btn-hover-bg: var(--ink-100);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--ink-200);
  --bs-btn-active-border-color: transparent;
}

/* Square icon-only button (copy, open, more). Always pair with aria-label/title. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-500);
  font-size: 1rem; line-height: 1; cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.icon-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.icon-btn.is-done { color: var(--success-600); }
.icon-btn-bordered { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-xs); }

/* Forms */
.form-label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-700); margin-bottom: 0.4rem; }
.form-label.small { font-size: 0.8rem; }
.form-text { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.35rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border-strong);
  padding: 0.55rem 0.8rem;
  font-size: 0.925rem;
  color: var(--text);
  background-color: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.form-select { padding-inline-end: 2.25rem; }
.form-control-sm, .form-select-sm { padding: 0.38rem 0.65rem; font-size: 0.825rem; border-radius: var(--radius-sm); }
.form-select-sm { padding-inline-end: 2rem; }
.form-control-lg, .form-select-lg { padding: 0.75rem 1rem; font-size: 1rem; border-radius: var(--radius-md); }
.form-control::placeholder { color: var(--ink-400); }
.form-control:hover, .form-select:hover { border-color: var(--ink-400); }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-xs), var(--ring);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--ink-50); color: var(--ink-500); }
.form-control[type="file"] { padding: 0.45rem 0.6rem; }
.form-control::file-selector-button {
  border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--ink-50);
  color: var(--ink-700); font-weight: 600; padding: 0.2rem 0.7rem; margin-inline-end: 0.75rem;
}
.form-check-input { border-color: var(--ink-300); }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { border-color: var(--brand-400, var(--brand-500)); box-shadow: var(--ring); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23a5abfc'/%3e%3c/svg%3e"); }
.form-check-label { color: var(--ink-700); }
.input-group-text { background: var(--ink-50); border-color: var(--border-strong); color: var(--ink-500); font-size: 0.9rem; }

/* Validation — ASP.NET's unobtrusive validation adds .input-validation-error to the field and
   renders messages in .field-validation-error / asp-validation-for spans (.text-danger). */
.form-control.input-validation-error, .form-select.input-validation-error,
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger-500); }
.form-control.input-validation-error:focus, .form-select.input-validation-error:focus,
.form-control.is-invalid:focus { box-shadow: var(--shadow-xs), var(--ring-danger); }
.field-validation-error, .invalid-feedback, span.text-danger { color: var(--danger-600) !important; font-size: 0.8rem; font-weight: 500; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 1.1rem; }
.validation-summary-errors { color: var(--danger-700); background: var(--danger-50); border: 1px solid #fecdca; border-radius: var(--radius-md); padding: 0.7rem 0.9rem; font-size: 0.875rem; margin-bottom: 1rem; }
.validation-summary-valid { display: none; }

/* Cards */
.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius-lg);
  --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-cap-padding-y: 0.9rem;
  --bs-card-cap-padding-x: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  --bs-card-spacer-y: 1.15rem;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.card.card-hover { transition: box-shadow var(--dur) ease, border-color var(--dur) ease; }
.card.card-hover:hover { box-shadow: var(--shadow-md); border-color: var(--ink-300); }
.card-header {
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-900);
}
.card-header .btn-sm { margin-block: -0.2rem; }
.card-footer { background: var(--ink-50); border-top: 1px solid var(--border); }
.card-title { font-weight: 700; letter-spacing: -0.015em; }
.card > .table-responsive:first-child, .card > .table:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.card > .table-responsive:last-child, .card > .list-group:last-child { border-bottom-left-radius: var(--bs-card-inner-border-radius); border-bottom-right-radius: var(--bs-card-inner-border-radius); overflow: hidden; }

/* Tables */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink-700);
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg: var(--ink-50);
  --bs-table-hover-color: var(--ink-900);
  --bs-table-striped-bg: var(--ink-50);
  font-size: 0.875rem;
  margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: 0.8rem 1rem; vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: 0.55rem 0.85rem; }
.table > thead > tr > th, .table > thead > tr > td {
  background: var(--ink-50);
  color: var(--ink-500);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table > :not(:first-child) { border-top: 0; }
.table td code, .table td a code { font-size: 0.82rem; }
.table-light { --bs-table-bg: var(--ink-50); }
.card > .table-responsive > .table > thead > tr > th:first-child,
.card > .table > thead > tr > th:first-child { border-top-left-radius: 0; }

/* Badges — soft, tinted status pills. Solid count badges (notification/chat counters, which all
   carry .rounded-pill) keep Bootstrap's solid fill so they stay readable at a glance. */
.badge {
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  border-radius: var(--radius-pill);
  padding: 0.3em 0.65em;
  line-height: 1.35;
}
.badge:not(.rounded-pill).bg-success { background-color: var(--success-50) !important; color: var(--success-700) !important; box-shadow: inset 0 0 0 1px #abefc6; }
.badge:not(.rounded-pill).bg-danger { background-color: var(--danger-50) !important; color: var(--danger-700) !important; box-shadow: inset 0 0 0 1px #fecdca; }
.badge:not(.rounded-pill).bg-warning { background-color: var(--warning-50) !important; color: var(--warning-700) !important; box-shadow: inset 0 0 0 1px #fedf89; }
.badge:not(.rounded-pill).bg-info { background-color: var(--accent-50) !important; color: #0e7490 !important; box-shadow: inset 0 0 0 1px #a5f0fc; }
.badge:not(.rounded-pill).bg-primary { background-color: var(--brand-50) !important; color: var(--brand-700) !important; box-shadow: inset 0 0 0 1px var(--brand-200); }
.badge:not(.rounded-pill).bg-secondary { background-color: var(--ink-100) !important; color: var(--ink-700) !important; box-shadow: inset 0 0 0 1px var(--ink-200); }
.badge:not(.rounded-pill).bg-light { background-color: var(--surface) !important; color: var(--ink-700) !important; box-shadow: inset 0 0 0 1px var(--ink-200); border: 0 !important; }
.badge:not(.rounded-pill).bg-dark { background-color: var(--ink-800) !important; }
.badge.rounded-pill.bg-danger { background-color: var(--danger-600) !important; }
/* Leading status dot for soft badges: <span class="badge bg-success badge-dot">Active</span> */
.badge-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-inline-end: 0.4em; vertical-align: 0.08em; }

/* Alerts — soft surfaces with a semantic border. */
.alert {
  --bs-alert-border-radius: var(--radius-md);
  --bs-alert-padding-x: 1rem;
  --bs-alert-padding-y: 0.8rem;
  font-size: 0.9rem;
  border-width: 1px;
}
.alert-success { --bs-alert-bg: var(--success-50); --bs-alert-color: var(--success-700); --bs-alert-border-color: #abefc6; }
.alert-danger { --bs-alert-bg: var(--danger-50); --bs-alert-color: var(--danger-700); --bs-alert-border-color: #fecdca; }
.alert-warning { --bs-alert-bg: var(--warning-50); --bs-alert-color: var(--warning-700); --bs-alert-border-color: #fedf89; }
.alert-info { --bs-alert-bg: var(--brand-25); --bs-alert-color: var(--brand-800); --bs-alert-border-color: var(--brand-100); }
.alert-secondary, .alert-light { --bs-alert-bg: var(--ink-50); --bs-alert-color: var(--ink-700); --bs-alert-border-color: var(--border); }
.alert-primary { --bs-alert-bg: var(--brand-50); --bs-alert-color: var(--brand-800); --bs-alert-border-color: var(--brand-200); }
.alert .alert-link { font-weight: 700; }
.alert .btn-close { padding: 1rem; }

/* Dropdowns */
.dropdown-menu {
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: var(--radius-md);
  --bs-dropdown-padding-y: 0.35rem;
  --bs-dropdown-padding-x: 0.35rem;
  --bs-dropdown-link-color: var(--ink-700);
  --bs-dropdown-link-hover-bg: var(--ink-100);
  --bs-dropdown-link-hover-color: var(--ink-900);
  --bs-dropdown-link-active-bg: var(--brand-50);
  --bs-dropdown-link-active-color: var(--brand-700);
  --bs-dropdown-font-size: 0.875rem;
  --bs-dropdown-header-color: var(--ink-500);
  --bs-dropdown-divider-bg: var(--border);
  box-shadow: var(--shadow-lg);
}
.dropdown-item { border-radius: var(--radius-sm); padding: 0.45rem 0.65rem; font-weight: 500; display: flex; align-items: center; gap: 0.55rem; }
.dropdown-item.active, .dropdown-item:active { font-weight: 600; }
.dropdown-header { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; padding: 0.5rem 0.65rem 0.35rem; }
.dropdown-item-text { padding: 0.45rem 0.65rem; }

/* Modals */
.modal {
  --bs-modal-border-radius: var(--radius-lg);
  --bs-modal-border-color: var(--border);
  --bs-modal-header-border-color: var(--border);
  --bs-modal-footer-border-color: var(--border);
  --bs-modal-box-shadow: var(--shadow-lg);
}
.modal-content { box-shadow: var(--shadow-lg); }
.modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-footer { background: var(--ink-50); border-bottom-left-radius: var(--bs-modal-inner-border-radius); border-bottom-right-radius: var(--bs-modal-inner-border-radius); }
.modal-backdrop { --bs-backdrop-bg: #0b1220; --bs-backdrop-opacity: 0.45; }

/* Pagination */
.pagination {
  --bs-pagination-color: var(--ink-700);
  --bs-pagination-bg: var(--surface);
  --bs-pagination-border-color: var(--border);
  --bs-pagination-hover-color: var(--ink-900);
  --bs-pagination-hover-bg: var(--ink-50);
  --bs-pagination-hover-border-color: var(--border);
  --bs-pagination-focus-box-shadow: var(--ring);
  --bs-pagination-active-bg: var(--brand-50);
  --bs-pagination-active-color: var(--brand-700);
  --bs-pagination-active-border-color: var(--brand-200);
  --bs-pagination-disabled-color: var(--ink-400);
  --bs-pagination-font-size: 0.85rem;
  --bs-pagination-border-radius: var(--radius-sm);
  gap: 0.25rem;
  flex-wrap: wrap;
}
.pagination .page-link { border-radius: var(--radius-sm) !important; min-width: 2.1rem; text-align: center; font-weight: 600; margin-inline-start: 0 !important; }

/* Tabs & pills */
.nav-tabs { --bs-nav-tabs-border-color: var(--border); --bs-nav-tabs-link-active-color: var(--brand-700); --bs-nav-tabs-link-active-border-color: transparent transparent var(--brand-600); gap: 0.25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--ink-500); font-weight: 600; font-size: 0.9rem; padding: 0.6rem 0.85rem; margin-bottom: -1px; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--ink-900); border-bottom-color: var(--ink-300); }
.nav-tabs .nav-link.active { color: var(--brand-700); border-bottom-color: var(--brand-600); background: transparent; }
.nav-pills { --bs-nav-pills-border-radius: var(--radius-sm); --bs-nav-pills-link-active-bg: var(--brand-50); --bs-nav-pills-link-active-color: var(--brand-700); }
.nav-pills .nav-link { color: var(--ink-600); font-weight: 600; font-size: 0.9rem; }
.nav-pills .nav-link:hover { background: var(--ink-100); color: var(--ink-900); }

/* Btn groups used as segmented filters */
.btn-group > .btn { box-shadow: none; }
.btn-group { box-shadow: var(--shadow-xs); border-radius: var(--radius-sm); }

/* List groups */
.list-group { --bs-list-group-border-color: var(--border); --bs-list-group-color: var(--ink-700); --bs-list-group-action-hover-bg: var(--ink-50); --bs-list-group-active-bg: var(--brand-50); --bs-list-group-active-color: var(--brand-700); --bs-list-group-active-border-color: var(--brand-200); }
.list-group-item { padding: 0.75rem 1.1rem; }

/* Toasts */
.toast { --bs-toast-border-radius: var(--radius-md); --bs-toast-border-color: var(--border); --bs-toast-box-shadow: var(--shadow-lg); --bs-toast-header-color: var(--ink-900); font-size: 0.875rem; }

/* Progress */
.progress { --bs-progress-height: 0.5rem; --bs-progress-bg: var(--ink-100); --bs-progress-border-radius: var(--radius-pill); --bs-progress-bar-bg: var(--brand-600); }

/* Tooltips / popovers */
.tooltip { --bs-tooltip-bg: var(--ink-900); --bs-tooltip-border-radius: var(--radius-sm); --bs-tooltip-font-size: 0.78rem; }
.popover { --bs-popover-border-color: var(--border); --bs-popover-border-radius: var(--radius-md); --bs-popover-box-shadow: var(--shadow-lg); }

/* Accordions (FAQ / help) */
.accordion { --bs-accordion-border-color: var(--border); --bs-accordion-border-radius: var(--radius-md); --bs-accordion-inner-border-radius: calc(var(--radius-md) - 1px); --bs-accordion-active-bg: var(--brand-25); --bs-accordion-active-color: var(--ink-900); --bs-accordion-btn-focus-box-shadow: var(--ring); }
.accordion-button { font-weight: 600; color: var(--ink-900); }

/* Code blocks */
pre { background: var(--ink-900); color: #e4e7ec; border-radius: var(--radius-md); padding: 1rem 1.1rem; font-size: 0.82rem; }
pre code { color: inherit; }

/* ---- 4b. Bootstrap 5.1 bridge ------------------------------------------- */
/* This project ships Bootstrap 5.1, whose components hard-code their colors/radii instead of
   reading the --bs-btn-*, --bs-alert-*, --bs-dropdown-* … variables that 5.2+ introduced. The
   component blocks above are written in those 5.3-style variables (so a future Bootstrap upgrade
   is a no-op); this bridge maps them onto real properties for 5.1. Scoped to the variants this
   design system defines, so any untouched Bootstrap variant keeps its stock look. */
.btn {
  padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
  font-size: var(--bs-btn-font-size);
  font-weight: var(--bs-btn-font-weight);
  border-radius: var(--bs-btn-border-radius);
}
.btn-primary, .btn-outline-primary, .btn-outline-secondary, .btn-light, .btn-secondary,
.btn-outline-danger, .btn-danger, .btn-outline-warning, .btn-outline-success, .btn-success,
.btn-outline-info, .btn-link, .btn-ghost {
  color: var(--bs-btn-color, #fff);
  background-color: var(--bs-btn-bg, transparent);
  border-color: var(--bs-btn-border-color, transparent);
}
.btn-primary:hover, .btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-light:hover, .btn-secondary:hover,
.btn-outline-danger:hover, .btn-danger:hover, .btn-outline-warning:hover, .btn-outline-success:hover, .btn-success:hover,
.btn-outline-info:hover, .btn-link:hover, .btn-ghost:hover {
  color: var(--bs-btn-hover-color, var(--bs-btn-color, #fff));
  background-color: var(--bs-btn-hover-bg, var(--bs-btn-bg));
  border-color: var(--bs-btn-hover-border-color, var(--bs-btn-border-color));
}
.btn-primary:focus, .btn-outline-primary:focus, .btn-outline-secondary:focus, .btn-light:focus, .btn-secondary:focus,
.btn-outline-danger:focus, .btn-danger:focus, .btn-outline-warning:focus, .btn-outline-success:focus, .btn-success:focus,
.btn-outline-info:focus, .btn-ghost:focus {
  color: var(--bs-btn-color, #fff);
  background-color: var(--bs-btn-bg, transparent);
  border-color: var(--bs-btn-border-color, transparent);
}
.btn:focus { box-shadow: var(--shadow-xs); }
.btn:focus-visible { box-shadow: var(--ring) !important; }
.btn-primary:active, .btn-primary.active, .btn-check:checked + .btn-primary, .btn-check:active + .btn-primary,
.btn-outline-primary:active, .btn-outline-primary.active, .btn-check:checked + .btn-outline-primary, .btn-check:active + .btn-outline-primary,
.btn-outline-secondary:active, .btn-outline-secondary.active, .btn-check:checked + .btn-outline-secondary, .btn-check:active + .btn-outline-secondary,
.btn-outline-danger:active, .btn-outline-danger.active, .btn-danger:active, .btn-success:active,
.btn-outline-warning:active, .btn-outline-success:active, .btn-outline-info:active, .btn-ghost:active, .btn-light:active, .btn-secondary:active {
  color: var(--bs-btn-active-color, var(--bs-btn-hover-color, #fff));
  background-color: var(--bs-btn-active-bg, var(--bs-btn-hover-bg));
  border-color: var(--bs-btn-active-border-color, var(--bs-btn-hover-border-color));
  box-shadow: none;
}
.btn-primary:disabled, .btn-primary.disabled { color: #fff; background-color: var(--bs-btn-disabled-bg); border-color: var(--bs-btn-disabled-border-color); opacity: 1; }
.btn-outline-secondary:disabled, .btn-outline-secondary.disabled, .btn-light:disabled { color: var(--bs-btn-disabled-color); background-color: var(--bs-btn-disabled-bg); border-color: var(--bs-btn-disabled-border-color); opacity: 1; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-start-start-radius: var(--bs-btn-border-radius); border-end-start-radius: var(--bs-btn-border-radius); }
.btn-group > .btn:last-child { border-start-end-radius: var(--bs-btn-border-radius); border-end-end-radius: var(--bs-btn-border-radius); }

/* Cards */
.card { border-color: var(--bs-card-border-color); border-radius: var(--bs-card-border-radius); }
.card-header { padding: var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x); background-color: var(--bs-card-cap-bg); }
.card-header:first-child { border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; }
.card-footer:last-child { border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius); }
.card-body { padding: var(--bs-card-spacer-y) var(--bs-card-spacer-x); }
.card-footer { padding: 0.8rem var(--bs-card-spacer-x); }

/* Tables */
.table { color: var(--bs-table-color); border-color: var(--bs-table-border-color); }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: var(--bs-table-hover-bg); color: var(--bs-table-hover-color); }

/* Dropdowns */
.dropdown-menu {
  padding: var(--bs-dropdown-padding-y) var(--bs-dropdown-padding-x);
  font-size: var(--bs-dropdown-font-size);
  border: 1px solid var(--bs-dropdown-border-color);
  border-radius: var(--bs-dropdown-border-radius);
}
.dropdown-item { color: var(--bs-dropdown-link-color); }
.dropdown-item:hover, .dropdown-item:focus { color: var(--bs-dropdown-link-hover-color); background-color: var(--bs-dropdown-link-hover-bg); }
.dropdown-item.active, .dropdown-item:active { color: var(--bs-dropdown-link-active-color); background-color: var(--bs-dropdown-link-active-bg); }
.dropdown-header { color: var(--bs-dropdown-header-color); }
.dropdown-divider { border-top-color: var(--bs-dropdown-divider-bg); margin: 0.35rem 0; }

/* Alerts */
.alert { color: var(--bs-alert-color); background-color: var(--bs-alert-bg); border-color: var(--bs-alert-border-color); border-radius: var(--bs-alert-border-radius); padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x); }
.alert .alert-link { color: inherit; }
.alert-dismissible { padding-inline-end: 3rem; }

/* Modals */
.modal-content { border-color: var(--bs-modal-border-color); border-radius: var(--bs-modal-border-radius); }
.modal-header { border-bottom-color: var(--bs-modal-header-border-color); }
.modal-footer { border-top-color: var(--bs-modal-footer-border-color); border-bottom-left-radius: calc(var(--radius-lg) - 1px); border-bottom-right-radius: calc(var(--radius-lg) - 1px); }
.modal-backdrop.show { opacity: 0.45; }
.modal-backdrop { background-color: #0b1220; }

/* Pagination */
.page-link { color: var(--bs-pagination-color); background-color: var(--bs-pagination-bg); border-color: var(--bs-pagination-border-color); font-size: var(--bs-pagination-font-size); padding: 0.38rem 0.65rem; }
.page-link:hover { color: var(--bs-pagination-hover-color); background-color: var(--bs-pagination-hover-bg); border-color: var(--bs-pagination-hover-border-color); }
.page-link:focus { box-shadow: var(--bs-pagination-focus-box-shadow); color: var(--bs-pagination-hover-color); background-color: var(--bs-pagination-hover-bg); }
.page-item.active .page-link { color: var(--bs-pagination-active-color); background-color: var(--bs-pagination-active-bg); border-color: var(--bs-pagination-active-border-color); }
.page-item.disabled .page-link { color: var(--bs-pagination-disabled-color); background-color: var(--surface); border-color: var(--border); }
.page-item:not(:first-child) .page-link { margin-inline-start: 0; }

/* Nav pills, list groups, progress, toasts, tooltips, accordions */
.nav-pills .nav-link { border-radius: var(--bs-nav-pills-border-radius); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { color: var(--bs-nav-pills-link-active-color); background-color: var(--bs-nav-pills-link-active-bg); }
.nav-tabs { border-bottom-color: var(--bs-nav-tabs-border-color); }
.list-group-item { color: var(--bs-list-group-color); border-color: var(--bs-list-group-border-color); }
.list-group-item-action:hover, .list-group-item-action:focus { background-color: var(--bs-list-group-action-hover-bg); }
.list-group-item.active { color: var(--bs-list-group-active-color); background-color: var(--bs-list-group-active-bg); border-color: var(--bs-list-group-active-border-color); }
.progress { height: var(--bs-progress-height); background-color: var(--bs-progress-bg); border-radius: var(--bs-progress-border-radius); }
.progress-bar { background-color: var(--bs-progress-bar-bg); }
.progress-bar.bg-success { background-color: var(--success-500) !important; }
.progress-bar.bg-warning { background-color: var(--warning-500) !important; }
.progress-bar.bg-danger { background-color: var(--danger-500) !important; }
.toast { border-color: var(--bs-toast-border-color); border-radius: var(--bs-toast-border-radius); box-shadow: var(--bs-toast-box-shadow); }
.tooltip-inner { background-color: var(--bs-tooltip-bg); border-radius: var(--bs-tooltip-border-radius); font-size: var(--bs-tooltip-font-size); }
.popover { border-color: var(--bs-popover-border-color); border-radius: var(--bs-popover-border-radius); box-shadow: var(--bs-popover-box-shadow); }
.accordion-item { border-color: var(--bs-accordion-border-color); }
.accordion-item:first-of-type, .accordion-item:first-of-type .accordion-button { border-top-left-radius: var(--bs-accordion-border-radius); border-top-right-radius: var(--bs-accordion-border-radius); }
.accordion-item:last-of-type { border-bottom-left-radius: var(--bs-accordion-border-radius); border-bottom-right-radius: var(--bs-accordion-border-radius); }
.accordion-button:not(.collapsed) { color: var(--bs-accordion-active-color); background-color: var(--bs-accordion-active-bg); box-shadow: inset 0 -1px 0 var(--border); }
.accordion-button:focus { box-shadow: var(--bs-accordion-btn-focus-box-shadow); border-color: var(--brand-300); }

/* Bootstrap 5.1 utilities that hard-code the stock blue */
.text-primary { color: var(--brand-600) !important; }
.bg-primary { background-color: var(--brand-600) !important; }
.border-primary { border-color: var(--brand-500) !important; }
.text-success { color: var(--success-600) !important; }
.text-danger { color: var(--danger-600) !important; }
.link-primary { color: var(--brand-600) !important; }
.form-check-input:checked[type="checkbox"], .form-check-input:checked[type="radio"] { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-switch .form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-range::-webkit-slider-thumb { background-color: var(--brand-600); }
.form-range::-moz-range-thumb { background-color: var(--brand-600); }
.spinner-border.text-primary { color: var(--brand-600) !important; }
.nav-link { color: var(--brand-600); }
.nav-link:hover, .nav-link:focus { color: var(--brand-700); }

/* ---- 5. App patterns ----------------------------------------------------- */

/* Page header: title + optional subtitle on the start side, primary actions on the end side.
   <div class="page-header"><div><h1 class="page-title">…</h1><p class="page-subtitle">…</p></div><div class="page-actions">…</div></div> */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: 1rem; margin-bottom: 1.5rem;
}
.page-header > div:first-child { min-width: 0; }
.page-eyebrow { font-size: 0.75rem; font-weight: 600; color: var(--brand-600); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.35rem; display: block; }
.page-title, .app-content > .container-fluid > h1, .app-content > .container-fluid > h2 {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; color: var(--ink-900); margin: 0;
}
.app-content > .container-fluid > h1, .app-content > .container-fluid > h2 { margin-bottom: 1.5rem; }
.page-subtitle { color: var(--text-secondary); margin: 0.35rem 0 0; font-size: 0.925rem; max-width: 60ch; }
.page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 575.98px) {
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
}

/* Section heading inside a page (between card groups). */
.section-title { font-size: 1rem; font-weight: 700; color: var(--ink-900); margin: 0 0 0.85rem; letter-spacing: -0.01em; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.85rem; }
.section-title-row .section-title { margin: 0; }

/* Card header with title + muted description + trailing actions. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head-title { font-weight: 650; font-size: 0.95rem; color: var(--ink-900); margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.card-head-sub { font-size: 0.8rem; color: var(--text-muted); margin: 0.1rem 0 0; font-weight: 400; }

/* KPI / stat card */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 1199.98px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479.98px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; min-width: 0;
}
.stat-card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.stat-card-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-600); }
.stat-card-icon {
  width: 2.1rem; height: 2.1rem; flex: none; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
  background: var(--brand-50); color: var(--brand-600); box-shadow: inset 0 0 0 1px var(--brand-100);
}
.stat-card-icon.is-success { background: var(--success-50); color: var(--success-600); box-shadow: inset 0 0 0 1px #d1fadf; }
.stat-card-icon.is-accent { background: var(--accent-50); color: var(--accent-600); box-shadow: inset 0 0 0 1px #cff9fe; }
.stat-card-icon.is-warning { background: var(--warning-50); color: var(--warning-700); box-shadow: inset 0 0 0 1px #fef0c7; }
.stat-card-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.03em; color: var(--ink-900); line-height: 1.1; }
.stat-card-foot { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; }

/* Toolbar row above a table (search/filter on start, bulk actions on end). */
.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.toolbar .form-control, .toolbar .form-select { min-width: 0; }
.toolbar-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.toolbar-search .ui-icon { position: absolute; inset-inline-start: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--ink-400); pointer-events: none; }
.toolbar-search .form-control { padding-inline-start: 2.2rem; }
.toolbar-spacer { flex: 1 1 auto; }
.bulk-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.6rem 1rem; background: var(--brand-25); border-bottom: 1px solid var(--brand-100); font-size: 0.85rem; }

/* Link identity cell: short link (copyable) on top, destination underneath. */
.link-cell { display: flex; align-items: flex-start; gap: 0.75rem; min-width: 0; }
.link-favicon {
  width: 2rem; height: 2rem; flex: none; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-50); color: var(--ink-500); box-shadow: inset 0 0 0 1px var(--border);
}
.link-cell-body { min-width: 0; flex: 1 1 auto; }
.link-short { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; color: var(--brand-700); font-size: 0.9rem; max-width: 100%; }
.link-short:hover { color: var(--brand-800); text-decoration: underline; text-underline-offset: 2px; }
.link-title { font-weight: 600; color: var(--ink-900); font-size: 0.875rem; }
.link-dest { color: var(--ink-500); font-size: 0.8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cell-truncate { max-width: 340px; }
.cell-actions { white-space: nowrap; text-align: end; }
.cell-actions form { display: inline; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-900); }

/* Empty state */
.empty-state { text-align: center; padding: 2.75rem 1.5rem; color: var(--text-muted); }
.empty-state-icon {
  width: 3rem; height: 3rem; margin: 0 auto 0.9rem; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
  background: var(--surface); color: var(--ink-500); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.empty-state-title { font-weight: 650; color: var(--ink-900); font-size: 1rem; margin-bottom: 0.3rem; }
.empty-state-text { font-size: 0.875rem; margin: 0 auto 1.1rem; max-width: 42ch; }
td .empty-state { padding: 2rem 1rem; }

/* Skeleton loading placeholder */
.skeleton { position: relative; overflow: hidden; background: var(--ink-100); border-radius: var(--radius-sm); min-height: 0.9rem; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent); animation: skeleton-shimmer 1.3s infinite; }
@keyframes skeleton-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* Small inline "key: value" meta row */
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.8rem; color: var(--text-muted); }
.meta-row .ui-icon { color: var(--ink-400); }

/* Quick-action tiles (dashboard) */
.quick-actions { display: grid; gap: 0.5rem; }
.quick-action {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.85rem;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  color: var(--ink-800); font-weight: 600; font-size: 0.875rem;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.quick-action:hover { border-color: var(--brand-200); background: var(--brand-25); color: var(--ink-900); box-shadow: var(--shadow-xs); }
.quick-action-icon { width: 2rem; height: 2rem; flex: none; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-600); }
.quick-action-sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--text-muted); }
.quick-action .ui-icon.chev { margin-inline-start: auto; color: var(--ink-400); }
[dir="rtl"] .quick-action .ui-icon.chev { transform: scaleX(-1); }

/* Activity feed list */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--ink-700); }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--brand-500); margin-top: 0.45rem; flex: none; box-shadow: 0 0 0 3px var(--brand-50); }
.feed-time { margin-inline-start: auto; color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* SVG icon helper (Ui/Icons.cs) — aligns with surrounding text by default. */
.ui-icon { display: inline-block; vertical-align: -0.125em; flex: none; }

/* ---- 6. Marketing site --------------------------------------------------- */

/* Constrained page width for the public site (the app shell uses full width). */
.site-container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 768px) { .site-container { padding-inline: 1.5rem; } }

/* Public navbar */
.navbar-public {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(16, 24, 40, 0.06);
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.navbar-public .navbar-brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 750; font-size: 1.2rem; letter-spacing: -0.03em;
  color: var(--ink-900);
  white-space: nowrap;
}
.navbar-public .navbar-brand svg { font-size: 1.45rem; }
.navbar-public .nav-link {
  color: var(--ink-600) !important;
  font-weight: 550;
  font-size: 0.925rem;
  padding: 0.45rem 0.8rem !important;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.navbar-public .nav-link:hover { color: var(--ink-900) !important; background: var(--ink-100); }
.navbar-public .nav-link.active { color: var(--ink-900) !important; }
.navbar-public .nav-link.dropdown-toggle::after { vertical-align: 0.15em; }
.navbar-public .btn { font-size: 0.875rem; }
.navbar-public .dropdown-menu { margin-top: 0.4rem; }
.navbar-public .navbar-text, .navbar-public .btn-outline-light { color: var(--ink-700) !important; border-color: var(--ink-300) !important; }

/* Round initial-letter avatar for the signed-in account menu. */
.navbar-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; flex: none;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff; font-weight: 700; font-size: 0.8rem;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--brand-100);
}

/* Notification Center dropdown — capped width/height with its own scrollbar. */
.notif-dropdown-menu { width: 340px; max-width: 92vw; max-height: 420px; overflow-y: auto; }
.notif-dropdown-menu .dropdown-item { white-space: normal; display: block; }

.navbar-compact-controls .nav-link { color: var(--ink-700) !important; font-size: 1.05rem; }
.navbar-toggler { border: 1px solid var(--border); padding: 0.35rem 0.5rem; border-radius: var(--radius-sm); }
.navbar-toggler:focus { box-shadow: var(--ring); }
.navbar-public .navbar-nav { flex-wrap: wrap; }

@media (max-width: 991.98px) {
  .navbar-public .navbar-collapse {
    margin-top: 0.75rem;
    padding: 0.6rem;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
  }
  .navbar-public .navbar-nav { gap: 0.1rem; }
  .navbar-public .navbar-nav .btn { width: 100%; margin-top: 0.4rem; }
  .navbar-public .dropdown-menu { box-shadow: none; border: 0; padding-inline-start: 0.75rem; }
}

/* Generic marketing section rhythm */
.mk-section { padding: 4.5rem 0; }
.mk-section-tight { padding: 3rem 0; }
@media (max-width: 767.98px) { .mk-section { padding: 3rem 0; } }
.mk-section-head { max-width: 680px; margin: 0 auto 2.75rem; text-align: center; }
.mk-section-head.is-start { margin-inline: 0; text-align: start; }
.mk-kicker { display: inline-block; font-size: 0.8rem; font-weight: 650; color: var(--brand-600); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.75rem; }
.mk-h2 { font-size: clamp(1.75rem, 3.2vw, 2.4rem); font-weight: 750; letter-spacing: -0.035em; line-height: 1.12; color: var(--ink-950); margin-bottom: 0.9rem; }
.mk-lead { font-size: 1.075rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }

/* Hero */
.hero-section {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  isolation: isolate;
}
/* Faint grid backdrop that fades out — product texture without gradient noise. */
.hero-section::before {
  content: ""; position: absolute; z-index: -1;
  inset: -2rem -50vw 0;
  background-image:
    linear-gradient(to right, rgba(16, 24, 40, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(16, 24, 40, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero-section::after {
  content: ""; position: absolute; z-index: -1;
  top: -6rem; inset-inline-end: -4rem; width: 38rem; height: 26rem;
  background: radial-gradient(closest-side, rgba(var(--brand-rgb), 0.12), transparent 70%);
  pointer-events: none;
}
@media (max-width: 767.98px) { .hero-section { padding: 2.5rem 0 2rem; } }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--surface);
  color: var(--ink-700);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  font-weight: 600; font-size: 0.8rem;
  padding: 0.3rem 0.8rem 0.3rem 0.35rem;
  border-radius: var(--radius-pill);
}
.hero-eyebrow-tag { background: var(--brand-600); color: #fff; border-radius: var(--radius-pill); padding: 0.1rem 0.5rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em; }
.hero-eyebrow:not(:has(.hero-eyebrow-tag)) { padding-inline-start: 0.8rem; }
.hero-title {
  font-size: clamp(2.35rem, 5.2vw, 3.9rem);
  font-weight: 780;
  line-height: 1.04;
  letter-spacing: -0.045em;
  color: var(--ink-950);
}
.hero-title .hl { color: var(--brand-600); }
.hero-lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--text-secondary); line-height: 1.6; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }
@media (max-width: 991.98px) { .hero-actions { justify-content: center; } .hero-lead { margin-inline: auto; } }
@media (max-width: 575.98px) { .hero-actions .btn { flex: 1 1 100%; } }
.hero-trust { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.hero-trust span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero-trust .ui-icon { color: var(--success-600); }
@media (max-width: 991.98px) { .hero-trust { justify-content: center; } }

/* Shared/_PageHero.cshtml — About / Contact / legal pages. */
.page-hero { padding: 3rem 0 2rem; }
.page-hero .hero-title { font-size: clamp(1.9rem, 4vw, 2.75rem); }
.page-hero-illustration { width: 100%; max-width: 240px; height: auto; }

/* Product preview frame (hero dashboard mock) — a browser-window chrome around the illustrative
   dashboard so it reads as "the product" rather than a floating card. */
.product-frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 30px 60px -20px rgba(16, 24, 40, 0.25), 0 12px 24px -12px rgba(16, 24, 40, 0.12);
  overflow: hidden;
}
.product-frame-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.9rem; background: var(--ink-50); border-bottom: 1px solid var(--border); }
.product-frame-dots { display: flex; gap: 0.35rem; }
.product-frame-dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--ink-200); display: block; }
.product-frame-url { flex: 1; min-width: 0; text-align: center; font-size: 0.72rem; color: var(--ink-500); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.2rem 0.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-frame-body { display: grid; grid-template-columns: 9.5rem 1fr; min-height: 300px; }
.product-frame-side { border-inline-end: 1px solid var(--border); padding: 0.85rem 0.6rem; background: var(--surface); display: flex; flex-direction: column; gap: 0.2rem; }
.product-frame-side span { display: flex; align-items: center; gap: 0.45rem; font-size: 0.72rem; font-weight: 600; color: var(--ink-500); padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); white-space: nowrap; overflow: hidden; }
.product-frame-side span.on { background: var(--brand-50); color: var(--brand-700); }
.product-frame-main { padding: 1rem 1.1rem 0.9rem; background: var(--page-bg); min-width: 0; }
@media (max-width: 575.98px) { .product-frame-body { grid-template-columns: 1fr; } .product-frame-side { display: none; } }
.product-frame-badge {
  position: absolute; inset-inline-start: -1rem; bottom: 2.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 0.6rem 0.8rem; display: flex; align-items: center; gap: 0.6rem; font-size: 0.78rem;
}

/* Hero mock dashboard (now rendered inside .product-frame-main). */
.hero-mock-card { background: transparent; border: 0; padding: 0; box-shadow: none; }
.hero-mock-url-bar {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.6rem 0.85rem;
  font-size: 0.8rem; color: var(--ink-500); margin-bottom: 0.85rem; box-shadow: var(--shadow-xs);
}
.hero-mock-url-result { margin-inline-start: auto; color: var(--brand-600); font-weight: 700; white-space: nowrap; transition: opacity .35s ease, transform .35s ease; }
.hero-mock-url-result.is-pre { opacity: 0; transform: translateY(3px); }
.hero-mock-chart-line { transition: stroke-dashoffset 1s ease; }
.hero-mock-chart-fill { transition: opacity .7s ease; }
.hero-mock-chart-fill.is-pre { opacity: 0; }
.hero-mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 0.85rem; }
.hero-mock-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.65rem 0.8rem; box-shadow: var(--shadow-xs); min-width: 0; }
.hero-mock-stat-label { font-size: 0.66rem; color: var(--ink-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-mock-stat-value { font-size: 1.2rem; font-weight: 750; color: var(--ink-900); margin-top: 0.15rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-mock-stat-value.is-success { color: var(--success-600); }
.hero-mock-chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.6rem 0.6rem 0.3rem; box-shadow: var(--shadow-xs); }
.hero-mock-caption { font-size: 0.68rem; color: var(--ink-400); text-align: end; margin-top: 0.35rem; }

.hero-mock-scenes { position: relative; min-height: 262px; }
.mock-scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 0.5rem;
  opacity: 0; transform: translateY(6px);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
}
.mock-scene.active { position: relative; opacity: 1; transform: translateY(0); pointer-events: auto; }
.mock-scene[data-scene="1"] { justify-content: flex-start; gap: 0; }

.hero-mock-chip-row { margin-inline-start: auto; display: flex; gap: 0.4rem; }
.hero-mock-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem; border-radius: var(--radius-pill);
  background: var(--brand-50); color: var(--brand-700);
  white-space: nowrap;
  transition: opacity .3s ease, transform .3s ease;
}
.hero-mock-chip.is-success { background: var(--success-50); color: var(--success-700); }
.hero-mock-chip.is-pre { opacity: 0; transform: translateY(3px); }

.hero-mock-qr-row { display: flex; align-items: center; gap: 1rem; }
.hero-mock-qr {
  flex: 0 0 auto; width: 84px; height: 84px;
  display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr);
  gap: 2px; padding: 8px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.hero-mock-qr i { border-radius: 1px; background: transparent; }
.hero-mock-qr i.on { background: var(--ink-900); transition: opacity .25s ease, transform .25s ease; }
.hero-mock-qr i.on.is-pre { opacity: 0; transform: scale(.4); }

.hero-mock-donut-row { display: flex; align-items: center; gap: 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.9rem; box-shadow: var(--shadow-xs); }
.hero-mock-donut { flex: 0 0 auto; }
.hero-mock-donut circle.seg { transition: stroke-dasharray .8s ease; }
.hero-mock-bars { display: flex; flex-direction: column; gap: 0.55rem; }
.hero-mock-bar-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.75rem; color: var(--ink-700); font-weight: 600; }
.hero-mock-bar-row .name { width: 88px; flex: 0 0 auto; }
.hero-mock-bar-track { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--ink-100); overflow: hidden; }
.hero-mock-bar-fill { height: 100%; border-radius: var(--radius-pill); transition: width .8s ease; }

.hero-mock-ticker-mask {
  position: relative; overflow: hidden; height: 2.75rem;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.hero-mock-ticker-track { position: absolute; top: 50%; left: 0; display: flex; gap: 0.6rem; transform: translateY(-50%); }
.mock-scene.active .hero-mock-ticker-track { animation: heroMockTicker 9s linear infinite; }
@keyframes heroMockTicker { from { transform: translate(0, -50%); } to { transform: translate(-50%, -50%); } }
.hero-mock-ticker-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.76rem; font-weight: 600; color: var(--ink-800); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.45rem 0.75rem; box-shadow: var(--shadow-xs);
}
.hero-mock-ticker-chip .ui-icon { color: var(--brand-600); }

@media (prefers-reduced-motion: reduce) {
  .mock-scene { transition: none; }
  .mock-scene.active .hero-mock-ticker-track { animation: none; }
  .hero-mock-url-result, .hero-mock-chart-line, .hero-mock-chart-fill,
  .hero-mock-chip, .hero-mock-qr i.on, .hero-mock-donut circle.seg, .hero-mock-bar-fill { transition: none; }
}

/* Try-it card (real, working public shortener demo) */
.try-it-card {
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .try-it-card { padding: 2rem 2.25rem; } }
.try-it-card .form-control-lg { font-size: 1rem; }
.try-it-result { border-top: 1px dashed var(--border-strong); padding-top: 1rem; }
.try-it-result code { color: var(--brand-700); background: var(--brand-50); padding: 0.2rem 0.55rem; border-radius: var(--radius-sm); }

/* Real platform totals strip */
.stats-strip { border-block: 1px solid var(--border); padding: 2rem 0; }
.stats-value { font-size: clamp(1.75rem, 4vw, 2.35rem); font-weight: 750; color: var(--ink-950); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.stats-label { font-size: 0.85rem; color: var(--ink-500); font-weight: 500; margin-top: 0.15rem; }
@media (min-width: 768px) { .stats-strip .col-4 + .col-4 { border-inline-start: 1px solid var(--border); } }

/* Feature grid cards */
.feature-card {
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.feature-card:hover { border-color: var(--ink-300); box-shadow: var(--shadow-md); }
.feature-card h3 { font-size: 1.02rem; font-weight: 650; margin-bottom: 0.45rem; letter-spacing: -0.015em; }
.feature-card p { font-size: 0.9rem; line-height: 1.6; }
.feature-icon {
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  box-shadow: inset 0 0 0 1px var(--brand-100);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.feature-card-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; margin-top: 0.75rem; }

/* Bento layout for the homepage capability section */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; }
.bento > .span-2 { grid-column: span 2; }
.bento > .span-3 { grid-column: span 3; }
.bento > .span-4 { grid-column: span 4; }
@media (max-width: 991.98px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bento > .span-2, .bento > .span-3 { grid-column: span 1; } .bento > .span-4 { grid-column: span 2; } }
@media (max-width: 575.98px) { .bento { grid-template-columns: 1fr; } .bento > * { grid-column: span 1 !important; } }
.bento-visual { margin-top: 1.1rem; border-radius: var(--radius-md); background: var(--ink-50); border: 1px solid var(--border); padding: 1rem; }

/* Workflow steps (Shorten → Share → Track → Optimize) */
.workflow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; counter-reset: wf; position: relative; }
@media (max-width: 991.98px) { .workflow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .workflow { grid-template-columns: 1fr; } }
.workflow-step { position: relative; padding: 1.35rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.workflow-step-num { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--ink-900); color: #fff; font-size: 0.75rem; font-weight: 700; margin-bottom: 0.9rem; font-variant-numeric: tabular-nums; }
.workflow-step h3 { font-size: 1rem; font-weight: 650; margin-bottom: 0.35rem; }
.workflow-step p { font-size: 0.875rem; color: var(--text-secondary); margin: 0; line-height: 1.55; }
.how-step-number { font-size: 0.85rem; font-weight: 800; color: var(--brand-500); }

/* Closing CTA band — the one saturated block on the page. */
.cta-band {
  background: var(--ink-950);
  border-radius: var(--radius-xl);
  padding: 3.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}
.cta-band::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background:
    radial-gradient(600px 240px at 50% -10%, rgba(var(--brand-rgb), 0.55), transparent 70%),
    radial-gradient(400px 200px at 100% 120%, rgba(6, 182, 212, 0.25), transparent 70%);
  pointer-events: none;
}
.cta-band::after {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.cta-band h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -0.03em; }
.cta-band p, .cta-band .text-muted { color: rgba(255, 255, 255, 0.72) !important; }
.cta-band .btn-primary { --bs-btn-bg: #fff; --bs-btn-color: var(--ink-950); --bs-btn-border-color: #fff; --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-color: var(--ink-950); --bs-btn-hover-border-color: var(--brand-50); --bs-btn-active-bg: var(--brand-100); --bs-btn-active-color: var(--ink-950); }
.cta-band .btn-outline-secondary { --bs-btn-color: #fff; --bs-btn-bg: transparent; --bs-btn-border-color: rgba(255, 255, 255, 0.28); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255, 255, 255, 0.08); --bs-btn-hover-border-color: rgba(255, 255, 255, 0.5); box-shadow: none; }

/* Analytics & conversion highlight */
.conv-highlight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 992px) { .conv-highlight-card { padding: 3rem; } }
.conv-highlight-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient-brand); }
.conv-highlight-eyebrow { background: var(--accent-50); border-color: #a5f0fc; color: #0e7490; padding-inline-start: 0.8rem; }
.conv-code-snippet {
  background: var(--ink-950); border-radius: var(--radius-md);
  padding: 1rem 1.1rem; font-family: var(--font-mono);
  font-size: 0.8rem; color: #a5f3fc; overflow-x: auto; line-height: 1.7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.conv-funnel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-md); }
.conv-funnel-row { margin-bottom: 1rem; }
.conv-funnel-row:last-child { margin-bottom: 0; }
.conv-funnel-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.4rem; color: var(--ink-800); font-weight: 600; }
.conv-funnel-track { height: 10px; border-radius: var(--radius-pill); background: var(--ink-100); overflow: hidden; }
.conv-funnel-fill { height: 100%; border-radius: var(--radius-pill); background: var(--brand-600); }
.conv-funnel-fill.is-success { background: var(--success-500); }

/* Check list (features / pricing) */
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.check-list li { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.9rem; color: var(--ink-700); }
.check-list .ui-icon { color: var(--brand-600); margin-top: 0.2rem; }

/* Features page: alternating rows */
.feat-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}
.feat-row:last-of-type { border-bottom: none; }
@media (min-width: 992px) {
  .feat-row { grid-template-columns: 1fr 1fr; gap: 4rem; }
  .feat-row.feat-row-reverse > *:first-child { order: 2; }
  .feat-row.feat-row-reverse > *:last-child { order: 1; }
}
.feat-icon-badge {
  width: 2.6rem; height: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  box-shadow: inset 0 0 0 1px var(--brand-100);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.feat-row h2 { color: var(--ink-950); letter-spacing: -0.03em; }
.feat-row p.text-muted { font-size: 1rem; line-height: 1.65; }
.feat-check-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: 0.6rem; color: var(--ink-700); font-size: 0.925rem; }
.feat-check-row .pricing-check { margin-top: 0.1rem; }
.feat-visual-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: var(--ink-700);
  box-shadow: var(--shadow-md);
}

/* FAQ */
.faq-item { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-item > div:first-child { color: var(--ink-900); font-weight: 650; }
.faq-list { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list details:last-child { border-bottom: 0; }
.faq-list summary { list-style: none; cursor: pointer; padding: 1.1rem 1.35rem; font-weight: 650; color: var(--ink-900); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary .ui-icon { color: var(--ink-400); transition: transform var(--dur) ease; }
.faq-list details[open] summary .ui-icon { transform: rotate(180deg); }
.faq-list summary:hover { background: var(--ink-50); }
.faq-list details > p { padding: 0 1.35rem 1.15rem; margin: 0; color: var(--text-secondary); line-height: 1.6; }

/* Pricing */
.pricing-card {
  position: relative;
  overflow: visible;
  border-radius: var(--radius-xl);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.pricing-card:hover { box-shadow: var(--shadow-md); border-color: var(--ink-300); }
.pricing-card .card-title { font-size: 1.1rem; font-weight: 700; }
.pricing-card.pricing-featured {
  border: 1px solid var(--brand-500);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.08), var(--shadow-lg);
}
.pricing-badge {
  position: absolute;
  top: -0.8rem; left: 50%;
  transform: translateX(-50%);
  background: var(--brand-600);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.pricing-price { font-size: 2.5rem; font-weight: 780; letter-spacing: -0.04em; color: var(--ink-950); font-variant-numeric: tabular-nums; }
.pricing-divider { border-top: 1px solid var(--border); margin: 0.5rem 0 1.25rem; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.65rem; flex-grow: 1; align-content: start; }
.pricing-features li { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.875rem; color: var(--ink-700); margin: 0 !important; }
.pricing-check { color: var(--brand-600); font-weight: 700; margin-inline-end: 0.15rem; flex: none; display: inline-flex; margin-top: 0.15rem; }
.pricing-x { color: var(--ink-400); font-weight: 700; margin-inline-end: 0.15rem; flex: none; display: inline-flex; margin-top: 0.15rem; }
.pricing-feature-excluded { color: var(--ink-400) !important; }
.pricing-currency-switch { display: flex; justify-content: center; margin-bottom: 2.25rem; }

/* Flash discounts (Pricing + Subscribe) */
.pricing-card.pricing-discounted {
  border: 1px solid var(--danger-500);
  animation: discount-card-glow 2.4s ease-in-out infinite;
}
@keyframes discount-card-glow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(240, 68, 56, 0.08), var(--shadow-lg); }
  50%      { box-shadow: 0 0 0 8px rgba(240, 68, 56, 0.16), var(--shadow-lg); }
}
.discount-ribbon {
  position: absolute;
  top: -0.85rem; left: 50%;
  transform: translateX(-50%);
  background: var(--danger-600);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(240, 68, 56, 0.35);
  white-space: nowrap;
  animation: discount-pulse 1.6s ease-in-out infinite;
  z-index: 2;
}
@keyframes discount-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.06); }
}
.pricing-price-was { font-size: 1.1rem; color: var(--ink-500); text-decoration: line-through; font-weight: 600; }
.pricing-price-discounted { color: var(--danger-600); }
.discount-countdown {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--danger-50);
  border: 1px solid #fecdca;
  color: var(--danger-700);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
}
.discount-countdown-label { font-weight: 500; opacity: 0.85; }
.discount-countdown-value { font-variant-numeric: tabular-nums; }
.discount-countdown-ended { opacity: 0.6; }
.discount-money-fly {
  position: absolute; font-size: 1.2rem; opacity: 0; pointer-events: none;
  animation: discount-money-float 3.2s ease-in infinite; z-index: 1;
}
.discount-money-fly-1 { left: 12%; bottom: 8%;  animation-delay: 0s; }
.discount-money-fly-2 { left: 50%; bottom: 4%;  animation-delay: 1.1s; }
.discount-money-fly-3 { left: 82%; bottom: 12%; animation-delay: 2.1s; }
@keyframes discount-money-float {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-140px) rotate(20deg); }
}
@media (prefers-reduced-motion: reduce) {
  .pricing-card.pricing-discounted, .discount-ribbon, .discount-money-fly { animation: none; }
}

/* Auth pages (standalone: Login/Register/Forgot/Reset/2FA/Confirm) */
.auth-shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--page-bg);
  padding: 2rem 1rem;
  position: relative;
  isolation: isolate;
}
.auth-shell::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background-image:
    linear-gradient(to right, rgba(16, 24, 40, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(16, 24, 40, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 25%, transparent 75%);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 2rem;
}
@media (max-width: 479.98px) { .auth-card { padding: 1.75rem 1.25rem; border-radius: var(--radius-lg); } }
.auth-card.auth-card-wide { max-width: 520px; }
.auth-brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 750; font-size: 1.3rem; letter-spacing: -0.03em;
  color: var(--ink-900);
}
.auth-brand svg { font-size: 1.6rem; }
.auth-card h1, .auth-card h2, .auth-card h3 { font-size: 1.35rem; letter-spacing: -0.025em; }
.auth-card .text-center.mb-4 > p.text-muted { font-size: 0.925rem; margin-top: 0.4rem; }
.auth-card .btn-primary.w-100 { padding-block: 0.65rem; }
.auth-card hr { margin: 1.5rem 0 1.25rem; }
.auth-foot { margin-top: 1.5rem; font-size: 0.8rem; color: var(--text-muted); text-align: center; }

/* Contact / About icon rows */
.contact-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 0.75rem;
}
.contact-icon {
  width: 2.6rem; height: 2.6rem; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 1.15rem;
}

/* Subscription status / usage */
.status-card { border-top: 3px solid var(--brand-600) !important; }
.usage-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  height: 100%;
}
.usage-tile-label { color: var(--ink-500); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.usage-tile-value { font-size: 1.75rem; font-weight: 750; color: var(--ink-900); margin-bottom: 0.6rem; letter-spacing: -0.03em; }
.usage-tile-value .usage-tile-limit { font-size: 0.95rem; font-weight: 500; color: var(--ink-500); }

/* Footer (signed-in shell: single line; public: rich columns) */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--ink-500);
  padding: 1.25rem 0;
  margin-top: 3rem;
  font-size: 0.85rem;
  text-align: center;
}
.site-footer-rich { text-align: start; padding-top: 3rem; background: var(--surface); margin-top: 4rem; }
.footer-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 750; font-size: 1.1rem; letter-spacing: -0.03em; color: var(--ink-900); margin-bottom: 0.75rem; }
.footer-brand svg { font-size: 1.35rem; }
.footer-tagline { font-size: 0.875rem; color: var(--ink-500); max-width: 28ch; }
.footer-heading { font-weight: 650; font-size: 0.8rem; margin-bottom: 0.9rem; color: var(--ink-900); }
.footer-link-list { list-style: none; padding: 0; margin: 0; }
.footer-link-list li { margin-bottom: 0.6rem; }
.footer-link-list a { color: var(--ink-500); text-decoration: none; font-size: 0.875rem; }
.footer-link-list a:hover { color: var(--ink-900); }
.footer-social-row { display: flex; gap: 0.5rem; }
.footer-social-link {
  width: 2.1rem; height: 2.1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--ink-600);
  font-weight: 700;
  text-decoration: none;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.footer-social-link:hover { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.footer-divider { border: none; border-top: 1px solid var(--border); margin: 0.5rem 0 1.25rem; }
.footer-legal-row a { color: var(--ink-500); }
.footer-legal-row a:hover { color: var(--ink-900); }

/* Directional "back" links — the arrow flips with reading direction. */
.back-link::before { content: "\2190\00A0"; }
[dir="rtl"] .back-link::before { content: none; }
[dir="rtl"] .back-link::after { content: "\00A0\2192"; }

/* ---- 7. Analytics widgets ------------------------------------------------ */

/* Ranked bar-lists — single sequential hue: magnitude ranking of one metric. */
.bar-list { display: flex; flex-direction: column; gap: 0.6rem; }
.bar-list-row { display: grid; grid-template-columns: 7rem 1fr 2.5rem; align-items: center; gap: 0.65rem; }
.bar-list-label { font-size: 0.83rem; font-weight: 500; color: var(--ink-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-list-track { height: 8px; border-radius: var(--radius-pill); background: var(--ink-100); overflow: hidden; }
.bar-list-fill { height: 100%; border-radius: var(--radius-pill); background: var(--brand-500); }
.bar-list-count { font-size: 0.83rem; font-weight: 650; color: var(--ink-900); text-align: end; font-variant-numeric: tabular-nums; }

/* Clicks-over-time trend chart */
.trend-chart-scroll { overflow-x: auto; padding-bottom: 0.25rem; }
.trend-chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; min-width: max-content; border-bottom: 1px solid var(--ink-300); }
.trend-bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; width: 14px; flex: none; }
.trend-bar { width: 100%; max-width: 20px; background: var(--brand-500); border-radius: 3px 3px 0 0; min-height: 2px; }
.trend-bar-col:hover .trend-bar { background: var(--brand-700); }
.trend-chart-labels { display: flex; gap: 3px; min-width: max-content; margin-top: 0.4rem; }
.trend-chart-label { width: 14px; flex: none; text-align: center; font-size: 0.62rem; color: var(--ink-500); writing-mode: vertical-rl; text-orientation: mixed; height: 3.2rem; }

/* Stat tiles with a delta */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.15rem; height: 100%; }
.stat-tile-label { color: var(--ink-500); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem; }
.stat-tile-value { font-size: 1.75rem; font-weight: 750; color: var(--ink-900); letter-spacing: -0.03em; }
.stat-tile-delta { font-size: 0.82rem; font-weight: 650; margin-top: 0.25rem; }
.stat-tile-delta.up { color: var(--success-600); }
.stat-tile-delta.down { color: var(--danger-600); }
.stat-tile-delta.flat { color: var(--ink-500); }

.visitor-mix-donut-wrap { position: relative; width: 112px; height: 112px; flex-shrink: 0; }

/* Peak-time heatmap */
.heatmap-scroll { overflow-x: auto; }
.heatmap-grid { display: grid; grid-template-columns: 2.75rem repeat(24, 1fr); gap: 2px; min-width: 640px; }
.heatmap-hour-label { font-size: 0.65rem; color: var(--ink-500); text-align: center; }
.heatmap-day-label { font-size: 0.72rem; color: var(--ink-700); font-weight: 600; display: flex; align-items: center; }
.heatmap-cell { aspect-ratio: 1 / 1; border-radius: 3px; min-width: 14px; }
.heatmap-scale { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.75rem; font-size: 0.75rem; color: var(--ink-500); }
.heatmap-scale-swatch { width: 14px; height: 14px; border-radius: 3px; }

/* Engagements dashboard */
.engagement-donut-wrap { position: relative; width: 200px; height: 200px; flex-shrink: 0; }
.engagement-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.engagement-donut-total { font-size: 1.5rem; font-weight: 750; color: var(--ink-900); line-height: 1.1; letter-spacing: -0.02em; }
.engagement-donut-label { font-size: 0.7rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: 0.04em; }
.engagement-legend-list { display: flex; flex-direction: column; gap: 0.55rem; min-width: 12rem; }
.engagement-legend-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.engagement-legend-name { color: var(--ink-700); }
.engagement-legend-count { font-weight: 650; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.engagement-legend-swatch-dashed { width: 16px; height: 0; border-top: 2px dashed var(--ink-500); border-radius: 0; vertical-align: middle; }
.engagement-map { height: 320px; border-radius: var(--radius-md); overflow: hidden; }
.engagements-card .card-body { transition: opacity 0.15s ease; }
.engagements-loading-overlay { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.6); border-radius: var(--radius-md); z-index: 2; }
.engagements-loading .card-body { opacity: 0.6; }
.engagements-loading .engagements-loading-overlay { display: flex; }

/* ---- 8. Bilingual / RTL -------------------------------------------------- */
/* Arabic uses Cairo (loaded only for the ar culture). [dir="rtl"] is set on <html>, and the RTL
   Bootstrap build mirrors Bootstrap's own utilities; logical properties above handle the rest. */
body.lang-ar,
body.lang-ar .hero-title,
body.lang-ar h1, body.lang-ar h2, body.lang-ar h3, body.lang-ar h4, body.lang-ar h5, body.lang-ar h6 {
  font-family: "Cairo", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}
body.lang-ar .hero-title { line-height: 1.25; }

[dir="rtl"] { text-align: right; }
[dir="rtl"] .navbar-nav { padding-right: 0; }
[dir="rtl"] .form-check { padding-right: 1.5em; padding-left: 0; }
[dir="rtl"] .form-check .form-check-input { float: right; margin-right: -1.5em; margin-left: 0; }
[dir="rtl"] .form-text, [dir="rtl"] .text-danger.small { text-align: right; }

/* Bars are magnitude, not text: fill direction stays LTR; only labels mirror. */
[dir="rtl"] .trend-chart-scroll, [dir="rtl"] .heatmap-scroll { direction: ltr; }
[dir="rtl"] .trend-chart-scroll > *, [dir="rtl"] .heatmap-grid { direction: rtl; }
[dir="rtl"] .engagement-legend-swatch { margin-right: 0; margin-left: 0.4rem; }

[dir="rtl"] table { text-align: right; }
[dir="rtl"] .card-header, [dir="rtl"] .feature-card, [dir="rtl"] .contact-row { text-align: right; }
[dir="rtl"] .ui-icon.flip-rtl { transform: scaleX(-1); }
[dir="rtl"] .dropdown-menu-end { --bs-position: start; right: auto; left: 0; }
[dir="rtl"] .hero-mock-bar-row { flex-direction: row-reverse; }
[dir="rtl"] .contact-row { flex-direction: row-reverse; justify-content: flex-end; }

/* ==========================================================================
   Live chat — floating customer/guest widget + admin shared inbox
   ========================================================================== */
.chat-widget-bubble {
  position: fixed; inset-inline-end: 1.5rem; bottom: 1.5rem; z-index: 1070;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--gradient-brand); border: none; color: #fff; font-size: 1.5rem;
  box-shadow: var(--shadow-lg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* Changed September 2026, per request: this used to be a bare, empty red dot (just "something is
   unread", no way to tell how much) — now it's a numbered badge, same red-for-unread visual
   language as the admin side's own `.chat-unread-badge`/`chatAdminNavBadge` counts, so a visitor
   sees exactly how many replies are waiting, not just that at least one is. */
.chat-widget-unread-badge {
  position: absolute; top: -2px; inset-inline-end: -2px; z-index: 1;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: #dc2626; color: #fff; border: 2px solid #fff;
  font-size: 0.68rem; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.chat-widget-panel {
  position: fixed; inset-inline-end: 1.5rem; bottom: 5.5rem; z-index: 1070;
  width: 320px; max-width: calc(100vw - 2rem); height: 440px; max-height: calc(100vh - 8rem);
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-widget-header {
  background: var(--gradient-brand); color: #fff; padding: 0.75rem 1rem;
  display: flex; align-items: center; justify-content: space-between; font-weight: 700;
}
.chat-widget-form { padding: 1rem; overflow-y: auto; }
/* min-height: 0 — same nested-flexbox fix as .chat-thread-messages below (see its comment): this
   is a single-level flex child here rather than nested two deep, so it was less likely to hit the
   bug in practice, but it's the identical setup (flex:1 + overflow-y:auto inside a fixed-height
   flex column) so it gets the same defensive fix rather than waiting for a report. */
.chat-widget-messages { flex: 1; overflow-y: auto; padding: 0.75rem; background: var(--ink-50); min-height: 0; }
.chat-widget-send { display: flex; gap: 0.5rem; padding: 0.6rem; border-top: 1px solid var(--ink-100); }
.chat-widget-send .form-control { flex: 1; }

/* Message bubbles — shared between the widget and the admin inbox thread. Customer messages
   align to the reading-start side, admin/support replies to the reading-end side (mirrors
   naturally under [dir="rtl"] since these use logical inset-inline-*, not left/right). */
.chat-bubble { max-width: 80%; margin-bottom: 0.5rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-md); font-size: 0.88rem; }
.chat-bubble-customer { background: #fff; border: 1px solid var(--ink-100); margin-inline-end: auto; }
.chat-bubble-admin { background: var(--brand-500); color: #fff; margin-inline-start: auto; }
.chat-bubble-time { font-size: 0.68rem; opacity: 0.65; margin-top: 0.2rem; }

/* Chat attachments (images/files) — shared between the widget and the admin inbox thread, same
   base64-data-URI-in-DB convention as everything else in ChatAttachmentHelper. */
.chat-attachment-image { display: block; max-width: 220px; max-height: 220px; border-radius: var(--radius-sm); margin-top: 0.3rem; cursor: pointer; }
.chat-attachment-file {
  display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.3rem;
  padding: 0.35rem 0.6rem; background: rgba(0, 0, 0, 0.05); border-radius: var(--radius-sm);
  font-size: 0.82rem; text-decoration: none; color: inherit;
}
.chat-attachment-file:hover { background: rgba(0, 0, 0, 0.1); }
.chat-bubble-admin .chat-attachment-file { background: rgba(255, 255, 255, 0.15); color: #fff; }
.chat-bubble-admin .chat-attachment-file:hover { background: rgba(255, 255, 255, 0.25); }

/* Attach (📎) button + "file staged, not sent yet" preview chip — shared markup pattern between
   the admin reply form (Pages/Chat/Index.cshtml) and the customer widget's send form
   (Pages/Shared/_ChatWidget.cshtml). */
.chat-attach-btn { flex: none; }
.chat-attach-preview {
  display: flex; align-items: center; gap: 0.4rem; margin: 0 0.75rem;
  padding: 0.3rem 0.6rem; background: var(--brand-50); color: var(--brand-700);
  border-radius: var(--radius-sm); font-size: 0.78rem;
}
.chat-attach-preview .btn-close { filter: none; opacity: 0.6; transform: scale(0.7); cursor: pointer; }
.chat-attach-preview .btn-close:hover { opacity: 1; }

/* Admin shared inbox — two-pane layout */
/* Bug fix, September 2026 — "the chat's input doesn't show when the [conversation] count gets
   large": the markup is <div class="card chat-inbox">, so this rule shares the element with
   Bootstrap's own .card class, which sets `flex-direction: column`. This rule never set
   flex-direction at all, only relying on flexbox's own default of `row` — but CSS resolves each
   property independently across every rule that touches the element, regardless of which
   class "looks like" the more specific one, so Bootstrap's explicit `column` was silently
   winning over our implicit default `row`. With only a couple of conversations in the list this
   went unnoticed (the visual difference between a short list stacked above the thread pane and
   one placed beside it is easy to miss at a glance), but once the conversation list held enough
   rows to exceed .chat-inbox's fixed 70vh height, the stacked layout pushed the entire second
   "row" — .chat-inbox-thread, i.e. the whole thread pane including the reply input — down below
   .chat-inbox's `overflow: hidden` edge, off-screen entirely. Explicitly declaring
   `flex-direction: row` here overrides Bootstrap's `.card` value directly on this rule and
   restores the intended side-by-side layout regardless of list length; the
   `@media (max-width: 640px)` override below still switches back to a stacked column on mobile,
   unchanged. */
.chat-inbox { display: flex; flex-direction: row; height: 70vh; min-height: 420px; overflow: hidden; }
.chat-inbox-list { width: 300px; flex: none; border-inline-end: 1px solid var(--ink-100); overflow-y: auto; }
.chat-conv-row { display: block; padding: 0.7rem 1rem; border-bottom: 1px solid var(--ink-100); color: inherit; }
.chat-conv-row:hover { background: var(--ink-50); }
.chat-conv-row.active { background: var(--brand-50); border-inline-start: 3px solid var(--brand-500); }
.chat-conv-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conv-time { font-size: 0.68rem; }
/* Bug fix, September 2026 — "the reply box disappears behind the page footer after a few
   messages": a classic nested-flexbox sizing bug. A flex item's default min-height is `auto`,
   which means "never shrink below your own content's height" — so once .chat-thread-messages had
   enough messages to want more room than was left inside the fixed 70vh .chat-inbox box, it (and
   its parent .chat-inbox-thread, which has the same default) simply grew instead of scrolling
   internally, pushing .chat-reply-form down past .chat-inbox's `overflow: hidden` edge. The reply
   form wasn't covered by anything — it was clipped clean off, with the page's own <footer
   class="site-footer"> (the very next element after the inbox card in _Layout.cshtml, sitting in
   normal document flow) visually taking its place lower on the page, which is what made it look
   like "a footer div" had moved on top of the input. `min-height: 0` on both flex items overrides
   that default so each one respects the space actually available above it in the flex column and
   scrolls its own overflow internally instead — same fix as .chat-widget-messages below, applied
   pre-emptively there so the floating customer widget's own scroll area can't hit the identical
   bug as its message list grows. */
.chat-inbox-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-thread-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--ink-100); }
.chat-thread-messages { flex: 1; overflow-y: auto; padding: 1rem; background: var(--ink-50); min-height: 0; }
.chat-reply-form { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.75rem; border-top: 1px solid var(--ink-100); }
.chat-reply-form .chat-attach-preview { margin: 0; }
.chat-reply-row { display: flex; gap: 0.5rem; }
.chat-reply-row textarea { flex: 1; resize: none; }

@media (max-width: 640px) {
  .chat-inbox { flex-direction: column; height: auto; }
  .chat-inbox-list { width: 100%; max-height: 240px; border-inline-end: none; border-bottom: 1px solid var(--ink-100); }
}

/* Live short-URL Details page (url-details-live.js) — connection status badge, the pulsing
   dot that says "this page updates itself", the live-activity feed, and the brief highlight
   flash on a number that just changed. */
.live-badge { display: inline-flex; align-items: center; gap: 0.35rem; }
.live-badge-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: currentColor; display: inline-block;
  animation: live-pulse 1.6s ease-in-out infinite;
}
.live-badge-dot-header { background: #16a34a; }

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.live-activity-feed { max-height: 220px; overflow-y: auto; }
.live-activity-item { padding: 0.35rem 0; border-bottom: 1px solid var(--ink-100); }
.live-activity-item:last-child { border-bottom: none; }
.live-activity-item-new { animation: live-item-in 0.4s ease-out; background: var(--brand-50); }

@keyframes live-item-in {
  from { background: var(--brand-100); }
  to { background: var(--brand-50); }
}

.live-flash { animation: live-flash-anim 0.9s ease-out; border-radius: 0.25rem; }

@keyframes live-flash-anim {
  0% { background: var(--brand-100); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge-dot, .live-activity-item-new, .live-flash { animation: none; }
}

/* ==========================================================================
   Signed-in app shell — persistent sidebar + top bar
   Light rail on the reading-start side (inset-inline-start, so it's on the
   left in English and the right in Arabic), grouped sections, SVG icons, a
   brand-tinted active state with an indicator bar. Desktop: collapsible to an
   icon rail (app-shell.js, persisted). Mobile (<992px): off-canvas panel
   opened by the topbar hamburger. Element IDs/classes used by app-shell.js
   are unchanged: #appSidebar, #appSidebarToggle, #appSidebarOverlay,
   #appSidebarCollapseToggle, .app-shell.sidebar-collapsed, .is-open.
   ========================================================================== */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
}

.app-shell { display: flex; min-height: 100vh; background: var(--page-bg); }

.app-sidebar {
  width: var(--sidebar-width);
  flex: none;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  position: fixed;
  inset-inline-start: 0;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform 0.25s var(--ease), width 0.2s var(--ease);
  overflow-x: hidden;
}

.app-sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: var(--topbar-height);
  padding-inline: 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.app-sidebar-brand {
  display: flex; align-items: center; gap: 0.55rem;
  font-weight: 750; font-size: 1.1rem; letter-spacing: -0.03em;
  color: var(--ink-900) !important;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.25rem;
}
.app-sidebar-brand svg { font-size: 1.45rem; }

/* Desktop-only collapse-to-icon-rail toggle (distinct from the mobile hamburger). */
.app-sidebar-collapse-toggle {
  flex: none;
  width: 1.9rem; height: 1.9rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-400);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.app-sidebar-collapse-toggle:hover { background: var(--ink-100); color: var(--ink-900); }
.app-sidebar-collapse-toggle .ui-icon { transition: transform 0.2s var(--ease); }
[dir="rtl"] .app-sidebar-collapse-toggle .ui-icon { transform: scaleX(-1); }
.app-shell.sidebar-collapsed .app-sidebar-collapse-toggle .ui-icon { transform: scaleX(-1); }
[dir="rtl"] .app-shell.sidebar-collapsed .app-sidebar-collapse-toggle .ui-icon { transform: none; }

.app-sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem 0.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-200) transparent;
}
.app-sidebar-nav::-webkit-scrollbar { width: 6px; }
.app-sidebar-nav::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: var(--radius-pill); }

.app-sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: var(--ink-400);
  padding: 1rem 0.65rem 0.4rem;
  white-space: nowrap;
}

.app-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.65rem;
  margin-bottom: 1px;
  border-radius: var(--radius-sm);
  color: var(--ink-600) !important;
  font-weight: 550;
  font-size: 0.875rem;
  white-space: nowrap;
  position: relative;
  border: none;
  background: transparent;
  width: 100%;
  text-align: start;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.app-sidebar-link .icon { flex: none; width: 1.15rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--ink-400); transition: color var(--dur-fast) ease; }
.app-sidebar-link .label { overflow: hidden; text-overflow: ellipsis; }
.app-sidebar-link .badge { margin-inline-start: auto; font-size: 0.68rem; }
.app-sidebar-link:hover { background: var(--ink-100); color: var(--ink-900) !important; }
.app-sidebar-link:hover .icon { color: var(--ink-700); }
.app-sidebar-link.active {
  background: var(--brand-50);
  color: var(--brand-800) !important;
  font-weight: 600;
}
.app-sidebar-link.active .icon { color: var(--brand-600); }
.app-sidebar-link.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -0.75rem; top: 0.45rem; bottom: 0.45rem;
  width: 3px; border-start-end-radius: 3px; border-end-end-radius: 3px;
  background: var(--brand-600);
}
.app-sidebar-link-btn { cursor: pointer; }
.app-sidebar-link:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }

.app-sidebar-footer {
  padding: 0.65rem 0.75rem 0.85rem;
  border-top: 1px solid var(--border);
  flex: none;
}

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

/* Collapsed desktop state (icon rail). */
.app-shell.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-width); }
.app-shell.sidebar-collapsed .app-main { margin-inline-start: var(--sidebar-collapsed-width); }
.app-shell.sidebar-collapsed .app-sidebar-brand .label,
.app-shell.sidebar-collapsed .app-sidebar-link .label,
.app-shell.sidebar-collapsed .app-sidebar-footer .label,
.app-shell.sidebar-collapsed .app-sidebar-link .badge { display: none; }
.app-shell.sidebar-collapsed .app-sidebar-section-label { font-size: 0; padding: 0.6rem 0 0.35rem; }
.app-shell.sidebar-collapsed .app-sidebar-section-label::after { content: ""; display: block; height: 1px; background: var(--border); margin: 0 0.6rem; }
.app-shell.sidebar-collapsed .app-sidebar-brand-row { flex-direction: column; justify-content: center; gap: 0.15rem; padding-inline: 0; }
.app-shell.sidebar-collapsed .app-sidebar-brand { flex: none; justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .app-sidebar-brand svg { font-size: 1.3rem; }
.app-shell.sidebar-collapsed .app-sidebar-collapse-toggle { width: 1.6rem; height: 1.3rem; }
.app-shell.sidebar-collapsed .app-sidebar-link { justify-content: center; padding-inline: 0; }
.app-shell.sidebar-collapsed .app-sidebar-link .icon { width: auto; }

.app-shell.no-sidebar-transition,
.app-shell.no-sidebar-transition .app-sidebar,
.app-shell.no-sidebar-transition .app-main { transition: none !important; }

/* Top bar */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-topbar-context { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: 1 1 auto; font-size: 0.875rem; }
.app-topbar-context .crumb-root { color: var(--ink-500); white-space: nowrap; }
.app-topbar-context .crumb-sep { color: var(--ink-300); }
.app-topbar-context .crumb-current { color: var(--ink-900); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 575.98px) { .app-topbar-context .crumb-root, .app-topbar-context .crumb-sep { display: none; } }
.app-topbar-actions { display: flex; align-items: center; gap: 0.25rem; flex: none; }
.app-topbar .topbar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  height: 2.25rem; min-width: 2.25rem; padding: 0 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--ink-600) !important; font-weight: 600; font-size: 0.82rem;
  position: relative;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.app-topbar .topbar-btn:hover, .app-topbar .topbar-btn[aria-expanded="true"] { background: var(--ink-100); color: var(--ink-900) !important; }
.app-topbar .topbar-btn .ui-icon { font-size: 1.1rem; }
.app-topbar .topbar-btn.dropdown-toggle::after { display: none; }
.app-topbar #notifNavBadge {
  position: absolute; top: 0.2rem; inset-inline-end: 0.15rem;
  min-width: 1.05rem; height: 1.05rem; padding: 0 0.3rem;
  font-size: 0.62rem; line-height: 1.05rem; border: 2px solid #fff; box-sizing: content-box;
}
.app-topbar .account-btn { padding-inline: 0.25rem 0.5rem; gap: 0.55rem; }
.app-topbar .account-btn .navbar-avatar { box-shadow: none; width: 1.85rem; height: 1.85rem; }
.app-topbar .account-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-800); }
.app-topbar .dropdown-menu { z-index: 1040; }
.account-menu { min-width: 15rem; }
.account-menu-head { padding: 0.55rem 0.65rem 0.65rem; border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; }
.account-menu-head .name { font-weight: 650; color: var(--ink-900); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-head .role { font-size: 0.75rem; color: var(--ink-500); }
.dropdown-item .ui-icon { color: var(--ink-400); font-size: 1rem; }
.dropdown-item:hover .ui-icon { color: var(--ink-700); }

.notif-item-title { font-size: 0.85rem; color: var(--ink-900); }
.notif-item-msg { font-size: 0.78rem; color: var(--ink-500); line-height: 1.4; }
.notif-unread .notif-item-title::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-600); margin-inline-end: 0.4rem; vertical-align: 0.12em; }

.app-sidebar-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink-700);
  width: 2.25rem; height: 2.25rem;
  border-radius: var(--radius-sm);
  flex: none;
}
.app-sidebar-toggle:hover { background: var(--ink-100); }

.app-content { flex: 1 1 auto; padding: 1.75rem 1.5rem 2rem; }
.app-content > .container-fluid { max-width: 1440px; margin-inline: auto; padding: 0; }
@media (max-width: 575.98px) { .app-content { padding: 1.25rem 1rem 1.5rem; } .app-topbar { padding: 0 0.75rem; } }

.app-shell .site-footer { margin-top: 0; padding: 1rem 1.5rem; font-size: 0.8rem; text-align: start; color: var(--ink-400); border-top: 1px solid var(--border); }

.workspace-banner { display: flex; align-items: center; gap: 0.6rem; }

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1025;
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: none; }
  .app-sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  [dir="rtl"] .app-sidebar { transform: translateX(100%); }
  [dir="rtl"] .app-sidebar.is-open { transform: translateX(0); }

  .app-main, .app-shell.sidebar-collapsed .app-main { margin-inline-start: 0; }
  .app-sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .app-sidebar-overlay.is-open { display: block; }

  /* The icon-rail collapse makes no sense with an off-canvas panel — hide the control and
     ignore any persisted collapsed state at this breakpoint. */
  .app-sidebar-collapse-toggle { display: none; }
  .app-shell.sidebar-collapsed .app-sidebar { width: var(--sidebar-width); }
  .app-shell.sidebar-collapsed .app-sidebar-brand .label,
  .app-shell.sidebar-collapsed .app-sidebar-link .label,
  .app-shell.sidebar-collapsed .app-sidebar-footer .label { display: initial; }
  .app-shell.sidebar-collapsed .app-sidebar-link .badge { display: inline-block; }
  .app-shell.sidebar-collapsed .app-sidebar-section-label { font-size: 0.7rem; padding: 1rem 0.65rem 0.4rem; }
  .app-shell.sidebar-collapsed .app-sidebar-section-label::after { display: none; }
  .app-shell.sidebar-collapsed .app-sidebar-brand-row { flex-direction: row; justify-content: flex-start; padding-inline: 1rem 0.65rem; }
  .app-shell.sidebar-collapsed .app-sidebar-brand { flex: 1 1 auto; justify-content: flex-start; padding: 0.25rem; }
  .app-shell.sidebar-collapsed .app-sidebar-link { justify-content: flex-start; padding: 0.5rem 0.65rem; }
  .app-shell.sidebar-collapsed .app-sidebar-link .icon { width: 1.15rem; }
}
/* ==========================================================================
   QR create form — frame-style gallery + live preview panel
   (Pages/QrCodes/Index.cshtml, wwwroot/js/qr-create.js)
   ========================================================================== */
.qr-frame-gallery .qr-frame-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  line-height: 1.1;
}

.qr-live-preview-frame {
  border: 1px solid var(--ink-100, #e5e7eb);
  border-radius: var(--radius-md, 0.5rem);
  background: #fafafa;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.qr-live-preview {
  width: 100%;
  max-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-live-preview svg {
  width: 100%;
  height: auto;
  display: block;
}

@media (min-width: 992px) {
  /* Keeps the preview panel visible alongside the form fields as the page scrolls, the same way
     the screenshot's own reference design (a fixed "Preview" panel beside a longer settings
     form) behaves — desktop-width only, since there's no meaningful "alongside" on narrow
     screens where the two columns stack. */
  .qr-live-preview-frame { position: sticky; top: 1rem; }
}


/* ==========================================================================
   Urls/Details page redesign (September 2026)
   Everything below is scoped to brand-new class names (details-hero, kpi-*,
   segmented-period, geo-frame, breakdown-*, insight-card, sidebar-stack) —
   nothing here touches .card, .btn, .stat-tile, .bar-list, .engagement-* or
   any other class other pages already rely on, so this redesign can't have
   side effects outside Details.cshtml/_EngagementsCard.cshtml/
   _ClickBreakdownsCard.cshtml. Reuses the existing --brand/--accent/--ink/
   --shadow/--radius tokens (plus the --amber/--pink additions above) rather
   than inventing a second palette, so it reads as an evolution of the
   existing design system, not a different one bolted on.
   ========================================================================== */

/* ---- Hero bar: link identity + status + primary actions, replacing the old
   plain "← Back to Short URLs" row + a separate dl-based title. ---- */
.details-hero {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.details-hero-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.details-hero-badge {
  width: 2.9rem; height: 2.9rem; flex: none;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem;
}
.details-hero-back {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.78rem; font-weight: 700; color: var(--ink-500);
  margin-bottom: 0.3rem;
}
.details-hero-back:hover { color: var(--brand-600); }
.details-hero h1 {
  font-size: 1.05rem; margin: 0 0 0.25rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px;
}
.details-hero-url { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; flex-wrap: wrap; }
.details-hero-url a { font-weight: 700; color: var(--brand-600); }
.details-hero-copy {
  background: var(--brand-50); color: var(--brand-600); border: none; border-radius: 0.45rem;
  padding: 0.1rem 0.5rem; font-size: 0.68rem; font-weight: 700; cursor: pointer;
}
.details-hero-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.details-hero-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 767.98px) { .details-hero h1 { max-width: 260px; } }

/* ---- KPI ribbon: promotes Total clicks / Today / This month / Conversion
   rate / Returning visitors out of scattered stat-tile rows and a separate
   Funnel card into one glanceable row at the top of the page. ---- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.kpi-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--kpi-accent, var(--brand-500));
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.kpi-icon {
  width: 1.9rem; height: 1.9rem; border-radius: 0.55rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--kpi-tint, var(--brand-50)); font-size: 0.95rem;
}
.kpi-delta { font-size: 0.7rem; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); }
.kpi-delta.up { background: #dcfce7; color: #15803d; }
.kpi-delta.down { background: #fee2e2; color: #b91c1c; }
.kpi-delta.flat { background: var(--ink-100); color: var(--ink-500); }
.kpi-label { font-size: 0.72rem; color: var(--ink-500); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.2rem; }
.kpi-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.kpi-sub { font-size: 0.72rem; color: var(--ink-500); margin-top: 0.25rem; }

/* ---- Engagements card: pill-style period selector, replacing the plain
   Bootstrap btn-group look — same <a class="js-engagement-period"> elements
   engagement-dashboard.js already wires up, only the presentation changes. ---- */
.segmented-period { display: inline-flex; background: var(--ink-100); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.segmented-period .js-engagement-period {
  border: none !important; border-radius: var(--radius-pill) !important;
  padding: 0.35rem 0.9rem !important; font-size: 0.8rem; font-weight: 700;
  background: transparent; color: var(--ink-500); box-shadow: none !important;
}
.segmented-period .js-engagement-period:hover { transform: none; background: rgba(255, 255, 255, 0.7); }
.segmented-period .js-engagement-period.btn-primary { background: #fff !important; color: var(--brand-700) !important; box-shadow: var(--shadow-sm) !important; }

/* Location-table pagination — same asp-page links/js-engagement-page hook, softer look. */
.loc-table-pagination .page-link { border-radius: var(--radius-pill); border: none; color: var(--brand-600); font-weight: 700; }
.loc-table-pagination .page-item.disabled .page-link { color: var(--ink-300); background: transparent; }

/* Frames the real Leaflet map (#engagementMap, untouched) in a soft card so it reads as part of
   the same design language instead of a plain unstyled rectangle. */
.geo-frame { border: 1px dashed rgba(99, 102, 241, 0.25); border-radius: var(--radius-lg); padding: 0.6rem; background: var(--brand-50); }
.geo-frame .engagement-map { border-radius: calc(var(--radius-lg) - 0.35rem); }

/* ---- Audience breakdown: Top countries/cities/devices/OS/browsers/languages/referrer
   source/referrer domains, as a compact grid of mini bar-lists instead of 8 full-width
   stacked cards — see _ClickBreakdownsCard.cshtml. ---- */
.breakdown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; }
@media (max-width: 991.98px) { .breakdown-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px) { .breakdown-grid { grid-template-columns: 1fr; } }
.breakdown-card { background: var(--ink-50); border: 1px solid rgba(15, 23, 42, 0.06); border-radius: var(--radius-md); padding: 0.9rem 1rem; }
.breakdown-card-head { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 800; color: var(--ink-700); margin-bottom: 0.7rem; }
.breakdown-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; margin-bottom: 0.45rem; }
.breakdown-row:last-child { margin-bottom: 0; }
.breakdown-row-label {
  flex: 0 0 5.5rem; color: var(--ink-700); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* height/background bumped from an earlier 7px/#fff pass — at that thickness and contrast the
   fill was easy to miss entirely on a real link with sparse data (one row per card), which is
   exactly when a reader most needs the bar to register at a glance that "this row is the
   whole 100%" rather than reading as blank space between a label and a number. */
.breakdown-row-track { flex: 1; background: var(--ink-100); border: 1px solid rgba(15, 23, 42, 0.06); border-radius: var(--radius-pill); height: 10px; overflow: hidden; min-width: 2.5rem; }
.breakdown-row-fill { height: 100%; border-radius: var(--radius-pill); min-width: 3px; }
.breakdown-row-count { width: 2.4rem; text-align: right; font-weight: 800; color: var(--ink-900); }
.breakdown-empty { font-size: 0.8rem; color: var(--ink-500); margin: 0; }
/* Top Cities (follow-up 53) is the one breakdown list shown in full, with no "Other" fold, so it
   can run to dozens of rows — scroll that one card's list instead of letting the whole
   .breakdown-grid row stretch to match it. */
.breakdown-card-scroll { max-height: 210px; overflow-y: auto; padding-inline-end: 0.25rem; }
/* Top Countries drill-down (follow-up 53): a country row with a per-country city breakdown
   behind it (see CityBreakdownByCountry) is clickable to expand that breakdown inline. */
.breakdown-row-clickable { cursor: pointer; border-radius: var(--radius-sm, 4px); transition: background-color 0.12s ease; }
.breakdown-row-clickable:hover, .breakdown-row-clickable:focus-visible { background: var(--ink-100); outline: none; }
.breakdown-drilldown { margin: 0.1rem 0 0.55rem; padding-inline-start: 0.9rem; border-inline-start: 2px solid var(--ink-100); }
.breakdown-drilldown .breakdown-row-nested { opacity: 0.9; }
/* No [dir="rtl"] override needed: border-inline-start/padding-inline-start above already flip to
   the correct side automatically under RTL, same as every other logical property in this file. */

/* ---- Smart Suggestions, promoted from a plain card to a callout that reads as
   "the app noticed something", matching the reference dashboard's insight panels. ---- */
.insight-card { background: linear-gradient(135deg, var(--brand-50), var(--pink-50)); border: 1px solid var(--brand-100); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; }
.insight-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 0.92rem; color: var(--brand-700); margin-bottom: 0.7rem; }

/* ---- Sidebar: QR codes + Live activity + Visitor mix now travel together as one sticky
   stack (previously only the QR card itself was sticky, back when it was the sidebar's only
   card) — see Details.cshtml's col-md-4. ---- */
.sidebar-stack { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 768px) {
  .sidebar-stack { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
}

/* ---- Live Activity + Visitor Mix scroll-fade (September 2026, follow-up 54) ----
   #scrollFadeSidebar wraps just these two cards (QR Codes sits above it, outside the wrapper, and
   keeps its normal sticky/always-visible behavior) — details-scroll-fade.js toggles
   .scroll-fade-hidden on it once the page scrolls past the top. max-height + opacity together (not
   opacity alone) so the cards actually collapse out of the sticky sidebar's flow instead of just
   turning invisible and leaving a blank gap in its place; overflow: hidden clips the content
   during the collapse instead of it reflowing/wrapping mid-transition. */
.scroll-fade-sidebar {
  max-height: 1000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.2s ease, margin-top 0.28s ease;
}
.scroll-fade-sidebar.scroll-fade-hidden {
  max-height: 0;
  opacity: 0;
  margin-top: -1rem; /* cancels .sidebar-stack's own 1rem gap so no dead gap is left above QR Codes */
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .scroll-fade-sidebar { transition: none; }
}

/* ---- Engagements / Clicks / Peak Times / Audience breakdown full-width row (September 2026,
   follow-up 54) — moved out of the narrower col-md-8 main column into their own col-12 row below
   the sidebar area, per the request that these fill the page's full width. A top border reads as
   "a new section starts here" now that it's no longer visually continuous with the narrower cards
   directly above it. ---- */
.details-fullwidth-row { margin-top: 0.25rem; padding-top: 1.25rem; border-top: 1px solid rgba(15, 23, 42, 0.08); }

[dir="rtl"] .breakdown-row { flex-direction: row-reverse; }
[dir="rtl"] .details-hero-badges, [dir="rtl"] .details-hero-url { flex-direction: row-reverse; justify-content: flex-end; }


/* ==========================================================================
   Short URLs table — link column sizing
   The destination URL is a single unbreakable string; capping the link body's width keeps its
   intrinsic size from pushing the actions column off-screen on laptop widths.
   ========================================================================== */
.col-link { min-width: 15rem; }
.col-link .link-cell-body { max-width: 24rem; }
@media (max-width: 1399.98px) { .col-link .link-cell-body { max-width: 20rem; } }
@media (max-width: 575.98px) { .col-link .link-cell-body { max-width: 13rem; } }

/* Details KPI ribbon: calmer — the tinted icon carries each KPI's accent, so the per-card colored
   top stripe (which read as a rainbow across the row) is dropped. */
.kpi-card { border-color: var(--border); box-shadow: var(--shadow-xs); }
.kpi-card::before { display: none; }
.kpi-icon { color: var(--kpi-accent, var(--brand-600)); }
.kpi-value { font-weight: 750; letter-spacing: -0.03em; }
.details-hero { border-color: var(--border); box-shadow: var(--shadow-xs); }
.details-hero-badge { background: var(--brand-600); }
.btn-ghost { justify-content: flex-start; text-align: start; }

/* Pricing: all packages share one row on desktop, so the price scales down a little to fit
   four or more narrower cards without wrapping. */
.pricing-price { font-size: clamp(1.75rem, 2.4vw, 2.5rem); }
@media (min-width: 992px) { .pricing-card .card-body { padding: 1.5rem !important; } }
