:root {
  /* Sidebar: 25% darker than the old #4f3fd6 -> #6a4fe0, with the shade changing from place to
     place - a lighter glow at the top right and a deeper navy at the bottom left. */
  --rail-bg:
    radial-gradient(130% 55% at 100% 0%, rgba(98, 76, 214, 0.55), transparent 60%),
    radial-gradient(120% 50% at 0% 100%, rgba(30, 24, 110, 0.6), transparent 60%),
    linear-gradient(165deg, #3b2fa0 0%, #342a92 50%, #503ba8 100%);
  --purple: #6449db;
  --purple-light: #efeafd;
  --purple-dark: #4f3fd6;
  --text-dark: #1f2430;
  --text-muted: #5f647a;
  --border: #ececf2;
  --page-bg: #f6f6fb;
  --panel-bg: #ffffff;
  --green: #1fae7a;
  --orange: #f0883e;
  --pink: #e0457b;
  --unread: #ef6a3c;

  --settings-nav-bg: #e6e6e6;
  --status-on-bg: #e6f8ef;
  --status-off-bg: #f1f1f6;
  --alert-warning-bg: #fff4e5;
  --alert-warning-text: #7f4c0e;
  --alert-success-bg: #e6f8ef;
  --alert-success-text: #14804a;
  --btn-danger-bg: #fdeaf1;
  --btn-danger-text: #a82050;
  --shadow-color: rgba(20, 10, 60, 0.35);
  --toast-bg: #1f2430;
}

html[data-theme="dark"] {
  --purple-light: #2a2560;
  --text-dark: #eef0f6;
  --text-muted: #9a9fb5;
  --border: #2d2f42;
  --page-bg: #14151f;
  --panel-bg: #1b1d2b;

  --settings-nav-bg: #181a26;
  --status-on-bg: #113a2b;
  --status-off-bg: #23253a;
  --alert-warning-bg: #3a2c14;
  --alert-warning-text: #f0b35d;
  --alert-success-bg: #113a2b;
  --alert-success-text: #4fd699;
  --btn-danger-bg: #3a1626;
  --btn-danger-text: #ef6ba0;
  --shadow-color: rgba(0, 0, 0, 0.55);
  --toast-bg: #2d3040;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-dark);
  background: var(--page-bg);
}

/* Slim, themed scrollbars everywhere instead of the bulky OS default -
   this alone makes every scrollable panel in the app feel less clunky. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 150, 0.35) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 150, 0.35);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 150, 0.55); }

/* A visible, on-brand focus ring for keyboard users instead of the
   inconsistent OS default - also just reads as more polished. */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- SuperAdmin shell: a slim top bar instead of the tenant's
   left rail - there's no business nav to show, just the platform admin
   console below and an account menu. ---------- */
.app-shell--topbar {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9px;
  background: var(--purple);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 10, 60, 0.25);
}
.mobile-menu-btn svg { width: 20px; height: 20px; }

.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 40, 0.45);
  z-index: 55;
}
.mobile-backdrop--visible { display: block; }


/* ---------- Primary sidebar ---------- */
.rail {
  background: var(--rail-bg);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

.rail__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 16px;
  text-decoration: none;
  color: #fff;
}

.rail__logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}

