/* ═══ AgentIA — design system (monochrome noir & blanc) ═══ */

:root {
  /* Primitives — échelle de gris (les noms navy/gold/cream sont
     conservés pour la compatibilité des composants) */
  --navy-900: #0A0A0A;   /* noir profond : nav, bulles user, héros */
  --navy-800: #141414;
  --navy-700: #1F1F1F;
  --navy-600: #2E2E2E;
  --gold-600: #171717;   /* accent texte sur fond clair */
  --gold-500: #111111;   /* ACCENT : noir */
  --gold-400: #A3A3A3;   /* gris clair : icônes sur fond sombre */
  --gold-300: #D4D4D4;   /* gris pâle : badges sur fond sombre */
  --cream:    #F7F7F7;   /* fond de page */
  --cream-hi: #FCFCFC;
  --cream-lo: #EFEFEF;

  /* Statuts (fonctionnels uniquement) */
  --success: #059669;
  --warning: #D08700;
  --danger:  #DC2626;
  --info:    #2563EB;

  /* Sémantique */
  --bg: linear-gradient(168deg, var(--cream-hi) 0%, var(--cream) 55%, var(--cream-lo) 100%);
  --surface:   #FFFFFF;
  --surface-2: var(--cream-hi);
  --text-1: #0A0A0A;
  --text-2: rgba(10, 10, 10, 0.64);
  --text-3: rgba(10, 10, 10, 0.44);
  --border-1: rgba(10, 10, 10, 0.12);
  --border-2: rgba(10, 10, 10, 0.06);
  --accent: var(--gold-500);
  --accent-soft: rgba(10, 10, 10, 0.06);
  --accent-line: rgba(10, 10, 10, 0.30);
  --on-accent: #FFFFFF;
  --gold-grad: linear-gradient(135deg, var(--navy-600) 0%, var(--navy-900) 100%);

  --navy-surface: var(--navy-900);
  --on-navy-1: #FFFFFF;
  --on-navy-2: rgba(255, 255, 255, 0.72);
  --on-navy-3: rgba(255, 255, 255, 0.46);
  --on-navy-line: rgba(255, 255, 255, 0.12);
  --on-navy-fill: rgba(255, 255, 255, 0.07);

  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
  --elev-2: 0 4px 14px rgba(0, 0, 0, 0.08);
  --elev-3: 0 10px 28px rgba(0, 0, 0, 0.12);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --s8: 32px; --s10: 40px; --s12: 48px;
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --fs-36: clamp(26px, 3.4vw, 36px);

  --dur-1: 160ms;
  --dur-2: 220ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ─── Base ─── */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-1);
  background-color: var(--cream);
  background-image: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(10, 10, 10, 0.12); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-400); }

a { color: inherit; }
a, button, input, select, textarea {
  transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease,
    box-shadow 200ms ease, opacity 200ms ease;
}
button { cursor: pointer; font-family: inherit; }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

h1, h2, h3 { font-family: "Montserrat", sans-serif; color: var(--text-1); }
h1 { font-weight: 700; font-size: var(--fs-36); line-height: 1.1; letter-spacing: -0.025em; }
h2 { font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
h3 { font-weight: 600; font-size: 16px; letter-spacing: -0.015em; }

.num { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold-600);
}

.muted { color: var(--text-3); }
.sub { color: var(--text-2); font-size: 14px; }

/* ─── Animations ─── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fadeUp var(--dur-2) var(--ease) both; }
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ─── Layout ─── */

.container { max-width: 1080px; margin: 0 auto; padding: 0 var(--s5); }
.page { padding: var(--s8) 0 var(--s12); }
.page-head { margin-bottom: var(--s6); }
.page-head p { margin-top: var(--s1); }

/* ─── Navigation ─── */

