/* ─── CSS Variables ─── */
:root {
  --bg: #0a0a0b;
  --bg-elevated: #111113;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --text-primary: #f5f2eb;
  --text-secondary: #9a958d;
  --text-muted: #8a857d;
  --gold: #c9a96e;
  --gold-light: #e8d5a3;
  --gold-dark: #8b7347;
  --danger: #e57373;
  --danger-soft: rgba(229, 115, 115, 0.12);
  --warn: #ffb74d;
  --warn-soft: rgba(255, 183, 77, 0.12);
  --success: #81c784;
  --success-soft: rgba(129, 199, 132, 0.12);
  --info: #64b5f6;
  --info-soft: rgba(100, 181, 246, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(201, 169, 110, 0.2);
  --divider: rgba(255, 255, 255, 0.06);
  --divider-soft: rgba(255, 255, 255, 0.04);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 60px rgba(201, 169, 110, 0.15);
  --radius: 14px;
  --radius-sm: 10px;
  --tap-target: 44px;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  /* Status colors (unified) */
  --status-scheduled: #c9a96e;
  --status-scheduled-bg: rgba(201, 169, 110, 0.10);
  --status-scheduled-border: rgba(201, 169, 110, 0.3);
  --status-completed: #81c784;
  --status-completed-bg: rgba(129, 199, 132, 0.10);
  --status-completed-border: rgba(129, 199, 132, 0.3);
  --status-cancelled: #6b665e;
  --status-cancelled-bg: rgba(107, 102, 94, 0.10);
  --status-cancelled-border: rgba(107, 102, 94, 0.3);
  --status-no_show: #e57373;
  --status-no_show-bg: rgba(229, 115, 115, 0.10);
  --status-no_show-border: rgba(229, 115, 115, 0.3);
  --status-rescheduled: #ffb74d;
  --status-rescheduled-bg: rgba(255, 183, 77, 0.10);
  --status-rescheduled-border: rgba(255, 183, 77, 0.3);
}

/* ─── Offline bar ─── */
.offline-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(229, 115, 115, 0.18);
  border: 1px solid rgba(229, 115, 115, 0.35);
  color: var(--danger);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  z-index: 2500;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.offline-bar-visible { transform: translateX(-50%) translateY(0); }

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button, a, input, select, textarea,
[role="button"], [data-view], [data-filter], [data-trigger] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Pull-to-refresh, overscroll glow, and 300ms tap delay all suppressed.
   In-app refresh must use the explicit button. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeSpeed;
}

button:focus-visible,

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

body.mobile-more-open {
  overflow: hidden;
}

.mobile-bottom-nav {
  display: none;
}

.mobile-more-backdrop,
.mobile-more-sheet {
  display: none;
}

.mobile-more-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
}

.mobile-more-backdrop[hidden],
.mobile-more-sheet[hidden] {
  display: none;
}

/* ─── Sidebar ─── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: linear-gradient(180deg, #111113 0%, #0d0d0e 100%);
  border-right: 1px solid var(--border);
  color: var(--text-primary);
  z-index: 10;
  transition: padding 0.3s ease;
}

.brand {
  padding: 0;
  flex: 1;
  min-width: 0;
}

.brand strong {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  display: block;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand small {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.nav-button {
  width: 100%;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  min-height: var(--tap-target);
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-button::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-button.active {
  color: var(--gold-light);
  background: rgba(201, 169, 110, 0.08);
}

.nav-button.active::before {
  opacity: 1;
}

.logout-button {
  color: var(--text-muted);
}

.logout-button:hover {
  color: #f5c6c6;
  background: rgba(229, 115, 115, 0.08);
}

/* ─── Main App Area ─── */
.app {
  padding: 32px;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.topbar p {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 14px;
}

/* ─── Status Pill ─── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-radius: 100px;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}

.status-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.4s ease;
}

.status-pill.connected {
  border-color: rgba(129, 199, 132, 0.3);
  color: var(--success);
  background: rgba(129, 199, 132, 0.08);
}

.status-pill.connected::before { background: var(--success); }

.status-pill.disconnected {
  border-color: rgba(229, 115, 115, 0.3);
  color: var(--danger);
  background: rgba(229, 115, 115, 0.08);
}

.status-pill.disconnected::before { background: var(--danger); }

.status-pill.loading {
  border-color: rgba(255, 183, 77, 0.3);
  color: var(--warn);
  background: rgba(255, 183, 77, 0.08);
}

.status-pill.loading::before {
  background: var(--warn);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-pill.error {
  border-color: rgba(229, 115, 115, 0.3);
  color: var(--danger);
  background: rgba(229, 115, 115, 0.08);
}

.status-pill.error::before { background: var(--danger); }

.status-pill.is-fetching {
  position: relative;
  overflow: hidden;
}
.status-pill.is-fetching::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.app-shell-disconnected .topbar {
  border-bottom-color: rgba(229, 115, 115, 0.18);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ─── Views ─── */
.view { display: none; }
.view.active {
  display: block;
  opacity: 1;
}

@keyframes viewFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Metrics ─── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  contain: layout paint;
}

.metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.metric:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

.metric:hover::before {
  opacity: 0.5;
}

.metric span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

