/* DigiQSL Redesign — Sidebar Layout, Modern Design System
 *
 * TYPE SCALE (base 15px)
 * ──────────────────────
 * .text-xs   0.733rem  11px   Meta, timestamps
 * .text-sm   0.8rem    12px   Captions, hints, badges
 * base       0.933rem  14px   Body, inputs, table cells
 * .text-md   1rem      15px   Slightly emphasised body
 * .text-lg   1.133rem  17px   Sub-headings
 * .text-xl   1.4rem    21px   Page titles
 * .text-2xl  1.6rem    24px   Stat values, hero
 *
 * WEIGHT SCALE
 * ──────────────────────
 * 400  Regular — body, inputs, descriptions
 * 500  Medium  — buttons, nav, badges, emphasis
 * 600  Semi    — headings, labels, panel titles, page titles (max used)
 */

/* ========== DESIGN TOKENS ========== */
:root {
  /* Sidebar — Light */
  --sidebar-w: 248px;
  --rail-w: 64px;
  --sidebar-bg: #ffffff;
  --sidebar-bg-2: #f8fafc;
  --sidebar-border: #e2e8f0;
  --sidebar-text: #64748b;
  --sidebar-text-hover: #1e293b;
  --sidebar-text-active: #fff;

  /* Surfaces */
  /* --page-bg: #f1f5f9; */
  --page-bg: #f1f5f96b;
  --surface: #fff;
  --surface-raised: #fff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Typography */
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --text-inv: #fff;

  /* Accent — Emerald */
  --pri: #059669;
  --pri-hover: #047857;
  --pri-bg: #ecfdf5;
  --pri-text: #065f46;
  --pri-ring: rgba(5, 150, 105, .25);

  /* Semantics */
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --ok: #22c55e;
  --ok-bg: #f0fdf4;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --warn-text: #92400e;
  --err: #ef4444;
  --err-bg: #fef2f2;
  --err-text: #991b1b;

  /* Radii */
  --r: 8px;
  --r-sm: 6px;
  --r-lg: 12px;

  /* Modal layout */
  --modal-mobile-inset: 12px;

  /* Font */
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Overlay / dark backdrop */
  --overlay: rgba(15, 23, 42, .45);
}

/* ========== RESET & BASE ========== */
html { font-size: 15px; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--page-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}
a { color: var(--pri); }
strong, b { font-weight: 600; }

/* ========== APP LAYOUT ========== */
.app-layout { display: flex; min-height: 100vh; }

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  overflow-y: auto;
  transition: width .2s ease, transform .25s ease;
}

.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 69px;
}
.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: var(--pri);
  border-radius: var(--r-sm);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-brand-icon--photo { background: none; overflow: hidden; }
.sidebar-brand-icon--photo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand-text {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -.3px;
  white-space: nowrap;
  text-decoration: none;
}
.sidebar-brand-text:hover { color: var(--text); text-decoration: none; }



