/* Premium SaaS UI layer. Backend markup, routes, and form contracts remain unchanged. */
:root {
  --ui-ink: #08142b;
  --ui-muted: #64748b;
  --ui-line: #e4eaf4;
  --ui-panel: rgba(255,255,255,.88);
  --ui-panel-solid: #fff;
  --ui-soft: #f6f8fc;
  --ui-navy: #07142b;
  --ui-purple: #7c3aed;
  --ui-blue: var(--brand-color, #2563eb);
  --ui-radius: 18px;
  --ui-shadow: 0 22px 55px rgba(15,23,42,.08);
  --ui-shadow-sm: 0 12px 28px rgba(15,23,42,.06);
}

* { letter-spacing: 0; }
html { font-size: 15px; }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 84% 2%, rgba(124,58,237,.16), transparent 28%),
    radial-gradient(circle at 14% 0%, rgba(37,99,235,.12), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #f4f7fc 44%, #eef3fb 100%);
  color: var(--ui-ink);
  overflow-x: hidden;
}

.app-shell { display: flex; min-height: 100vh; }
.app-main {
  flex: 1;
  min-width: 0;
  padding: 26px;
}

/* Sidebar and responsive navigation shell */
.sidebar {
  width: 286px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  padding: 20px 14px;
  color: #111827;
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.42)),
    rgba(248,250,252,.72);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  border-right: 1px solid rgba(15,23,42,.08);
  box-shadow: 18px 0 48px rgba(15,23,42,.08);
  z-index: 1040;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,116,139,.35) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(100,116,139,.28); border-radius: 999px; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin-bottom: 18px;
  padding: 0 10px 14px;
  border-bottom: 1px solid rgba(15,23,42,.06);
  font-size: 19px;
  font-weight: 900;
  color: #07111f;
}
.brand::before { display: none; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-purple) 58%, #f97316);
  box-shadow: 0 14px 32px rgba(59,130,246,.32);
}
.sidebar-nav,
.sidebar nav { display: flex; flex-direction: column; gap: 7px; }
.sidebar-section {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 12px 12px 6px;
  text-transform: uppercase;
}
.sidebar-link,
.nav-group summary {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 9px 11px;
  border: 1px solid rgba(15,23,42,.06);
  border-radius: 22px;
  color: #111827;
  text-decoration: none;
  font-weight: 750;
  background: rgba(255,255,255,.34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.82),
    0 10px 24px rgba(15,23,42,.035);
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav-group summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nav-group summary::marker { content: ""; font-size: 0; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  color: #334155;
  background:
    linear-gradient(180deg, rgba(255,255,255,.74), rgba(226,232,240,.74));
  border: 1px solid rgba(148,163,184,.3);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 7px 16px rgba(15,23,42,.07);
}
.sidebar-link span:not(.nav-icon),
.nav-group-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-chevron {
  margin-left: auto;
  color: #475569;
  transition: transform .18s ease;
}
.nav-group[open] > summary .nav-chevron { transform: rotate(180deg); }
.sidebar a svg,
.nav-icon svg { flex: 0 0 auto; opacity: .92; }
.sidebar-link:hover,
.nav-group summary:hover {
  transform: translateX(3px);
  color: #07111f;
  background: rgba(255,255,255,.68);
  border-color: rgba(15,23,42,.1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.92),
    0 16px 30px rgba(15,23,42,.08);
}
.nav-group[open] > summary {
  color: #020617;
  background:
    linear-gradient(180deg, rgba(15,23,42,.12), rgba(15,23,42,.07)),
    rgba(255,255,255,.58);
  border-color: rgba(15,23,42,.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.82),
    inset 0 -1px 0 rgba(15,23,42,.06),
    0 16px 34px rgba(15,23,42,.12);
}
.nav-group[open] > summary .nav-icon,
.sidebar-link:hover .nav-icon,
.nav-group summary:hover .nav-icon {
  color: #0f172a;
  background: linear-gradient(180deg, #fff, #dde6f0);
}
.sidebar-link.active {
  color: #020617;
  background:
    linear-gradient(180deg, rgba(15,23,42,.16), rgba(15,23,42,.09)),
    rgba(255,255,255,.62);
  border-color: rgba(15,23,42,.2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    inset 0 -1px 0 rgba(15,23,42,.08),
    0 18px 34px rgba(15,23,42,.14);
}
.sidebar-link.active .nav-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-purple));
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 10px 20px rgba(37,99,235,.24);
}
.nav-group-panel {
  display: grid;
  gap: 5px;
  margin: 6px 0 9px 18px;
  padding-left: 12px;
  border-left: 1px solid rgba(15,23,42,.1);
}
.nav-group-panel .sidebar-link {
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 18px;
  font-size: 14px;
  color: #1f2937;
  font-weight: 800;
  background: rgba(255,255,255,.3);
}
.nav-group-panel .nav-icon {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
  border-radius: 14px;
  color: #334155;
  background: linear-gradient(180deg, rgba(255,255,255,.76), rgba(226,232,240,.84));
}
.nav-group-panel .sidebar-link:hover {
  color: #020617;
  background: rgba(255,255,255,.74);
}
.nav-group-panel .sidebar-link.active {
  color: #020617;
}
.nav-group-panel .sidebar-link.active .nav-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-purple));
}
.sidebar-link.muted {
  cursor: default;
  color: #64748b;
  opacity: 1;
}
.sidebar-link.muted small {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #0369a1;
  background: rgba(14,165,233,.1);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.sidebar-link.logout {
  margin-top: 8px;
  color: #991b1b;
}
.sidebar-link.logout .nav-icon {
  color: #991b1b;
  background: #fee2e2;
}
.sidebar-theme-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 22px;
  color: #0f172a;
  background:
    linear-gradient(180deg, rgba(15,23,42,.07), rgba(15,23,42,.035)),
    rgba(255,255,255,.5);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    0 12px 24px rgba(15,23,42,.06);
  font: inherit;
  font-weight: 850;
  text-align: left;
}
.sidebar-theme-toggle:hover {
  background:
    linear-gradient(180deg, rgba(15,23,42,.11), rgba(15,23,42,.05)),
    rgba(255,255,255,.68);
}
.theme-toggle-track {
  width: 42px;
  height: 24px;
  margin-left: auto;
  padding: 3px;
  border-radius: 14px;
  background: rgba(15,23,42,.16);
  border: 1px solid rgba(15,23,42,.1);
}
.theme-toggle-track span {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15,23,42,.18);
  transition: transform .18s ease;
}
html[data-sidebar-theme="dark"] .sidebar {
  color: #f8fafc;
  background:
    linear-gradient(180deg, rgba(15,23,42,.82), rgba(15,23,42,.64)),
    rgba(2,6,23,.78);
  border-right-color: rgba(255,255,255,.08);
  box-shadow: 22px 0 54px rgba(2,6,23,.28);
}
html[data-sidebar-theme="dark"] .brand {
  color: #fff;
  border-bottom-color: rgba(255,255,255,.09);
}
html[data-sidebar-theme="dark"] .sidebar-section {
  color: rgba(226,232,240,.62);
}
html[data-sidebar-theme="dark"] .sidebar-link,
html[data-sidebar-theme="dark"] .nav-group summary,
html[data-sidebar-theme="dark"] .sidebar-theme-toggle {
  color: #e5edf8;
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 10px 24px rgba(2,6,23,.12);
}
html[data-sidebar-theme="dark"] .nav-icon {
  color: #dbeafe;
  background: rgba(226,232,240,.13);
  border-color: rgba(255,255,255,.08);
}
html[data-sidebar-theme="dark"] .nav-chevron {
  color: rgba(226,232,240,.78);
}
html[data-sidebar-theme="dark"] .sidebar-link:hover,
html[data-sidebar-theme="dark"] .nav-group summary:hover,
html[data-sidebar-theme="dark"] .sidebar-theme-toggle:hover,
html[data-sidebar-theme="dark"] .nav-group[open] > summary {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.1)),
    rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
}
html[data-sidebar-theme="dark"] .nav-group-panel {
  border-left-color: rgba(226,232,240,.16);
}
html[data-sidebar-theme="dark"] .nav-group-panel .sidebar-link {
  color: #dbeafe;
  background: rgba(255,255,255,.055);
}
html[data-sidebar-theme="dark"] .sidebar-link.active,
html[data-sidebar-theme="dark"] .nav-group-panel .sidebar-link.active {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(37,99,235,.9), rgba(124,58,237,.9)),
    rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.16);
}
html[data-sidebar-theme="dark"] .sidebar-link.active .nav-icon,
html[data-sidebar-theme="dark"] .nav-group-panel .sidebar-link.active .nav-icon {
  background: rgba(255,255,255,.2);
}
html[data-sidebar-theme="dark"] .sidebar-link.muted {
  color: rgba(203,213,225,.62);
}
html[data-sidebar-theme="dark"] .sidebar-link.logout {
  color: #fecaca;
}
html[data-sidebar-theme="dark"] .sidebar-link.logout .nav-icon {
  color: #fecaca;
  background: rgba(239,68,68,.13);
}
html[data-sidebar-theme="dark"] .theme-toggle-track {
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-purple));
  border-color: rgba(255,255,255,.14);
}
html[data-sidebar-theme="dark"] .theme-toggle-track span {
  transform: translateX(18px);
}
/* Legacy sidebar link support for pages that still output plain anchors. */
.sidebar a:not(.sidebar-link) {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 20px;
  color: #111827;
  text-decoration: none;
  font-weight: 750;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease;
}
.sidebar a:not(.sidebar-link) svg { flex: 0 0 auto; opacity: .86; }
.sidebar a:not(.sidebar-link):hover {
  transform: translateX(3px);
  color: #07111f;
  background: rgba(255,255,255,.74);
  border-color: rgba(15,23,42,.08);
}
.sidebar a:not(.sidebar-link).active {
  color: #fff;
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-purple));
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 16px 34px rgba(37,99,235,.3);
}
.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: #fff;
  color: var(--ui-ink);
  align-items: center;
  justify-content: center;
  box-shadow: var(--ui-shadow-sm);
}
.sidebar-backdrop { display: none; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 20px 22px;
  border: 1px solid rgba(226,232,240,.82);
  border-radius: 22px;
  background: rgba(255,255,255,.76);
  box-shadow: var(--ui-shadow);
  backdrop-filter: blur(18px);
}
.topbar h1 {
  margin: 0 0 3px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
  font-weight: 900;
  color: var(--ui-ink);
}
.topbar .text-muted { color: var(--ui-muted) !important; font-weight: 650; }