.nav {
  background: var(--navy-surface);
  box-shadow: var(--elev-2);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 var(--s5);
  display: flex; align-items: center; gap: var(--s5);
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: var(--s3);
  text-decoration: none; color: var(--on-navy-1);
  font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 16px;
  letter-spacing: -0.015em;
}
.brand-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(145deg, var(--navy-700), var(--navy-900));
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold-400); font-size: 14px;
}
.nav-links { display: flex; gap: var(--s2); margin-left: var(--s4); flex: 1; }
.nav-links a {
  color: var(--on-navy-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 14px; border-radius: var(--r-pill);
}
.nav-links a:hover { color: var(--on-navy-1); background: var(--on-navy-fill); }
.nav-links a.active {
  color: var(--gold-300);
  background: var(--on-navy-fill);
  border: 1px solid var(--on-navy-line);
}
.nav-right { display: flex; align-items: center; gap: var(--s3); }
.credits-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: var(--r-pill);
  background: var(--on-navy-fill); border: 1px solid var(--on-navy-line);
  color: var(--gold-300); font-size: 12px; font-weight: 600;
}
.nav-user { color: var(--on-navy-3); font-size: 13px; }
.btn-logout {
  background: none; border: 1px solid var(--on-navy-line); color: var(--on-navy-2);
  font-size: 13px; padding: 5px 14px; border-radius: var(--r-pill);
}
.btn-logout:hover { color: var(--on-navy-1); background: var(--on-navy-fill); }

/* ─── Cartes ─── */

.card {
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-1);
  padding: var(--s6);
}
a.card { text-decoration: none; display: block; }
.card-hover:hover { border-color: var(--accent-line); box-shadow: var(--elev-2); }
.card-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.card-title { font-family: "Montserrat", sans-serif; font-weight: 600; font-size: 14px; }
.card-sub { font-size: 12px; color: var(--text-3); }

.pastille {
  flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(145deg, var(--navy-700), var(--navy-900));
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold-400);
}
.pastille svg { width: 16px; height: 16px; }
.pastille-lg { width: 46px; height: 46px; }
.pastille-lg svg { width: 22px; height: 22px; }

.grid { display: grid; gap: var(--s4); }
.grid-agents { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ─── Bandeau navy (héros) ─── */

.hero {
  border-radius: 16px;
  box-shadow: var(--elev-2);
  padding: var(--s8);
  color: var(--on-navy-1);
  background:
    radial-gradient(1100px 420px at 80% -80%, rgba(255, 255, 255, 0.14), transparent 60%),
    linear-gradient(150deg, var(--navy-800), var(--navy-900));
  margin-bottom: var(--s6);
}
.hero h1 { color: var(--on-navy-1); }
.hero .sub { color: var(--on-navy-2); }
.hero .eyebrow { color: var(--gold-400); }
.hero-stats { display: flex; gap: var(--s8); margin-top: var(--s5); flex-wrap: wrap; }
.hero-stat-label {
  font-family: "Montserrat", sans-serif; font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.10em; color: var(--on-navy-3);
}
.hero-stat-value {
  font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 32px;
  font-variant-numeric: tabular-nums;
  /* dégradé clair : lisible sur le héros noir */
  background-image: linear-gradient(135deg, #FFFFFF 0%, #A3A3A3 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ─── Boutons ─── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-pill);
  font-family: "Inter", sans-serif; font-weight: 600; font-size: 14px;
  padding: 10px 24px; min-height: 40px;
  border: none; text-decoration: none;
}
.btn-primary { background: var(--gold-grad); color: var(--on-accent); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--elev-3); }
.btn-primary:active { transform: translateY(0) scale(0.985); }
.btn-secondary {
  background: var(--surface); color: var(--text-1);
  border: 1px solid var(--border-1); box-shadow: var(--elev-1);
}
.btn-secondary:hover { border-color: var(--accent-line); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 16px; min-height: 32px; font-size: 13px; }

/* ─── Badges ─── */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
}
.badge-success {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}
.badge-neutral {
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border-1);
}
.badge-warning {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}
.badge-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
.badge-gold {
  color: var(--gold-600);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

/* ─── Formulaires ─── */

.field { margin-bottom: var(--s4); }
.field label {
  display: block; font-size: 13px; font-weight: 500; color: var(--text-1);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.input, textarea.input, select.input {
  width: 100%;
  border: 1px solid var(--border-1); border-radius: var(--r-sm);
  background: var(--surface);
  font-family: "Inter", sans-serif; font-size: 14px; color: var(--text-1);
  padding: 9px 12px; min-height: 40px;
}
.input::placeholder { color: var(--text-3); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 16px -6px rgba(0, 0, 0, 0.30);
}
textarea.input { resize: vertical; line-height: 1.5; }

.form-error {
  display: flex; align-items: center; gap: 8px;
  color: var(--danger); font-size: 13px; font-weight: 500;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: var(--s4);
}
.form-success {
  display: flex; align-items: center; gap: 8px;
  color: var(--success); font-size: 13px; font-weight: 500;
  background: color-mix(in srgb, var(--success) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: var(--s4);
}

/* ─── Page auth (login / register) ─── */

.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s6);
}
.auth-card { width: 100%; max-width: 400px; padding: var(--s8); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: var(--s3); margin-bottom: var(--s6); text-align: center; }
.auth-links { text-align: center; margin-top: var(--s5); font-size: 13px; color: var(--text-2); }
.auth-links a { color: var(--gold-600); font-weight: 500; }

/* ─── États vides ─── */

.empty {
  border: 1.5px dashed var(--border-1); border-radius: var(--r-lg);
  padding: var(--s10); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--s3);
}
.empty p { color: var(--text-2); max-width: 380px; }

