/* ============================================================================
 * Dust Caution — Mountain Office design system
 * Aesthetic: papier chaud, encre profonde, un seul accent teal.
 * Serif éditorial pour les titres (Fraunces), grotesque distinctif (IBM Plex
 * Sans) pour l'UI. Sobre, posé, intentionnel.
 * ========================================================================= */

:root {
  /* Surfaces */
  --paper:          #FAF8F4;
  --paper-soft:     #F4F1EA;
  --surface:        #FFFFFF;
  --surface-soft:   #FBFAF7;

  /* Ink */
  --ink-900:        #161417;
  --ink-800:        #2A272C;
  --ink-700:        #44424A;
  --ink-500:        #6C6973;
  --ink-400:        #8E8B95;
  --ink-300:        #B6B3BB;

  /* Lines */
  --line:           #E8E4DD;
  --line-soft:      #F0EDE6;
  --line-strong:    #D0CBC0;

  /* Accent: teal sobre */
  --accent-900:     #0A3F44;
  --accent-700:     #0E5258;
  --accent-600:     #11646B;
  --accent-500:     #1A7E86;
  --accent-soft:    #E1ECEE;
  --accent-soft-2:  #D3E3E5;

  /* Status */
  --warm-700:       #7B4A0E;
  --warm-soft:      #F6EAD3;
  --danger-700:     #952121;
  --danger-500:     #B23535;
  --danger-soft:    #F7E4E2;
  --success-700:    #225A36;
  --success-soft:   #E2EEE5;
  --muted-soft:     #ECE9E3;

  /* Spacing scale (4 base) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  /* Shadows (whisper-soft) */
  --shadow-xs: 0 1px 0 rgba(24, 22, 26, 0.02);
  --shadow-sm: 0 1px 2px rgba(24, 22, 26, 0.04), 0 1px 0 rgba(24, 22, 26, 0.02);
  --shadow-md: 0 4px 18px rgba(24, 22, 26, 0.06), 0 1px 2px rgba(24, 22, 26, 0.04);
  --shadow-lg: 0 24px 60px rgba(24, 22, 26, 0.16), 0 4px 14px rgba(24, 22, 26, 0.08);

  /* Type — fonts système, sobres, performantes */
  --font-ui:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Motion */
  --easing: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
}

/* ----------------------------------------------------------------------------
 * Reset + base
 * ------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink-900);
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }

p { margin: 0; color: var(--ink-700); }

.muted { color: var(--ink-500); }
.small { font-size: 0.82rem; }
.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.error { color: var(--danger-700); font-size: 0.88rem; }
.empty {
  color: var(--ink-500);
  padding: var(--s-12) var(--s-4);
  text-align: center;
  font-size: 0.95rem;
}

::selection { background: var(--accent-soft); color: var(--ink-900); }

/* ----------------------------------------------------------------------------
 * Topbar
 * ------------------------------------------------------------------------- */

.topbar {
  background: rgba(250, 248, 244, 0.88);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-3) var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}
.brand {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-900);
}