/* Nav sections */
.sidebar-section {
  padding: 18px 20px 6px;
  font-size: .733rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-auth-link { color: var(--pri) !important; font-weight: 500 !important; }
.sidebar-nav { padding: 0; list-style: none; margin: 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: .933rem;
  font-weight: 400;
  border-radius: 0;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-nav a i { font-size: 1.067rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav a:hover { color: var(--sidebar-text-hover); background: var(--sidebar-bg-2); text-decoration: none; }
.sidebar-nav a.active { color: var(--sidebar-text-active); background: var(--pri); font-weight: 500; }
.sidebar-nav .nav-badge {
  margin-left: auto;
  font-size: .733rem;
  background: var(--sidebar-bg-2);
  color: var(--sidebar-text);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-nav a.active .nav-badge { background: rgba(255,255,255,.2); color: #fff; border-color: transparent; }
.sidebar-nav .nav-lock { margin-left: auto; font-size: .8rem; color: var(--text-3); flex-shrink: 0; }

/* Bottom section */
.sidebar-bottom { margin-top: auto; padding: 0 0 8px; }
.sidebar-bottom .sidebar-nav a { color: var(--text-3); }
.sidebar-bottom .sidebar-nav a.active { color: var(--sidebar-text-active); }
.sidebar-report { margin-top: auto; padding: 0 0 12px; border-top: 1px solid var(--sidebar-bg-2); }
.sidebar-report a { color: var(--err) !important; }
.sidebar-report a:hover { color: var(--sidebar-text-hover) !important; }
.sidebar-bottom ~ .sidebar-report { margin-top: 0; }
.sidebar.collapsed .sidebar-report { padding: 0 0 4px; border-top: none; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-report { padding: 0 0 12px; border-top: 1px solid var(--sidebar-bg-2); }

/* Collapse toggle */
.sidebar-collapse-toggle {
  background: none; border: none;
  color: var(--text-3); cursor: pointer;
  padding: 4px; margin-left: auto;
  font-size: 1.1rem; flex-shrink: 0;
  display: flex; align-items: center;
  transition: .15s;
}
.sidebar-collapse-toggle:hover { color: var(--text); }

/* ========== SIDEBAR COLLAPSED STATE (icon rail) ========== */
.sidebar.collapsed { width: var(--rail-w); }
.sidebar.collapsed .sidebar-brand { padding: 18px 16px; justify-content: center; }
.sidebar.collapsed .sidebar-brand-text { display: none; }
.sidebar.collapsed .sidebar-collapse-toggle { display: none; }
.sidebar.collapsed .sidebar-section { font-size: 0; padding: 14px 0 2px; text-align: center; }
.sidebar.collapsed .sidebar-section::after { content: ''; display: block; width: 24px; height: 1px; background: var(--border); margin: 0 auto; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 10px; gap: 0; font-size: 0; }
.sidebar.collapsed .sidebar-nav a i { font-size: 1.15rem; margin: 0; width: auto; }
.sidebar.collapsed .sidebar-nav .nav-badge { display: none; }
.sidebar.collapsed .sidebar-nav .nav-lock { display: none; }
.sidebar.collapsed .sidebar-bottom { padding: 0 0 4px; }
.sidebar.collapsed .sidebar-bottom .sidebar-nav a { justify-content: center; padding: 10px; gap: 0; font-size: 0; }
.sidebar.collapsed .sidebar-bottom .sidebar-nav a i { font-size: 1.15rem; margin: 0; width: auto; }
.sidebar.collapsed ~ .main { margin-left: var(--rail-w); }

/* Hover expand — suppressed when .no-hover-expand is active (just-collapsed) */
.sidebar.collapsed:not(.no-hover-expand):hover { width: var(--sidebar-w); box-shadow: 6px 0 24px rgba(0,0,0,.08); z-index: 210; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-brand { padding: 18px 20px; justify-content: flex-start; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-brand-text { display: inline; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-collapse-toggle { display: flex; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-section { font-size: .733rem; padding: 18px 20px 6px; text-align: left; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-section::after { display: none; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-nav a { justify-content: flex-start; padding: 9px 20px; gap: 10px; font-size: .933rem; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-nav a i { font-size: 1.067rem; width: 20px; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-nav .nav-badge { display: inline-flex; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-nav .nav-lock { display: inline; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-bottom { padding: 0 0 8px; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-bottom .sidebar-nav a { justify-content: flex-start; padding: 9px 20px; gap: 10px; font-size: .933rem; }
.sidebar.collapsed:not(.no-hover-expand):hover .sidebar-bottom .sidebar-nav a i { font-size: 1.067rem; width: 20px; }
.sidebar.collapsed:not(.no-hover-expand):hover ~ .main { margin-left: var(--rail-w); }

/* ========== MAIN CONTENT ========== */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  transition: margin-left .2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}
.main-content {
  padding: 28px 32px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ========== TOPBAR (mobile only, <768px) ========== */
.topbar {
  display: none;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { font-weight: 600; font-size: 1rem; color: var(--text); }
.topbar-toggle {
  background: none; border: none;
  color: var(--text); font-size: 1.3rem;
  cursor: pointer; padding: 4px;
  margin-left: auto;
}
.sidebar-close {
  display: none;
  position: absolute; top: 12px; right: 12px;
  background: none; border: none;
  color: var(--sidebar-text);
  font-size: 1.3rem; cursor: pointer;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 199;
}

/* ========== FOOTER ========== */
.app-footer {
  width: 100%;
  padding: 28px 0 0;
  /* border-top: 1px solid var(--border); */
  color: var(--text-3);
  font-size: .867rem;
  line-height: 1.8;
  text-align: center;
  margin-top: auto;
}
.app-footer--creator {
  width: min(100%, 960px);
  align-self: flex-start;
  padding-bottom: 8px;
  margin: -24px 0 20px 32px;
}
.app-footer__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.app-footer a { color: var(--text-3); text-decoration: none; margin: 0; font-weight: 400; }
.app-footer a:hover { color: var(--pri); }

/* ========== PAGE HEADER ========== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title { font-size: 1.4rem; font-weight: 600; margin: 0; letter-spacing: -.3px; }
.page-title-accent {
  display: inline-block;
  margin-left: 8px;
  font-size: .68em;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  vertical-align: middle;
}
.page-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.page-header-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: .867rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.page-header-tool:hover {
  border-color: var(--text-3);
  background: var(--page-bg);
  color: var(--text);
  text-decoration: none;
}
.page-header-tool i { font-size: .95rem; }
.page-header-tool--premium {
  border-color: var(--pri);
  background: var(--pri-bg);
  color: var(--pri-text);
}
.page-header-tool--premium:hover {
  border-color: var(--pri-hover);
  background: #dff7eb;
  color: var(--pri-text);
}
.page-header-tool--premium i { color: var(--pri); }
.page-header-tool--notifications {
  position: relative;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  gap: 0;
  border-radius: 999px;
  flex-shrink: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text);
}
.page-header-tool--notifications:hover {
  border-color: transparent;
  background: transparent;
  color: var(--pri-hover);
}
.page-header-tool--notifications i {
  font-size: 1.05rem;
}
.page-header-tool--active {
  border-color: var(--pri);
  background: var(--pri-bg);
  color: var(--pri-text);
}
.page-header-tool-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--err);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  line-height: 1;
}
.page-header-tool--notifications .page-header-tool-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  /* background: var(--pri-bg); */
  background: var(--pri);
  color: var(--text-inv);
  box-shadow: none;
}

/* ========== PANELS / CARDS ========== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.panel-toolbar { padding: 12px 16px; }
.logbook-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.logbook-toolbar__primary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 420px;
  min-width: 0;
  flex-wrap: wrap;
}
.logbook-toolbar__switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.logbook-toolbar__select {
  flex: 0 1 280px;
  min-width: 0;
  max-width: 100%;
  height: auto;
  line-height: 1;
}
.logbook-toolbar__summary {
  font-size: .8rem;
  color: var(--text-3);
  flex: 1 1 240px;
  min-width: 0;
}
.logbook-toolbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.panel-compact { padding: 14px 20px; }
.panel-flush { padding: 0; }
.panel-scroll { overflow-x: auto; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-3);
  margin: 0 0 14px;
}
.section-label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-3);
  margin: 0 0 10px;
}
.panel-header .panel-title { margin-bottom: 0; }

/* ========== FORM SYSTEM ========== */
.form-row { display: flex; gap: 14px; margin-bottom: 14px; align-items: flex-start; }
.form-row > * { flex: 1; min-width: 0; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f-input-with-action {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s;
}
.f-input-with-action:focus-within { border-color: var(--pri); box-shadow: 0 0 0 2px var(--pri-ring); }
.f-input-with-action .f-input {
  border: none;
  border-radius: 0;
  flex: 1;
}
.f-input-with-action .f-input:focus { box-shadow: none; }
.f-input-with-action .shortcut-btn {
  border-radius: 0;
  margin: 0;
  border: none;
  border-left: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--page-bg);
  flex-shrink: 0;
}
.f-input-with-action .shortcut-btn:last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }
.f-input-with-action .shortcut-btn:hover { background: var(--pri-bg); color: var(--pri); border-color: var(--border); }

/* Primary form input: labeled inline */
.f-labeled {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s;
}
.f-labeled--compact { width: fit-content; flex: none !important; }
.qsl-custom-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: space-between; }
.qsl-custom-row > .f-labeled--compact { flex: 1 1 100% !important; width: auto; }
.qsl-custom-row > .f-labeled--compact select { flex: 1; text-align: center; }
.qsl-custom-row > .f-labeled--compact #addBackgroundBtn { flex: 1 1 auto; justify-content: flex-start; }
@media (min-width: 520px) {
  .qsl-custom-row > .f-labeled--compact { flex: none !important; width: fit-content; }
  .qsl-custom-row > .f-labeled--compact #addBackgroundBtn { flex: 0 0 auto; }
}
.f-labeled:focus-within { border-color: var(--pri); box-shadow: 0 0 0 2px var(--pri-ring); }

.f-label {
  background: var(--page-bg);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 12px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  min-width: 76px;
  flex-shrink: 0;
}

.f-labeled input,
.f-labeled select,
.f-labeled textarea {
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: .933rem;
  font-family: var(--font);
  flex: 1;
  min-width: 0;
  background: transparent;
  color: var(--text);
}
.f-labeled input:disabled,
.f-labeled select:disabled { opacity: .5; cursor: not-allowed; }

.f-labeled .f-suffix {
  padding: 10px 12px;
  color: var(--text-3);
  font-size: .867rem;
  border-left: 1px solid var(--border);
  background: var(--page-bg);
  display: flex;
  align-items: center;
  font-weight: 400;
}

/* Top-oriented labels */
label.f-top {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
  display: block;
}
.helper-text {
  display: block;
  font-size: .8rem;
  color: var(--text-3);
  margin-top: 4px;
}

input.f-input, select.f-input, textarea.f-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px 12px;
  font-size: .933rem;
  font-family: var(--font);
  outline: none;
  color: var(--text);
  transition: .15s;
}
input.f-input:focus, select.f-input:focus, textarea.f-input:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 2px var(--pri-ring);
}
input.f-input:disabled { opacity: .5; cursor: not-allowed; }
textarea.f-input { resize: vertical; }

/* Shortcut buttons */
.shortcut-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.shortcut-btn {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--page-bg);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  transition: .15s;
}
.shortcut-btn:hover { border-color: var(--pri); color: var(--pri); background: var(--pri-bg); }
.shortcut-btn.active { background: var(--pri); color: #fff; border-color: var(--pri); }

/* Shortcuts inside f-labeled — at the right edge */
.f-labeled .shortcut-btn {
  border-radius: 0;
  margin: 0;
  border: none;
  border-left: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--page-bg);
  flex-shrink: 0;
}
.f-labeled .shortcut-btn:last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }
.f-labeled .shortcut-btn:hover { background: var(--pri-bg); color: var(--pri); border-color: var(--border); }
#bgPickerToggle { background: #fff; }
#bgPickerToggle:hover { background: var(--pri-bg); color: var(--pri); }

/* ========== BUTTONS ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 20px; font-size: .933rem; font-weight: 500; font-family: var(--font); border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; transition: .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-pri { background: var(--pri); color: #fff; border-color: var(--pri); }
.btn-pri:hover { background: var(--pri-hover); color: #fff; }
.btn-sec { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-sec:hover { background: var(--page-bg); }
.btn-outline { background: transparent; color: var(--pri); border-color: var(--pri); }
.btn-outline:hover { background: var(--pri-bg); }
.btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn-danger:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--text-2); border: none; padding: 9px 14px; }
.btn-ghost:hover { color: var(--text); background: var(--page-bg); }
.btn-sm { padding: 7px 14px; font-size: .867rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .933rem; transition: .15s;
}
.btn-icon:hover { background: var(--page-bg); color: var(--text); border-color: var(--text-3); }
.btn-icon.danger:hover { color: var(--err); border-color: var(--err); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-group > .btn { border-radius: var(--r-sm); }
#lockDesignBtn { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* ========== BADGES ========== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-sm); font-size: .8rem; font-weight: 500; }
.badge-unsent { background: var(--page-bg); color: var(--text-3); }
.badge-queued { background: var(--warn-bg); color: var(--warn-text); }
.badge-sent { background: var(--pri-bg); color: var(--pri-text); }
.badge-confirmed { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-err { background: var(--err-bg); color: var(--err-text); }

/* ========== CHIPS ========== */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: var(--r-sm); font-size: .8rem; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }

/* ========== DROPZONE ========== */
.dz {
  display: flex; align-items: center; gap: 16px;
  padding: 28px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
  text-decoration: none;
  position: relative;
}
.dz:hover { border-color: var(--pri); background: var(--pri-bg); }
.dz:focus-visible { border-color: var(--pri); outline: 3px solid var(--pri-ring); outline-offset: 2px; }
.dz.dz--drag { border-style: solid; border-color: var(--pri); background: var(--pri-bg); box-shadow: 0 0 0 4px var(--pri-ring); }
.dz.dz--has-file { border-style: solid; border-color: var(--pri); background: var(--pri-bg); cursor: default; }
.dz.dz--error { border-style: solid; border-color: var(--err); background: var(--err-bg); }
.dz-icon {
  width: 52px; height: 52px;
  border-radius: var(--r);
  background: var(--page-bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: .2s;
}
.dz-icon i { font-size: 1.5rem; color: var(--pri); }
.dz:hover .dz-icon { background: var(--surface); border-color: var(--pri); }
.dz-text { display: flex; flex-direction: column; min-width: 0; }
.dz-title { font-weight: 600; font-size: .933rem; color: var(--text); }
.dz-sub { font-size: .867rem; color: var(--text-2); }
.dz-meta { font-size: .8rem; color: var(--text-3); margin-top: 2px; }
/* File selected state */
.dz-idle { display: flex; align-items: center; gap: 16px; }
.dz.dz--has-file .dz-idle { display: none; }
.dz-file { display: flex; align-items: center; gap: 14px; width: 100%; }
.dz-file-icon { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--pri-bg); color: var(--pri-text); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.dz-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dz-file-name { font-weight: 600; font-size: .933rem; color: var(--pri-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-file-meta { font-size: .8rem; color: var(--text-3); }
.dz-file-remove { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 6px; font-size: .933rem; border-radius: var(--r-sm); transition: .15s; flex-shrink: 0; }
.dz-file-remove:hover { color: var(--err); background: var(--err-bg); }
/* Processing spinner */
.dz.dz--processing .dz-file-icon i { display: none; }
.dz.dz--processing .dz-file-icon::after {
  content: ''; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--pri);
  border-radius: 50%; animation: dz-spin .6s linear infinite;
}
@keyframes dz-spin { to { transform: rotate(360deg); } }
.dz-spin-icon { display: inline-block; animation: dz-spin .6s linear infinite; }
/* Status messages */
.dz-status { margin-top: 6px; }
.dz-hint { font-size: .8rem; color: var(--text-3); }
.dz-error-msg { font-size: .8rem; color: var(--err-text); display: flex; align-items: center; gap: 4px; }
/* Mobile */
@media (max-width: 767px) {
  .dz { flex-direction: column; text-align: center; padding: 24px 16px; }
  .dz-idle { flex-direction: column; text-align: center; }
  .dz-file { flex-direction: column; text-align: center; }
}

/* ========== TABLE ========== */
.tbl { width: 100%; border-collapse: collapse; font-size: .933rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.tbl tr:hover td { background: var(--page-bg); }
.tbl .cell-call { font-weight: 600; letter-spacing: .2px; }
.tbl .cell-mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: .867rem; }
.tbl .cell-muted { color: var(--text-2); font-size: .867rem; }

/* ========== CANVAS ========== */
.canvas-frame { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.canvas-placeholder {
  aspect-ratio: 960/611;
  background: linear-gradient(135deg, var(--border), var(--border-light));
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}

/* ========== STAT CARDS ========== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; text-align: center; }
.stat-val { font-size: 1.6rem; font-weight: 600; letter-spacing: -1px; color: var(--text); line-height: 1; }
.stat-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); margin-top: 4px; }
.stat-note { font-size: .8rem; color: var(--text-2); margin-top: 4px; }
a.stat-card { text-decoration: none; color: inherit; transition: border-color .15s; }
a.stat-card:hover { border-color: var(--pri); }
.stat-card.active { border-color: var(--pri); }

/* ========== STATION CARDS ========== */
.station-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 22px; margin-bottom: 12px; transition: .15s; }
.station-card:hover { border-color: var(--text-3); }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 24px; margin-top: 10px; }
.sd-label { color: var(--text-3); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.sd-val { font-size: .933rem; font-weight: 400; margin-top: 2px; }
.sc-default { font-size: .8rem; font-weight: 500; color: var(--pri-text); background: var(--pri-bg); padding: 3px 10px; border-radius: var(--r-sm); }

/* ========== INFO GRID ========== */
.info-grid { display: grid; grid-template-columns: 140px 1fr; gap: 0; }

/* ========== AVATAR ========== */
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--pri); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.4rem; flex-shrink: 0; }
.info-label { padding: 10px 0; border-bottom: 1px solid var(--border-light); color: var(--text-2); font-weight: 500; font-size: .933rem; }
.info-val { padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: .933rem; font-weight: 400; }
.info-grid > :nth-last-child(-n+2) { border-bottom: none; }

/* ========== PAGINATION ========== */
.pgn { display: flex; gap: 2px; justify-content: center; margin-top: 16px; }
.pgn a, .pgn span { padding: 6px 12px; border-radius: var(--r-sm); font-size: .867rem; font-weight: 500; text-decoration: none; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.pgn .pg-active { background: var(--pri); color: #fff; border-color: var(--pri); }
.pgn a:hover { border-color: var(--pri); color: var(--pri); }

/* ========== GRID LAYOUTS ========== */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2col > .span-2 { grid-column: 1 / -1; }
.profile-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.profile-col-left, .profile-col-right { display: flex; flex-direction: column; gap: 16px; }
.stations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stations-grid > .span-full { grid-column: 1 / -1; }
.profile-page .profile-col-left > .panel,
.profile-page .profile-col-right > .panel { margin-bottom: 0; }

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 10000;
  display: flex; flex-direction: column;
  gap: 8px;
  max-width: 380px; width: 100%;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  font-size: .933rem; line-height: 1.5;
  animation: toast-in .25s ease;
}
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-dismiss { background: none; border: none; color: var(--text-3); font-size: .9rem; cursor: pointer; padding: 0; margin-left: 4px; flex-shrink: 0; }
.toast-dismiss:hover { color: var(--text); }
.toast-success { border-color: var(--pri); }
.toast-success .toast-icon { color: var(--pri); }
.toast-error { border-color: var(--err); }
.toast-error .toast-icon { color: var(--err); }
.toast-warning { border-color: var(--warn); }
.toast-warning .toast-icon { color: var(--warn); }
.toast-info { border-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.toast { transition: opacity .2s, transform .2s; }

/* ========== GLOBAL OPTIONS AUTO-SAVE FEEDBACK ========== */
.opt-saved { outline: 2px solid var(--pri); outline-offset: 1px; border-radius: var(--r-sm); transition: outline-color .3s ease; }
.opt-error { outline: 2px solid var(--err); outline-offset: 1px; border-radius: var(--r-sm); transition: outline-color .3s ease; }

/* ========== FORM VALIDATION ========== */
.f-error .f-labeled { border-color: var(--err); }
.f-error .f-input { border-color: var(--err); }
.f-error-msg { color: var(--err-text); font-size: .8rem; font-weight: 400; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.f-error-msg i { font-size: .867rem; }
.f-labeled.f-invalid { border-color: var(--err); }
.f-labeled.f-invalid:focus-within { box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.f-input.f-input-error { border-color: var(--err); }
.f-input.f-input-error:focus { box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.f-labeled.f-labeled-error { border-color: var(--err); }
.f-labeled.f-labeled-error:focus-within { border-color: var(--err); box-shadow: 0 0 0 2px rgba(239,68,68,.2); }

/* Validation banner */
.validation-banner { background: var(--err-bg); border: 1px solid var(--err); border-radius: var(--r); padding: 14px 18px; margin-bottom: 16px; }
.validation-banner-title { font-weight: 600; font-size: .933rem; color: var(--err-text); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.validation-banner ul { margin: 0; padding: 0 0 0 18px; font-size: .867rem; color: var(--err-text); }
.validation-banner li { margin-bottom: 2px; }

/* ========== MODALS (new design) ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%; max-width: 480px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-box.modal-lg { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-weight: 600; font-size: 1rem; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-3); font-size: 1.2rem; cursor: pointer; padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body-custom { padding: 22px; overflow-y: auto; flex: 1; font-size: .933rem; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
.modal-foot-left { margin-right: auto; }

.app-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-modal-footer__cancel {
  flex: 0 0 auto;
}
.app-modal-footer__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

/* ========== HOMEPAGE CREATOR ========== */
.creator-wrap { max-width: 960px; }

.email-qsl-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.email-qsl-modal-footer__secondary {
  flex: 0 0 auto;
  margin-left: auto;
}
.email-qsl-modal-footer__primary {
  flex: 0 0 auto;
  min-width: 168px;
}

@media (min-width: 768px) {
  .email-qsl-modal-footer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
  .email-qsl-modal-footer__secondary {
    grid-column: 1;
    margin-left: 0;
  }
  .email-qsl-modal-footer__primary {
    grid-column: 3;
    justify-self: end;
  }
}

/* Station details collapsible area */
.station-details-collapse { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.station-details-collapse.show { display: block; }

.station-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: .867rem;
  color: var(--warn-text);
  margin-bottom: 12px;
}

/* ========== ADD CARD ========== */
.add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  min-height: 100%;
  height: 100%;
  text-align: center;
  cursor: pointer;
  color: var(--text-3);
  transition: .2s;
  background: var(--surface);
  text-decoration: none;
}
.add-card:hover { border-color: var(--pri); color: var(--pri); background: var(--pri-bg); }

/* ========== DANGER ZONE ========== */
.danger-zone { border-color: var(--err); }
.danger-zone .panel-title { color: var(--err-text); }

/* ========== DELETE ACCOUNT & DELETE STATION MODAL REDESIGN ========== */
#deleteAccountModal .modal-content,
#deleteStationModal .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
  background: var(--surface);
}
#deleteAccountModal .modal-header,
#deleteStationModal .modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#deleteAccountModal .modal-title,
#deleteStationModal .modal-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
#deleteAccountModal .modal-body,
#deleteStationModal .modal-body {
  padding: 22px;
  font-size: .933rem;
  background: var(--surface);
}
#deleteAccountModal .modal-body .form-control {
  font-family: var(--font);
  font-size: .933rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  background: var(--surface);
}
#deleteAccountModal .modal-body .form-control:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px var(--pri-bg);
  outline: none;
}
#deleteAccountModal .modal-body .form-label,
#deleteStationModal .modal-body .form-label {
  font-size: .867rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
#deleteAccountModal .modal-footer,
#deleteStationModal .modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
#deleteAccountModal .modal-footer .app-modal-footer__actions,
#deleteStationModal .modal-footer .app-modal-footer__actions { display: contents; }
#deleteAccountModal .delete-account-modal__warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--err);
  border-radius: var(--r);
  background: linear-gradient(135deg, rgba(254,242,242,.96) 0%, rgba(255,255,255,.98) 100%);
}
#deleteAccountModal .delete-account-modal__warning-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(239,68,68,.12);
  color: var(--err);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
#deleteAccountModal .delete-account-modal__warning-title {
  margin: 0 0 4px;
  font-size: .933rem;
  font-weight: 600;
  color: var(--err-text);
}
#deleteAccountModal .delete-account-modal__warning-copy {
  margin: 0;
  font-size: .867rem;
  line-height: 1.6;
  color: var(--text-2);
}
#deleteAccountModal .btn-outline-secondary,
#deleteStationModal .btn-outline-secondary {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 20px;
  border-radius: var(--r-sm);
}
#deleteAccountModal .btn-outline-secondary:hover,
#deleteStationModal .btn-outline-secondary:hover {
  background: var(--page-bg) !important;
}
#deleteAccountModal .btn-danger,
#deleteStationModal .btn-danger {
  background: var(--err) !important;
  border-color: var(--err) !important;
  color: #fff !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 20px;
  border-radius: var(--r-sm);
}
#deleteAccountModal .btn-danger:hover,
#deleteStationModal .btn-danger:hover {
  opacity: .9;
}

/* ========== CONFIRMATION / GENERIC MODAL REDESIGN ========== */
/* Override old app-modal classes on #confirmationModal to match mockup design system */
#confirmationModal .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
  background: var(--surface);
}
#confirmationModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#confirmationModal .modal-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--text);
}
#confirmationModal .modal-body {
  padding: 22px;
  font-size: .933rem;
  background: var(--surface);
}
#confirmationModal .modal-body p { margin: 0; }
#confirmationModal .modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
#confirmationModal .modal-footer .app-modal-footer__actions { display: contents; }
#confirmationModal .btn-success,
#confirmationModal .btn-primary {
  background: var(--pri) !important;
  border-color: var(--pri) !important;
  color: #fff !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  box-shadow: none;
}
#confirmationModal .btn-success:hover,
#confirmationModal .btn-primary:hover {
  background: #047857 !important;
  border-color: #047857 !important;
}
#confirmationModal .btn-outline-secondary {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  box-shadow: none;
}
#confirmationModal .btn-outline-secondary:hover {
  background: var(--page-bg) !important;
}