/* ─── Tableaux ─── */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  font-family: "Montserrat", sans-serif; font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.10em; color: var(--text-3);
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border-1);
}
.table td {
  padding: 12px; font-size: 14px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: top;
}
.table tbody tr:hover { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; }

/* ─── Chat ─── */

.chat-layout { display: flex; flex-direction: column; height: calc(100vh - 60px); }
.chat-topbar {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--border-1);
}
.chat-topbar .spacer { flex: 1; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-messages {
  max-width: 780px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s8);
  display: flex; flex-direction: column; gap: var(--s3);
}
.bubble {
  max-width: 82%;
  padding: 10px 16px;
  border-radius: var(--r-lg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14.5px;
}
.bubble-user {
  align-self: flex-end;
  background: linear-gradient(150deg, var(--navy-700), var(--navy-900));
  color: var(--on-navy-1);
  border-bottom-right-radius: var(--s1);
}
.bubble-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border-1);
  box-shadow: var(--elev-1);
  border-bottom-left-radius: var(--s1);
}
.tool-chip {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--gold-600);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  padding: 3px 12px;
}
.tool-chip.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold-500);
  animation: typing-dot 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

.chat-inputbar {
  border-top: 1px solid var(--border-1);
  background: var(--surface);
  padding: var(--s4) var(--s5);
}
.chat-form {
  max-width: 780px; margin: 0 auto;
  display: flex; gap: var(--s3); align-items: flex-end;
}
.chat-form textarea {
  flex: 1; max-height: 160px;
  border: 1px solid var(--border-1); border-radius: var(--r-lg);
  padding: 10px 16px; font-family: "Inter", sans-serif; font-size: 14.5px;
  resize: none; line-height: 1.5;
}
.chat-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 16px -6px rgba(0, 0, 0, 0.30);
}

/* ─── Connecteurs ─── */

.connector-row { display: flex; flex-direction: column; gap: var(--s4); }
.connector-head { display: flex; align-items: center; gap: var(--s3); }
.connector-head .grow { flex: 1; }
.connector-form { border-top: 1px solid var(--border-2); padding-top: var(--s4); }
.connector-actions { display: flex; gap: var(--s2); align-items: center; }

/* ─── Divers ─── */