/* ─── Panels ─── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  contain: layout paint;
}

.panel:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 600;
}

/* ─── Split Layout ─── */
.split {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 24px;
  align-items: start;
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-client-form-toggle,
.mobile-client-form-close,
.mobile-client-form-cancel {
  display: none;
}

.client-form-header-actions,
.client-form-actions {
  display: flex;
  gap: 10px;
}

.client-form-actions {
  align-items: center;
}

.client-form-actions .primary {
  flex: 1 1 auto;
}

/* ─── Form Elements ─── */
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 16px; /* >=16px prevents iOS Safari zoom-on-focus */
  transition: var(--transition);
  min-height: var(--tap-target);
}

input::placeholder {
  color: var(--text-muted);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dark);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a958d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ─── Buttons ─── */
.primary, .secondary {
  border: 0;
  border-radius: 100px;
  padding: 12px 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-target);
  white-space: nowrap;
}

.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a0b;
  box-shadow: 0 4px 20px rgba(201, 169, 110, 0.2);
}

.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(201, 169, 110, 0.3);
}

.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(201, 169, 110, 0.2);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: 0 2px 8px rgba(201, 169, 110, 0.12);
}

.primary.is-loading {
  pointer-events: none;
  opacity: 0.78;
}

.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.secondary:hover {
  border-color: var(--border-hover);
  background: rgba(201, 169, 110, 0.05);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(201, 169, 110, 0.2);
}

.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

/* ─── Tables ─── */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
}

th {
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--divider-soft);
}

th:first-child { border-radius: var(--radius-sm) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider-soft);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:last-child td:first-child { border-radius: 0 0 0 var(--radius-sm); }
tr:last-child td:last-child { border-radius: 0 0 var(--radius-sm) 0; }

/* ─── Row Actions ─── */
.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: var(--transition);
  min-height: 38px;
}

.link-button:hover {
  background: rgba(201, 169, 110, 0.1);
  color: var(--gold-light);
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 100px;
  padding: 4px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.badge.connected {
  border-color: rgba(129, 199, 132, 0.3);
  color: var(--success);
  background: rgba(129, 199, 132, 0.08);
}

.badge.error, .badge.failed {
  border-color: rgba(229, 115, 115, 0.3);
  color: var(--danger);
  background: rgba(229, 115, 115, 0.08);
}

.badge.disconnected {
  border-color: rgba(229, 115, 115, 0.3);
  color: var(--danger);
  background: rgba(229, 115, 115, 0.08);
}

.badge.loading, .badge.pending {
  border-color: rgba(255, 183, 77, 0.3);
  color: var(--warn);
  background: rgba(255, 183, 77, 0.08);
}

.badge.sent {
  border-color: rgba(129, 199, 132, 0.3);
  color: var(--success);
  background: rgba(129, 199, 132, 0.08);
}

/* ─── Utilities ─── */
.computed {
  color: var(--text-muted);
  font-size: 14px;
}

.computed strong {
  color: var(--gold);
  font-weight: 500;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

/* ─── QR Box ─── */
.qr-box {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
  overflow-wrap: anywhere;
  transition: var(--transition);
}

.qr-box:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.qr-box img {
  max-width: 100%;
  width: 260px;
  height: auto;
  border-radius: var(--radius-sm);
}

.qr-box .computed {
  margin-top: 12px;
  color: var(--text-secondary);
}

/* ─── Onboarding ─── */
.onboarding {
  margin-top: 24px;
}

.onboarding h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--gold-light);
}

.onboarding ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.onboarding li {
  margin-bottom: 8px;
}

.onboarding small {
  color: var(--text-muted);
  font-size: 13px;
}

.onboarding em {
  color: var(--gold);
  font-style: normal;
  font-weight: 500;
}

/* ─── Billing ─── */
.billing-layout {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(300px, 1fr);
  gap: 24px;
  align-items: start;
}

.billing-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero */
.billing-hero {
  text-align: center;
}

.billing-hero-badge {
  margin-bottom: 16px;
}

.billing-hero-badge .badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 16px;
}

.billing-hero-badge .badge.connected {
  background: rgba(129, 199, 132, 0.12);
  border-color: rgba(129, 199, 132, 0.45);
  color: var(--success);
}

.billing-hero-badge .badge.error {
  background: rgba(229, 115, 115, 0.12);
  border-color: rgba(229, 115, 115, 0.45);
  color: var(--danger);
  animation: pulse-dot 2s ease-in-out infinite;
}

.billing-hero-badge .badge.pending {
  background: rgba(255, 183, 77, 0.12);
  border-color: rgba(255, 183, 77, 0.45);
  color: var(--warn);
}

.billing-hero-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.billing-hero-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Price block */
.billing-price-block {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}

.billing-price-currency {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-light);
  line-height: 1;
}

.billing-price-amount {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: -0.03em;
  line-height: 1;
}