/* ========== LOCATION LOOKUP MODAL REDESIGN ========== */
#locationLookupModal .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
  background: var(--surface);
}
#locationLookupModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#locationLookupModal .modal-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--text);
}
#locationLookupModal .modal-body {
  padding: 22px;
  font-size: .933rem;
  background: var(--surface);
}
#locationLookupModal .form-control {
  font-family: var(--font);
  font-size: .933rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  color: var(--text);
  background: var(--surface);
}
#locationLookupModal .form-control:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px var(--pri-bg);
  outline: none;
}
#locationLookupModal .btn-outline-success {
  background: var(--pri) !important;
  border-color: var(--pri) !important;
  color: #fff !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 16px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
#locationLookupModal .btn-outline-success:hover {
  background: #047857 !important;
  border-color: #047857 !important;
}

/* ========== AUTH MODAL REDESIGN (Bootstrap wrapper + mockup styling) ========== */
/* Override Bootstrap modal content to match mockup design system */
#authModal .modal-content,
#forgotPasswordModal .modal-content,
#resetPasswordModal .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
}

#authModal .modal-header,
#forgotPasswordModal .modal-header,
#resetPasswordModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

#authModal .modal-title,
#forgotPasswordModal .modal-title,
#resetPasswordModal .modal-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--text);
}

