:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #eceef2;
  --ink: #16181d;
  --ink-2: #454b57;
  --muted: #878d99;
  --line: #e5e7ec;
  --accent: #4f5bd5;
  --accent-strong: color-mix(in srgb, var(--accent) 82%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, white);
  --on-accent: #ffffff;
  --sel: #1fa463;
  --sel-soft: #e3f5eb;
  --fav: #e5484d;
  --maybe: #5b6474;
  --maybe-soft: #eceef2;
  --ok: #1f8f57;
  --ok-soft: #e3f5eb;
  --warn: #b26b00;
  --warn-soft: #fff3df;
  --danger: #cc3d3d;
  --danger-soft: #fdeaea;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 18, 24, .06), 0 6px 24px rgba(16, 18, 24, .07);
  --shadow-lg: 0 20px 60px rgba(16, 18, 24, .22);
  --font: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --display: 'Frank Ruhl Libre', 'David Libre', Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.25; }
p { margin: 0 0 .8em; }

.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.ic.fill { fill: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { border-color: #cfd3da; background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2a2d35; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.accent:hover { background: var(--accent-strong); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13.5px; gap: 6px; }
.btn.small .ic { width: 17px; height: 17px; }
.btn.wa { color: #128c4b; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer; color: inherit;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(0, 0, 0, .05); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field small { color: var(--muted); font-size: 12.5px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[dir=ltr], .ltr { direction: ltr; text-align: left; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 0; user-select: none; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: #d3d7de; position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(-18px); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 1000;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 14.5px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); text-align: center;
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* modal */
.modal-wrap {
  position: fixed; inset: 0; z-index: 900; background: rgba(16, 18, 24, .45);
  display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s;
  backdrop-filter: blur(3px);
}
.modal-wrap.show { opacity: 1; }
.modal {
  width: min(460px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.98); transition: transform .25s var(--ease);
}
.modal.wide { width: min(920px, 100%); }
.modal-wrap.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 8px; }
.modal-head h3 { font-family: var(--display); font-size: 22px; }
.modal-body { padding: 8px 20px 16px; overflow: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; padding: 12px 20px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-screen { min-height: 100dvh; display: grid; place-items: center; }

.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
input[type=range] { accent-color: var(--accent); }
