:root {
  --navy-900: #050f1d;
  --navy-800: #071a2e;
  --navy-700: #0b2545;
  --navy-600: #13345c;
  --teal: #2dd4bf;
  --teal-600: #14b8a6;
  --teal-700: #0f8f83;
  --blue: #3b82f6;
  --ink: #e8f1f8;
  --ink-dim: #9fb3c8;
  --line: rgba(159, 179, 200, .22);
  --danger: #f87171;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
html:has(body.visitor) { background: var(--navy-900); }
body.visitor {
  background-color: var(--navy-900);
  background-repeat: no-repeat;
  background-image:
    radial-gradient(1000px 600px at 85% -10%, rgba(45, 212, 191, .16), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(59, 130, 246, .12), transparent 60%),
    linear-gradient(180deg, var(--navy-800), var(--navy-900));
}
a { color: var(--teal); }
h1, h2 { line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.75rem, 6vw, 2.6rem); }
h2 { font-size: 1.3rem; }
code { background: rgba(0,0,0,.08); padding: 1px 5px; border-radius: 4px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--teal);
  box-shadow: 0 0 18px rgba(45, 212, 191, .55); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--teal); }
.brand-word { font-weight: 800; letter-spacing: .14em; font-size: 1.05rem; }
.brand-sub { font-size: .78rem; color: var(--ink-dim); border-left: 1px solid var(--line); padding-left: 10px; }

.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 18px 32px; flex: 1; }
.wrap.narrow { max-width: 460px; }
.wrap.wide { max-width: 1400px; }

