/* ═══════════════════════════════════════════════════════════════
   Jus d'orange SaaS — Components
   ═══════════════════════════════════════════════════════════════ */

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.card:hover { border-color: var(--border); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.2px;
}
.card-title .icon { color: var(--orange); font-size: 16px; }

/* ─── Stat Card ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  border-color: rgba(255,109,26,0.35);
  transform: translateY(-3px);
  box-shadow: var(--shadow-orange);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 110px; height: 110px;
  background: radial-gradient(circle at 100% 0, var(--orange-glow2), transparent 70%);
  pointer-events: none;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1.2px;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: var(--space-2); }
.stat-icon { position: absolute; top: var(--space-5); right: var(--space-5); font-size: 22px; opacity: 0.35; }

.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full);
}
.stat-trend.up   { background: var(--green-bg); color: var(--green); }
.stat-trend.down { background: var(--red-bg);   color: var(--red); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  outline: none;
  user-select: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(255,109,26,0.25);
}
.btn-primary:hover { box-shadow: var(--shadow-orange); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-secondary {
  background: var(--bg-surface2);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(240,71,71,0.32);
}
.btn-danger:hover { background: var(--red); color: white; }

.btn-success {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(46,204,113,0.32);
}
.btn-success:hover { background: var(--green); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-surface2); color: var(--text-primary); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-icon { padding: 9px; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-active   { background: var(--green-bg);  color: var(--green);  }
.badge-active::before { background: var(--green); }
.badge-inactive { background: var(--bg-surface3); color: var(--text-muted); }
.badge-inactive::before { background: var(--text-muted); }
.badge-pending  { background: var(--yellow-bg); color: var(--yellow); }
.badge-pending::before { background: var(--yellow); animation: pulse 1.5s infinite; }
.badge-failed   { background: var(--red-bg);    color: var(--red);    }
.badge-failed::before { background: var(--red); }
.badge-ago { background: rgba(251,146,60,.15); color: #fb923c; }
.badge-ago::before { background: #fb923c; }
.badge-success  { background: var(--green-bg);  color: var(--green);  }
.badge-success::before { background: var(--green); }
.badge-unused   { background: var(--blue-bg);   color: var(--blue);   }
.badge-unused::before { background: var(--blue); }
.badge-used     { background: var(--bg-surface3); color: var(--text-muted); }
.badge-used::before { background: var(--text-muted); }
.badge-invalid  { background: var(--red-bg);    color: var(--red);    }
.badge-invalid::before { background: var(--red); }
.badge-info     { background: var(--blue-bg);   color: var(--blue);   }
.badge-info::before { background: var(--blue); }
.badge-warn     { background: var(--yellow-bg); color: var(--yellow); }
.badge-warn::before { background: var(--yellow); }
.badge-error    { background: var(--red-bg);    color: var(--red);    }
.badge-error::before { background: var(--red); }
.badge-debug    { background: var(--purple-bg); color: var(--purple); }
.badge-debug::before { background: var(--purple); }

/* ─── Form Controls ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  color: var(--text-primary);
  font-size: 15px; /* >=16px-ish avoids iOS zoom; 15 keeps design tight */
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
  background: var(--bg-surface);
}
.form-input::placeholder { color: var(--text-muted); }
/* Locked/read-only fields: stay flush with the form — same background and
   border as every other input, just dimmed text and a no-drop cursor — so
   it reads as "part of the form, can't type here" rather than a separate
   floating card sitting on top of the layout. */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: var(--bg-surface2);
  color: var(--text-muted);
}
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6b76' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}
.form-textarea { resize: vertical; min-height: 88px; }
.form-hint  { font-size: 11px; color: var(--text-muted); }
.form-error { font-size: 11px; color: var(--red); }

/* Fluid, mobile-first: columns are sized by content, not a fixed
   breakpoint. Each field gets at least 130px — on a narrow phone that
   fits exactly one column, on a wider phone/tablet/laptop it naturally
   flows to two (or more) without any magic-number media query. */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-4);
}

/* Toggle / Switch */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-base);
}
.toggle input:checked + .toggle-slider { background: var(--orange-glow); border-color: var(--orange); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--orange); }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  background: var(--bg-surface2);
  padding: 12px 15px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.table td {
  padding: 13px 15px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--bg-surface2); color: var(--text-primary); }

.table-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-muted);
  font-size: 13px;
}
.table-empty .empty-icon { font-size: 34px; display: block; margin-bottom: var(--space-3); opacity: 0.4; }