.billing-price-period {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

/* Summary */
.billing-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.billing-summary > div {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  transition: var(--transition);
}

.billing-summary > div:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.billing-summary span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.billing-summary strong {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Result message */
.billing-result {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  min-height: 24px;
  margin: 0;
  transition: color 0.3s ease;
}

.billing-result:empty::before {
  content: '\200B';
  display: inline;
}

.billing-result--success {
  color: var(--success);
  font-weight: 500;
}

.billing-result--error {
  color: var(--danger);
  font-weight: 500;
}

/* PayPal */
.paypal-button-container {
  min-height: 56px;
  margin: 8px 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  background: transparent !important;
  gap: 10px;
}

.paypal-button-container::before,
.paypal-button-container::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--divider), transparent);
  transform: translateX(-50%);
  pointer-events: none;
}

.paypal-button-container::before {
  top: -10px;
}

.paypal-button-container::after {
  bottom: -10px;
}

.paypal-button-container > div,
.paypal-button-container iframe {
  border-radius: 15px !important;
  overflow: hidden;
  z-index: 1;
  background: transparent !important;
}

.paypal-button-container [role="link"],
.paypal-button-container button {
  border-radius: 15px !important;
  background: transparent !important;
}

/* The "Debit or Credit Card" alternative button defaults to white.
   PayPal renders it as a separate iframe with no theme hooks from the
   SDK style option, so we force its background and text to match the
   app's dark theme. */
.paypal-button-container > div:not(:first-child),
.paypal-button-container > div:not(:first-child) iframe {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-hover) !important;
  color: var(--text-primary) !important;
}

/* Trust signals */
.billing-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 20px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.billing-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.billing-trust-item svg {
  color: var(--gold);
  flex-shrink: 0;
}

/* Benefits panel */
.billing-benefits {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.billing-benefit {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.billing-benefit:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(3px);
}

.billing-benefit-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--gold-light);
  border-radius: 10px;
  background: rgba(201, 169, 110, 0.1);
  border: 1px solid rgba(201, 169, 110, 0.18);
}

.billing-benefit-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.billing-benefit-text strong {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  display: block;
}

.billing-benefit-text span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  display: block;
}

/* FAQ */
.billing-faq {
  border-top: 1px solid var(--divider);
  padding-top: 20px;
}

.billing-faq-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.billing-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
  overflow: hidden;
  transition: var(--transition);
}

.billing-faq-item:hover {
  border-color: var(--border-hover);
}

.billing-faq-item summary {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
  min-height: var(--tap-target);
}

.billing-faq-item summary::-webkit-details-marker {
  display: none;
}

.billing-faq-item summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.billing-faq-item[open] summary::after {
  transform: rotate(-135deg);
}

.billing-faq-item[open] summary {
  color: var(--gold-light);
  border-bottom: 1px solid var(--divider);
}

.billing-faq-item p {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

/* Responsive billing */
@media (max-width: 900px) {
  .billing-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .billing-price-amount {
    font-size: 44px;
  }

  .billing-price-currency {
    font-size: 22px;
  }

  .billing-summary {
    grid-template-columns: 1fr;
  }

  .billing-summary > div {
    min-height: 60px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .billing-summary > div strong {
    text-align: right;
  }

  .paypal-button-container {
    min-height: 56px;
  }

  .billing-trust {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .billing-benefit {
    padding: 12px;
  }

  .billing-benefit:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  .billing-hero-title {
    font-size: 22px;
  }

  .billing-price-amount {
    font-size: 38px;
  }

  .billing-faq-item summary {
    padding: 10px 12px;
  }

  .billing-faq-item p {
    padding: 10px 12px;
  }
}

/* ─── Notification Filter ─── */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Toolbar above the notifications table — search + chip filter row.
   Stays visible while the user scrolls through rows. */
.notif-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  margin: 4px 0 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.notif-toolbar .search-input {
  flex: 1 1 220px;
  min-width: 0;
}

.notif-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 1 auto;
}

.notif-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.notif-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.notif-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.notif-chip[aria-selected="true"] {
  color: var(--text-primary);
  background: rgba(201, 169, 110, 0.14);
  border-color: rgba(201, 169, 110, 0.36);
}

.notif-chip[aria-selected="true"] .notif-chip__dot {
  background: var(--gold);
}

.notif-chip[data-status="sent"] .notif-chip__dot { background: var(--success); }
.notif-chip[data-status="failed"] .notif-chip__dot { background: var(--danger); }
.notif-chip[data-status="pending"] .notif-chip__dot { background: var(--warn); }

.notif-chip[aria-selected="true"][data-status="sent"] {
  background: rgba(129, 199, 132, 0.12);
  border-color: rgba(129, 199, 132, 0.36);
}
.notif-chip[aria-selected="true"][data-status="failed"] {
  background: rgba(229, 115, 115, 0.12);
  border-color: rgba(229, 115, 115, 0.36);
}
.notif-chip[aria-selected="true"][data-status="pending"] {
  background: rgba(255, 183, 77, 0.12);
  border-color: rgba(255, 183, 77, 0.36);
}

/* The clear-X inside the search input. */
.search-input {
  position: relative;
  min-width: 220px;
}
.search-input input {
  width: 100%;
  padding-left: 38px;
  padding-right: 38px;
  min-height: 38px;
}
.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}
.search-clear:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
@media (max-width: 720px) {
  .search-input { width: 100%; }
}

@media (max-width: 720px) {
  .notif-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 8px;
  }
  .notif-toolbar .search-input {
    flex-basis: auto;
    width: 100%;
  }
  .notif-chips {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .notif-chips::-webkit-scrollbar { display: none; }
  .notif-chip {
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .notif-toolbar {
    position: static; /* sticky inside a scrolling table on small phones adds jank */
  }
  .notif-chip {
    padding: 6px 12px;
    font-size: 12.5px;
    min-height: 34px;
  }
}

.panel-header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.panel-header-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

/* Retry button on a failed notification row. On mobile cards the
   "Detalle" cell already shows the inline error message; the button
   must be its own row, full-width, and easy to thumb-tap. */
.retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(229, 115, 115, 0.1);
  color: var(--danger);
  border: 1px solid rgba(229, 115, 115, 0.28);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  transition: var(--transition);
}
.retry-btn:hover {
  background: rgba(229, 115, 115, 0.18);
  border-color: rgba(229, 115, 115, 0.5);
}
.retry-btn:active {
  transform: scale(0.98);
}
.retry-btn:disabled {
  opacity: 0.6;
  pointer-events: none;
}
.retry-btn svg { width: 14px; height: 14px; }

:where(td.notif-actions) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
:where(td.notif-error) {
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.4;
  word-break: break-word;
  display: block;
  padding-bottom: 2px;
}

.notif-client {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.notif-client strong {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  word-break: break-word;
}
.notif-client__phone {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.retry-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

@media (max-width: 720px) {
  td.notif-actions .retry-btn {
    width: 100%;
    min-height: 42px;
  }
  td.notif-actions {
    align-items: stretch;
  }
}

/* ─── Test Message Result ─── */
#test-message-result {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
  min-height: 20px;
}

/* ─── Mobile App Navigation ─── */
.mobile-nav-item,
.mobile-more-action {
  border: 0;
  cursor: pointer;
  transition: color 0.22s ease, background 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}

.mobile-nav-item {
  min-width: 0;
  min-height: 56px;
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 4px 6px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
}

.mobile-nav-item svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
  transition: transform 0.22s ease;
}

.mobile-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-nav-item:hover {
  color: var(--text-primary);
  background: var(--divider-soft);
}

.mobile-nav-item[aria-current="page"] {
  color: var(--gold-light);
  background: rgba(201, 169, 110, 0.12);
}

.mobile-nav-item[aria-current="page"] svg {
  transform: translateY(-1px);
}

.mobile-more-sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 125;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-elevated);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.mobile-more-header {
  padding: 2px 4px 12px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 10px;
}