.hero { padding: 18px 2px 22px; }
.hero-sm { padding-bottom: 14px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 700; color: var(--teal); margin: 0 0 10px; }
.accent { background: linear-gradient(90deg, var(--teal), #7dd3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--ink-dim); font-size: 1.05rem; margin: 0 0 16px; }
.lede strong { color: var(--ink); }
.product-chips { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.product-chips li { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: rgba(255,255,255,.03); font-weight: 600; }
.product-chips small { color: var(--ink-dim); font-weight: 400; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.dot-sp { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.dot-am { background: var(--teal); box-shadow: 0 0 10px var(--teal); }

.card { background: rgba(11, 37, 69, .72); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.35); backdrop-filter: blur(6px); }

.notice { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; }
.notice p { margin: 0; }
.notice-ok { border-color: rgba(45, 212, 191, .5); background: rgba(45, 212, 191, .1); }
.notice-err { border-color: rgba(248, 113, 113, .6); background: rgba(248, 113, 113, .1); }
.notice:focus { outline: none; }

/* form */
.form .field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.form label, .form legend { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 6px; padding: 0; }
.req { color: var(--teal); }
.form input[type=text], .form input[type=email], .form input[type=tel], .form input[type=password],
.form input:not([type]), .form select {
  width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  color: var(--ink); background: rgba(5, 15, 29, .7); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 13px 14px; min-height: 50px; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.form select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%), linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.form select option { color: #0b2545; background: #fff; }
.form input:focus, .form select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(45, 212, 191, .2); }
.hint { margin: 6px 0 0; font-size: .82rem; color: var(--ink-dim); }
.err { margin: 6px 0 0; font-size: .85rem; color: var(--danger); min-height: 0; }
.err:empty { display: none; }
.has-error input, .has-error select { border-color: var(--danger) !important; }
.is-hidden { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg { margin: 0 !important; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 50px; padding: 8px 6px;
  border: 1.5px solid var(--line); border-radius: 12px; background: rgba(5, 15, 29, .7); font-weight: 600; font-size: .92rem; transition: all .15s; }
.seg input:checked + span { border-color: var(--teal); background: rgba(45, 212, 191, .16); color: #fff; box-shadow: 0 0 0 3px rgba(45, 212, 191, .18); }
.seg input:focus-visible + span { box-shadow: 0 0 0 4px rgba(45, 212, 191, .35); }
.has-error .seg span { border-color: rgba(248, 113, 113, .6); }

.check { display: flex !important; gap: 12px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 2px 0 0; accent-color: var(--teal-600); }
.has-error .check span { color: #fecaca; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700;
  border-radius: 12px; padding: 12px 18px; min-height: 48px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: transform .05s, filter .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(90deg, var(--teal-600), var(--teal)); color: #04211e; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-block { width: 100%; min-height: 54px; font-size: 1.05rem; margin-top: 4px; }
.btn-ghost { background: transparent; border-color: var(--line); color: inherit; }
.fine { font-size: .82rem; color: var(--ink-dim); }
.center { text-align: center; }

/* watch */
.jump { display: flex; gap: 8px; flex-wrap: wrap; }
.jump a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.product { padding: 0; overflow: hidden; margin: 0 0 22px; scroll-margin-top: 12px; }
.player { background: #000; aspect-ratio: 16 / 9; }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.product-body { padding: 18px; }
.product-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.product-head h2 { margin: 0; font-size: 1.45rem; }
.duration { font-size: .8rem; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.tagline { color: var(--teal); font-weight: 600; margin: 6px 0 10px; }
.product-body p:last-child { color: var(--ink-dim); margin: 0; }

.prose h2 { font-size: 1.05rem; margin-top: 1.3em; }
.prose p { color: var(--ink-dim); }

.foot { display: flex; gap: 16px; justify-content: center; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); font-size: .8rem; color: var(--ink-dim); }

/* ---------------- admin (light, data-dense) ---------------- */
body.admin { background: #f3f6fa; color: #0f1f33; }
body.admin .topbar { background: var(--navy-800); color: var(--ink); }
body.admin .card { background: #fff; border-color: #dde5ee; box-shadow: 0 1px 2px rgba(15, 31, 51, .06); backdrop-filter: none; }
body.admin a { color: #0f766e; }
body.admin a.btn-primary { color: #04211e; }
body.admin .fine, body.admin .hint { color: #5b6b7f; }
body.admin .form input, body.admin .filters input, body.admin .filters select, body.admin .form select {
  background: #fff; color: #0f1f33; border: 1.5px solid #cfd9e4; }
body.admin .btn-ghost { border-color: #cfd9e4; color: #0f1f33; background: #fff; }
body.admin .notice { background: #fff8e6; border-color: #f3d58a; color: #5a4300; }
body.admin .notice-err { background: #fdecec; border-color: #f5b5b5; color: #8a1c1c; }
.admin-nav { display: flex; align-items: center; gap: 18px; font-size: .9rem; }
body.admin .admin-nav a, .linklike { color: var(--ink); text-decoration: none; }
.admin-nav form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
body.admin .wrap { padding-top: 22px; }

.dash-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.dash-head h1 { font-size: 1.7rem; margin: 0; }
.dash-head .fine { margin: 4px 0 0; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-export { background: #0f766e; color: #fff !important; letter-spacing: .03em; padding: 12px 22px; }
.btn-export:hover { background: #0d6660; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid #dde5ee; border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--navy-700); }
.stat-sp { border-top-color: var(--blue); }
.stat-am { border-top-color: var(--teal-600); }
.stat-both { border-top-color: #8b5cf6; }
.stat-label { font-size: .85rem; color: #5b6b7f; font-weight: 600; }
.stat-num { font-size: 2.3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .78rem; color: #5b6b7f; }

.filters { display: grid; grid-template-columns: 2.2fr repeat(5, 1fr) auto; gap: 12px; align-items: end; padding: 16px; margin-bottom: 12px; }
.filters label { display: block; font-size: .78rem; font-weight: 700; color: #5b6b7f; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.filters input, .filters select { width: 100%; font: inherit; font-size: .95rem; padding: 9px 10px; border-radius: 10px; min-height: 42px; }
.f-actions { display: flex; gap: 8px; }
.f-actions .btn { min-height: 42px; padding: 8px 14px; }

.table-wrap { padding: 0; overflow: auto; max-height: 70vh; }
table.leads { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .87rem; }
.leads th { position: sticky; top: 0; background: #0b2545; color: #fff; text-align: left; font-weight: 600; padding: 10px 12px; white-space: nowrap; z-index: 1; }
.leads td { padding: 9px 12px; border-bottom: 1px solid #edf1f5; vertical-align: top; }
.leads tbody tr:hover td { background: #f6fafc; }
.leads .empty { text-align: center; color: #5b6b7f; padding: 40px; }
.mono { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill-sp { background: #dbeafe; color: #1e40af; }
.pill-am { background: #ccfbf1; color: #115e59; }
.pill-both { background: #ede9fe; color: #5b21b6; }
.pager { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

.qr-card h1 { font-size: 1.6rem; }
.qr { width: 100%; max-width: 360px; height: auto; display: block; margin: 10px auto; }
.qr-url { white-space: normal; word-break: break-all; font-size: .9rem; }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
  .f-search { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .brand-sub { display: none; }
}
@media (max-width: 380px) {
  .seg span { font-size: .84rem; }
}
@media (min-width: 720px) {
  .card { padding: 28px; }
  .product { padding: 0; }
  .product-body { padding: 22px 26px 26px; }
}
@media print {
  .topbar, .no-print, .foot { display: none !important; }
  body.admin { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