/* ─── Mobile: tables become stacked cards ────────────────────── */
@media (max-width: 768px) {
  .table-cards thead { display: none; }
  .table-cards tbody tr {
    display: block;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    background: var(--bg-surface);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
  }
  .table-cards tbody tr:last-child { margin-bottom: 0; }
  .table-cards tbody tr:hover td { background: transparent; }
  .table-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border-subtle) !important;
    gap: var(--space-3);
  }
  .table-cards td:last-child { border-bottom: none !important; padding-bottom: 0; }
  .table-cards td:first-child { padding-top: 0; }
  .table-cards td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 78px;
  }
  .table-cards td[data-label="Actions"] { justify-content: flex-end; padding-top: var(--space-2); flex-wrap: wrap; }
  .table-cards td[data-label="Actions"]::before { display: none; }
  .table-cards-wrap { border: none !important; overflow: visible !important; background: transparent !important; }
  .table-cards-wrap .table-wrapper { border: none; overflow: visible; }
}

/* ─── Modal (centered desktop · bottom-sheet mobile) ─────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  transform: scale(0.96) translateY(12px);
  transition: transform var(--transition-base) var(--ease-spring);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  gap: var(--space-3);
}
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close {
  background: var(--bg-surface2); border: 1px solid var(--border-subtle); cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  width: 32px; height: 32px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast); flex-shrink: 0;
}
.modal-close:hover { color: var(--red); border-color: rgba(240,71,71,0.3); background: var(--red-bg); }

.modal-body { display: flex; flex-direction: column; gap: var(--space-4); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* ─── Confirm dialog (UI.confirm — replaces window.confirm) ──────
   Reuses .modal/.modal-overlay/.modal-header/.modal-body/.modal-footer
   so it inherits the same look everywhere, including the mobile
   bottom-sheet behavior. Only needs a couple of confirm-specific
   tweaks: smaller width, higher z-index (it can open on top of an
   already-open modal, e.g. confirming a delete from inside an edit
   modal), and the message/typed-confirmation styling. */
.confirm-overlay { z-index: 400; }
.confirm-modal { max-width: 400px; }
.confirm-message { font-size: 14px; color: var(--text-secondary); line-height: 1.6; white-space: pre-line; }
.confirm-type-input { font-family: var(--font-mono); }

/* ─── Search bar ─────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-bar:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-glow); }
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 14px; flex: 1; min-width: 0;
}

/* iOS Safari auto-zooms the page on focus for any text input under 16px.
   Bumping just the mobile breakpoint keeps the tighter desktop sizing
   (14px/15px) while stopping that zoom-and-snap-back jump on phones. */