/* ----------------------------------------------------------------------------
 * Page container
 * ------------------------------------------------------------------------- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-6) var(--s-16);
  display: grid;
  gap: var(--s-6);
}

@media (max-width: 640px) {
  .topbar-inner { padding: var(--s-3) var(--s-4); }
  .container { padding: var(--s-5) var(--s-4) var(--s-12); gap: var(--s-5); }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.1rem; }
}

/* ----------------------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  box-shadow: var(--shadow-xs);
}
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.card-header .eyebrow { margin-bottom: var(--s-1); }
.card-header h2 { margin: 0; }

@media (max-width: 640px) {
  .card { padding: var(--s-5); border-radius: var(--r-md); }
  .card-header { margin-bottom: var(--s-4); }
}

.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  border: 1px solid;
  font-size: 0.92rem;
  font-family: var(--font-ui);
}
.alert-error {
  background: var(--danger-soft);
  border-color: rgba(149, 33, 33, 0.18);
  color: var(--danger-700);
}

/* ----------------------------------------------------------------------------
 * Forms
 * ------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.field > span,
.field > label > span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-700);
  letter-spacing: -0.005em;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"] {
  display: block;
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  margin: 0;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  box-shadow: none;
  transition:
    border-color var(--t-fast) var(--easing),
    box-shadow var(--t-fast) var(--easing),
    background var(--t-fast) var(--easing);
}
input::placeholder { color: var(--ink-400); opacity: 1; }
input:hover { border-color: var(--ink-300); }
input:focus {
  outline: none;
  border-color: var(--accent-600);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[readonly] {
  background: var(--surface-soft);
  color: var(--ink-700);
  cursor: text;
}
input[readonly]:focus { box-shadow: none; border-color: var(--line-strong); }

/* Retirer les fleches/spinner sur input[type=number] (Safari, Chrome, Firefox) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* Create form layout : tout sur une ligne en desktop */
.create-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
  align-items: end;
}
.create-form-actions { display: flex; justify-content: stretch; }
.create-form-actions .btn {
  width: 100%;
  height: 44px;
  padding: 0 22px;
}

@media (min-width: 720px) {
  .create-form {
    grid-template-columns: minmax(120px, 1.1fr) minmax(160px, 1.7fr) minmax(90px, 0.9fr) auto;
    gap: var(--s-4);
  }
  .create-form-actions .btn { width: auto; }
}

/* ----------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--surface);
  --btn-border: var(--line-strong);
  --btn-color: var(--ink-900);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--btn-color);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--t-fast) var(--easing),
    border-color var(--t-fast) var(--easing),
    color var(--t-fast) var(--easing),
    box-shadow var(--t-fast) var(--easing),
    transform 80ms var(--easing);
}
.btn:hover:not(:disabled) {
  --btn-bg: var(--surface-soft);
  --btn-border: var(--ink-400);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: var(--r-xs); }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; border-radius: var(--r-xs); }

.btn-primary {
  --btn-bg: var(--accent-700);
  --btn-border: var(--accent-700);
  --btn-color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) {
  --btn-bg: var(--accent-900);
  --btn-border: var(--accent-900);
  --btn-color: #FFFFFF;
}

.btn-danger {
  --btn-bg: var(--surface);
  --btn-border: rgba(149, 33, 33, 0.4);
  --btn-color: var(--danger-700);
}
.btn-danger:hover:not(:disabled) {
  --btn-bg: var(--danger-700);
  --btn-border: var(--danger-700);
  --btn-color: #FFFFFF;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-color: var(--ink-500);
}
.btn-ghost:hover:not(:disabled) {
  --btn-bg: var(--surface-soft);
  --btn-border: var(--line);
  --btn-color: var(--ink-900);
}

.btn .icon { display: inline-flex; width: 14px; height: 14px; }
.btn-sm .icon { width: 12px; height: 12px; }

/* Icon-only button (utilisé pour le crayon) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  color: var(--ink-400);
  cursor: pointer;
  transition:
    background var(--t-fast) var(--easing),
    border-color var(--t-fast) var(--easing),
    color var(--t-fast) var(--easing),
    opacity var(--t-fast) var(--easing);
  opacity: 0;
}
tr:hover .icon-btn,
.icon-btn:focus-visible { opacity: 1; }
.icon-btn:hover {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--accent-700);
}
.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.icon-btn svg { display: block; width: 14px; height: 14px; }

@media (max-width: 640px) {
  .icon-btn { opacity: 1; } /* Pas de hover sur mobile, toujours visible */
}

/* ----------------------------------------------------------------------------
 * Link result (après création d'une caution)
 * ------------------------------------------------------------------------- */