/* Panels, cards, and stats */
.card {
  border: 1px solid rgba(226,232,240,.9) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-panel) !important;
  box-shadow: var(--ui-shadow-sm) !important;
  backdrop-filter: blur(14px);
}
.card:hover { box-shadow: var(--ui-shadow) !important; }
.card h1, .card h2, .card h3, .card .h5, .card .h6 {
  color: var(--ui-ink);
  font-weight: 850;
}
.stat {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1;
  font-weight: 900;
  color: var(--ui-ink);
}
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 148px;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -42px -58px auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.16), transparent 68%);
}
.stat-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-blue);
  background: #eef5ff;
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.08);
}
.stat-label {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.usage-row {
  padding: 12px 0;
}
.usage-row + .usage-row { border-top: 1px solid var(--ui-line); }
.progress {
  height: 9px;
  border-radius: 999px;
  background: #e9eef8;
  overflow: hidden;
}
.progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ui-blue), var(--ui-purple));
}

.account-list {
  display: grid;
  gap: 12px;
}

.sender-card-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.sender-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.connected-account {
  align-items: center;
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fffb 100%) !important;
  border: 1px solid #bbf7d0 !important;
  border-radius: 14px !important;
  box-shadow: 0 16px 32px rgba(16, 185, 129, .11) !important;
  color: var(--ui-ink);
  display: flex !important;
  flex-wrap: nowrap;
  gap: 14px;
  min-height: 82px;
  padding: 15px 16px !important;
  position: relative;
}

