/* Form Inspace — shared design tokens & components */
:root {
  --accent: #16794c;
  --accent-ink: #ffffff;
  --accent-strong: color-mix(in oklab, var(--accent) 82%, black);
  --accent-soft: color-mix(in oklab, var(--accent) 10%, white);
  --accent-softer: color-mix(in oklab, var(--accent) 5%, white);
  --accent-ring: color-mix(in oklab, var(--accent) 28%, transparent);

  --bg: #f6f6f2;
  --surface: #ffffff;
  --surface-2: #fafaf7;
  --ink: #15171c;
  --ink-2: #3b3f47;
  --muted: #646a74;
  --faint: #9aa0a9;
  --line: #e6e6e0;
  --line-2: #d9dad3;
  --danger: #c2410c;
  --danger-soft: #fff4ed;
  --ok: #15803d;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, .05);
  --shadow: 0 1px 2px rgba(20, 22, 26, .04), 0 8px 24px -12px rgba(20, 22, 26, .12);
  --shadow-lg: 0 2px 4px rgba(20, 22, 26, .04), 0 24px 48px -20px rgba(20, 22, 26, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ----------
   Designed to be pressed: one obviously-primary action per view (isolation effect),
   large thumb-sized targets (Fitts), a raised look that reads as pressable,
   instant tactile feedback on press, and a forward-pointing arrow that nudges on hover. */
.btn {
  --h: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--h);
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -.005em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s var(--spring), box-shadow .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .25s var(--spring); }
.btn:active { transform: scale(.97); transition-duration: .06s; }
.btn[disabled] { cursor: not-allowed; opacity: .55; }

.btn-primary {
  --h: 56px;
  padding: 0 26px;
  color: var(--accent-ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 55%),
    var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -2px 0 rgba(0,0,0,.14),
    0 1px 2px rgba(0,0,0,.08),
    0 10px 22px -10px color-mix(in oklab, var(--accent) 75%, black);
  overflow: hidden;
}
.btn-primary:hover {
  background:
    linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0) 55%),
    var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.25),
    inset 0 -2px 0 rgba(0,0,0,.14),
    0 2px 4px rgba(0,0,0,.08),
    0 16px 28px -12px color-mix(in oklab, var(--accent) 80%, black);
  transform: translateY(-1px);
}
.btn-primary:hover .arrow { transform: translateX(4px); }
.btn-primary:active {
  transform: translateY(1px) scale(.98);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.18), 0 2px 6px -2px color-mix(in oklab, var(--accent) 70%, black);
}
/* One-time light sweep to pull attention to the next action once a step is complete. */
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
}
.btn-primary.is-ready::after { animation: sweep 1.1s var(--ease) .15s 1; }
@keyframes sweep { to { transform: translateX(120%); } }

.btn-ghost {
  color: var(--ink-2);
  background: transparent;
  border: 1.5px solid var(--line-2);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--faint); color: var(--ink); }
.btn-ghost:hover .arrow-back { transform: translateX(-3px); }

.btn-soft { color: var(--accent-strong); background: var(--accent-soft); }
.btn-soft:hover { background: color-mix(in oklab, var(--accent) 16%, white); }

.btn-danger { color: var(--danger); background: transparent; border: 1.5px solid color-mix(in oklab, var(--danger) 30%, white); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { --h: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-icon { --h: 40px; width: 40px; padding: 0; border-radius: 11px; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading > * { opacity: 0; }
.btn.is-loading::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.textarea { min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: #c5c7bf; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.select {
  padding-right: 44px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23646a74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.select.is-placeholder { color: var(--faint); }
.select option { color: var(--ink); }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .input.is-invalid { border-color: var(--danger); background: var(--danger-soft); }

.label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 8px; color: var(--ink); }
.help { font-size: 13.5px; color: var(--muted); margin: -2px 0 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  font-size: 12.5px; font-weight: 600;
  border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.ok { background: #ecfdf3; color: #15803d; border-color: #c6f0d6; }
.badge.warn { background: #fff7e6; color: #a16207; border-color: #fde7b0; }
.badge.off { background: #f3f3f0; color: #646a74; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  pointer-events: auto;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .35s var(--spring);
}
.toast.err { background: #7c2d12; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

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

/* ---------- Searchable select (assets/select.js) ---------- */
.fi-select { position: relative; min-width: 0; }
.fi-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.fi-trigger { display: flex; align-items: center; text-align: left; cursor: pointer; gap: 8px; }
.fi-trigger .fi-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-trigger.is-placeholder .fi-value { color: var(--faint); }
.fi-trigger:disabled { cursor: not-allowed; opacity: .6; }
.fi-select.is-open .fi-trigger { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.fi-trigger.is-invalid { border-color: var(--danger); background-color: var(--danger-soft); }
.fi-pop {
  position: fixed; z-index: 90; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(20,22,26,.06), 0 22px 48px -16px rgba(20,22,26,.28);
  overflow: hidden; opacity: 0; transform: translateY(-4px) scale(.985); transform-origin: top center;
  transition: opacity .14s var(--ease), transform .18s var(--ease);
}
.fi-pop.is-up { transform-origin: bottom center; transform: translateY(4px) scale(.985); }
.fi-pop.is-in { opacity: 1; transform: none; }
.fi-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--faint); flex: none; }
.fi-search input { flex: 1; min-width: 0; height: 46px; border: 0; outline: none; background: transparent; font-size: 15px; color: var(--ink); }
.fi-search input::placeholder { color: var(--faint); }
.fi-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.fi-opt { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 15px; line-height: 1.3; color: var(--ink); }
.fi-opt span { flex: 1; min-width: 0; }
.fi-opt svg { flex: none; color: var(--accent); opacity: 0; }
.fi-opt.is-active { background: var(--accent-softer); background: color-mix(in oklab, var(--accent) 8%, white); }
.fi-opt.is-selected { font-weight: 650; }
.fi-opt.is-selected svg { opacity: 1; }
.fi-opt.is-disabled { opacity: .45; cursor: not-allowed; }
.fi-opt mark { background: color-mix(in oklab, var(--accent) 18%, white); color: inherit; border-radius: 3px; padding: 0 1px; }
.fi-empty { padding: 18px 14px 20px; text-align: center; color: var(--muted); font-size: 14px; }