.link-result {
  margin-top: var(--s-6);
  padding: var(--s-5);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--r-md);
}
.link-result-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-700);
  margin-bottom: var(--s-2);
}
.copy-row {
  display: flex;
  gap: var(--s-2);
  align-items: stretch;
}
.copy-row input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--surface);
  border-color: var(--accent-soft-2);
  padding: 9px 11px;
}
@media (max-width: 520px) {
  .copy-row { flex-direction: column; }
  .copy-row .btn { width: 100%; }
}

/* ----------------------------------------------------------------------------
 * Liste cautions — header (onglets + refresh)
 * ------------------------------------------------------------------------- */

.cautions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-5);
  min-height: 44px;
}
.tabs {
  display: flex;
  gap: var(--s-1);
  margin-bottom: -1px;
  flex: 1;
  min-width: 0;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  transition: color var(--t-fast) var(--easing), border-color var(--t-base) var(--easing);
  letter-spacing: -0.005em;
}
.tab:hover { color: var(--ink-900); }
.tab.is-active {
  color: var(--accent-700);
  border-bottom-color: var(--accent-700);
}
.tab:focus-visible {
  outline: none;
  border-bottom-color: var(--accent-700);
  color: var(--accent-700);
}
.tab .count {
  background: var(--paper-soft);
  color: var(--ink-500);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  min-width: 22px;
  border-radius: var(--r-full);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .count {
  background: var(--accent-soft);
  color: var(--accent-700);
}

#btn-refresh {
  margin-bottom: var(--s-1);
  flex-shrink: 0;
  color: var(--ink-500);
}
.refresh-icon {
  display: inline-flex;
  align-items: center;
  width: 14px;
  height: 14px;
  transition: transform 400ms var(--easing);
}
.refresh-icon svg { width: 14px; height: 14px; display: block; }
#btn-refresh.is-refreshing .refresh-icon { animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 540px) {
  .refresh-label { display: none; }
  #btn-refresh { padding: 6px 10px; }
}

/* ----------------------------------------------------------------------------
 * Toolbar : recherche + filtres par groupe
 * ------------------------------------------------------------------------- */

