/* en.my main site + dashboards. Dark by default, light via [data-theme="light"]. */
:root {
  --bg: #0b0b0f; --bg2: #13131a; --surface: #17171f; --surface2: #1f1f2a; --line: #2a2a38;
  --text: #f2f2f5; --muted: #a1a1b5; --accent: #c6f135; --accent2: #ff4fd8; --on-accent: #0b0b0f;
  --danger: #ff5c6c; --ok: #3ddc97; --warn: #ffc247;
  --radius: 14px; --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f7f7f2; --bg2: #efefe8; --surface: #ffffff; --surface2: #f2f2ee; --line: #dedbd2;
  --text: #15151a; --muted: #5d5d6e; --on-accent: #0b0b0f; --shadow: 0 10px 30px rgba(0,0,0,.08);
  --danger: #c8102e; --ok: #0a7f4f; --warn: #9a6100;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
img { max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.1rem); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.container { width: min(1160px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(560px, 100% - 32px); margin-inline: auto; }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--text); font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer; transition: transform .15s, background .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); color: var(--text); border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* Cards & badges */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h3 { margin-top: 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface2); border: 1px solid var(--line); vertical-align: middle; }
.badge-vip, .badge-premium { background: linear-gradient(90deg, #ffd34d, #ff9f1c); color: #1a1200; border: 0; }
.badge-admin { background: var(--danger); color: #fff; border: 0; }
.badge-moderator { background: #6c8cff; color: #fff; border: 0; }
.badge-ok, .badge-published, .badge-active, .badge-visible, .badge-resolved { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: transparent; }
.badge-warn, .badge-pending, .badge-draft, .badge-open, .badge-reserved { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); border-color: transparent; }
.badge-danger, .badge-banned, .badge-hidden, .badge-blocked { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); border-color: transparent; }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
label .hint, .hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=tel], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font: 15px/1.4 var(--font); }
textarea { min-height: 100px; resize: vertical; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.input-group { display: flex; align-items: stretch; margin-top: 6px; }
.input-group span { display: flex; align-items: center; padding: 0 10px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px 0 0 10px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.input-group span:last-child { border-radius: 0 10px 10px 0; }
.input-group input { margin: 0; border-radius: 0; min-width: 0; }
.input-group input:first-child { border-radius: 10px 0 0 10px; }
.input-group input:last-child { border-radius: 0 10px 10px 0; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 40px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: .2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { left: 21px; background: var(--on-accent); }
.switch input:focus-visible + i { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Flash / notices */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.flash-success { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.flash-error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.flash-info { border-color: var(--line); background: var(--surface); }
.errors { padding: 12px 16px 12px 32px; border-radius: 12px; border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); margin-bottom: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface2); }
tr:last-child td { border-bottom: 0; }
td .row { gap: 6px; flex-wrap: nowrap; }
td form { display: inline; margin: 0; }

/* Tabs / filters */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.active, .tabs a:hover { background: var(--surface2); color: var(--text); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar input, .toolbar select { margin: 0; width: auto; min-width: 160px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.pagination .current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Stats & chart */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding: 8px 0; }
.chart .bar { flex: 1; height: var(--h); min-height: 2px; background: linear-gradient(to top, var(--accent), var(--accent2)); border-radius: 4px 4px 0 0; position: relative; }
.chart .bar span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); opacity: 0; }
.chart .bar:hover span { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }

/* Public header/footer */
.site-header { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { font-weight: 800; font-size: 1.3rem; text-decoration: none; letter-spacing: -.04em; display: flex; align-items: center; gap: 8px; }
.logo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.main-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.main-nav > a:not(.btn) { padding: 8px 12px; text-decoration: none; font-weight: 600; font-size: 15px; color: var(--muted); border-radius: 8px; }
.main-nav > a:not(.btn):hover, .main-nav > a[aria-current] { color: var(--text); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; font-size: 18px; }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; margin-left: auto; }
  .main-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 16px 20px; }
  .main-nav.open { display: flex; }
}
.site-footer { border-top: 1px solid var(--line); margin-top: 80px; padding: 40px 0; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
main.page { padding: 40px 0; min-height: 60vh; }
.ad { margin: 16px auto; text-align: center; max-width: 100%; overflow: hidden; }

/* Home */
.hero-home { padding: clamp(60px, 10vw, 130px) 0 60px; text-align: center; position: relative; overflow: hidden; }
.hero-home::before { content: ''; position: absolute; inset: -40% -10% auto; height: 120%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent2) 30%, transparent), transparent), radial-gradient(closest-side at 70% 40%, color-mix(in srgb, var(--accent) 25%, transparent), transparent); filter: blur(40px); z-index: -1; }
.hero-home h1 { font-size: clamp(2.6rem, 8vw, 5.6rem); letter-spacing: -.05em; }
.hero-home h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-home .lead { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.claim { display: flex; max-width: 520px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px; }
.claim span { padding: 0 4px 0 16px; align-self: center; color: var(--muted); font-weight: 600; white-space: nowrap; }
.claim input { border: 0; background: transparent; margin: 0; padding: 10px 4px; min-width: 0; font-weight: 600; }
.claim input:focus { outline: none; }
.claim:focus-within { outline: 2px solid var(--accent); }
.section { padding: 60px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .ico { font-size: 28px; }
.tpl-card { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .2s, border-color .2s; }
.tpl-card:hover { transform: translateY(-4px); border-color: var(--accent); color: inherit; }
.tpl-thumb { aspect-ratio: 4/3; position: relative; overflow: hidden; background: var(--bg2); }
.tpl-thumb iframe { width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0; border: 0; pointer-events: none; }
.tpl-meta { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl-meta p { margin: 0; font-size: 13px; color: var(--muted); }
.swatch { height: 100%; display: grid; place-items: center; font-size: 2rem; font-weight: 800; padding: 16px; text-align: center; }
.steps { counter-reset: s; }
.steps li { list-style: none; counter-increment: s; position: relative; padding-left: 48px; margin-bottom: 18px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.6em; }
.prose a { color: var(--accent); }

/* Auth */
.auth-card { max-width: 440px; margin: 40px auto; }
.auth-card h1 { font-size: 2rem; }

/* Dashboard layout */
.dash { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.dash-side { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.dash-side .logo { margin: 4px 8px 18px; }
.dash-side a.nav { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; }
.dash-side a.nav:hover { background: var(--surface); color: var(--text); }
.dash-side a.nav.active { background: var(--surface2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.dash-side .group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 12px 4px; }
.dash-side .side-foot { margin-top: auto; padding-top: 16px; display: flex; gap: 8px; align-items: center; }
.dash-main { padding: 24px clamp(16px, 3vw, 40px); min-width: 0; }
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-top h1 { font-size: 1.7rem; margin: 0; }
.dash-mobile-bar { display: none; }
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: fixed; inset: 0 30% 0 0; z-index: 80; transform: translateX(-105%); transition: transform .2s; height: 100%; }
  .dash-side.open { transform: none; box-shadow: var(--shadow); }
  .dash-mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 60; }
}
.page-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.page-row h3 { margin: 0; }
details.inline > summary { cursor: pointer; list-style: none; }
details.inline > summary::-webkit-details-marker { display: none; }
details.inline[open] > summary { margin-bottom: 12px; }
.comment-item { border-bottom: 1px solid var(--line); padding: 14px 0; }
.comment-item:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.serp { background: #fff; color: #202124; padding: 16px; border-radius: 12px; font-family: arial, sans-serif; }
.serp .u { color: #188038; font-size: 13px; }
.serp .t { color: #1a0dab; font-size: 19px; margin: 2px 0; }
.serp .d { color: #4d5156; font-size: 14px; }
.install-banner { position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 420px; margin: auto; z-index: 90; display: none; }
.install-banner.show { display: block; }

.chk-tags { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.chk-tags .check { font-size: 14px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag-chips a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.tag-chips a.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* WYSIWYG (wysiwyg.js), shared by the editor and admin pages */
.wy { border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); margin-top: 6px; font-weight: 400; }
.wy-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); }
.wy-bar button { min-width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; font-size: 13px; }
.wy-bar button:hover { background: var(--surface2); }
.wy-area { min-height: 140px; padding: 10px 12px; outline: none; font-size: 15px; max-height: 520px; overflow-y: auto; }
.wy-area:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.wy-area p { margin: 0 0 .6em; }

/* ---------- Starter wizard ---------- */
.wiz-progress { display: flex; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; counter-reset: wiz; }
.wiz-progress li { flex: 1; padding-top: 8px; border-top: 4px solid var(--line); font-size: .8rem; color: var(--muted); counter-increment: wiz; }
.wiz-progress li::before { content: counter(wiz) ". "; }
.wiz-progress li.on { border-color: var(--accent); color: var(--text); font-weight: 600; }
.wiz-step { border: 0; padding: 0; margin: 0 0 8px; }
.wiz-step legend { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; padding: 0; }
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.persona { position: relative; margin: 0; }
.persona input, .wiz-tpl input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.persona span { display: grid; gap: 6px; place-items: center; min-height: 96px; padding: 12px; text-align: center; font-weight: 600; border: 2px solid var(--line); border-radius: 12px; background: var(--surface2); }
.persona span b { font-size: 1.8rem; font-weight: 400; }
.persona input:checked + span, .wiz-tpl input:checked ~ .sw { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.persona input:focus-visible + span, .wiz-tpl input:focus-visible ~ .sw { outline: 3px solid var(--accent2); outline-offset: 2px; }
.wiz-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.wiz-tpl { position: relative; display: grid; gap: 4px; margin: 0; font-size: .85rem; }
.wiz-tpl .sw { display: grid; place-items: center; height: 70px; border-radius: 10px; border: 2px solid var(--line); font-size: 1.3rem; font-weight: 700; }
.wiz-tpl.suggested .nm::after { content: " · suggested"; color: var(--accent); font-weight: 600; }
.wiz-tpl.locked { opacity: .45; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
.wiz-nav [data-finish], .wiz-nav [data-next] { margin-left: auto; }

/* ---------- QR code ---------- */
.qr-card { display: grid; justify-items: center; }
.qr-box { background: #fff; padding: 10px; border-radius: 12px; line-height: 0; }
.qr-box svg { width: min(280px, 70vw); height: auto; }