.mobile-more-header h2 {
  font-size: 16px;
}

.mobile-more-header p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.mobile-more-actions {
  display: grid;
  gap: 8px;
}

.mobile-more-action {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}

.mobile-more-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--divider-soft);
  color: var(--gold);
  flex: 0 0 auto;
}

.mobile-more-action:hover,
.mobile-more-action[aria-current="page"] {
  color: var(--text-primary);
  background: rgba(201, 169, 110, 0.08);
}

.mobile-more-action.danger {
  color: #f5c6c6;
}

.mobile-more-action.danger .mobile-more-icon {
  color: var(--danger);
  background: rgba(229, 115, 115, 0.08);
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .app {
    padding: 24px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    display: none;
  }

  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .app {
    padding: 16px;
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 130;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    min-height: 72px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--bg-elevated);
    box-shadow: 0 14px 50px rgba(0, 0, 0, 0.52);
  }

  .mobile-more-backdrop,
  .mobile-more-sheet {
    display: block;
  }

  .mobile-client-form-toggle {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 13px 16px;
    border: 1px solid rgba(201, 169, 110, 0.22);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.14), rgba(255, 255, 255, 0.03));
    color: var(--gold-light);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.24);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease;
  }

  .mobile-client-form-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-client-form-toggle:hover,
  .mobile-client-form-toggle[aria-expanded="true"] {
    border-color: rgba(201, 169, 110, 0.42);
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.22), rgba(255, 255, 255, 0.04));
  }

  .mobile-client-form-toggle-icon {
    transition: transform 0.22s ease;
  }

  .mobile-client-form-toggle[aria-expanded="true"] .mobile-client-form-toggle-icon {
    transform: rotate(180deg);
  }

  .client-form-panel {
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    overflow: hidden;
    pointer-events: none;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    transition: max-height 0.32s ease, opacity 0.22s ease, transform 0.24s ease, padding 0.24s ease, border-color 0.24s ease, margin 0.24s ease;
  }

  .client-form-panel.mobile-open,
  .client-form-panel[aria-hidden="false"] {
    max-height: 760px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    margin-bottom: 24px;
    padding-top: 18px;
    padding-bottom: 18px;
    border-color: var(--border);
  }

  .client-form-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .mobile-client-form-close,
  .mobile-client-form-cancel {
    display: inline-flex;
  }

  .client-form-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 10px;
  }

  .client-form-actions .primary,
  .client-form-actions .secondary {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    border-spacing: 0;
  }

  table thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
  }

  td {
    display: grid;
    grid-template-columns: minmax(112px, 40%) minmax(0, 1fr);
    gap: 12px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--divider-soft);
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
  }

  td[colspan] {
    display: block;
    padding: 18px;
    text-align: center;
  }

  td[colspan]::before {
    display: none;
  }

  tr:hover td {
    background: transparent;
  }

  .row-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .row-actions .link-button {
    flex: 1 1 92px;
    border: 1px solid rgba(201, 169, 110, 0.16);
    background: rgba(201, 169, 110, 0.06);
    text-align: center;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 14px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
  }
  h1 { font-size: 22px; }
  .topbar {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }
  .status-pill {
    width: 100%;
    justify-content: center;
  }
  .metrics { grid-template-columns: 1fr; }
  .metric strong { font-size: 26px; }
  th, td { padding: 12px 14px; font-size: 13px; }
  .panel { padding: 16px; }
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }
  .panel-header .secondary,
  .form-panel .primary,
  #save-template-btn,
  #save-follow-up-btn {
    width: 100%;
  }
  .actions {
    flex-direction: column;
  }
  .actions .primary,
  .actions .secondary {
    width: 100%;
  }
  td {
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
  }
}