#authModal .modal-body,
#forgotPasswordModal .modal-body,
#resetPasswordModal .modal-body {
  padding: 22px;
  font-size: .933rem;
  background: var(--surface);
}

#authModal .modal-footer,
#forgotPasswordModal .modal-footer,
#resetPasswordModal .modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

#forgotPasswordModal .modal-footer .app-modal-footer__actions,
#resetPasswordModal .modal-footer .app-modal-footer__actions {
  display: contents;
}

/* Auth modal form controls — override Bootstrap form-control to match design system */
#authModal .form-control,
#forgotPasswordModal .form-control,
#resetPasswordModal .form-control {
  font-family: var(--font);
  font-size: .933rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  line-height: 1.4;
}
#authModal .form-control:focus,
#forgotPasswordModal .form-control:focus,
#resetPasswordModal .form-control:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px var(--pri-bg);
  outline: none;
}
#authModal .form-control.is-invalid {
  border-color: var(--err);
  box-shadow: 0 0 0 3px var(--err-bg);
}

/* Auth modal labels */
#authModal .form-label,
#forgotPasswordModal .form-label,
#resetPasswordModal .form-label {
  font-size: .867rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* Auth modal buttons — override Bootstrap btn-success / btn-outline-secondary */
#authModal .btn-success,
#authModal .btn.app-btn.btn-success,
#forgotPasswordModal .btn-success,
#forgotPasswordModal .btn.app-btn.btn-success,
#resetPasswordModal .btn-success,
#resetPasswordModal .btn.app-btn.btn-success {
  background: var(--pri) !important;
  border-color: var(--pri) !important;
  color: #fff !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  box-shadow: none;
}
#authModal .btn-success:hover,
#forgotPasswordModal .btn-success:hover,
#resetPasswordModal .btn-success:hover {
  background: #047857 !important;
  border-color: #047857 !important;
}

