/* ==========================================================================
   Admin panel styles (Bootstrap 5.3 + overrides)
   A calm, neutral interface: Inter for UI, the brand colour used only as an
   accent (primary buttons, focus, active states). Brand tokens match the
   website (Frontend/web/src/app/globals.css) so previews look right.
   ========================================================================== */

:root {
  /* Brand (website) */
  --brand: #5859ff;
  --brand-2: #0cc0f1;
  --brand-dark: #4344e6;
  --brand-soft: #f0f0ff;
  --brand-ring: rgba(88, 89, 255, 0.18);
  --night: #07050f;
  --night-2: #0e0a22;
  --grad: linear-gradient(100deg, var(--brand), var(--brand-2));

  /* Neutrals */
  --page-bg: #f7f7f8;
  --surface: #ffffff;
  --card-bg: var(--surface);
  --subtle-bg: #fafafa;
  --hover-bg: #f4f4f5;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --border-hover: #c4c4cb;
  --active-bg: #ececee;
  --warning-text: #78350f;
  --danger-text: #7f1d1d;
  --danger-strong: #991b1b;
  --success-text: #14532d;

  /* Status */
  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-line: #bbf7d0;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-line: #fde68a;
  --info-soft: #f5f5ff;
  --info-line: #dcdcfe;

  --sidebar-w: 268px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow-sm: 0 1px 3px rgba(24, 24, 27, 0.06), 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(24, 24, 27, 0.18), 0 4px 8px -4px rgba(24, 24, 27, 0.06);

  /* Bootstrap theme hooks */
  --bs-body-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --bs-body-font-size: 1rem; /* 16px */
  --bs-body-line-height: 1.55;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--page-bg);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 88, 89, 255;
  --bs-link-color: var(--brand-dark);
  --bs-link-color-rgb: 67, 68, 230;
  --bs-link-hover-color: var(--brand);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-secondary-color: var(--muted);
  --bs-focus-ring-color: var(--brand-ring);
  --bs-emphasis-color: var(--text);
}

body {
  background: var(--page-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
}

.fs-4 { font-size: 1.125rem !important; }
.fs-5 { font-size: 1rem !important; }

.text-muted,
.form-text {
  color: var(--muted) !important;
}

.form-text {
  font-size: 0.875rem;
  margin-top: 0.375rem;
  line-height: 1.5;
}

.small,
small {
  font-size: 0.8125rem;
}

a {
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.text-primary {
  color: var(--brand) !important;
}

.text-grad {
  background-image: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  --bs-btn-padding-y: 0.4375rem;
  --bs-btn-padding-x: 0.875rem;
  --bs-btn-font-size: 0.9375rem;
  --bs-btn-font-weight: 500;
  --bs-btn-line-height: 1.4;
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-focus-box-shadow: 0 0 0 3px var(--brand-ring);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.btn .bi {
  font-size: 1em;
  line-height: 1;
}

.btn-sm {
  --bs-btn-padding-y: 0.25rem;
  --bs-btn-padding-x: 0.625rem;
  --bs-btn-font-size: 0.875rem;
  min-height: 32px;
  gap: 0.3rem;
}

.btn-lg {
  --bs-btn-padding-y: 0.5625rem;
  --bs-btn-padding-x: 1.125rem;
  --bs-btn-font-size: 0.9375rem;
  min-height: 42px;
}

.btn-primary,
.btn-grad {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-dark {
  --bs-btn-bg: var(--text);
  --bs-btn-border-color: var(--text);
  --bs-btn-hover-bg: var(--text-2);
  --bs-btn-hover-border-color: var(--text-2);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand-dark);
  --bs-btn-border-color: var(--info-line);
  --bs-btn-hover-color: var(--brand-dark);
  --bs-btn-hover-bg: var(--brand-soft);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-soft);
  --bs-btn-active-color: var(--brand-dark);
}

.btn-light {
  --bs-btn-bg: var(--surface);
  --bs-btn-color: var(--text-2);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--hover-bg);
  --bs-btn-hover-color: var(--text);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-bg: var(--active-bg);
  --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-disabled-bg: var(--surface);
  --bs-btn-disabled-border-color: var(--border);
  --bs-btn-disabled-color: var(--faint);
  box-shadow: var(--shadow-xs);
}

.btn-ghost {
  --bs-btn-color: var(--text-2);
  --bs-btn-hover-bg: var(--hover-bg);
  --bs-btn-hover-color: var(--text);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--hover-bg);
  --bs-btn-active-color: var(--text);
  --bs-btn-active-border-color: transparent;
}

.btn-danger {
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
  --bs-btn-hover-bg: var(--danger-dark);
  --bs-btn-hover-border-color: var(--danger-dark);
  --bs-btn-active-bg: var(--danger-dark);
  --bs-btn-disabled-bg: var(--danger);
  --bs-btn-disabled-border-color: var(--danger);
  box-shadow: var(--shadow-xs);
}