/* ─── Templates ─── */
.templates-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 24px;
  align-items: start;
}

.template-tabs-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-tab {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.template-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.template-tab.active {
  color: var(--gold-light);
  background: rgba(201, 169, 110, 0.08);
}

.template-hint {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 0;
}

.template-hint code {
  background: rgba(201, 169, 110, 0.1);
  color: var(--gold-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.template-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.template-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-edit-area .panel-header {
  flex-wrap: wrap;
}

/* ─── Toggle Switch ─── */
.toggle-label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 100px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.3s ease;
}

.toggle-label input:checked + .toggle-switch {
  background: rgba(201, 169, 110, 0.3);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(18px);
  background: var(--gold);
}

@media (max-width: 1024px) {
  .templates-layout {
    grid-template-columns: 1fr;
  }
  .template-tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .template-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .template-tab {
    padding: 10px 12px;
    font-size: 13px;
    text-align: center;
  }
  .template-hint {
    overflow-wrap: anywhere;
  }
}

/* ─── Auth Pages (shared) ─── */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 20px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(201, 169, 110, 0.08) 0%, transparent 60%),
    var(--bg);
  grid-template-columns: 1fr;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft), 0 0 80px rgba(201, 169, 110, 0.05);
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

.auth-back-link {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.auth-back-link:hover {
  color: var(--gold-light);
  border-color: rgba(201, 169, 110, 0.25);
  background: rgba(201, 169, 110, 0.06);
}

.auth-back-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark), var(--gold));
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  gap: 8px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.02em;
  margin: 0;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.auth-form-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form h2 {
  display: none;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
}

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

@media (max-width: 480px) {
  .auth-page {
    align-items: stretch;
    padding: 12px;
  }
  .auth-card {
    align-self: center;
    padding: 42px 18px 28px;
  }
  .login-form .primary,
  .login-form .link-button {
    width: 100%;
  }
  .auth-title {
    font-size: 22px;
  }
  .auth-card::before {
    height: 2px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 12px;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
  .topbar {
    margin-bottom: 16px;
    padding-bottom: 12px;
    gap: 10px;
  }
  .topbar p { font-size: 13px; }
  .panel { padding: 14px; }
  .panel-header { margin-bottom: 14px; gap: 8px; }
  .metric { padding: 16px; }
  .metric strong { font-size: 24px; }
  .metric span { font-size: 11px; }

  .actions {
    flex-direction: column;
  }
  .actions .primary,
  .actions .secondary {
    width: 100%;
  }

  .split { gap: 16px; }

  .qr-box {
    min-height: 180px;
    padding: 16px;
  }
  .qr-box img { width: 200px; }

  .onboarding { margin-top: 16px; }
  .onboarding h2 { font-size: 16px; }
  .onboarding ol { padding-left: 16px; font-size: 13px; }

  .settings-section { gap: 12px; margin-bottom: 18px; }
  .settings-row { gap: 10px; }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .pagination-info { text-align: center; }
  .pagination-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }

  .empty-state { padding: 40px 16px; }
  .empty-state-icon { width: 56px; height: 56px; border-radius: 16px; }
  .empty-state-icon svg { width: 26px; height: 26px; }
  .empty-state-title { font-size: 16px; }

  .onboarding-panel {
    max-width: 100%;
    border-radius: 16px;
  }
  .onboarding-header { padding: 18px 18px 8px; }
  .onboarding-body { padding: 8px 18px 16px; font-size: 13px; }
  .onboarding-form { padding: 8px 18px 14px; gap: 12px; }
  .onboarding-footer { padding: 12px 18px 16px; }
  .onboarding-title { font-size: 19px; }

  .mobile-bottom-nav {
    left: 6px;
    right: 6px;
    padding: 5px;
    gap: 2px;
    min-height: 66px;
    border-radius: 18px;
  }
  .mobile-nav-item {
    min-height: 50px;
    padding: 5px 2px 4px;
    font-size: 10px;
    border-radius: 14px;
  }
  .mobile-nav-item svg { width: 19px; height: 19px; }

  .mobile-more-sheet {
    left: 8px;
    right: 8px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    padding: 14px;
    border-radius: 18px;
  }
  .mobile-more-header { padding: 2px 4px 10px; margin-bottom: 8px; }
  .mobile-more-action { min-height: 44px; padding: 10px; font-size: 13px; }
  .mobile-more-icon { width: 28px; height: 28px; border-radius: 8px; }

  td {
    grid-template-columns: minmax(88px, 36%) minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
  }
  td::before { font-size: 10px; }

  .toast-container {
    max-width: calc(100vw - 12px);
  }
  .toast { font-size: 13px; padding: 10px 12px 10px 10px; }
}