#authModal .btn-outline-secondary,
#authModal .btn.app-btn.btn-outline-secondary,
#forgotPasswordModal .btn-outline-secondary,
#forgotPasswordModal .btn.app-btn.btn-outline-secondary,
#resetPasswordModal .btn-outline-secondary,
#resetPasswordModal .btn.app-btn.btn-outline-secondary {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: var(--font);
  font-weight: 500;
  font-size: .933rem;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  box-shadow: none;
}
#authModal .btn-outline-secondary:hover,
#forgotPasswordModal .btn-outline-secondary:hover,
#resetPasswordModal .btn-outline-secondary:hover {
  background: var(--page-bg) !important;
}

/* Auth modal alerts */
#authModal .alert,
#forgotPasswordModal .alert,
#resetPasswordModal .alert {
  font-size: .867rem;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  margin-top: 12px;
}

/* Auth modal panel/step appearance */
.auth-modal-content {
  background: var(--surface) !important;
}
.auth-modal-content::before { display: none; }
.auth-modal-header {
  background: var(--surface) !important;
}
.auth-modal-body {
  background: var(--surface) !important;
}
.auth-step-panel { background: transparent; border: none; padding: 0; }
.auth-step-panel::before { display: none; }
.app-modal-panel { background: transparent; border: none; padding: 0; }
.app-modal-panel::before { display: none; }

/* Auth entry field styling */
.auth-entry-input {
  font-family: var(--font) !important;
  font-size: .933rem !important;
  padding: 10px 12px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-sm) !important;
}
.auth-entry-input:focus {
  border-color: var(--pri) !important;
  box-shadow: 0 0 0 3px var(--pri-bg) !important;
}
.auth-entry-error,
.auth-inline-error {
  color: var(--err);
  font-size: .8rem;
  margin-top: 4px;
}

/* Auth step bar */
.auth-step-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.auth-step-mode { font-weight: 600; color: var(--text); font-size: .933rem; }
.auth-step-indicator { font-size: .8rem; color: var(--text-3); }

/* Auth step copy */
.auth-step-copy { margin-bottom: 4px; }
.auth-step-title { font-size: .933rem; font-weight: 500; color: var(--text); }
.auth-step-text { font-size: .933rem; color: var(--text-2); }

/* Auth entry label */
.auth-prefill-entry-label {
  font-size: .867rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  display: block;
}

/* Auth modal form helpers */
.auth-modal-helper {
  font-size: .867rem;
  color: var(--text-3);
  background: var(--page-bg);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}

/* Password toggle button */
.auth-input-with-toggle { position: relative; }
.auth-input-with-toggle-control { padding-right: 42px !important; }
.auth-password-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--text-3); padding: 6px 10px;
  cursor: pointer; font-size: .933rem;
}
.auth-password-toggle:hover { color: var(--text); }

/* Auth input with pencil action */
.auth-input-with-action { position: relative; }
.auth-input-with-action-control { padding-right: 42px !important; }
.auth-input-action {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--text-3); padding: 6px 10px;
  cursor: pointer; font-size: .933rem;
  text-decoration: none;
}
.auth-input-action:hover { color: var(--pri); }

/* Forgot password form text */
#forgotPasswordModal .form-text,
.password-reset-modal-copy {
  font-size: .867rem;
  color: var(--text-3);
}
.password-reset-modal-copy {
  margin: 0 0 14px;
  line-height: 1.5;
}

/* Auth choice grids and guest sections */
.auth-choice-grid { width: 100%; }
.auth-choice-buttons { display: flex; gap: 8px; }
.auth-choice-buttons .btn { flex: 1; }
.auth-choice-buttons #authGuestAction { flex: 1; }
.auth-choice-buttons #authGuestAction .btn { width: 100%; }
.auth-choice-guest-section { margin-top: 8px; }
.auth-choice-guest-copy { font-size: .867rem; color: var(--text-3); }
.auth-prefill-notice { font-size: .933rem; color: var(--text-2); }
.auth-prefill-helper { font-size: .867rem; color: var(--text-3); background: var(--page-bg); border-radius: var(--r-sm); padding: 10px 14px; margin-top: 12px; }
.auth-prefill-divider { text-align: center; margin: 12px 0; font-size: .8rem; color: var(--text-3); position: relative; }
.auth-prefill-divider::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.auth-prefill-divider span { background: var(--surface); padding: 0 10px; position: relative; }
.auth-prefill-guest-action { margin-top: 8px; }
.auth-chooser-inline-actions { margin-top: 12px; }

/* Auth form alerts */
.auth-form-alert:not(.d-none) { margin-top: 12px; }

