/* Studio BGK Admin — Brevo-style SaaS shell */

:root {
  --shell-bg: #f4f6f8;
  --shell-surface: #ffffff;
  --shell-border: #e8ecf1;
  --shell-sidebar-w: 15rem;
  --shell-sidebar-w-collapsed: 4rem;
  --shell-topbar-h: 3.25rem;
  --shell-bottom-h: 3.75rem;
  --accent: #c9893a;
  --accent-hover: #b07832;
  --accent-soft: #fff8ed;
  --accent-border: #f0dfc4;
  --text: #1a1f36;
  --text-muted: #697386;
  --text-subtle: #8792a2;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06);
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-sans: "Source Sans 3", system-ui, sans-serif;
  /* legacy aliases */
  --app-bg: var(--shell-bg);
  --app-surface: var(--shell-surface);
  --app-ink: var(--text);
  --app-muted: var(--text-muted);
  --app-line: var(--shell-border);
  --app-accent: var(--accent);
  --app-bottom-h: var(--shell-bottom-h);
}

*, *::before, *::after { box-sizing: border-box; }

.app-body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--shell-bg);
  -webkit-font-smoothing: antialiased;
}

/* ——— Root layout ——— */
.app-root {
  min-height: 100dvh;
  display: flex;
}

.app-frame {
  flex: 1;
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

.app-flash {
  margin: 0 1.5rem;
  max-width: none;
}

.app-dev-banner {
  margin: 0 1.5rem 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #854d0e;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: var(--radius-sm);
}

/* ——— Sidebar ——— */
.app-sidebar {
  position: sticky;
  top: 0;
  flex-shrink: 0;
  width: var(--shell-sidebar-w);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--shell-surface);
  border-right: 1px solid var(--shell-border);
  z-index: 50;
  transition: width 0.2s ease;
}

.app-sidebar[data-collapsed="true"] {
  width: var(--shell-sidebar-w-collapsed);
}

.app-sidebar__head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--shell-topbar-h);
  padding: 0 0.75rem 0 1rem;
  border-bottom: 1px solid var(--shell-border);
}

.app-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  text-decoration: none;
}

.app-brand img {
  height: 26px;
  width: auto;
  display: block;
}

.app-sidebar[data-collapsed="true"] .app-brand img {
  height: 22px;
}

.app-sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-surface);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.app-sidebar__toggle:hover {
  background: var(--shell-bg);
  color: var(--text);
}

.app-sidebar__toggle svg {
  width: 1rem;
  height: 1rem;
}

.app-sidebar[data-collapsed="true"] .app-sidebar__toggle-icon--open { display: none; }
.app-sidebar[data-collapsed="false"] .app-sidebar__toggle-icon--closed { display: none; }

.app-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.25;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.app-nav-link:hover {
  background: var(--shell-bg);
  color: var(--text);
}

.app-nav-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
  border-left-color: var(--accent);
}

.app-nav-link__icon {
  display: flex;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
}

.app-nav-link__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.app-sidebar__toggle svg,
.app-topbar__menu svg,
.app-bottom-link__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.app-sidebar[data-collapsed="true"] .app-nav-link__label,
.app-sidebar[data-collapsed="true"] .app-brand img {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.app-sidebar[data-collapsed="true"] .app-nav-link {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.app-sidebar[data-collapsed="true"] .app-sidebar__toggle {
  margin: 0 auto;
}

.app-sidebar__foot {
  padding: 0.5rem;
  border-top: 1px solid var(--shell-border);
}

.app-nav-link--muted {
  color: var(--text-subtle);
  font-weight: 500;
}

.app-sidebar-backdrop {
  display: none;
}

/* ——— Topbar ——— */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--shell-topbar-h);
  padding: 0 1.5rem;
  background: var(--shell-surface);
  border-bottom: 1px solid var(--shell-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-topbar__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.app-topbar__menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-surface);
  color: var(--text);
  cursor: pointer;
}

.app-topbar__menu svg {
  width: 1.125rem;
  height: 1.125rem;
}

.app-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.app-breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--text-subtle);
}

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

.app-breadcrumb a:hover {
  color: var(--accent);
}

.app-breadcrumb span[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ——— Page head ——— */
.app-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.app-page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.app-page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ——— Metric tiles ——— */
.app-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.app-metric-tile {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.app-metric-tile__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.app-metric-tile__value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}

.app-metric-tile__hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* Legacy stats → tiles compat */
.app-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.app-stat {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  border-right: 1px solid var(--shell-border);
}

.app-stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.app-stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--text);
}

.app-stat-split { opacity: 0.35; font-weight: 500; }

/* ——— Cards ——— */
.app-card,
.app-body .admin-card,
.app-panel {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.app-card__head,
.app-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--shell-border);
}

.app-card__head h2,
.app-panel-head h2,
.app-body .admin-card > h2:first-child {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
}

.app-card__head h2,
.app-panel-head h2 {
  margin-bottom: 0;
}

.app-card__body { }

.app-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