.connected-account.disconnected {
  background: #f8fafc !important;
  border-color: var(--ui-line) !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, .05) !important;
}

.connected-account-icon,
.connected-account-check {
  align-items: center;
  border-radius: 14px;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
}

.connected-account-icon {
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 185, 129, .14);
  color: #059669;
  height: 46px;
  width: 46px;
}

.connected-account-icon.provider-google {
  background: linear-gradient(135deg, #fff 0%, #ecfdf5 100%);
  color: #16a34a;
}

.connected-account-icon.provider-ms {
  background: linear-gradient(135deg, #eff6ff 0%, #ecfeff 100%);
  color: #2563eb;
}

.connected-account.disconnected .connected-account-icon {
  color: #94a3b8;
}

.connected-account-check {
  background: linear-gradient(135deg, #10b981, #22c55e);
  color: #fff;
  height: 32px;
  margin-left: auto;
  width: 32px;
  box-shadow: 0 10px 22px rgba(16, 185, 129, .28);
}

.connected-account-label {
  align-items: center;
  color: #047857;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.connected-account.disconnected .connected-account-label {
  color: #64748b;
}

@media (max-width: 575.98px) {
  .sender-card-head { align-items: stretch; flex-direction: column; }
  .sender-actions .btn { width: 100%; }
  .connected-account { align-items: flex-start; }
  .connected-account-check { margin-left: 0; }
}

/* Buttons */
.btn {
  min-height: 38px;
  border-radius: 11px !important;
  font-weight: 800 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary, .btn-success {
  border: 0 !important;
  color: #fff !important;
  background: linear-gradient(135deg, var(--ui-blue), var(--ui-purple)) !important;
  box-shadow: 0 14px 28px rgba(37,99,235,.2) !important;
}
.btn-danger {
  border: 0 !important;
  background: linear-gradient(135deg, #ef4444, #db2777) !important;
  box-shadow: 0 14px 28px rgba(239,68,68,.16) !important;
}
.btn-warning {
  border: 0 !important;
  color: #2b1800 !important;
  background: linear-gradient(135deg, #fbbf24, #f97316) !important;
}
.btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-danger, .btn-outline-warning, .btn-outline-dark {
  background: rgba(255,255,255,.78) !important;
  border-color: var(--ui-line) !important;
  color: #22304a !important;
}
.btn-sm { min-height: 32px; padding-inline: 11px; }

/* Forms and tables */
.form-control, .form-select {
  min-height: 42px;
  border-color: #dfe6f1 !important;
  border-radius: 12px !important;
  background-color: rgba(255,255,255,.92) !important;
  font-weight: 550;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ui-blue) !important;
  box-shadow: 0 0 0 .24rem rgba(37,99,235,.13) !important;
}
.form-label {
  color: #27364f;
  font-size: 13px;
  font-weight: 800;
}
.form-text, .text-muted { color: var(--ui-muted) !important; }
textarea.code-editor {
  min-height: 380px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}
.table-responsive {
  border-radius: 14px;
}
.table { margin-bottom: 0; }
.table th {
  padding: 15px 14px;
  color: #34435e;
  font-size: 12px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ui-line);
  background: rgba(248,250,252,.84);
}
.table td {
  padding: 15px 14px;
  border-color: #edf1f7;
  vertical-align: middle;
}
.table tbody tr:hover { background: rgba(239,246,255,.68); }
.badge {
  border-radius: 999px;
  padding: .48em .72em;
  font-weight: 850;
}
.alert {
  border-radius: 15px;
  border: 1px solid rgba(226,232,240,.9);
  box-shadow: 0 14px 28px rgba(15,23,42,.05);
}

/* Setup and report surfaces */
.setup-card {
  min-height: 132px;
  position: relative;
}
.setup-step-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-blue);
  background: #eef5ff;
}
.live-report-panel, .live-report-scroll {
  border-color: var(--ui-line) !important;
  border-radius: 14px !important;
}
.live-report-stat {
  border: 1px solid var(--ui-line) !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.04);
}

/* Auth screens that include the shared CSS directly. */
body.d-flex.align-items-center.justify-content-center {
  padding: 18px;
}
body.d-flex.align-items-center.justify-content-center .card {
  width: min(100%, 460px) !important;
}

.template-browser {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: 220px minmax(0, 1fr);
}
.template-new-button {
  min-height: 50px;
  width: 100%;
}
.template-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  min-width: 0;
  overflow: visible;
}
.template-list-item,
.template-list-empty {
  min-width: 0;
  width: 100%;
}
.template-list-item strong,
.template-list-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-list-item strong {
  white-space: nowrap;
}
.template-list-item small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