@media (max-width: 380px) {
  .app {
    padding: 10px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
  h1 { font-size: 18px; }
  h2 { font-size: 15px; }
  .topbar { margin-bottom: 14px; padding-bottom: 10px; }
  .topbar p { font-size: 12px; }
  .panel { padding: 12px; }
  .panel-header { margin-bottom: 12px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 22px; }
  .metric-icon { width: 30px; height: 30px; margin-bottom: 8px; }
  .metric-icon svg { width: 15px; height: 15px; }

  .status-pill {
    font-size: 12px;
    padding: 5px 12px;
    min-height: 30px;
  }

  .primary, .secondary {
    padding: 10px 18px;
    font-size: 13px;
    min-height: 40px;
  }

  input, select, textarea {
    padding: 10px 12px;
    font-size: 16px;
    min-height: 40px;
  }

  label { font-size: 12px; gap: 6px; }

  .mobile-bottom-nav {
    left: 4px;
    right: 4px;
    padding: 4px;
    gap: 1px;
    min-height: 62px;
    border-radius: 16px;
  }
  .mobile-nav-item {
    min-height: 46px;
    padding: 4px 1px 3px;
    font-size: 9.5px;
    gap: 1px;
    border-radius: 12px;
  }
  .mobile-nav-item svg { width: 18px; height: 18px; }

  .mobile-more-sheet {
    left: 6px;
    right: 6px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    padding: 12px;
  }

  td {
    grid-template-columns: minmax(80px, 34%) minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
    font-size: 13px;
  }
  td::before { font-size: 9.5px; }

  .badge {
    font-size: 11px;
    padding: 3px 10px;
    min-height: 24px;
  }

  .link-button {
    padding: 6px 8px;
    font-size: 12px;
    min-height: 34px;
  }

  .row-actions { gap: 4px; }
  .row-actions .link-button { flex: 1 1 80px; }

  .computed { font-size: 13px; }

  .form-error { font-size: 12px; }

  .settings-hint { font-size: 11px; }

  .onboarding-panel { border-radius: 14px; }
  .onboarding-title { font-size: 17px; }
  .onboarding-body { font-size: 12.5px; }
  .onboarding-progress { padding: 14px 16px 0; }
  .onboarding-header { padding: 14px 14px 6px; }
  .onboarding-body { padding: 6px 14px 14px; }
  .onboarding-form { padding: 6px 14px 12px; }
  .onboarding-footer { padding: 10px 14px 14px; }

  .auth-card { padding: 42px 14px 24px; border-radius: 16px; }
  .auth-back-link {
    top: 10px;
    left: 10px;
  }
  .auth-title { font-size: 20px; }
  .auth-subtitle { font-size: 12px; }
  .auth-form-title { font-size: 14px; }

  .toast { font-size: 12.5px; gap: 8px; border-radius: 10px; }
  .toast-icon { width: 24px; height: 24px; }
  .toast-action { font-size: 11px; padding: 5px 10px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Touch devices: drop hover-only transform/shadow changes so the
   "stuck lifted" state doesn't persist after a tap. Color-only hovers
   are harmless on touch and kept. */
@media (hover: none) {
  .primary:hover,
  .secondary:hover,
  .metric:hover,
  .panel:hover,
  .nav-button:hover,
  .template-tab:hover,
  .qr-box:hover,
  .sidebar-profile:hover,
  .sidebar-collapse-btn:hover,
  .link-button:hover,
  .btn-danger:hover,
  .retry-btn:hover,
  .refresh-btn-icon:hover {
    transform: none;
    box-shadow: none;
  }
  .cal-fab:hover {
    transform: scale(1) translateY(0);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
}

/* Data-saver: stop non-essential motion and reveal observers. */
@media (prefers-reduced-data: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Skip Link ─── */
.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--gold);
  color: #0a0a0b;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid #0a0a0b;
  outline-offset: -2px;
}

/* ─── Skeletons ─── */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
}
.skeleton-text { height: 14px; margin: 6px 0; }
.skeleton-text-lg { height: 32px; margin: 8px 0; }
.skeleton-text-sm { height: 10px; }
.skeleton-block { height: 100px; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; }
.skeleton-row .skeleton { flex: 1; }
.skeleton-table-row {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider-soft);
}

/* ─── Toast Container ─── */
.toast-container {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 24px);
  width: 100%;
  max-width: 480px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  background: rgba(20, 20, 22, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px) saturate(1.2);
  font-size: 14px;
  color: var(--text-primary);
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.toast-visible { transform: translateY(0); opacity: 1; }
.toast-leaving { transform: translateY(10px); opacity: 0; }
.toast-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}
.toast-success { border-color: rgba(129, 199, 132, 0.3); }
.toast-success .toast-icon { color: var(--success); background: var(--success-soft); }
.toast-error { border-color: rgba(229, 115, 115, 0.3); }
.toast-error .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast-info { border-color: rgba(100, 181, 246, 0.3); }
.toast-info .toast-icon { color: var(--info); background: var(--info-soft); }
.toast-warning { border-color: rgba(255, 183, 77, 0.3); }
.toast-warning .toast-icon { color: var(--warn); background: var(--warn-soft); }
.toast-text { flex: 1; min-width: 0; }
.toast-action {
  border: 0;
  background: rgba(201, 169, 110, 0.18);
  color: var(--gold-light);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.toast-action:hover { background: rgba(201, 169, 110, 0.28); }
.toast-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }

@media (max-width: 720px) {
  .toast-container {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 16px);
  }
}

/* ─── Empty States ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(201, 169, 110, 0.06);
  border: 1px solid rgba(201, 169, 110, 0.18);
  color: var(--gold);
}
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
}
.empty-state-text {
  font-size: 14px;
  line-height: 1.6;
  max-width: 360px;
}
.empty-state-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ─── Tooltips ─── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(17, 17, 19, 0.98);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1100;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Sidebar User Profile ─── */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-align: left;
  border-width: 1px;
  font: inherit;
  color: inherit;
}
.sidebar-profile:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-hover);
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--gold);
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid rgba(201, 169, 110, 0.18);
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Sidebar collapse ─── */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-collapse-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}
body.sidebar-collapsed {
  grid-template-columns: 80px 1fr;
}
body.sidebar-collapsed .sidebar { padding: 20px 12px; }
body.sidebar-collapsed .nav-button {
  text-align: center;
  padding: 12px 8px;
  font-size: 0;
}
body.sidebar-collapsed .nav-button::before { left: -1px; }
body.sidebar-collapsed .nav-button > * { display: none; }
body.sidebar-collapsed .nav-button .nav-icon { display: inline-flex; }
body.sidebar-collapsed .brand strong { font-size: 20px; }
body.sidebar-collapsed .brand small { display: none; }
body.sidebar-collapsed .sidebar-profile { justify-content: center; padding: 4px; }
body.sidebar-collapsed .sidebar-user-info { display: none; }
body.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
body.sidebar-collapsed .logout-button { font-size: 0; }
body.sidebar-collapsed .logout-button::after { content: 'Salir'; font-size: 13px; }

.nav-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.22s ease;
}

.nav-button:hover .nav-icon {
  color: var(--text-primary);
}

.nav-button.active .nav-icon {
  color: var(--gold);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 16px;
}

/* ─── Metrics with icons ─── */
.metric-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid rgba(201, 169, 110, 0.18);
  color: var(--gold);
  margin-bottom: 12px;
}
.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.danger { background: var(--danger-soft); border-color: rgba(229, 115, 115, 0.3); color: var(--danger); }
.metric-icon.success { background: var(--success-soft); border-color: rgba(129, 199, 132, 0.3); color: var(--success); }
.metric-icon.info { background: var(--info-soft); border-color: rgba(100, 181, 246, 0.3); color: var(--info); }

/* ─── Status chip with icon ─── */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-chip .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ─── Search input ─── */
.search-input {
  position: relative;
  min-width: 220px;
}
.search-input input {
  width: 100%;
  padding-left: 38px;
  min-height: 38px;
}
.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}
@media (max-width: 720px) {
  .search-input { width: 100%; }
}

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination-info {
  color: var(--text-muted);
  font-size: 13px;
}
.pagination-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pagination-buttons button {
  min-width: 38px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.pagination-buttons button:hover:not(:disabled):not(.active) {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}
.pagination-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination-buttons button.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0a0a0b;
  border-color: transparent;
}

/* ─── Retry button (notification row) ─── */
.retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(229, 115, 115, 0.1);
  color: var(--danger);
  border: 1px solid rgba(229, 115, 115, 0.25);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.retry-btn:hover { background: rgba(229, 115, 115, 0.18); }
.retry-btn svg { width: 12px; height: 12px; }

/* ─── Settings page ─── */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.settings-section .panel-header { margin-bottom: 4px; }
.settings-section .panel-header h2 { font-size: 16px; }
.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 6px;
}
@media (max-width: 720px) {
  .settings-row { grid-template-columns: 1fr; }
}

.settings-actions-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 560px) {
  .settings-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-actions-bar .primary,
  .settings-actions-bar .secondary {
    width: 100%;
  }
  .settings-actions-bar .computed {
    text-align: center;
  }
}

/* ─── Onboarding wizard ─── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modalOverlayIn 0.3s ease forwards;
}
.onboarding-overlay.closing {
  animation: modalOverlayOut 0.18s ease forwards;
}
.onboarding-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modalPanelIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.onboarding-progress {
  display: flex;
  gap: 6px;
  padding: 18px 24px 0;
}
.onboarding-progress-step {
  flex: 1;
  height: 3px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.3s ease;
}
.onboarding-progress-step.active { background: var(--gold); }
.onboarding-progress-step.done { background: var(--success); }
.onboarding-header {
  padding: 24px 24px 12px;
  text-align: center;
}
.onboarding-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.onboarding-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.onboarding-body {
  padding: 12px 32px 20px;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}
.onboarding-illustration {
  display: grid;
  place-items: center;
  padding: 20px;
}
.onboarding-illustration svg {
  width: 80px;
  height: 80px;
  color: var(--gold);
  opacity: 0.8;
}
.onboarding-form {
  padding: 8px 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.onboarding-form .primary {
  margin-top: 8px;
}
.onboarding-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  gap: 12px;
}
.onboarding-skip {
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes modalPanelIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Status badges in tables ─── */
td.status-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-cell .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-cell.sent .dot { background: var(--success); }
.status-cell.failed .dot { background: var(--danger); }
.status-cell.pending .dot { background: var(--warn); }