/* ——— Tabs ——— */
.app-tabs,
.dossier-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.app-tab,
.dossier-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 550;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.app-tab:hover,
.dossier-tab:hover {
  background: var(--shell-bg);
  color: var(--text);
}

.app-tab.is-active,
.dossier-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--text);
}

.app-tab__count {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--text-subtle);
}

.app-tab.is-active .app-tab__count,
.dossier-tab.is-active .app-tab__count {
  color: var(--accent-hover);
}

/* ——— Toolbar & filters ——— */
.app-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.app-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--shell-border);
}

.app-filters__field {
  flex: 1 1 10rem;
  min-width: 0;
}

.app-filters__field--search {
  flex: 2 1 14rem;
}

.app-filters label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.app-filters input,
.app-filters select,
.app-toolbar input,
.app-toolbar select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-surface);
  color: var(--text);
}

.app-filters input:focus,
.app-filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 137, 58, 0.12);
}

.app-filters-actions {
  flex: 0 0 auto;
}

/* ——— Data table ——— */
.app-data-table {
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--shell-surface);
}

.app-data-table__head,
.app-data-table__row {
  display: grid;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 1rem;
}

.app-data-table__head {
  background: #fafbfc;
  border-bottom: 1px solid var(--shell-border);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.app-data-table__row {
  border-bottom: 1px solid var(--shell-border);
  font-size: 0.875rem;
  transition: background 0.1s;
}

.app-data-table__row:last-child {
  border-bottom: 0;
}

.app-data-table__row:hover {
  background: #fafbfc;
}

.app-data-table__row a {
  color: inherit;
  text-decoration: none;
}

.app-data-table__row a:hover strong {
  color: var(--accent-hover);
}

.app-data-table--3 {
  --cols: minmax(0, 1.5fr) minmax(0, 1fr) auto;
}

.app-data-table--3 .app-data-table__head,
.app-data-table--3 .app-data-table__row {
  grid-template-columns: var(--cols);
}

.app-data-table--4 {
  --cols: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 0.8fr) auto;
}

.app-data-table--4 .app-data-table__head,
.app-data-table--4 .app-data-table__row {
  grid-template-columns: var(--cols);
}

/* ——— Lists (subscribers, dossiers) ——— */
.sub-list,
.app-body .dossier-list {
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--shell-surface);
}

.sub-row,
.app-body .dossier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--shell-border);
  background: var(--shell-surface);
  transition: background 0.1s;
}

.sub-row:last-child,
.app-body .dossier-row:last-of-type {
  border-bottom: 0;
}

.sub-row:hover,
.app-body .dossier-row:hover {
  background: #fafbfc;
}

.sub-row-main {
  display: grid;
  gap: 0.2rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.sub-row-email strong { font-size: 0.875rem; font-weight: 600; }

.sub-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.sub-row-actions,
.app-body .dossier-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.dossier-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dossier-list-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
}

/* ——— Mini list & empty ——— */
.app-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-mini-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--shell-border);
}

.app-mini-list li:last-child { border-bottom: 0; }

.app-mini-list strong { font-size: 0.875rem; font-weight: 600; }
.app-mini-list .muted { font-size: 0.78rem; }

.app-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.app-empty strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.app-empty p {
  margin: 0;
  font-size: 0.84rem;
}

/* ——— Chips & badges ——— */
.app-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.app-chips--inline { margin-top: 0.15rem; }

.app-chip {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--shell-border);
  background: #fafbfc;
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--text-muted);
  border-radius: 999px;
}

.app-chip--sm { font-size: 0.68rem; padding: 0.1rem 0.4rem; }

.app-body .badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
}

.badge-ok { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.badge-muted { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.badge-warn { background: #fffaeb; color: #b54708; border: 1px solid #fedf89; }

/* ——— Buttons in admin ——— */
.app-body .btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 560;
  border-radius: var(--radius-sm);
  gap: 0.35rem;
}

.app-body .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.app-body .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.app-body .btn-ghost {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  color: var(--text);
}

.app-body .btn-ghost:hover {
  background: var(--shell-bg);
  border-color: #d1d5db;
}

.app-body .dossier-copy-btn,
.app-body .dossier-row-actions .btn,
.app-body .sub-row-actions .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}

/* ——— Forms ——— */
.app-body .form-grid { gap: 0.85rem; }

.app-body .admin-card input[type="text"],
.app-body .admin-card input[type="email"],
.app-body .admin-card input[type="number"],
.app-body .admin-card input[type="date"],
.app-body .admin-card input[type="password"],
.app-body .admin-card input[type="search"],
.app-body .admin-card input[type="file"],
.app-body .admin-card textarea,
.app-body .admin-card select,
.app-body .app-card input,
.app-body .app-card textarea,
.app-body .app-card select {
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
}

.app-body .admin-card input:focus,
.app-body .admin-card textarea:focus,
.app-body .admin-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 137, 58, 0.12);
}

.app-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem 1.25rem;
}

.app-field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.app-field-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* ——— Auth ——— */
.app-body--auth {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--shell-bg);
  min-height: 100dvh;
}

.app-auth { width: min(400px, 100%); }

