:root {
  /* Naater: Lapis (brand) + Lime (the "ready" moment) on Cloud, Midnight ink. */
  --brand: #3A41F2;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --ready: #C6F432;
  --ready-ink: #0F1035;
  --bg: #F5F4EF;
  --surface: #ffffff;
  --surface-2: #FAFAF7;
  --ink: #0F1035;
  --ink-2: #33355A;
  --muted: #6A6C86;
  --line: #E4E3EC;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --called: var(--ready);
  --called-ink: var(--ready-ink);
  --called-soft: #F1FAD2;
  --called-deep: #4A6100;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 16, 53, .06), 0 4px 16px rgba(15, 16, 53, .06);
  --shadow-lg: 0 10px 40px rgba(15, 16, 53, .14);
  --font: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
img { max-width: 100%; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: transform .06s ease, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 88%, #000); }
.btn-called { background: var(--called); color: var(--called-ink); border-color: transparent; }
.btn-called:hover { background: color-mix(in srgb, var(--called) 88%, #000); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-lg { min-height: 54px; font-size: 17px; padding: 0 24px; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; padding: 0; }

/* Forms */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
.input:focus { border-color: var(--brand); }
textarea.input { min-height: 88px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Cards & badges */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-called { background: var(--called-soft); color: var(--called-deep); border-color: transparent; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.dot.off { background: #ef4444; }

/* Toasts */
.toasts { position: fixed; inset-inline: 0; bottom: 20px; display: grid; justify-items: center; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { background: #0F1035; color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; transition: opacity .4s, transform .4s; max-width: calc(100vw - 32px); }
.toast-ok { background: var(--ok); }
.toast-error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(28,25,23,.45); display: grid; place-items: center; padding: 16px; z-index: 500; }
.modal { background: var(--surface); border-radius: 20px; padding: 24px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal h2 { margin: 0 0 12px; font-size: 20px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

.lang-btn { font-weight: 700; min-width: 44px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.biz-logo { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.code-digits { font-family: var(--font); font-weight: 800; letter-spacing: .18em; direction: ltr; unicode-bidi: isolate; }