.cautions-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.search-input {
  width: 100%;
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.groupe-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-700);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--t-fast) var(--easing),
    border-color var(--t-fast) var(--easing),
    color var(--t-fast) var(--easing);
}
.chip:hover { border-color: var(--ink-400); background: var(--surface-soft); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.chip.is-active {
  background: var(--accent-700);
  border-color: var(--accent-700);
  color: #fff;
}

/* ----------------------------------------------------------------------------
 * Tableau cautions
 * ------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--s-2));
}
.cautions {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.cautions th,
.cautions td {
  padding: 14px var(--s-3);
  text-align: left;
  vertical-align: top;
}
.cautions thead th {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-500);
  border-bottom: 1px solid var(--line);
  padding-top: 10px;
  padding-bottom: 10px;
}
.cautions tbody tr {
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast) var(--easing);
}
.cautions tbody tr:last-child { border-bottom: none; }
.cautions tbody tr:hover { background: var(--surface-soft); }

.libelle-cell { min-width: 220px; max-width: 360px; }
.groupe-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent-700);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  padding: 2px 9px;
  border-radius: var(--r-full);
  margin-bottom: 5px;
}
.libelle-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.libelle-text {
  font-weight: 500;
  color: var(--ink-900);
  word-break: break-word;
}
.payeur {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--ink-500);
  word-break: break-word;
}

.amount-main {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 500;
  color: var(--ink-900);
}
.amount-sub {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
}

.date-cell {
  color: var(--ink-700);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.col-actions { white-space: nowrap; text-align: right; }
.col-actions .btn + .btn { margin-left: var(--s-2); }

/* ----------------------------------------------------------------------------
 * Badges statut
 * ------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.badge-en_attente {
  background: var(--warm-soft);
  color: var(--warm-700);
  border-color: rgba(123, 74, 14, 0.18);
}
.badge-bloquee {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(14, 82, 88, 0.2);
}
.badge-capturee {
  background: var(--success-soft);
  color: var(--success-700);
  border-color: rgba(34, 90, 54, 0.18);
}
.badge-annulee,
.badge-expiree {
  background: var(--muted-soft);
  color: var(--ink-500);
  border-color: var(--line-strong);
}

/* ----------------------------------------------------------------------------
 * Mobile : le tableau devient des cartes
 * ------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .cautions thead { display: none; }
  .cautions, .cautions tbody, .cautions tr, .cautions td { display: block; width: 100%; }
  .cautions tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-3);
    background: var(--surface);
  }
  .cautions tbody tr:hover { background: var(--surface); }
  .cautions tbody tr:last-child { margin-bottom: 0; }

  .cautions td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-2) 0;
    border-bottom: 1px dashed var(--line-soft);
    text-align: right;
  }
  .cautions td:last-child { border-bottom: none; }
  .cautions td:first-child {
    border-bottom: 1px solid var(--line);
    padding-bottom: var(--s-3);
    margin-bottom: var(--s-2);
  }
  .cautions td::before {
    content: attr(data-label);
    color: var(--ink-500);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    flex-shrink: 0;
    text-align: left;
    padding-top: 3px;
  }
  .libelle-cell { min-width: 0; max-width: none; }
  .libelle-cell::before { display: none; }
  .libelle-cell { text-align: left; }
  .libelle-row { justify-content: space-between; }
  .col-actions {
    flex-wrap: wrap;
    gap: var(--s-2);
    justify-content: flex-end;
  }
  .col-actions .btn { flex: 1; min-width: 100px; }
  .col-actions .btn + .btn { margin-left: 0; }
}

/* ----------------------------------------------------------------------------
 * Page Connexion
 * ------------------------------------------------------------------------- */

body.is-auth {
  background: var(--paper);
  min-height: 100vh;
}
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: var(--s-8);
  box-shadow: var(--shadow-sm);
}
.auth-card .eyebrow {
  display: block;
  margin-bottom: var(--s-2);
}
.auth-card h1 {
  margin-bottom: var(--s-1);
  font-size: 1.5rem;
}
.auth-card .muted { margin-bottom: var(--s-5); font-size: 0.92rem; }
.auth-card .field { margin-bottom: var(--s-3); }
.auth-card .btn-primary {
  width: 100%;
  margin-top: var(--s-4);
  padding: 11px 16px;
}

@media (max-width: 480px) {
  .auth-card { padding: var(--s-6); }
}

/* ----------------------------------------------------------------------------
 * Pages publiques (success / cancel)
 * ------------------------------------------------------------------------- */

body.is-public { background: var(--paper); min-height: 100vh; }
.public-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
}
.public-card {
  max-width: 500px;
  text-align: center;
  padding: var(--s-12) var(--s-8);
  box-shadow: var(--shadow-sm);
}
.public-card h1 {
  margin-bottom: var(--s-3);
  font-size: 1.85rem;
}
.public-card p {
  margin-bottom: var(--s-3);
  font-size: 1rem;
  line-height: 1.65;
}
.public-card p:last-child { margin-bottom: 0; }
.public-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto var(--s-5);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}
.public-icon.success { background: var(--success-700); }
.public-icon.cancel { background: var(--ink-500); }

/* ----------------------------------------------------------------------------
 * Modale
 * ------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 20, 23, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 160ms var(--easing);
}
.modal-dialog {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: popIn 200ms var(--easing);
}
.modal-dialog h3 {
  font-size: 1.25rem;
  margin-bottom: var(--s-2);
}
.modal-dialog > p {
  color: var(--ink-700);
  margin-bottom: var(--s-5);
  line-height: 1.55;
}
.modal-dialog .field { margin-bottom: var(--s-4); }
.modal-dialog .field:last-of-type { margin-bottom: 0; }
.modal-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  margin-top: var(--s-6);
}
@media (max-width: 540px) {
  .modal-dialog { padding: var(--s-6) var(--s-5); }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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