/* Auth modal form footer adjustment */
.auth-modal-form-footer { width: 100%; }
.auth-modal-form-footer .btn { width: 100%; }

/* Form text override */
#forgotPasswordModal .form-text {
  margin-top: 4px;
  display: block;
}

/* ========== UTILITY CLASSES ========== */
.text-mono { font-family: 'SF Mono', 'Consolas', monospace; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-3); }
.text-danger { color: var(--err); }
.text-sm { font-size: .867rem; }
.text-xs { font-size: .8rem; }
.text-strong { font-weight: 600; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: 8px; }
.w-full { width: 100%; }
.d-none { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ========== ADMIN PAGES ========== */
.admin-page { }

/* Admin action buttons row */
.admin-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.admin-actions form { display: inline-flex; }

/* Small icon buttons for admin tables */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: .15s;
}
.btn-icon:hover { border-color: var(--text-3); color: var(--text); }
.btn-icon.btn-icon--active { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn-icon.btn-icon--danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-icon.btn-icon--warn { background: var(--warn); border-color: var(--warn); color: #000; }
.btn-icon.btn-icon--info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }

/* Admin badges (semantic colors) */
.badge-ok { background: var(--ok-bg); color: #166534; }
.badge-danger { background: var(--err-bg); color: var(--err-text); }
.badge-info { background: var(--info-bg); color: #1e40af; }
.badge-premium { background: var(--warn-bg); color: var(--warn-text); }
.badge-muted { background: var(--page-bg); color: var(--text-3); }
.badge-light { background: var(--page-bg); color: var(--text-2); border: 1px solid var(--border); }

/* Admin form switch */
.form-switch-row {
  display: flex; align-items: center; gap: 10px;
}
.form-switch-row input[type="checkbox"] {
  width: 36px; height: 20px; appearance: none; -webkit-appearance: none;
  background: var(--border); border-radius: 10px; position: relative;
  cursor: pointer; transition: .2s; flex-shrink: 0;
}
.form-switch-row input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .2s;
}
.form-switch-row input[type="checkbox"]:checked { background: var(--pri); }
.form-switch-row input[type="checkbox"]:checked::after { left: 18px; }
.form-switch-row input[type="checkbox"]:disabled { opacity: .4; cursor: not-allowed; }
.form-switch-row.disabled span,
.form-switch-row.disabled label { opacity: .4; cursor: not-allowed; }

.admin-user-manage-summary {
  margin-bottom: 18px;
}

.admin-user-manage-summary__identity {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-user-manage-summary__callsign {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .3px;
}

.admin-user-manage-summary__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.admin-user-manage-summary__grid {
  row-gap: 8px;
}

.admin-user-manage-section {
  margin-bottom: 16px;
}

.admin-user-manage-section__copy {
  font-size: .867rem;
  color: var(--text-2);
  margin: 0 0 12px;
  line-height: 1.5;
}

.admin-user-manage-premium-modes {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-user-manage-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  background: var(--surface);
  cursor: pointer;
}
.admin-user-manage-option.active {
  background: var(--warn-bg);
  border-color: var(--warn);
}
.admin-user-manage-date-needs-input {
  background: #fef2f2;
  border: 1px solid var(--err);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}

.admin-user-manage-option input {
  margin-top: 2px;
}

.admin-user-manage-option strong,
.admin-user-manage-option small {
  display: block;
}

.admin-user-manage-option small {
  font-size: .8rem;
  color: var(--text-3);
  margin-top: 2px;
}

.admin-user-manage-date-group {
  margin-bottom: 10px;
}

/* QSL thumbnail grid */
.qsl-thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.qsl-thumb-item { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; color: inherit; background: var(--surface); transition: border-color .15s; }
.qsl-thumb-item:hover { border-color: var(--pri); }
.qsl-thumb-item > a { text-decoration: none; color: inherit; }
.qsl-thumb-item img { width: 100%; aspect-ratio: 960/611; object-fit: cover; display: block; }
.qsl-thumb-delete { position: absolute; top: 4px; right: 4px; z-index: 1; width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--err); color: #fff; font-size: 14px; line-height: 22px; text-align: center; padding: 0; cursor: pointer; opacity: .85; transition: opacity .15s; }
.qsl-thumb-delete:hover { opacity: 1; }
.qsl-thumb-info { padding: 6px 8px; font-size: .8rem; line-height: 1.3; }
.qsl-thumb-info strong { display: block; font-size: .833rem; }
.qsl-thumb-info small { color: var(--text-3); }

.admin-user-manage-help,
.admin-user-manage-inline-note,
.admin-user-manage-preview {
  display: block;
  font-size: .8rem;
  color: var(--text-2);
  margin-top: 6px;
  line-height: 1.45;
}

.admin-user-manage-inline-note {
  color: var(--text-3);
}

.admin-user-manage-preview {
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.admin-user-manage-actions-grid {
  display: grid;
  gap: 12px;
}

.admin-user-manage-actions-grid form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (min-width: 720px) {
  .admin-user-manage-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Admin two-column layout */
.admin-split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; }
@media (max-width: 991px) { .admin-split { grid-template-columns: 1fr; } }

/* Admin callsign list */
.admin-list-custom-coem { border-bottom: 1px solid var(--border); }
.admin-list { border: 1px solid var(--border); border-radius: var(--r); }
.admin-list-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border-light);
  text-decoration: none; color: var(--text); transition: .1s;
}
.admin-list-item:hover { background: var(--page-bg); color: var(--text); }
.admin-list-item.active { background: var(--pri-bg); border-left: 3px solid var(--pri); }
.admin-list-item:last-child { border-bottom: none; }

/* ========== RESPONSIVE ========== */

/* Tablet: auto-collapse sidebar to icon rail (992-768) */
@media (max-width: 991px) and (min-width: 768px) {
  .sidebar:not(.open) { width: var(--rail-w); }
  .sidebar:not(.open) .sidebar-brand { padding: 18px 16px; justify-content: center; }
  .sidebar:not(.open) .sidebar-brand-text { display: none; }
  .sidebar:not(.open) .sidebar-collapse-toggle { display: none; }
  .sidebar:not(.open) .sidebar-section { font-size: 0; padding: 14px 0 2px; text-align: center; }
  .sidebar:not(.open) .sidebar-section::after { content: ''; display: block; width: 24px; height: 1px; background: var(--border); margin: 0 auto; }
  .sidebar:not(.open) .sidebar-nav a { justify-content: center; padding: 10px; gap: 0; font-size: 0; }
  .sidebar:not(.open) .sidebar-nav a i { font-size: 1.15rem; margin: 0; width: auto; }
  .sidebar:not(.open) .sidebar-nav .nav-badge { display: none; }
  .sidebar:not(.open) .sidebar-nav .nav-lock { display: none; }
  .sidebar:not(.open) .sidebar-bottom { padding: 0 0 4px; }
  .sidebar:not(.open) .sidebar-bottom .sidebar-nav a { justify-content: center; padding: 10px; gap: 0; font-size: 0; }
  .sidebar:not(.open) .sidebar-bottom .sidebar-nav a i { font-size: 1.15rem; margin: 0; width: auto; }
  .sidebar:not(.open) .sidebar-report { padding: 0 0 4px; border-top: none; }
  .main { margin-left: var(--rail-w); }
  /* Hover expand at tablet */
  .sidebar:not(.open):hover { width: var(--sidebar-w); box-shadow: 6px 0 24px rgba(0,0,0,.08); z-index: 210; }
  .sidebar:not(.open):hover .sidebar-brand { padding: 18px 20px; justify-content: flex-start; }
  .sidebar:not(.open):hover .sidebar-brand-text { display: inline; }
  .sidebar:not(.open):hover .sidebar-section { font-size: .733rem; padding: 18px 20px 6px; text-align: left; }
  .sidebar:not(.open):hover .sidebar-section::after { display: none; }
  .sidebar:not(.open):hover .sidebar-nav a { justify-content: flex-start; padding: 9px 20px; gap: 10px; font-size: .933rem; }
  .sidebar:not(.open):hover .sidebar-nav a i { font-size: 1.067rem; width: 20px; }
  .sidebar:not(.open):hover .sidebar-nav .nav-badge { display: inline-flex; }
  .sidebar:not(.open):hover .sidebar-nav .nav-lock { display: inline; }
  .sidebar:not(.open):hover .sidebar-bottom { padding: 0 0 8px; }
  .sidebar:not(.open):hover .sidebar-bottom .sidebar-nav a { justify-content: flex-start; padding: 9px 20px; gap: 10px; font-size: .933rem; }
  .sidebar:not(.open):hover .sidebar-bottom .sidebar-nav a i { font-size: 1.067rem; width: 20px; }
  .sidebar:not(.open):hover .sidebar-report { padding: 0 0 12px; border-top: 1px solid var(--sidebar-bg-2); }
}

/* Mobile: sidebar hidden, topbar visible, grids stack */
@media (max-width: 767px) {
  .modal-overlay {
    align-items: center;
    padding: var(--modal-mobile-inset);
    overflow-y: auto;
  }
  .modal-box {
    max-height: calc(100vh - (var(--modal-mobile-inset) * 2));
  }
  .app-mobile-inset-modal .modal-dialog {
    width: min(560px, calc(100% - (var(--modal-mobile-inset) * 2)));
    max-width: none;
    margin: var(--modal-mobile-inset) auto;
  }
  .app-mobile-inset-modal .modal-dialog.modal-dialog-centered {
    align-items: center;
    min-height: calc(100% - (var(--modal-mobile-inset) * 2));
  }
  .app-mobile-inset-modal .modal-dialog.modal-fullscreen-sm-down {
    width: min(560px, calc(100% - (var(--modal-mobile-inset) * 2)));
    max-width: none;
    height: auto;
    margin: var(--modal-mobile-inset) auto;
  }
  .app-mobile-inset-modal .modal-dialog.modal-fullscreen-sm-down .modal-content {
    height: auto;
  }
  .app-mobile-inset-modal .modal-content {
    max-height: calc(100vh - (var(--modal-mobile-inset) * 2));
    border-radius: var(--r-lg) !important;
  }
  .app-mobile-inset-modal .modal-body {
    min-height: 0;
    overflow-y: auto;
  }
  .app-modal-footer {
    flex-wrap: wrap;
  }
  .app-modal-footer__actions {
    width: auto;
  }
  .sidebar { transform: translateX(-100%); width: 280px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .sidebar.open { transform: translateX(0); }
  .sidebar .sidebar-section { white-space: nowrap; overflow: visible; flex-shrink: 0; }
  .sidebar.collapsed { width: 280px; transform: translateX(-100%); }
  .sidebar.collapsed.open { transform: translateX(0); width: 280px; }
  .sidebar.collapsed.open .sidebar-brand-text,
  .sidebar.collapsed.open .sidebar-section,
  .sidebar.collapsed.open .sidebar-nav .nav-badge { display: revert; }
  .sidebar.collapsed.open .sidebar-section::after { display: none; }
  .sidebar.collapsed.open .sidebar-nav a { justify-content: flex-start; padding: 9px 20px; gap: 10px; font-size: .933rem; }
  .sidebar.collapsed.open .sidebar-nav a i { font-size: 1.067rem; width: 20px; }
  .sidebar.collapsed.open .sidebar-nav .nav-lock { display: inline; }
  .sidebar.collapsed.open .sidebar-section { font-size: .733rem; padding: 18px 20px 6px; }
  .sidebar.collapsed.open .sidebar-bottom { padding: 0 0 8px; }
  .sidebar.collapsed.open .sidebar-bottom .sidebar-nav a { justify-content: flex-start; padding: 9px 20px; gap: 10px; font-size: .933rem; }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }
  .topbar { display: flex; }
  .main { margin-left: 0; }
  .main-content { padding: 16px; }
  .form-row { flex-direction: column; gap: 8px; align-items: stretch; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-right { width: 100%; margin-left: 0; justify-content: flex-start; }
  .page-header-tools { display: none; }
  .page-title-accent { display: block; margin: 6px 0 0; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .sd-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 110px 1fr; }
  .grid-2col { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .stations-grid { grid-template-columns: 1fr; }
  .logbook-toolbar__switcher {
    width: 100%;
  }
  .logbook-toolbar__select {
    flex: 1 1 auto;
    width: 100%;
  }
  .logbook-toolbar__summary {
    flex-basis: 100%;
  }
  .logbook-toolbar__actions {
    width: 100%;
    justify-content: stretch;
  }
  .logbook-toolbar__actions .btn {
    flex: 1 1 0;
  }
  .app-footer {
    padding-top: 24px;
  }
  .email-qsl-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .email-qsl-modal-footer__secondary {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    order: 2;
  }
  .email-qsl-modal-footer__primary {
    width: 100%;
    min-width: 0;
    order: 1;
  }
  html { font-size: 14px; }
  .notif-dropdown { top: 56px; right: 8px; }
}

@media (max-width: 991px) {
  .sidebar .sidebar-collapse-toggle,
  .sidebar.collapsed:not(.no-hover-expand):hover .sidebar-collapse-toggle {
    display: none;
  }
}

/* ========== IMPERSONATION BANNER ========== */
.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: var(--r-sm);
  font-size: .933rem;
  color: var(--warn-text);
  margin-bottom: 16px;
}

/* ========== DONATION / EXTENSION PROMOS ========== */
.donation-promo {
  background: #475569;
  border: 1px solid #475569;
  border-radius: var(--r);
  padding: 12px 16px;
  text-align: center;
  color: #fff;
  font-size: .933rem;
  margin-bottom: 16px;
}
.donation-promo a { color: #fff; font-weight: 600; text-decoration: underline; }

/* ========== BETA FEEDBACK BANNER ========== */
.beta-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: var(--r-sm);
  font-size: .867rem;
  color: var(--text);
  margin-bottom: 16px;
  transition: background .15s, box-shadow .15s;
}
.beta-banner:hover { background: #fef3c7; box-shadow: 0 0 0 3px var(--warn-bg); color: var(--text); }
.beta-banner-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.beta-banner-link:hover {
  color: inherit;
  text-decoration: none;
}
.beta-banner-link > i:first-child { font-size: 1.25rem; color: var(--warn); flex-shrink: 0; }
.beta-banner-copy { min-width: 0; }
.beta-banner-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex: 0 0 auto;
}
.beta-banner-dismiss:hover {
  background: rgba(255,255,255,.55);
  color: var(--text);
}
.beta-banner-dismiss:focus-visible {
  outline: 2px solid var(--pri);
  outline-offset: 2px;
}
.beta-banner--narrow { max-width: 960px; }

.extension-promo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: .933rem;
  color: var(--text-2);
}
.extension-promo .btn-pri { flex-shrink: 0; }

/* ── Error pages ── */
.error-page { text-align: center; padding: 60px 20px; max-width: 560px; margin: 0 auto; }
.error-code { font-size: 4rem; font-weight: 600; color: var(--text-3); letter-spacing: -2px; line-height: 1; }
.error-heading { font-size: 1.4rem; font-weight: 600; margin: 12px 0 8px; }
.error-message { color: var(--text-2); font-size: .933rem; margin-bottom: 24px; }
.error-ref { color: var(--text-3); font-size: .8rem; margin-bottom: 16px; }
.error-dev { text-align: left; margin-bottom: 24px; border-color: var(--err); }
.error-dev-title { font-weight: 600; font-size: .867rem; color: var(--err-text); margin-bottom: 8px; }
.error-dev p { margin: 0 0 8px; font-size: .867rem; }
.error-dev pre { font-size: .8rem; overflow-x: auto; margin: 0; color: var(--text-2); }

/* ========== NOTIFICATIONS — Bell & Dropdown ========== */

/* Topbar bell (mobile) */
.topbar-bell {
  background: none; border: none;
  color: var(--text); font-size: 1.2rem;
  cursor: pointer; padding: 4px;
  margin-left: auto;
  position: relative;
  display: flex; align-items: center;
}
.topbar-bell-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--err); color: #fff;
  font-size: .65rem; font-weight: 600;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.topbar-toggle { margin-left: auto; }
.topbar-bell + .topbar-toggle { margin-left: 8px; }

/* Notification dropdown */
.notif-dropdown {
  display: none;
  position: fixed;
  top: 72px;
  left: auto;
  right: 16px;
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 220;
  overflow: hidden;
}
.notif-dropdown--open { display: block; }
.notif-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .933rem;
}
.notif-mark-all {
  background: none; border: none;
  color: var(--pri); cursor: pointer;
  font-size: 1.1rem; padding: 2px;
  display: flex; align-items: center;
}
.notif-mark-all:hover { color: var(--pri-hover); }
.notif-dropdown-body {
  max-height: 400px;
  overflow-y: auto;
}
.notif-dropdown-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: .867rem;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.notif-dropdown-empty i { font-size: 1.5rem; }
.notif-dropdown-footer {
  display: block;
  text-align: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: .867rem;
  color: var(--pri);
  text-decoration: none;
}
.notif-dropdown-footer:hover { background: var(--page-bg); text-decoration: none; }