.app-auth-card {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-md);
}

.app-auth-logo {
  display: block;
  margin: 0 auto 1.15rem;
  height: 36px;
  width: auto;
}

.app-auth-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 650;
  text-align: center;
  color: var(--text);
}

.app-auth-lead {
  margin: 0 0 1.15rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.app-auth-form .btn { width: 100%; margin-top: 0.35rem; }

.app-totp-setup {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  margin: 1rem 0;
}

.app-totp-qr {
  border-radius: var(--radius-sm);
  border: 1px solid var(--shell-border);
  width: 180px;
  height: 180px;
}

.app-totp-secret {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-align: center;
  word-break: break-all;
}

.app-body .admin-login-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.app-body .flash {
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.875rem;
}

.app-body .muted { color: var(--text-muted); }

.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;
}

/* ——— Unsubscribe reason stats ——— */
.unsub-reason-stats {
  display: grid;
  gap: 0.75rem;
}

.unsub-reason-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
}

.unsub-reason-label { font-size: 0.84rem; }
.unsub-reason-count { font-size: 0.82rem; font-weight: 650; color: var(--text-muted); white-space: nowrap; }

.unsub-reason-bar {
  grid-column: 1 / -1;
  height: 0.35rem;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
}

.unsub-reason-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #9a7b1a, var(--accent));
  border-radius: inherit;
  min-width: 2px;
}

/* ——— Public unsubscribe (shared) ——— */
.app-body--unsub {
  min-height: 100dvh;
  padding: 1.25rem;
}

.app-auth--unsub { width: min(460px, 100%); }

.app-auth-card--unsub {
  text-align: center;
  padding: 1.75rem 1.5rem 1.5rem;
}

.unsub-survey-options {
  display: grid;
  gap: 0.5rem;
  margin: 1.15rem 0 1rem;
  text-align: left;
}

.unsub-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.unsub-option:hover { border-color: #d1d5db; background: #fafbfc; }

.unsub-option:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(201, 137, 58, 0.12);
}

.unsub-option input { margin-top: 0.2rem; accent-color: var(--accent); }
.unsub-submit { width: 100%; }
.unsub-cancel, .unsub-foot { margin-top: 0.85rem; font-size: 0.84rem; color: var(--text-muted); }

/* ——— Bottom nav (mobile) ——— */
.app-bottom-nav { display: none; }

/* ——— Responsive ——— */
@media (max-width: 1279px) {
  .app-metric-grid,
  .app-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 959px) {
  .app-root {
    flex-direction: column;
    padding-bottom: calc(var(--shell-bottom-h) + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(17rem, 88vw);
    height: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-md);
  }

  .app-sidebar[data-drawer-open="true"] {
    transform: translateX(0);
  }

  .app-sidebar[data-collapsed="true"] {
    width: min(17rem, 88vw);
  }

  .app-sidebar[data-collapsed="true"] .app-nav-link__label,
  .app-sidebar[data-collapsed="true"] .app-brand img {
    opacity: 1;
    width: auto;
    overflow: visible;
  }

  .app-sidebar[data-collapsed="true"] .app-nav-link {
    justify-content: flex-start;
    padding: 0.55rem 0.75rem;
  }

  .app-sidebar__toggle { display: none; }

  .app-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26, 31, 54, 0.35);
    z-index: 40;
  }

  .app-sidebar-backdrop[hidden] { display: none; }

  .app-topbar__menu { display: inline-flex; }

  .app-content {
    padding: 1rem 1rem 1.5rem;
  }

  .app-flash { margin: 0 1rem; }

  .app-grid-2 { grid-template-columns: 1fr; }

  .app-filters { flex-direction: column; align-items: stretch; }
  .app-filters__field,
  .app-filters__field--search { flex: 1 1 auto; }

  .app-data-table__head { display: none; }

  .app-data-table--3 .app-data-table__row,
  .app-data-table--4 .app-data-table__row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .sub-row,
  .app-body .dossier-row {
    grid-template-columns: 1fr;
  }

  .app-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--shell-bottom-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--shell-surface);
    border-top: 1px solid var(--shell-border);
    z-index: 45;
    box-shadow: 0 -2px 8px rgba(16, 24, 40, 0.04);
  }

  .app-bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 600;
    border-top: 2px solid transparent;
    padding: 0.35rem 0.15rem 0.25rem;
  }

  .app-bottom-link__icon {
    display: flex;
    width: 1.125rem;
    height: 1.125rem;
  }

  .app-bottom-link__icon svg {
    width: 100%;
    height: 100%;
  }

  .app-bottom-link.is-active {
    color: var(--accent-hover);
    border-top-color: var(--accent);
  }

  .app-page-title { font-size: 1.15rem; }
}

@media (max-width: 639px) {
  .app-metric-grid,
  .app-stats {
    grid-template-columns: 1fr;
  }

  .app-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .app-page-head__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .app-topbar { padding: 0 1rem; }

  .app-topbar__logout {
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .app-metric-tile__value,
  .app-stat-value { font-size: 1.25rem; }
}