.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-color: var(--danger-dark);
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-border-color: var(--danger-line);
  --bs-btn-active-bg: var(--danger-soft);
  --bs-btn-active-color: var(--danger-dark);
  box-shadow: var(--shadow-xs);
}

.btn-outline-light {
  --bs-btn-color: var(--text-2);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--hover-bg);
  --bs-btn-hover-color: var(--text);
}

.btn-icon {
  width: 38px;
  min-height: 38px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 30px;
  min-height: 30px;
}

.btn-close {
  --bs-btn-close-opacity: 0.45;
  --bs-btn-close-focus-shadow: 0 0 0 3px var(--brand-ring);
  font-size: 0.75rem;
}

/* ---------- Forms ---------- */
.form-label {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.form-control,
.form-select {
  font-size: 0.9375rem;
  min-height: 40px;
  padding: 0.4375rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background-color: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.form-select {
  padding-right: 2.25rem;
  background-position: right 0.75rem center;
}

.form-control::placeholder {
  color: var(--faint);
}

textarea.form-control {
  min-height: 84px;
  line-height: 1.55;
}

.form-control:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) {
  border-color: var(--border-hover);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.form-control:disabled,
.form-select:disabled,
fieldset:disabled .form-control,
fieldset:disabled .form-select {
  background-color: var(--subtle-bg);
  color: var(--muted);
  box-shadow: none;
}

.form-control-color {
  width: 44px;
  min-height: 38px;
  padding: 0.25rem;
  flex: none;
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
  border-color: var(--danger);
}

.was-validated .form-control:invalid:focus,
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.was-validated .form-control:valid,
.form-control.is-valid {
  border-color: var(--border-strong);
  background-image: none;
  padding-right: 0.75rem;
}

.invalid-feedback {
  font-size: 0.8125rem;
  color: var(--danger);
}

/* Switches */
.form-switch .form-check-input {
  width: 2.25em;
  height: 1.25em;
  cursor: pointer;
  border-color: var(--border-strong);
  background-color: var(--border);
  --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='%23fff'/%3e%3c/svg%3e");
}

.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='%23fff'/%3e%3c/svg%3e");
}

.form-switch.big-switch {
  padding-left: 3.1rem;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.form-switch.big-switch .form-check-input {
  width: 2.5rem;
  height: 1.375rem;
  margin-left: -3.1rem;
  margin-top: 0;
}

.form-switch.big-switch .form-check-label {
  font-weight: 500;
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

.form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.form-check-input[type="checkbox"]:not([role="switch"]) {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.2rem;
  border-color: var(--border-strong);
  border-radius: 4px;
}

.form-check-label {
  padding-left: 0.2rem;
  font-size: 0.9375rem;
}

.input-group-text {
  background: var(--subtle-bg);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.875rem;
}

.input-group > .btn {
  box-shadow: none;
  border-color: var(--border-strong);
}

.field-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--hover-bg);
  border: 1px solid var(--border);
  padding: 0 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: 1px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* Collapsible "More options" area for rarely changed fields */
.more-options {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

.more-toggle:hover {
  color: var(--text);
}

.more-toggle .bi {
  transition: transform 0.15s;
}

.more-toggle[aria-expanded="true"] .bi {
  transform: rotate(90deg);
}

/* ---------- Layout ---------- */
.admin-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--subtle-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: none;
  height: var(--topbar-h);
  padding: 0 1rem;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--night-2);
  display: grid;
  place-items: center;
  flex: none;
  font-family: "Outfit", var(--bs-body-font-family);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-mark span {
  background-image: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-text small {
  font-size: 0.75rem;
  color: var(--muted);
}

.logo {
  font-family: "Outfit", var(--bs-body-font-family);
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.1;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 0.5rem 0.625rem 0.75rem;
}

.sidebar-nav .nav-group {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  padding: 1rem 0.625rem 0.375rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.625rem;
  min-height: 34px;
  border-radius: 7px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}

.sidebar-nav a i {
  font-size: 1rem;
  width: 1.125rem;
  text-align: center;
  color: var(--faint);
  transition: color 0.12s;
}

.sidebar-nav a:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.sidebar-nav a:hover i {
  color: var(--muted);
}

.sidebar-nav a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

.sidebar-nav a.active i {
  color: var(--brand);
}

.sidebar-nav .badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2em 0.5em;
  min-width: 20px;
}

.sidebar-foot {
  flex: none;
  padding: 0.75rem 0.625rem 0.625rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.side-clock {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.side-clock .clock-time {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.side-clock .clock-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.125rem;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.user-row .user-btn {
  flex: 1;
  min-width: 0;
  text-decoration: none;
}


.user-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.4375rem 0.5rem;
  border: 0;
  background: transparent;
  border-radius: 8px;
  text-align: left;
  color: var(--text);
}

.user-btn:hover,
.user-btn[aria-expanded="true"] {
  background: var(--hover-bg);
}

.user-btn .who-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
}

.user-btn .who-mail {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-btn .bi-chevron-expand {
  margin-left: auto;
  color: var(--faint);
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.topbar .menu-toggle {
  display: none;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  min-width: 0;
  margin: 0;
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.crumbs a:hover {
  color: var(--text);
}

.crumbs .sep {
  color: var(--border-strong);
}

.crumbs .here {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  padding: 1.5rem 1.5rem 2rem;
  width: 100%;
  flex: 1;
}

.page-head {
  margin-bottom: 1.5rem;
}

.page-head h1 {
  font-size: 1.625rem;
  line-height: 1.25;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.page-head .lead-text {
  font-size: 1rem;
  color: var(--muted);
  max-width: 680px;
  margin: 0;
}

.breadcrumb-back {
  display: none; /* replaced by the breadcrumb in the top bar */
}

/* ---------- Cards ---------- */
.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  --bs-card-cap-bg: transparent;
  background: var(--card-bg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom-color: var(--border);
}

.card-header h2,
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.card-header p {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.card-body {
  padding: 1.25rem;
}

.section-card + .section-card {
  margin-top: 1.25rem;
}

/* Stat tiles on the Home page */
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}

a.stat-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 1rem;
  color: var(--faint);
}

.stat-icon.grad {
  color: var(--brand);
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  order: -1;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-foot {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat-foot .up {
  color: var(--success);
  font-weight: 500;
}

/* Quick action tiles */
.quick-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--surface);
  height: 100%;
  transition: border-color 0.12s, background 0.12s;
}

.quick-action:hover {
  border-color: var(--border-strong);
  background: var(--subtle-bg);
  color: var(--text);
}

.quick-action i {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 0.9375rem;
  color: var(--text-2);
  background: var(--hover-bg);
  border: 1px solid var(--border);
}

.quick-action small {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Checklist ("Things to finish") */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6875rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.checklist li:last-child {
  border-bottom: 0;
}

.checklist .dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
}

.checklist .dot.done {
  background: var(--success);
  color: #fff;
}

.checklist .dot.todo {
  border: 1.5px dashed var(--border-strong);
  color: transparent;
}

.checklist li:has(.dot.done) > span:not(.dot) {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.progress-thin {
  height: 6px;
  background: var(--hover-bg);
  border-radius: 999px;
  overflow: hidden;
}

.progress-thin > span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

/* Website section list ("Edit Website" page) */
.section-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.section-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}

.section-row:hover {
  background: var(--subtle-bg);
  color: inherit;
}

.section-list li:last-child .section-row {
  border-bottom: 0;
}

.section-num {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.section-row h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.section-row p {
  margin: 0.0625rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.section-row .go {
  margin-left: auto;
  flex: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--faint);
  font-size: 0;
  min-height: 0;
  padding: 0;
}

.section-row .go i {
  font-size: 0.875rem;
}

.section-row .go i::before {
  content: "\F285"; /* chevron-right */
}

.section-row:hover .go {
  color: var(--text);
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
  vertical-align: middle;
}

.pill .bi {
  font-size: 0.75rem;
}

.pill-new,
.pill-on,
.pill-replied,
.pill-off,
.pill-todo {
  padding-left: 0.4375rem;
}

.pill-new::before,
.pill-on::before,
.pill-replied::before,
.pill-off::before,
.pill-todo::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill-replied .bi,
.pill-on .bi {
  display: none;
}

.pill-new {
  background: var(--brand-soft);
  border-color: var(--info-line);
  color: var(--brand-dark);
}

.pill-replied,
.pill-on {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success);
}

.pill-off {
  background: var(--hover-bg);
  border-color: var(--border);
  color: var(--muted);
}

.pill-todo {
  background: var(--warning-soft);
  border-color: var(--warning-line);
  color: var(--warning);
}

.pill-source {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}

.pill-source .bi {
  color: var(--muted);
}

/* ---------- Tables (Enquiries) ---------- */
.table {
  --bs-table-hover-bg: var(--subtle-bg);
  --bs-table-color: var(--text);
  margin: 0;
  font-size: 0.9375rem;
}

.table > :not(caption) > * > * {
  padding: 0.75rem 1.25rem;
  vertical-align: middle;
  border-bottom-color: var(--border);
}

.table thead th {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 500;
  background: var(--subtle-bg);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table-clickable tbody tr {
  cursor: pointer;
}

.table tbody tr.is-new .who {
  font-weight: 600;
}

.table .who {
  font-weight: 500;
  position: relative;
}

.table tbody tr.is-new td:first-child {
  box-shadow: inset 2px 0 0 var(--brand);
}

.table .who small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}

.table .avatar {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.filter-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tabs .btn {
  min-height: 28px;
  --bs-btn-padding-y: 0.1875rem;
  --bs-btn-padding-x: 0.75rem;
  --bs-btn-font-size: 0.8125rem;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: color-mix(in srgb, var(--surface) 60%, transparent);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-color: var(--muted);
  border-radius: 6px;
  box-shadow: none;
  flex: none;
}

.filter-tabs .btn.active {
  background: var(--surface);
  border-color: transparent;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.filter-tabs .badge {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--brand) !important;
}

.search-box {
  max-width: 300px;
}

.search-box .input-group-text {
  background: var(--surface);
  border-right: 0;
  padding-right: 0.25rem;
  color: var(--faint);
}

.search-box .form-control {
  border-left: 0;
}

.search-box:focus-within .input-group-text {
  border-color: var(--brand);
}

/* Enquiry cards for phones (table hidden there) */
.enquiry-card {
  display: block;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.875rem;
}

.enquiry-card:last-child {
  border-bottom: 0;
}

.enquiry-card.is-new {
  box-shadow: inset 2px 0 0 var(--brand);
}

/* Enquiry detail panel */
.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.detail-row:last-child {
  border-bottom: 0;
  display: block;
}

.detail-row .k {
  color: var(--muted);
}

.detail-row .v {
  word-break: break-word;
}

.message-box {
  background: var(--subtle-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  white-space: pre-wrap;
  font-size: 0.875rem;
  line-height: 1.6;
}

.offcanvas {
  --bs-offcanvas-width: 480px;
  --bs-offcanvas-border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

.offcanvas-header {
  min-height: var(--topbar-h);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.offcanvas-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ---------- Repeatable items (FAQ, services, ...) ---------- */
.repeat-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 0.625rem;
  box-shadow: var(--shadow-xs);
}

.repeat-item-head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.5rem 0.5rem 0.875rem;
  border-bottom: 1px solid var(--border);
  background: var(--subtle-bg);
  border-radius: 10px 10px 0 0;
  min-height: 46px;
}

.repeat-item-head .num {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.repeat-item-head .summary {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.repeat-item-head .tools {
  display: flex;
  gap: 0.25rem;
  flex: none;
}

.repeat-item-head .tools .btn {
  box-shadow: none;
}

.repeat-item-head .tools .btn-light {
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--surface);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
}

.repeat-item-head .tools [data-toggle-item] {
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border);
}

.repeat-item-head .tools .btn-outline-danger {
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-color: var(--muted);
}

.repeat-item-head .tools .btn-outline-danger:hover {
  color: var(--danger);
}

.repeat-item-body {
  padding: 1rem;
}

.repeat-item.collapsed-item .repeat-item-body {
  display: none;
}

.repeat-item.collapsed-item .repeat-item-head {
  border-bottom: 0;
  border-radius: 10px;
  background: var(--surface);
}

.btn-add {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-2);
  width: 100%;
  min-height: 42px;
  font-weight: 500;
  box-shadow: none;
}

.btn-add:hover {
  border-color: var(--brand);
  border-style: dashed;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* ---------- Save bar ---------- */
.save-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 1010;
  margin: 1.5rem 0 0;
  padding: 0.625rem 0.625rem 0.625rem 1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.save-bar .status {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.save-bar .status .bi {
  font-size: 0.9375rem;
}

.save-bar:not(.dirty) .status .bi {
  color: var(--success);
}

.save-bar.dirty .status {
  color: var(--warning);
  font-weight: 500;
}

.save-bar .actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

/* ---------- Callouts ---------- */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  border: 1px solid;
  align-items: flex-start;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.callout > i {
  font-size: 1rem;
  flex: none;
  line-height: 1.4;
}

.callout strong {
  font-weight: 600;
}

.callout p {
  margin-bottom: 0.25rem;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout .btn {
  margin-top: 0.5rem !important;
}

.callout-info {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}

.callout-info > i {
  color: var(--brand);
}

.callout-warning {
  background: var(--warning-soft);
  border-color: var(--warning-line);
  color: var(--warning-text);
}

.callout-warning > i {
  color: var(--warning);
}

.callout-danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger-text);
}

.callout-danger > i {
  color: var(--danger);
}

.callout-danger strong.title {
  color: var(--danger-strong);
}

.callout-success {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success-text);
}

.callout-success > i {
  color: var(--success);
}

/* Warning list used when adding an admin */
.danger-list {
  text-align: left;
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem 0.75rem 2.25rem;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--danger-text);
}

.danger-list li {
  margin: 0.2rem 0;
}

.confirm-box {
  display: flex;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--subtle-bg);
}

.confirm-box .form-check-input {
  margin: 0.15rem 0 0;
  flex: none;
}

/* ---------- Brand colour preview ---------- */
.brand-preview {
  border-radius: 10px;
  padding: 1.75rem;
  background: var(--night);
  color: #b9c0de;
  background-image: radial-gradient(80% 90% at 100% 0%, color-mix(in srgb, var(--p1) 30%, transparent), transparent 60%);
}

.brand-preview .logo {
  font-size: 1.5rem;
}

.brand-preview .pv-grad {
  background-image: linear-gradient(100deg, var(--p1), var(--p2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-preview .pv-btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  background-image: linear-gradient(100deg, var(--p1), var(--p2));
}

.brand-preview .pv-btn-ghost {
  display: inline-block;
  padding: 0.5625rem 1.2rem;
  border-radius: 10px;
  color: #fff;
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.swatch-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: box-shadow 0.12s, transform 0.12s;
}

.swatch-btn:hover,
.swatch-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--brand);
  transform: translateY(-1px);
}

/* ---------- Google preview ---------- */
.google-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.125rem 1.25rem;
  font-family: Arial, sans-serif;
  background: #ffffff;
}

.google-preview .gp-url {
  font-size: 14px;
  color: #202124;
}

.google-preview .gp-title {
  font-size: 20px;
  color: #1a0dab;
  margin: 0.25rem 0;
  line-height: 1.3;
}

.google-preview .gp-desc {
  font-size: 14px;
  color: #4d5156;
  line-height: 1.55;
}

/* ---------- Simple text editor (legal pages) ---------- */
.rte {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.rte:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.375rem;
  border-bottom: 1px solid var(--border);
  background: var(--subtle-bg);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.rte-toolbar .btn {
  min-height: 28px;
  box-shadow: none;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--surface);
  --bs-btn-hover-border-color: var(--border);
}

.rte-body {
  min-height: 360px;
  padding: 1.25rem 1.5rem;
  outline: none;
  font-size: 0.9375rem;
  line-height: 1.7;
  max-width: 820px;
}

.rte-body h2 {
  font-size: 1.0625rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ---------- Toasts ---------- */
.toast-container {
  z-index: 1090;
}

.toast {
  --bs-toast-font-size: 0.875rem;
  --bs-toast-max-width: 380px;
  --bs-toast-border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.toast .toast-body {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.75rem 0.875rem;
  line-height: 1.5;
}

.toast .toast-body i {
  font-size: 1rem;
  line-height: 1.4;
}

.toast .btn-close {
  margin-top: 0.15rem;
}

/* ---------- Modals ---------- */
.modal-backdrop {
  --bs-backdrop-bg: #18181b;
  --bs-backdrop-opacity: 0.4;
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
  padding: 1rem 1.25rem;
}

.modal-header {
  border-bottom: 0;
  padding-bottom: 0.25rem;
}

.modal-footer {
  background: var(--subtle-bg);
  border-radius: 0 0 14px 14px;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
}

.modal-footer > * {
  margin: 0;
}

.modal-body {
  padding: 0.75rem 1.25rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-2);
}

.modal-title {
  font-weight: 600;
  font-size: 1.0625rem !important;
}

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(88, 89, 255, 0.07), transparent 70%),
    var(--page-bg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.login-brand .brand-mark {
  width: 32px;
  height: 32px;
  font-size: 0.8125rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 2rem;
}

.login-card h1 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.login-foot {
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- API keys page ---------- */
.key-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 1.6fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.key-row:last-child {
  border-bottom: 0;
}

.key-row .key-name {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
}

.key-row .key-desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.125rem;
}

.key-row .key-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
  align-items: center;
}

.key-row .managed {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  min-width: 0;
}

.key-row .managed code {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.env-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  color: var(--muted);
  font-weight: 400;
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0 0.3rem;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  letter-spacing: 0;
}

label .env-key {
  display: table;
}

.mono,
.secret-field .form-control,
.key-row .form-control {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
}

.key-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.key-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}

.key-status.is-set::before {
  background: var(--success);
}

.key-status.is-missing {
  color: var(--warning);
}

.key-status.is-missing::before {
  background: #f59e0b;
}

.lock-banner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.lock-banner .lock-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.lock-banner.unlocked {
  background: var(--warning-soft);
  border-color: var(--warning-line);
}

.lock-banner.unlocked .lock-icon {
  background: var(--surface);
  border-color: var(--warning-line);
  color: var(--warning);
}

/* ---------- Misc ---------- */
.min-w-0 {
  min-width: 0;
}

.flex-none {
  flex: none;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  margin: 1.5rem 0 1rem;
}

.divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--info-line);
  flex: none;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty-state i {
  font-size: 1.5rem;
  color: var(--faint);
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
}

.empty-state .fs-5 {
  color: var(--text);
  font-weight: 500;
  font-size: 0.9375rem !important;
}

kbd {
  background: var(--hover-bg);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  font-size: 0.75rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

code {
  color: var(--text-2);
  font-size: 0.8125rem;
}

.dropdown-menu {
  --bs-dropdown-font-size: 0.875rem;
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: 10px;
  --bs-dropdown-link-hover-bg: var(--hover-bg);
  --bs-dropdown-link-active-bg: var(--hover-bg);
  --bs-dropdown-link-active-color: var(--text);
  --bs-dropdown-item-padding-y: 0.4rem;
  --bs-dropdown-item-border-radius: 6px;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0.3rem;
}

.dropdown-item {
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-item .bi {
  color: var(--muted);
}

.dropdown-item.text-danger .bi {
  color: inherit;
}

.list-group {
  --bs-list-group-border-color: var(--border);
  --bs-list-group-action-hover-bg: var(--subtle-bg);
}

.accordion {
  --bs-accordion-border-color: var(--border);
  --bs-accordion-border-radius: var(--radius);
  --bs-accordion-inner-border-radius: calc(var(--radius) - 1px);
  --bs-accordion-active-bg: var(--subtle-bg);
  --bs-accordion-active-color: var(--text);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 3px var(--brand-ring);
  --bs-accordion-btn-padding-y: 0.875rem;
  --bs-accordion-btn-padding-x: 1.25rem;
  --bs-accordion-body-padding-x: 1.25rem;
  --bs-accordion-body-padding-y: 1.25rem;
  box-shadow: var(--shadow-xs);
  border-radius: var(--radius);
}

.accordion-button {
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
}

.nav-pills.page-tabs,
.page-tabs {
  display: inline-flex;
  gap: 2px !important;
  padding: 3px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.page-tabs .nav-link {
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  padding: 0.3125rem 0.875rem !important;
  border-radius: 6px !important;
  color: var(--muted) !important;
  background: transparent !important;
  border: 0 !important;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.page-tabs .nav-link:hover {
  color: var(--text) !important;
}

.page-tabs .nav-link.active {
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-sm);
}

.tier-card.featured {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm) !important;
}

.feature-box {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--subtle-bg);
  border: 1px solid var(--border);
}

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

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  outline: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    background: var(--surface);
  }

  .sidebar.open {
    transform: none;
    box-shadow: var(--shadow-lg);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.4);
    z-index: 1035;
    display: none;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar .menu-toggle {
    display: inline-flex;
    margin-left: -0.375rem;
  }

  .content {
    padding: 1.25rem 1rem 1.5rem;
  }

  .search-box {
    max-width: none;
    width: 100%;
  }

  .page-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
  }

  .page-tabs .nav-link {
    white-space: nowrap;
  }

  .key-row {
    grid-template-columns: 1fr auto;
  }

  .key-row > .key-value {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 575.98px) {
  /* Phones: inputs at 16px so iOS does not zoom when a box is tapped */
  .form-control,
  .form-select {
    font-size: 1rem;
    min-height: 42px;
  }

  .btn {
    min-height: 40px;
  }

  .btn-sm {
    min-height: 34px;
  }

  .page-head h1 {
    font-size: 1.3125rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-header {
    padding: 0.875rem 1rem;
  }

  .save-bar {
    bottom: 0.5rem;
    padding: 0.625rem;
  }

  .save-bar .status {
    font-size: 0.8125rem;
    width: 100%;
    padding-left: 0.25rem;
  }

  .save-bar .actions {
    width: 100%;
    margin-left: 0;
  }

  .save-bar .actions .btn {
    flex: 1;
  }

  .stat-tile {
    padding: 0.875rem 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .latest-item {
    flex-wrap: wrap;
  }

  .latest-item > .min-w-0 {
    flex: 1 1 calc(100% - 36px - 1rem);
  }

  .latest-item .meta {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: left !important;
    padding-left: calc(36px + 0.75rem);
  }

  .latest-item .meta .small {
    margin-top: 0 !important;
  }

  .quick-action {
    padding: 0.625rem;
  }

  .section-row {
    padding: 0.75rem 1rem;
  }

  .callout {
    padding: 0.75rem 0.875rem;
  }

  .brand-preview {
    padding: 1.25rem;
  }

  .section-card + .section-card {
    margin-top: 1rem;
  }

  .topbar .hide-xs {
    display: none !important;
  }

  .repeat-item-head {
    flex-wrap: wrap;
  }

  .repeat-item-head .summary {
    order: 3;
    flex-basis: 100%;
    padding-bottom: 0.25rem;
  }

  .repeat-item-head .tools {
    margin-left: auto;
  }

  .offcanvas {
    --bs-offcanvas-width: 100%;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }

  .login-card {
    padding: 1.5rem;
  }

  .filter-tabs {
    width: 100%;
  }

  .filter-tabs .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.form-control[readonly] {
  background-color: var(--subtle-bg);
  color: var(--text-2);
  box-shadow: none;
}

.form-control[readonly]:focus {
  border-color: var(--border-strong);
  box-shadow: none;
}

/* Page forms: even spacing between cards, including cards inside wrappers (#tiers, #groups) */
.content > form:not(.card),
.content > form > fieldset,
#tiers,
#groups {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.content > form:not(.card) .section-card + .section-card {
  margin-top: 0;
}

.content > form:not(.card) > .save-bar {
  margin-top: 0.25rem;
}

.list-group {
  --bs-list-group-bg: var(--surface);
}

.key-row .managed a {
  text-decoration: none;
}

@media (max-width: 575.98px) {
  .content > form:not(.card),
  .content > form > fieldset,
  #tiers,
  #groups {
    gap: 1rem;
  }
}

@media (max-width: 575.98px) {
  .save-bar:not(.dirty) .status {
    display: none;
  }

  .lock-banner {
    flex-wrap: wrap;
  }

  .lock-banner > div {
    flex: 1 1 calc(100% - 52px) !important;
  }

  .lock-banner > .btn {
    width: 100%;
  }
}

/* Short laptop screens: compact sidebar footer so the menu never needs to scroll */
@media (min-width: 992px) and (max-height: 760px) {
  .sidebar-nav .nav-group {
    padding-top: 0.625rem;
  }

  .sidebar-foot {
    gap: 0.5rem;
    padding-top: 0.5rem;
  }

  .side-clock {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.625rem;
  }

  .side-clock .clock-time {
    font-size: 0.9375rem;
  }

  .side-clock .clock-date {
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-foot > .btn {
    min-height: 32px;
  }
}

/* ---------- Dark mode (top bar toggle; follows the computer's setting until chosen) ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0b0b0d;
  --surface: #141417;
  --subtle-bg: #18181b;
  --hover-bg: #1f1f23;
  --active-bg: #27272a;
  --text: #f4f4f5;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --border-hover: #52525b;
  --brand-soft: rgba(88, 89, 255, 0.14);
  --brand-dark: #8b8cff;
  --brand-ring: rgba(120, 121, 255, 0.3);
  --info-soft: rgba(88, 89, 255, 0.1);
  --info-line: rgba(120, 121, 255, 0.35);
  --success: #4ade80;
  --success-soft: rgba(34, 197, 94, 0.1);
  --success-line: rgba(34, 197, 94, 0.3);
  --success-text: #bbf7d0;
  --danger: #f87171;
  --danger-dark: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --danger-line: rgba(239, 68, 68, 0.3);
  --danger-text: #fecaca;
  --danger-strong: #fca5a5;
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --warning-line: rgba(245, 158, 11, 0.3);
  --warning-text: #fde68a;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --bs-link-color: #8b8cff;
  --bs-link-color-rgb: 139, 140, 255;
  --bs-link-hover-color: #a5a6ff;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-grad {
  --bs-btn-hover-bg: #6a6bff;
  --bs-btn-hover-border-color: #6a6bff;
  --bs-btn-active-bg: #6a6bff;
}

html[data-theme="dark"] .btn-danger {
  --bs-btn-bg: #dc2626;
  --bs-btn-border-color: #dc2626;
  --bs-btn-hover-bg: #b91c1c;
  --bs-btn-hover-border-color: #b91c1c;
}

html[data-theme="dark"] .checklist .dot.done {
  color: #052e16;
}

html[data-theme="dark"] .form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

html[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(1);
}

html[data-theme="dark"] .modal-backdrop {
  --bs-backdrop-bg: #000;
  --bs-backdrop-opacity: 0.6;
}

html[data-theme="dark"] .brand-mark {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .login-page {
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(88, 89, 255, 0.12), transparent 70%),
    var(--page-bg);
}

/* ---------- Top bar tools ---------- */
.topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar-tools .btn-icon {
  position: relative;
  color: var(--muted);
}

.topbar-tools .btn-icon:hover,
.topbar-tools .btn-icon[aria-expanded="true"] {
  color: var(--text);
}

.topbar-tools .tool-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.375rem;
}

.topbar-tools .logout-top {
  color: var(--text-2);
}

.topbar-tools .logout-top:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--page-bg);
}