.rail__header span {
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The business's own logo (templates/_brand_mark.html), with no box
   behind it - a transparent logo sits straight on the purple. */
.brand-mark {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}
.brand-mark__big {
  display: block;
  max-width: 100%;
  max-height: 52px;
  object-fit: contain;
  object-position: left center;
}
.rail__header .brand-mark__name {
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Account Settings: the same header on the sidebar's purple. */
.brand-preview {
  display: flex;
  align-items: center;
  width: 240px;
  max-width: 100%;
  min-height: 64px;
  padding: 12px;
  border-radius: 10px;
  background: var(--rail-bg);
  color: #fff;
}
.brand-preview .brand-mark__name { font-weight: 600; font-size: 14.5px; }

/* Business sidebar: the profile sits right under the menu (after Connect
   Rabta), its menu opening upwards over the menu; "Rabta - Powered by ..." closes the
   sidebar at the very bottom. */
.rail:not(.rail--topbar) .rail__nav { flex: none; }
.rail:not(.rail--topbar) .profile-menu-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

/* ---------- Business sidebar: "R"s of different sizes drift slowly down from the top,
   as if behind a pane of glass (a faint mist on top), very light so they only just show. Pure
   decoration - it sits behind the menu and ignores the mouse. ---------- */
/* z-index: the sidebar (and the RABTA WhatsApp window that opens from it) paints above the page next to it. Without
   it, "isolate" kept the window's own z-index inside the sidebar, and the chat list's positioned avatars showed
   through on top of the window. (On a phone the sidebar has its own z-index below.) */
.rail:not(.rail--topbar) { isolation: isolate; z-index: 60; }
.rail__fx {
  position: sticky;   /* stays put while the menu scrolls */
  top: 0;
  height: 0;
  margin: -14px -12px 14px; /* pulled up over the rail padding, pushed back down so the menu does not move */
  z-index: -1;
  pointer-events: none;
}
.rail__fx-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
/* the glass: a soft sheen and a fine mist of condensation over the R's */
.rail__fx-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, 0.07) 100%),
    radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1.5px) 0 0 / 11px 11px,
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.5px) 5px 6px / 17px 17px;
}
.rail__r {
  position: absolute;
  top: 0;
  left: var(--x);
  font-size: var(--s);
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, var(--o, 0.2));
  filter: blur(var(--b, 1px));
  will-change: transform;
  animation: rail-fall var(--t) linear var(--d) infinite;
}
@keyframes rail-fall {
  from { transform: translate3d(0, -100px, 0) rotate(var(--r0)); }
  to { transform: translate3d(var(--dx, 0px), calc(100vh + 100px), 0) rotate(var(--r1)); }
}
.rail__r:nth-child(1)  { --x: 8%;  --s: 54px; --r0: -18deg; --r1: 24deg;  --t: 26s; --d: -4s;  --o: 0.08; --dx: 14px; }
.rail__r:nth-child(2)  { --x: 62%; --s: 30px; --r0: 25deg;  --r1: -40deg; --t: 19s; --d: -11s; --o: 0.10; --dx: -10px; }
.rail__r:nth-child(3)  { --x: 34%; --s: 76px; --r0: 8deg;   --r1: 50deg;  --t: 34s; --d: -20s; --o: 0.05; --dx: 20px; --b: 1.6px; }
.rail__r:nth-child(4)  { --x: 80%; --s: 44px; --r0: -35deg; --r1: 12deg;  --t: 23s; --d: -2s;  --o: 0.09; --dx: -18px; }
.rail__r:nth-child(5)  { --x: 18%; --s: 24px; --r0: 40deg;  --r1: -25deg; --t: 17s; --d: -9s;  --o: 0.11; --dx: 8px; --b: 0.6px; }
.rail__r:nth-child(6)  { --x: 48%; --s: 62px; --r0: -8deg;  --r1: -62deg; --t: 30s; --d: -15s; --o: 0.06; --dx: -22px; --b: 1.4px; }
.rail__r:nth-child(7)  { --x: 72%; --s: 36px; --r0: 15deg;  --r1: 70deg;  --t: 21s; --d: -7s;  --o: 0.09; --dx: 12px; }
.rail__r:nth-child(8)  { --x: 3%;  --s: 38px; --r0: -50deg; --r1: -5deg;  --t: 25s; --d: -17s; --o: 0.08; --dx: 16px; }
.rail__r:nth-child(9)  { --x: 88%; --s: 68px; --r0: 30deg;  --r1: -20deg; --t: 32s; --d: -25s; --o: 0.05; --dx: -14px; --b: 1.6px; }
.rail__r:nth-child(10) { --x: 40%; --s: 20px; --r0: -12deg; --r1: 36deg;  --t: 15s; --d: -13s; --o: 0.12; --dx: -6px; --b: 0.5px; }

@media (prefers-reduced-motion: reduce) {
  .rail__r { animation: none; display: none; }
}
/* The business switched the sidebar animation off: the R layer is not even sent (see
   base_shell.html); the footer block stills itself with .is-still (powered_block.css). */