/* Dropdown notification items */
.notif-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--page-bg); }
.notif-item--unread { background: var(--pri-bg); }
.notif-item--unread:hover { background: #d1fae5; }
.notif-item--busy { opacity: .72; }
.notif-item-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-3);
  font-size: 1.05rem;
}
.notif-item--unread .notif-item-icon { color: var(--pri); }
.notif-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.notif-item-title {
  font-size: .867rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-item-time {
  font-size: .733rem;
  color: var(--text-3);
  margin-top: 0;
  line-height: 1.2;
}
.notif-item-open {
  width: 36px;
  height: 36px;
  margin-left: auto;
  margin-right: -4px;
  border: none;
  background: transparent;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.notif-item-open:hover {
  color: var(--pri);
  background: rgba(5, 150, 105, .08);
}
.notif-item-open:disabled {
  opacity: .55;
  cursor: default;
}
.notif-item-open i {
  font-size: .95rem;
}

/* ========== NOTIFICATIONS — Full Page ========== */
.notif-page-header .btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.notif-page-panel {
  padding: 0;
  overflow: hidden;
}

.notif-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 24px;
}

.notif-filter-row--toolbar {
  align-items: center;
  justify-content: space-between;
}

.notif-filter-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.notif-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  font-size: .867rem;
  font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
}