@media (max-width: 768px) {
  .form-input, .form-select, .form-textarea, .search-bar input {
    font-size: 16px;
  }
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--space-4) + var(--safe-top));
  right: var(--space-4);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  min-width: 280px;
  max-width: 380px;
  animation: slideInRight var(--transition-base) var(--ease-spring);
  border-left-width: 3px;
}
.toast.removing { animation: slideOutRight var(--transition-base) ease forwards; }
.toast-icon { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.toast-msg   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
.toast.info    { border-left-color: var(--blue); }

/* ─── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 34px; height: 34px; border-width: 3px; }

/* ─── Log stream ─────────────────────────────────────────────── */
.log-stream {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 12px;
  height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-line { display: flex; gap: var(--space-3); padding: 3px 0; border-bottom: 1px solid var(--border-subtle); }
.log-line:last-child { border-bottom: none; }
.log-time { color: var(--text-muted); flex-shrink: 0; }
.log-level { width: 50px; flex-shrink: 0; font-weight: 600; }
.log-msg { color: var(--text-secondary); flex: 1; word-break: break-word; }
.log-line.info  .log-level { color: var(--blue);   }
.log-line.warn  .log-level { color: var(--yellow); }
.log-line.error .log-level { color: var(--red);    }
.log-line.debug .log-level { color: var(--purple); }

/* ─── Drop zone ──────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--orange); background: var(--orange-glow2); }
.drop-zone .drop-icon { font-size: 48px; opacity: 0.35; display: block; margin-bottom: var(--space-3); }
.drop-zone p { font-size: 14px; margin-bottom: var(--space-2); color: var(--text-primary); }
.drop-zone .drop-hint { font-size: 12px; color: var(--text-muted); }
.drop-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  flex-wrap: wrap;
  position: relative;
}
/* "Showing X-Y of Z" — sits to the left of the page buttons on wide
   screens (absolute so it doesn't disturb the button row's centering),
   and just stacks above them once things get tight on mobile. */
.page-info {
  font-size: 12px;
  color: var(--text-muted);
  position: absolute;
  left: 0;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .page-info { position: static; width: 100%; text-align: center; margin-bottom: var(--space-2); }
}
.page-btn {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  min-width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.page-btn:hover, .page-btn.active {
  background: var(--gradient-brand);
  border-color: transparent;
  color: white;
}
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ─── Skeleton loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface2) 25%, var(--bg-surface3) 50%, var(--bg-surface2) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}
/* Same shimmer, but sized for a single line of text (a stat number, a
   sub-label) instead of a whole card — for places that show a static "—"
   placeholder while waiting on the first API response. The text itself is
   made transparent so only the shimmer bar shows; removing this class
   (done in JS once real data arrives) brings the text back instantly. */
.skel-line {
  display: inline-block;
  min-width: 70px;
  color: transparent !important;
  background: linear-gradient(90deg, var(--bg-surface2) 25%, var(--bg-surface3) 50%, var(--bg-surface2) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
}

/* ─── Divider ────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-4) 0; }

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; opacity: 0.35; margin-bottom: var(--space-4); }
.empty-state h3 { font-size: 15px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; margin-top: var(--space-2); }

/* ─── Callout banner ─────────────────────────────────────────────
   A colored, left-accented card used for "heads up" banners (next-code
   queue, bulk-action bar, payment-due notices, etc). Previously each page
   (recharge.html, phones.html, proxies.html) hand-rolled this same
   gradient+border combo inline with a different literal color every time.
   These four color variants cover every case seen across the app so far —
   add more only if a genuinely new color is needed. */
.callout-banner {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid;
  border-left-width: 4px;
}
.callout-green  { background: linear-gradient(135deg, rgba(34,197,94,.12) 0%, rgba(34,197,94,.04) 100%); border-color: rgba(34,197,94,.35); border-left-color: #22c55e; }
.callout-orange { background: rgba(251,146,60,.12); border-color: rgba(251,146,60,.4); border-left-color: #fb923c; }
.callout-red    { background: linear-gradient(135deg, rgba(239,68,68,.12) 0%, rgba(239,68,68,.06) 100%); border-color: rgba(239,68,68,.35); border-left-color: #ef4444; }
.callout-blue   { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.35); border-left-color: #3b82f6; }

/* ─── Alert / info box ───────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid;
  line-height: 1.5;
}
.alert-info    { background: var(--blue-bg);   color: var(--blue);   border-color: rgba(74,158,255,0.3); }
.alert-success { background: var(--green-bg);  color: var(--green);  border-color: rgba(46,204,113,0.3); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(245,166,35,0.3); }
.alert-error   { background: var(--red-bg);    color: var(--red);    border-color: rgba(240,71,71,0.3); }

/* ─── Mobile refinements ─────────────────────────────────────── */
@media (max-width: 768px) {
  .btn { min-height: 42px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; }
  .btn-icon { min-width: 42px; }

  /* Bottom-sheet modals — action buttons always reachable, no scrolling
     to the bottom needed.

     Structure: .modal becomes the fixed-height shell (it stops scrolling
     itself); .modal-body becomes the ONE scrolling region inside it;
     .modal-header stays pinned at the top; .modal-footer stays pinned
     at the bottom.

     Some pages put <form class="modal-body"> around EVERYTHING,
     including .modal-footer (so the footer is a descendant of the
     scrolling form, not a sibling of it). `position: sticky` handles
     that case — it pins the footer to the bottom of whichever ancestor
     is actually scrolling, which is .modal-body once the rule below
     makes it the real scroll container. `flex-shrink: 0` handles the
     simpler case where .modal-footer is a direct sibling of .modal-body. */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;            /* .modal is the scroll container — reliable everywhere */
    -webkit-overflow-scrolling: touch;
    padding: var(--space-4) var(--space-4) calc(var(--space-3) + var(--safe-bottom));
    transform: translateY(100%);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  /* grab handle */
  .modal::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: var(--border-strong);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-3);
  }
  /* Footer stays pinned to the bottom of the sheet while the form above it
     scrolls. `sticky` finds the nearest scrolling ancestor on its own
     (.modal here) even when .modal-footer is nested inside a plain
     <form class="modal-body"> — no flex restructuring needed. */
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-elevated);
    margin: var(--space-3) calc(-1 * var(--space-4)) 0;
    padding: var(--space-3) var(--space-4) 0;
  }

  .toast-container {
    top: calc(var(--space-3) + var(--safe-top));
    right: var(--space-3);
    left: var(--space-3);
  }
  .toast { min-width: unset; max-width: 100%; }

  .table th, .table td { padding: 11px 12px; }
}