/* ─── Refresh button (mobile) ─── */
.refresh-btn-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.refresh-btn-icon:hover { border-color: var(--border-hover); color: var(--text-primary); }
.refresh-btn-icon svg { width: 16px; height: 16px; }

/* ─── Destructive button style ─── */
.btn-danger {
  background: transparent;
  border: 1px solid rgba(229, 115, 115, 0.3);
  color: var(--danger);
  border-radius: 100px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-danger:hover {
  background: rgba(229, 115, 115, 0.12);
  border-color: rgba(229, 115, 115, 0.5);
}

/* ─── Calendar status filter clarification ─── */
.calendar-status-bar {
  align-items: center;
}

.calendar-status-bar-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-chip[aria-pressed="true"] {
  font-weight: 600;
}

/* ─── Reset link in form ─── */
.link-button {
  min-height: 32px;
}

/* ─── Active nav indicator (better visibility) ─── */
.nav-button {
  position: relative;
}
.nav-button.active {
  background: linear-gradient(90deg, rgba(201, 169, 110, 0.12), rgba(201, 169, 110, 0.04));
}

/* ─── Inline form error ─── */
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-error::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center / contain no-repeat;
  flex-shrink: 0;
}
.form-error:empty { display: none; }
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 115, 115, 0.1);
}
input[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 115, 115, 0.18);
}

/* ─── Confirmation modal ─── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  animation: modalOverlayIn 0.2s ease forwards;
}
.confirm-overlay.closing {
  animation: modalOverlayOut 0.18s ease forwards;
}
.confirm-panel {
  width: min(100%, 420px);
  padding: 26px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: modalPanelIn 0.24s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.confirm-icon {
  width: 58px;
  height: 58px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 18px;
}
.confirm-icon-warning {
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid rgba(255, 183, 77, 0.24);
}
.confirm-icon-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(229, 115, 115, 0.24);
}
.confirm-icon-info {
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid rgba(100, 181, 246, 0.24);
}
.confirm-panel h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}
.confirm-panel p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.confirm-actions button {
  min-height: 42px;
}
.btn-confirm-warning,
.btn-confirm-danger,
.btn-confirm-info {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  color: #0a0a0b;
  font-weight: 700;
  cursor: pointer;
}
.btn-confirm-warning { background: var(--warn); }
.btn-confirm-danger { background: var(--danger); }
.btn-confirm-info { background: var(--info); }

/* ─── Change password modal ─── */
.change-password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: modal-fade 0.18s ease-out;
}
.change-password-overlay.closing { animation: modal-fade 0.18s ease-in reverse; }
@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.change-password-panel {
  width: min(440px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.change-password-panel .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  padding: 0;
}
.change-password-panel .modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.change-password-panel .modal-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.change-password-panel .modal-close:hover { color: var(--text-primary); background: var(--bg-glass); }
.change-password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.change-password-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}
.change-password-form input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}
.change-password-form input:focus {
  outline: none;
  border-color: var(--border-hover);
  background: var(--bg-glass);
}
.change-password-form input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -4px;
}
.password-strength-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 100px;
  overflow: hidden;
}
.password-strength-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 100px;
  transition: width 0.25s ease, background 0.25s ease;
}
.password-strength-bar > span.danger  { background: var(--danger); }
.password-strength-bar > span.warning { background: var(--warn); }
.password-strength-bar > span.info    { background: var(--info); }
.password-strength-bar > span.success { background: var(--success); }
.password-strength-label {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 96px;
  text-align: right;
}
.change-password-form .form-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin: -4px 0 0;
}
.change-password-form .form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
  min-height: 1.4em;
}
.change-password-form .modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
[data-tone="danger"] {
  color: var(--danger);
}

.verification-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.3);
  color: #facc15;
  font-size: 14px;
  margin: 12px 24px 0;
  border-radius: 10px;
}
.verification-banner[hidden] {
  display: none;
}
.verification-banner .link-button { color: #facc15; }

.password-strength {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 12px;
}
.password-strength-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.password-strength-fill {
  height: 100%;
  width: 0%;
  background: #ef4444;
  transition: width 200ms ease, background 200ms ease;
}
.password-strength-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.auth-terms {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-terms a { color: #facc15; }
.auth-terms input { width: 16px; height: 16px; }

.session-list,
.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.session-item,
.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  font-size: 13px;
}
.session-item.session-current {
  border-color: rgba(34, 197, 94, 0.4);
}
.session-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 11px;
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
  border-radius: 4px;
}
.event-item { flex-direction: column; align-items: flex-start; }
.event-item .computed { margin: 0; }
.empty { color: var(--text-muted); font-size: 13px; }