html[data-theme="dark"] .notif-dot {
  background: #ef4444;
}

.notif-menu {
  width: 360px;
  max-width: calc(100vw - 2rem);
  padding: 0 !important;
  overflow: hidden;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.notif-head strong {
  font-size: 0.875rem;
}

.notif-head button {
  border: 0;
  background: none;
  padding: 0;
  font-size: 0.75rem;
  color: var(--bs-link-color);
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.notif-item:hover {
  background: var(--subtle-bg);
  color: var(--text);
}

.notif-item .avatar {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.notif-item.unread {
  background: var(--info-soft);
}

.notif-item.unread .notif-title::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  margin-left: 0.375rem;
  vertical-align: middle;
}

.notif-title {
  font-weight: 500;
}

.notif-text {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 250px;
}

.notif-time {
  color: var(--faint);
  font-size: 0.75rem;
}

.notif-foot {
  display: block;
  text-align: center;
  padding: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
}

.notif-foot:hover {
  background: var(--subtle-bg);
}

@media (max-width: 575.98px) {
  .topbar-tools .tool-sep {
    display: none;
  }
}

.toast {
  --bs-toast-bg: var(--surface);
  background: var(--surface);
  color: var(--text);
}

/* ==========================================================================
   Brand colour layer: the website's own palette (Frontend globals.css)
   --brand #5859ff → --brand-2 #0cc0f1 on night #07050f / #0e0a22 / #141031
   ========================================================================== */
:root {
  --site-soft: #b9c0de;
  --site-dim: #7e86ac;
  --site-line: rgba(255, 255, 255, 0.1);
  --site-panel: #141031;
}

/* ---------- Sidebar: night panel with the website's glow ---------- */
.sidebar {
  background-color: var(--night-2);
  background-image:
    radial-gradient(120% 45% at 0% 0%, rgba(88, 89, 255, 0.28), transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(12, 192, 241, 0.14), transparent 60%);
  border-right: 1px solid var(--site-line);
  color: var(--site-soft);
}

.sidebar .brand {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.3125rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--site-line);
  height: var(--topbar-h);
}

.brand-logo {
  font-family: "Outfit", var(--bs-body-font-family);
  font-weight: 800;
  font-size: 1.1875rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #fff;
}

.brand-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--site-dim);
}