.row { display: flex; align-items: center; gap: var(--s3); }
.row .grow { flex: 1; }
.mt-2 { margin-top: var(--s2); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mb-4 { margin-bottom: var(--s4); }
.stack > * + * { margin-top: var(--s4); }
.gold-italic { font-style: italic; color: var(--gold-600); }

@media (max-width: 640px) {
  .nav-inner { gap: var(--s3); }
  .nav-user { display: none; }
  .hero { padding: var(--s6); }
  .bubble { max-width: 92%; }
}

/* ─── Canvas ─── */

.canvas-layout { display: flex; height: calc(100vh - 60px); overflow: hidden; }
.canvas-wrap { flex: 1; overflow: auto; position: relative; }
.canvas {
  position: relative;
  width: 2400px; height: 1600px;
  background-image: radial-gradient(rgba(10, 10, 10, 0.10) 1px, transparent 1px);
  background-size: 22px 22px;
}
.canvas-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.canvas-links path { pointer-events: stroke; cursor: pointer; }
.link-path {
  fill: none; stroke: var(--navy-900); stroke-width: 2.5; stroke-linecap: round;
}
.link-path:hover { stroke: var(--danger); }
.link-temp {
  fill: none; stroke: var(--text-3); stroke-width: 2; stroke-dasharray: 6 6; stroke-linecap: round;
}

.node {
  position: absolute;
  width: 176px;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-1);
  padding: var(--s3) var(--s4);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.node:hover { border-color: var(--accent-line); box-shadow: var(--elev-2); }
.node.dragging { cursor: grabbing; box-shadow: var(--elev-3); opacity: 0.92; z-index: 30; }
.node-head { display: flex; align-items: center; gap: var(--s2); }
.node-title { font-family: "Montserrat", sans-serif; font-weight: 600; font-size: 13px; }
.node-status { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; font-weight: 500; }
.node-status .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.node-status.on { color: var(--success); }
.node-status.on .dot { background: var(--success); }
.node-status.off { color: var(--text-3); }
.node-status.off .dot { background: var(--text-3); }
.node-status.warn { color: var(--warning); }
.node-status.warn .dot { background: var(--warning); }

.node-port {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--navy-900);
  cursor: crosshair;
}
.node-port:hover { background: var(--accent-soft); transform: translateY(-50%) scale(1.25); }
.node-port.right { right: -8px; }

.node-center {
  position: absolute;
  width: 128px; height: 128px;
  border-radius: 20px;
  background: linear-gradient(150deg, var(--navy-700), var(--navy-900));
  box-shadow: var(--elev-2);
  color: var(--on-navy-1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  z-index: 10;
}
.node-center:hover { box-shadow: var(--elev-3); }
.node-center.dragging { cursor: grabbing; opacity: 0.92; z-index: 30; }
.node-center .logo { width: 44px; height: 44px; color: #fff; }
.node-center .label {
  font-family: "Montserrat", sans-serif; font-weight: 600; font-size: 12px;
  color: var(--on-navy-2); max-width: 112px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center;
}

.palette {
  width: 280px; flex: none;
  background: var(--surface);
  border-left: 1px solid var(--border-1);
  overflow-y: auto;
  padding: var(--s5);
}
.palette h3 { margin-bottom: var(--s1); }
.palette > .sub { margin-bottom: var(--s4); }
.palette-item {
  display: flex; align-items: flex-start; gap: var(--s3);
  border: 1px solid var(--border-1); border-radius: var(--r-md);
  padding: var(--s3);
  margin-bottom: var(--s3);
  cursor: grab;
  background: var(--surface);
  user-select: none;
  -webkit-user-select: none;
}
.palette-item:hover { border-color: var(--accent-line); box-shadow: var(--elev-1); }
.palette-item .name { font-family: "Montserrat", sans-serif; font-weight: 600; font-size: 13px; }
.palette-item .desc { font-size: 12px; color: var(--text-3); line-height: 1.45; margin-top: 2px; }
.palette-empty { border: 1.5px dashed var(--border-1); border-radius: var(--r-md); padding: var(--s4); font-size: 12.5px; color: var(--text-3); text-align: center; }
.palette-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--border-2); }

.canvas-toast {
  position: fixed; right: 300px; bottom: 24px; z-index: 60;
  max-width: 420px;
  background: var(--navy-900); color: var(--on-navy-1);
  border-radius: var(--r-md); box-shadow: var(--elev-3);
  padding: 12px 18px; font-size: 13.5px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 250ms var(--ease), transform 250ms cubic-bezier(0.34, 1.3, 0.64, 1);
  pointer-events: none;
}
.canvas-toast.show { opacity: 1; transform: translateY(0); }
.canvas-toast.error { background: var(--danger); }

/* ─── Modale ─── */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 10, 10, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s5);
  opacity: 0; pointer-events: none;
  transition: opacity 150ms ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-3);
  padding: var(--s6);
  transform: scale(0.95);
  transition: transform 150ms var(--ease);
  max-height: 86vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.modal-head h3 { font-size: 18px; flex: 1; }
.modal-close {
  width: 44px; height: 44px; flex: none;
  background: none; border: none; border-radius: var(--r-sm);
  color: var(--text-3); font-size: 22px; line-height: 1;
}
.modal-close:hover { color: var(--text-1); background: var(--surface-2); }
.modal-actions { display: flex; gap: var(--s3); align-items: center; margin-top: var(--s5); }