.notif-filter-chip:hover {
  border-color: var(--pri);
  background: var(--pri-bg);
  color: var(--pri);
  text-decoration: none;
}

.notif-filter-chip--active {
  border-color: var(--pri);
  background: var(--pri);
  color: #fff;
}

.notif-filter-chip--active:hover {
  background: var(--pri-hover);
  color: #fff;
}

.notif-filter-count {
  color: inherit;
  font-weight: 500;
}

.notif-page-empty {
  padding: 48px 24px;
}

.notif-page-list {
  border-top: 1px solid var(--border-light);
}

.notif-page-item {
  background: var(--surface);
  padding: 18px 24px;
  transition: background .15s, border-color .15s;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  scroll-margin-top: 92px;
}

.notif-page-item:last-child { border-bottom: none; }

.notif-page-item:hover { background: var(--page-bg); }

.notif-page-item:target {
  background: linear-gradient(90deg, rgba(220, 252, 231, .9) 0%, var(--surface) 180px);
  box-shadow: inset 3px 0 0 var(--pri);
}

.notif-page-item:target .notif-page-icon {
  border-color: #b7ebcf;
  color: var(--pri);
}

.notif-page-item--unread {
  background: linear-gradient(90deg, rgba(236, 253, 245, .95) 0%, var(--surface) 160px);
  border-left: 3px solid var(--pri);
  padding-left: 21px;
  cursor: pointer;
}

.notif-page-item--unread:hover {
  background: linear-gradient(90deg, rgba(220, 252, 231, .95) 0%, var(--surface) 160px);
}

.notif-page-item--busy {
  opacity: .75;
  cursor: progress;
}

.notif-page-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.notif-page-item--compact .notif-page-main {
  align-items: center;
}

.notif-page-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--page-bg);
  color: var(--text-3);
  font-size: 1rem;
}

.notif-page-item--unread .notif-page-icon {
  border-color: #b7ebcf;
  background: var(--surface);
  color: var(--pri);
}

.notif-page-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  flex: 1;
  min-width: 0;
}

.notif-page-title-wrap {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-page-title {
  margin: 0;
  color: var(--text);
  font-size: .967rem;
  font-weight: 600;
  line-height: 1.35;
}

.notif-page-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pri);
  flex-shrink: 0;
}

.notif-page-time {
  grid-column: 2;
  grid-row: 1;
  padding-top: 2px;
  color: var(--text-3);
  font-size: .8rem;
  white-space: nowrap;
}

.notif-page-item--compact .notif-page-time {
  padding-top: 0;
}

.notif-page-message {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--text-2);
  font-size: .933rem;
  line-height: 1.6;
}

.notif-pagination {
  padding: 0 24px 24px;
  margin-top: 0;
}

.notif-pagination-gap {
  border-color: transparent !important;
  background: transparent !important;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
  font-size: .933rem;
}
.empty-state i { display: block; font-size: 2.5rem; margin-bottom: 8px; color: var(--text-3); }
.empty-state p { margin: 0; }
.empty-state-title {
  margin: 12px 0 6px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.empty-state-copy {
  color: var(--text-2);
  font-size: .933rem;
}
.empty-state-action {
  margin-top: 16px;
}

.pagination-nav {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 16px;
  font-size: .867rem;
}
.pagination-info { color: var(--text-3); }

@media (max-width: 767px) {
  .notif-filter-row {
    padding: 12px 18px;
  }

  .notif-filter-row--toolbar {
    align-items: flex-start;
  }

  .notif-filter-list {
    width: 100%;
  }

  .notif-page-empty {
    padding: 36px 18px 22px;
  }

  .notif-page-item {
    padding: 16px 18px;
  }

  .notif-page-item--unread {
    padding-left: 15px;
  }

  .notif-page-main {
    gap: 12px;
  }

  .notif-page-content {
    grid-template-columns: 1fr;
  }

  .notif-page-time {
    grid-column: 1;
    grid-row: 3;
    text-align: left;
  }

  .notif-pagination {
    padding: 0 18px 18px;
  }
}