@media (max-width: 1100px) {
  .app-main { padding: 20px; }
  .sidebar { width: 248px; }
}

@media (max-width: 860px) {
  body.sidebar-open { overflow: hidden; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 310px);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 1040;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.46);
    backdrop-filter: blur(3px);
    z-index: 1030;
  }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-link,
  .nav-group summary,
  .sidebar-theme-toggle {
    min-height: 46px;
  }
  .nav-group-panel {
    margin-left: 10px;
    padding-left: 9px;
  }
  .topbar {
    align-items: flex-start;
    justify-content: flex-start;
  }
  .topbar > div:first-of-type { flex: 1; }
  .topbar .text-end { text-align: left !important; width: 100%; }
  .app-main { padding: 14px; }
  .card { border-radius: 16px !important; }
  .table { min-width: 760px; }
  .template-browser {
    grid-template-columns: 1fr;
  }
  .template-new-button {
    margin-bottom: 0;
  }
}

@media (max-width: 560px) {
  html { font-size: 14px; }
  .topbar { padding: 15px; flex-wrap: wrap; }
  .topbar h1 { font-size: 24px; }
  .row.g-3, .row.g-4 { --bs-gutter-y: .85rem; }
  .btn { width: auto; }
  .d-flex.flex-wrap.gap-1 .btn,
  .d-flex.flex-wrap.gap-2 .btn { flex: 1 1 auto; }
}