.sidebar-nav {
  padding-top: 0.625rem;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-nav .nav-group {
  color: var(--site-dim);
}

.sidebar-nav a {
  color: var(--site-soft);
}

.sidebar-nav a i {
  color: var(--site-dim);
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-nav a:hover i {
  color: var(--site-soft);
}

.sidebar-nav a.active {
  position: relative;
  background: linear-gradient(100deg, rgba(88, 89, 255, 0.32), rgba(12, 192, 241, 0.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(120, 121, 255, 0.35);
}

.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -0.625rem;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}

.sidebar-nav a.active i {
  color: var(--brand-2);
}

.sidebar-nav .badge {
  background: var(--grad);
}

.sidebar-foot {
  border-top-color: var(--site-line);
}

.side-clock {
  background: rgba(20, 16, 49, 0.7);
  border-color: var(--site-line);
}

.side-clock .clock-time {
  color: #fff;
}

.side-clock .clock-date {
  color: var(--site-dim);
}

.sidebar-foot > .btn-light {
  --bs-btn-bg: rgba(255, 255, 255, 0.06);
  --bs-btn-color: #fff;
  --bs-btn-border-color: var(--site-line);
  --bs-btn-hover-bg: rgba(255, 255, 255, 0.12);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-border-color: rgba(255, 255, 255, 0.2);
  --bs-btn-active-bg: rgba(255, 255, 255, 0.12);
  --bs-btn-active-color: #fff;
  box-shadow: none;
}

.user-btn {
  color: #fff;
}

.user-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-btn .who-mail {
  color: var(--site-dim);
}

.sidebar .avatar {
  background: var(--grad);
  color: #fff;
  box-shadow: none;
}

/* ---------- Header: brand line + soft brand tint ---------- */
.topbar {
  background:
    linear-gradient(100deg, rgba(88, 89, 255, 0.07), rgba(12, 192, 241, 0.05)),
    color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--grad);
  opacity: 0.85;
}

.crumbs .here {
  color: var(--text);
  font-weight: 600;
}

.topbar-tools .btn-icon:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.notif-dot {
  top: 8px;
  right: 8px;
  min-width: 0;
  width: 9px;
  height: 9px;
  padding: 0;
  font-size: 0;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Brand accents in the content ---------- */
.btn-primary,
.btn-grad {
  border: 0;
  background-image: var(--grad);
  box-shadow: 0 8px 20px -12px var(--brand);
}

.btn-primary:hover,
.btn-grad:hover,
.btn-primary:focus-visible,
.btn-grad:focus-visible {
  filter: brightness(1.07);
  box-shadow: 0 10px 24px -12px var(--brand);
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  top: 0.875rem;
  background: var(--brand-soft);
  color: var(--brand);
}

.stat-icon.grad {
  background: var(--grad);
  color: #fff;
}

.progress-thin > span {
  background: var(--grad);
}


/* ---------- Footer ---------- */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8125rem;
  color: var(--muted);
}

.app-footer strong {
  font-family: "Outfit", var(--bs-body-font-family);
  font-weight: 800;
  background-image: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
}

.app-footer a {
  color: var(--muted);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--brand);
}

.app-footer .ver {
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.6875rem;
  color: var(--faint);
}

@media (max-width: 991.98px) {
  .app-footer {
    padding: 0.875rem 1rem;
    justify-content: center;
    text-align: center;
  }
}

/* ---------- Dark mode uses the website's night colours ---------- */
html[data-theme="dark"] {
  --page-bg: #07050f;
  --surface: #0e0a22;
  --subtle-bg: #120e2b;
  --hover-bg: #1a1540;
  --active-bg: #221c4f;
  --text: #ffffff;
  --text-2: #dfe2f5;
  --muted: #b9c0de;
  --faint: #7e86ac;
  --border: #221d45;
  --border-strong: #2f2960;
  --border-hover: #3d3678;
}

html[data-theme="dark"] .sidebar {
  background-color: #0a0719;
}

html[data-theme="dark"] .topbar {
  background:
    linear-gradient(100deg, rgba(88, 89, 255, 0.12), rgba(12, 192, 241, 0.06)),
    color-mix(in srgb, var(--page-bg) 88%, transparent);
}


.login-brand .brand-logo {
  color: var(--text);
  font-size: 1.625rem;
}

.login-card {
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--grad);
}

.key-row textarea.form-control {
  min-height: 96px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

textarea.mono {
  font-size: 0.875rem;
}

/* Demo one-click login (design preview only) */
.demo-login .divider-label::before {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.demo-login .divider-label {
  justify-content: center;
  text-transform: lowercase;
}

/* ---------- Form buttons keep their own width ---------- */
.content > form:not(.card) > .btn {
  align-self: flex-start;
}