/* A small on/off switch (Settings -> Account). */
.switch-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.switch-row .hint { margin: 2px 0 0; }
.switch-row__switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; cursor: pointer; }
.switch-row__switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-row__slider {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: #c9c9d8;
  transition: background 0.2s;
}
.switch-row__slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.switch-row__switch input:checked + .switch-row__slider { background: var(--purple, #6449db); }
.switch-row__switch input:checked + .switch-row__slider::before { transform: translateX(20px); }
.switch-row__switch input:focus-visible + .switch-row__slider { outline: 2px solid var(--purple, #6449db); outline-offset: 2px; }

.rail__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  padding: 9px 10px;
  margin-bottom: 18px;
}
.rail__search svg { width: 15px; height: 15px; color: rgba(255, 255, 255, 0.7); flex: none; }
.rail__search input {
  border: none;
  background: transparent;
  outline: none;
  color: #fff;
  font-size: 13px;
  width: 100%;
}
.rail__search input::placeholder { color: rgba(255, 255, 255, 0.65); }
.rail__search button {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  padding: 0;
  flex: none;
}
.rail__search button svg { width: 15px; height: 15px; }

.rail__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.rail__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  position: relative;
  border: none;
  background: transparent;
  text-decoration: none;
  font-size: 13.5px;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.rail__item svg { width: 18px; height: 18px; flex: none; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }

.rail__item:hover { background: rgba(255, 255, 255, 0.12); color: #fff; transform: translateX(2px); }
.rail__item:hover svg { transform: scale(1.1); }

.rail__item.active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #fff;
}

.rail__item span:not(.rail__badge) { flex: 1; }
.rail__badge {
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--pink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ---------- "Connect Rabta" widget: a small toggle-able chat popover
   anchored near the sidebar item, so an agent can message RABTA support
   without leaving whatever page they're on. ---------- */
.connect-rabta-widget {
  position: fixed;
  left: 270px;
  bottom: 20px;
  width: 320px;
  max-width: calc(100vw - 40px);
  height: 420px;
  max-height: calc(100vh - 40px);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(20, 10, 60, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 70;
}
.connect-rabta-widget[hidden] { display: none; }
.connect-rabta-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--purple);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  flex: none;
}
.connect-rabta-widget__header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
.connect-rabta-widget__header button:hover { opacity: 1; }
.connect-rabta-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.connect-rabta-widget__msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  line-height: 1.4;
  word-break: break-word;
}
.connect-rabta-widget__msg.in { align-self: flex-start; background: var(--settings-nav-bg); color: var(--text-dark); }
.connect-rabta-widget__msg.out { align-self: flex-end; background: var(--purple); color: #fff; }
.connect-rabta-widget__composer {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  flex: none;
}
.connect-rabta-widget__composer input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
}
.connect-rabta-widget__composer button {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.connect-rabta-widget__composer button svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .connect-rabta-widget { left: 20px; }
}

.rail--topbar {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  overflow: visible;
}
.rail--topbar .rail__header { padding: 0; }
.rail--topbar .profile-menu-wrap { margin-top: 0; }
.rail--topbar .profile-menu {
  top: calc(100% + 8px);
  bottom: auto;
  left: auto;
  right: 0;
}

.profile-menu-wrap { position: relative; margin-top: 12px; }

.rail__profile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.rail__profile:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

@keyframes profile-menu-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: var(--purple);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 16px 40px var(--shadow-color);
  z-index: 40;
  animation: profile-menu-in 0.15s ease;
}

.profile-menu__availability {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.profile-menu__availability select {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12.5px;
  outline: none;
}
.profile-menu__availability select option { color: var(--text-dark); }

.profile-menu__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin: 6px 4px;
}

.profile-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 13px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.profile-menu__item svg { width: 16px; height: 16px; flex: none; }
.profile-menu__item:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

.profile-menu__item--button {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.profile-menu form { margin: 0; }

.rail__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #c2410c;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* A short, one-time fade+rise as each page's content loads, so navigating
   between pages doesn't feel like an abrupt cut. */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Generic page content (settings/contacts/reports) ---------- */
.page {
  overflow-y: auto;
  padding: 32px 40px;
  animation: page-fade-in 0.35s ease;
}

.page__header { margin-bottom: 24px; }
.page__header h1 { font-size: 22px; margin: 0 0 6px; }
.page__header p { font-size: 13.5px; color: var(--text-muted); margin: 0; }

.card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(20, 10, 60, 0.04);
}

.card h2 { font-size: 15px; margin: 0 0 16px; }

.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.form-row .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="color"],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 13.5px;
  outline: none;
  background: var(--page-bg);
  font-family: inherit;
  color: var(--text-dark);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row input[type="text"]:focus,
