:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #121826;
  --muted: #5b6577;
  --border: #e2e6ee;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --ok: #0f7b3e;
  --ok-soft: #e4f6ec;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --danger: #c0262d;
  --danger-soft: #fdeaea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --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.55; 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(2rem, 4.5vw, 3.1rem); letter-spacing: -.03em; }
h2 { font-size: 1.45rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.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: 10px; 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)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; 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: #c5ccd8; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.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: 9px;
}
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 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #eef0f4; 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: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

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

.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: 9px; 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(580px, 100% - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog .dialog-body { padding: 22px; max-height: 85vh; overflow: auto; }

.testbar { background: #fff7d6; color: #5c4400; text-align: center; font-size: .82rem; padding: 6px 12px; border-bottom: 1px solid #f1df9f; }
.testbar a { color: inherit; font-weight: 700; }

/* ---------- marketing ---------- */
.site-header { background: rgba(255,255,255,.92); backdrop-filter: blur(6px); 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: 62px; gap: 12px; }
.logo { font-weight: 850; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -.03em; display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #22d3ee); display: inline-grid; place-items: center; color: #fff; font-size: .95rem; }
.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
@media (max-width: 760px) { .nav .nav-link { display: none; } }
.hero { padding: 76px 0 60px; background: radial-gradient(1200px 400px at 70% -10%, #e0e7ff 0, transparent 60%), radial-gradient(800px 300px at 0% 0%, #cffafe 0, transparent 60%); }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.hero .grad { background: linear-gradient(90deg, #4f46e5, #0891b2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section { padding: 60px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; color: var(--brand); margin-bottom: 6px; }
.feature { padding: 4px 0; }
.feature .icon { font-size: 1.5rem; margin-bottom: 6px; }
.feature h3 { margin-bottom: 4px; }
.price { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; }
.plan { display: flex; flex-direction: column; }
.plan ul { padding-left: 18px; color: var(--muted); flex: 1; }
.plan.featured { border: 2px solid var(--brand); position: relative; }
.plan.featured::before { content: "Most popular"; position: absolute; top: -12px; left: 20px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; counter-reset: s; }
.flow > div { counter-increment: s; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; }
.flow > div::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; margin-bottom: 8px; font-size: .85rem; }
.flow h3 { font-size: .98rem; margin-bottom: 2px; }
.flow p { font-size: .86rem; color: var(--muted); margin: 0; }
.site-footer { padding: 32px 0; color: var(--muted); font-size: .9rem; }
.site-footer a { color: var(--muted); }

/* ---------- app shell (dashboard/admin) ---------- */
.shell { display: grid; grid-template-columns: 236px 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; padding: 0 10px 6px; }
.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: 7px; font-weight: 500; }
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: rgba(255,255,255,.13); color: #fff; }
.sidebar .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px; }
.sidebar .count { float: right; background: #ef4444; color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 7px; font-weight: 800; }
.main { padding: 24px; min-width: 0; }
.main-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.banner { padding: 12px 16px; border-radius: 9px; margin-bottom: 12px; background: var(--warn-soft); color: #5c4400; }
.banner-danger { background: var(--danger-soft); color: #7a1512; }
.banner-info { background: var(--brand-soft); color: #312e81; }
.banner-ok { background: var(--ok-soft); color: #0b4f29; }
.menu-toggle { display: none; }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 25% 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: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #eef0f4; display: block; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.checklist p { margin: 0 0 8px; }

/* ---------- pay page ---------- */
.pay-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.pay-summary { background: #f1f3f9; padding: 48px clamp(16px, 5vw, 64px); }
.pay-form { padding: 48px clamp(16px, 5vw, 64px); background: #fff; }
.pay-amount { font-size: 2.2rem; font-weight: 800; margin: 6px 0 20px; }
@media (max-width: 820px) { .pay-wrap { grid-template-columns: 1fr; } .pay-summary, .pay-form { padding: 24px 16px; } }

/* ---------- mailbox ---------- */
.mail { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
.mail-list { max-height: calc(100vh - 160px); overflow: auto; padding: 0; }
.mail-item { display: block; width: 100%; text-align: left; padding: 12px 14px; border: none; border-bottom: 1px solid var(--border); background: none; cursor: pointer; font: inherit; }
.mail-item:hover, .mail-item.active { background: var(--brand-soft); }
.mail-view iframe { width: 100%; height: calc(100vh - 220px); border: 1px solid var(--border); border-radius: 9px; background: #fff; }
@media (max-width: 820px) { .mail { grid-template-columns: 1fr; } }

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