:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #14171f;
  --muted: #5d6675;
  --border: #e3e6eb;
  --brand: #1f6feb;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0fe;
  --ok: #137333;
  --ok-soft: #e6f4ea;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --danger: #c5221f;
  --danger-soft: #fce8e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -.02em; }
h2 { font-size: 1.4rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(460px, 100% - 32px); margin-inline: auto; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stack > * + * { margin-top: 12px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #c9ced6; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.05); border-color: var(--brand); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; }

label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: auto; margin-right: 6px; }
input[type=color] { padding: 2px; height: 38px; }
.check { display: flex; align-items: center; font-weight: 500; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: capitalize; background: #eef0f3; color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--brand-soft); color: var(--brand); }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

.stat { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; transition: .2s; z-index: 1000; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }

dialog { border: none; border-radius: var(--radius); padding: 0; width: min(560px, 100% - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog .dialog-body { padding: 20px; max-height: 80vh; overflow: auto; }

/* ---------- marketing ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
@media (max-width: 720px) { .nav .nav-link { display: none; } }
.hero { padding: 72px 0 56px; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 620px; }
.section { padding: 56px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.feature h3 { margin-bottom: 4px; }
.price { font-size: 2rem; font-weight: 800; }
.plan.featured { border: 2px solid var(--brand); }
.plan ul { padding-left: 18px; color: var(--muted); }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; padding-left: 40px; position: relative; margin-bottom: 16px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; }
.site-footer { padding: 32px 0; color: var(--muted); font-size: .9rem; }
.site-footer a { color: var(--muted); }
.legal { max-width: 760px; }
.legal h2 { margin-top: 1.6em; }

/* ---------- app shell (dashboard/admin) ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #cbd5e1; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { color: #fff; display: block; padding: 0 10px 4px; }
.sidebar .biz-name { padding: 0 10px 16px; font-size: .85rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar a { display: block; color: #cbd5e1; text-decoration: none; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px; }
.main { padding: 24px; min-width: 0; }
.main-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; background: var(--warn-soft); color: #5c4400; }
.banner-danger { background: var(--danger-soft); color: #7a1512; }
.banner-info { background: var(--brand-soft); color: #0b3d91; }
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px; }
}
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eef0f3; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

@media print {
  .no-print, .sidebar, .site-header, .site-footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