.form-row input[type="email"]:focus,
.form-row input[type="password"]:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(106, 79, 224, 0.15);
}

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.checkbox-row label { font-size: 13.5px; font-weight: 500; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--purple); color: #fff; }
.btn--primary:hover { background: var(--purple-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(106, 79, 224, 0.35); }
.btn--ghost { background: var(--page-bg); color: var(--text-dark); border: 1px solid var(--border); }
.btn--ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn--danger { background: var(--btn-danger-bg); color: var(--btn-danger-text); }
.btn--danger:hover { filter: brightness(0.95); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
}
.status-pill--on { background: var(--status-on-bg); color: var(--green); }
.status-pill--off { background: var(--status-off-bg); color: var(--text-muted); }

table.simple-table { width: 100%; border-collapse: collapse; }
table.simple-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.simple-table td {
  padding: 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
table.simple-table tr:last-child td { border-bottom: none; }
table.simple-table tbody tr { transition: background-color 0.12s ease; }
table.simple-table tbody tr:hover { background: var(--page-bg); }

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(20, 10, 60, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 10, 60, 0.08); }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-row .bar-label { width: 130px; font-size: 13px; flex: none; }
.bar-track { flex: 1; background: var(--page-bg); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--purple); border-radius: 999px; }
.bar-row .bar-value { width: 32px; text-align: right; font-size: 12.5px; color: var(--text-muted); }

.snippet-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.snippet-item__title { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.snippet-item__content { font-size: 13px; color: var(--text-muted); }

.alert {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 18px;
}
.alert--warning { background: var(--alert-warning-bg); color: var(--alert-warning-text); }
.alert--success { background: var(--alert-success-bg); color: var(--alert-success-text); }
.alert--error { background: var(--btn-danger-bg); color: var(--btn-danger-text); }

/* ---------- Settings section (light secondary sidebar, matches the inbox panel) ---------- */
.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}

.settings-nav {
  background: var(--settings-nav-bg);
  border-right: 1px solid var(--border);
  color: var(--text-dark);
  overflow-y: auto;
  padding: 18px 12px 24px;
}

.settings-nav__back {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.settings-nav__back svg { width: 15px; height: 15px; }
.settings-nav__back:hover { background: var(--page-bg); color: var(--text-dark); }

.settings-nav__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 14.5px;
  padding: 6px 10px 16px;
}
.settings-nav__title svg { width: 16px; height: 16px; }

.settings-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.settings-nav a svg { width: 16px; height: 16px; flex: none; color: var(--text-muted); transition: color 0.15s ease; }
.settings-nav a:hover { background: var(--page-bg); }
.settings-nav a.active { background: var(--purple-light); color: var(--purple); font-weight: 600; }
.settings-nav a.active svg { color: var(--purple); }
.settings-nav a.locked { color: var(--text-muted); }
.settings-nav a.locked svg { color: var(--text-muted); }
.settings-nav a .lock-icon { margin-left: auto; width: 13px; height: 13px; }

.settings-content {
  overflow-y: auto;
  background: var(--page-bg);
}

.settings-nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text-dark);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin: 64px 16px 0;
}
.settings-nav-toggle svg { width: 15px; height: 15px; }

.upgrade-banner {
  border: 1px dashed var(--purple);
  background: var(--purple-light);
  color: var(--purple-dark);
  border-radius: 12px;
  padding: 22px 24px;
  font-size: 13.5px;
  line-height: 1.6;
}
.upgrade-banner strong { display: block; font-size: 15px; margin-bottom: 6px; color: var(--text-dark); }

@media (max-width: 860px) {
  .mobile-menu-btn { display: flex; }

  .app-shell:not(.app-shell--topbar) { grid-template-columns: 1fr; }

  .rail:not(.rail--topbar) {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 58;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .rail.rail--open { transform: translateX(0); }

  .rail--topbar { padding: 10px 16px; }

  .page { padding: 72px 16px 24px; }
  .app-shell--topbar .page { padding: 24px 16px; }

  .settings-layout { grid-template-columns: 1fr; }

  .settings-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 58;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .settings-nav.settings-nav--open { transform: translateX(0); }

  .settings-nav__back { display: flex; }

  .settings-nav-toggle { display: inline-flex; }

  .settings-content .page { padding-top: 16px; }
}

.app-main { display: contents; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.skip-link { position: absolute; left: 8px; top: -48px; z-index: 1000; background: var(--purple-dark); color: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none; font-size: 13px; }
.skip-link:focus { top: 8px; }
.app-main:focus { outline: none; }
