/* Vatly — shared tokens & components */
@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-latin-ext.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plexmono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --pine: #0E3B2E;
  --pine-2: #15513F;
  --ledger: #2E7D5B;
  --ledger-title: #1F6F54;
  --paper: #F5F7F2;
  --sheet: #FFFFFF;
  --ink: #15211C;
  --ink-2: #4A5A52;
  --ink-3: #7A8A82;
  --grid: #DDE8E1;
  --grid-2: #EEF4F0;
  --hi: #FFE14D;
  --hi-soft: #FFF2CC;
  --stamp: #B93A27;
  --ok: #2E7D5B;
  --focus: #1C6CF2;

  --bg: var(--paper);
  --surface: var(--sheet);
  --text: var(--ink);
  --muted: var(--ink-2);
  --faint: var(--ink-3);
  --line: var(--grid);
  --line-2: var(--grid-2);

  --mint: #E4F2EA;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 20px;
  --shadow-sheet: 0 1px 0 rgba(14, 59, 46, .06), 0 12px 32px -14px rgba(14, 59, 46, .28);
  --shadow-card: 0 1px 2px rgba(14, 59, 46, .05), 0 14px 34px -20px rgba(14, 59, 46, .25);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}

*, *::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.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--hi); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Type */
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -.022em; font-weight: 700; text-wrap: balance; }
h1 { font-weight: 750; }
h2 { font-size: clamp(1.65rem, 3vw, 2.35rem); }
h3 { font-size: 1.12rem; letter-spacing: -.012em; }
p { margin: 0; }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--muted); max-width: 60ch; }
.num { font-variant-numeric: tabular-nums; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: 34px; }
.brand span { font-weight: 750; font-size: 1.3rem; letter-spacing: -.035em; }

/* Buttons */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem;
  border: 1px solid var(--b-bd); border-radius: 12px;
  background: var(--b-bg); color: var(--b-fg);
  font-weight: 600; font-size: .95rem; letter-spacing: -.005em; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(14, 59, 46, .06);
  transition: transform .18s var(--ease-out), background-color .18s, border-color .18s, box-shadow .18s;
}
.btn:hover { border-color: #B5C5BB; transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(14, 59, 46, .3); }
.btn:active { transform: translateY(0) scale(.985); box-shadow: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { --b-bg: var(--pine); --b-fg: #fff; --b-bd: var(--pine); box-shadow: 0 8px 18px -10px rgba(14, 59, 46, .6), inset 0 1px 0 rgba(255,255,255,.08); }
.btn-primary:hover { --b-bg: var(--pine-2); border-color: var(--pine-2); box-shadow: 0 10px 22px -10px rgba(14, 59, 46, .65); }
.btn-ghost { box-shadow: none; }
.btn-hi { --b-bg: var(--hi); --b-fg: var(--ink); --b-bd: var(--hi); }
.btn-hi:hover { border-color: var(--ink); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; }
.btn-ghost:hover { --b-bg: var(--line-2); border-color: transparent; }
.btn-danger { --b-fg: var(--stamp); }
.btn-danger:hover { border-color: var(--stamp); }
.btn-sm { min-height: 34px; padding: .35rem .8rem; font-size: .85rem; }
.btn-lg { min-height: 54px; padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* Forms */
.field { display: grid; gap: .35rem; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: .55rem .8rem;
  border: 1px solid #C9D7CE; border-radius: var(--r-m);
  background: var(--surface); color: var(--text);
  box-shadow: inset 0 1px 2px rgba(14, 59, 46, .04);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: #9AA8A0; }
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ledger); box-shadow: 0 0 0 3px rgba(46, 125, 91, .18); }
.input.mono { font-family: var(--mono); font-size: .92rem; }
.hint { font-size: .82rem; color: var(--faint); }
.form-error { color: var(--stamp); font-size: .9rem; font-weight: 550; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--pine); flex: none; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #C9D6CF; transition: background .2s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .3s var(--ease-out); }
.switch input:checked + i { background: var(--pine); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* Toasts */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .7rem; align-items: center; padding: .8rem 1rem; border-radius: 14px; background: var(--ink); color: #fff; font-size: .93rem; box-shadow: 0 14px 30px -10px rgba(0,0,0,.4); animation: toast-in .45s var(--ease-out); }
.toast.err { background: var(--stamp); }
.toast.ok::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--hi); flex: none; }
.toast.out { animation: toast-out .3s var(--ease-in-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal::before { content: ''; position: absolute; inset: 0; background: rgba(14, 33, 26, .45); backdrop-filter: blur(3px); animation: fade .25s; }
.modal-card { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 22px; padding: 1.75rem; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); animation: pop .4s var(--ease-out); }
.modal-card h3 { font-size: 1.35rem; margin-bottom: .5rem; padding-right: 2rem; }
.modal-close { position: absolute; top: .6rem; right: .6rem; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.steps-list { margin: 1rem 0 0; padding-left: 1.2rem; display: grid; gap: .55rem; }
.kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border: 1.5px solid var(--line); border-radius: 7px; background: var(--line-2); vertical-align: middle; }
.kbd svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* “Made by ibi apps” credit, same wording as the other ibi apps */
.made-by { font-size: .88rem; color: var(--muted); }
.made-by a, .app-foot a { color: var(--ledger); font-weight: 600; text-decoration: none; }
.made-by a:hover, .app-foot a:hover { text-decoration: underline; }
