/* Katsub auth pages: sign-up, login, dashboard */
:root {
  color-scheme: light dark;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --text: #141a2a;
  --muted: #5b6478;
  --border: #dde2eb;
  --primary: #059669;
  --primary-strong: #047857;
  --primary-soft: #e6f6ef;
  --on-primary: #ffffff;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --focus: rgba(5, 150, 105, .35);
  --shadow: 0 12px 32px rgba(20, 26, 42, .08);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #121933;
    --surface-2: #19213f;
    --text: #e8ecf5;
    --muted: #9aa4bd;
    --border: #283255;
    --primary: #10b981;
    --primary-strong: #34d399;
    --primary-soft: rgba(16, 185, 129, .14);
    --on-primary: #04221a;
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .12);
    --focus: rgba(52, 211, 153, .35);
    --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
}
[hidden] { display: none !important; }
a { color: var(--primary-strong); }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 22px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
  margin: 8px 0 20px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-size: 18px; font-weight: 800;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}
@media (min-width: 480px) { .card { padding: 28px 28px; } }

h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.foot { text-align: center; color: var(--muted); font-size: 14px; margin: 20px 0 0; }

/* stepper */
.stepper {
  list-style: none; margin: 0 0 22px; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.stepper li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; position: relative; }
.stepper li::before {
  content: ""; position: absolute; top: 14px; left: calc(-50% + 18px); right: calc(50% + 18px);
  height: 2px; background: var(--border);
}
.stepper li:first-child::before { display: none; }
.stepper .dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 2px solid var(--border); background: var(--surface); color: var(--muted);
  position: relative; z-index: 1;
}
.stepper li.active { color: var(--text); font-weight: 600; }
.stepper li.active .dot { border-color: var(--primary); color: var(--primary-strong); box-shadow: 0 0 0 4px var(--focus); }
.stepper li.done .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.stepper li.done::before, .stepper li.active::before { background: var(--primary); }

/* forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.input {
  width: 100%; height: 50px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 12px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input.code { text-align: center; font-size: 26px; letter-spacing: .5em; font-weight: 700; padding-left: .5em; }
.field-error { color: var(--danger); font-size: 13px; margin: 6px 0 0; min-height: 0; }
.field-error:empty { display: none; }
.row-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 420px) { .row-2 { grid-template-columns: 1fr 1fr; } }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--primary-strong);
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 10px; cursor: pointer; border-radius: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 0 18px;
  font: inherit; font-weight: 700; font-size: 16px;
  border-radius: 12px; border: 1.5px solid transparent; cursor: pointer;
  background: var(--primary); color: var(--on-primary);
  transition: filter .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.link { background: none; border: 0; color: var(--primary-strong); width: auto; min-height: 0; padding: 6px 4px; font-weight: 600; font-size: 14px; }
.btn.link[disabled] { color: var(--muted); }
.btn + .btn { margin-top: 10px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 0 0 16px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid transparent;
}
.alert.success { background: var(--primary-soft); color: var(--primary-strong); }
.alert:empty { display: none; }

.actions-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions-row .btn + .btn { margin-top: 0; }
.small-muted { color: var(--muted); font-size: 13px; }

/* face verification */
.face-intro { text-align: center; }
.face-badge {
  width: 72px; height: 72px; border-radius: 50%; margin: 4px auto 14px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong);
}
.face-badge.warn-badge { background: #fff4db; color: #b45309; }
@media (prefers-color-scheme: dark) { .face-badge.warn-badge { background: rgba(251, 191, 36, .14); color: #fbbf24; } }
.tips { text-align: left; list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.tips svg { flex: 0 0 auto; color: var(--primary-strong); margin-top: 2px; }

.cam {
  position: relative; width: min(76vw, 300px); aspect-ratio: 1 / 1; margin: 6px auto 16px;
}
.cam video, .cam img {
  position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px);
  border-radius: 50%; object-fit: cover; transform: scaleX(-1);
  background: #000;
}
.cam svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.cam .ring-track { stroke: var(--border); }
.cam .ring-progress { stroke: var(--primary); transition: stroke-dashoffset .35s ease; }
.cam.bad .ring-track { stroke: #e0a100; }
.cam svg.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam svg.guide ellipse { stroke: rgba(255, 255, 255, .75); transition: stroke .2s; }
.cam.bad svg.guide ellipse { stroke: rgba(255, 196, 0, .9); }
.cam.good svg.guide ellipse { stroke: var(--primary); stroke-dasharray: none; stroke-width: 1.6; }
.cam-overlay {
  position: absolute; inset: 10px; border-radius: 50%;
  display: grid; place-items: center; text-align: center; padding: 24px;
  background: rgba(8, 12, 24, .62); color: #fff; font-weight: 600; font-size: 15px;
}
.cam-overlay .spinner { margin: 0 auto 10px; width: 28px; height: 28px; }
.cam .tick {
  position: absolute; right: 8%; bottom: 8%; width: 46px; height: 46px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center;
  border: 3px solid var(--surface);
}
.face-instruction { text-align: center; font-size: 19px; font-weight: 700; margin: 0 0 4px; min-height: 1.5em; }
.face-hint { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 14px; min-height: 1.4em; }
.face-hint.warn { color: #b45309; }
@media (prefers-color-scheme: dark) { .face-hint.warn { color: #fbbf24; } }
.chips { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips li {
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--border); color: var(--muted); background: var(--surface-2);
}
.chips li.current { border-color: var(--primary); color: var(--text); font-weight: 600; }
.chips li.done { background: var(--primary-soft); border-color: transparent; color: var(--primary-strong); }

.summary { list-style: none; margin: 0 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 6px; font-size: 14px; }
.summary li { display: flex; justify-content: space-between; gap: 12px; }
.summary li span:first-child { color: var(--muted); }
.summary li span:last-child { font-weight: 600; text-align: right; word-break: break-word; }
.ok-badge { color: var(--primary-strong); }

/* dashboard */
.profile { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 2px solid var(--primary); }
.kv { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: 14px; }
.kv li + li { border-top: 1px solid var(--border); }
.kv li span:first-child { color: var(--muted); }
.kv li span:last-child { font-weight: 600; text-align: right; word-break: break-word; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* admin */
.card.wide { max-width: 880px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-tabs a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border: 1.5px solid var(--border); }
.admin-tabs a.active { background: var(--primary-soft); color: var(--primary-strong); border-color: transparent; }
.admin-tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; text-align: center; }
.admin-h2 { font-size: 17px; margin: 26px 0 10px; }
.req { border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 14px; background: var(--surface-2); }
.req .kv { margin-bottom: 12px; background: var(--surface); }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: #000; display: block; }
.photos figcaption { text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.req-actions { display: flex; gap: 10px; justify-content: flex-end; }
.req-actions form { flex: 1 1 0; max-width: 220px; }
.req-actions .btn + .btn { margin-top: 0; }
.user-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
.user-row .avatar { width: 56px; height: 56px; flex: 0 0 auto; }
.status { font-weight: 700; text-transform: capitalize; }
.status-approved { color: var(--primary-strong); }
.status-rejected { color: var(--danger); }
.status-superseded { color: var(--muted); }
.admin-search { display: flex; gap: 8px; margin: 0 0 12px; }
.admin-search .input { flex: 1 1 auto; height: 44px; }
.admin-search .btn { width: auto; min-height: 44px; }
.req-actions.wrap { flex-wrap: wrap; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { width: auto; min-height: 36px; padding: 0 14px; font-size: 14px; }
.limit-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.limit-badge.blocked { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.kv.limits li { align-items: center; }
.kv.limits li > span:first-child { color: var(--text); text-align: left; min-width: 0; overflow-wrap: anywhere; }
.kv.limits li > span:last-child { flex: 0 0 auto; }
.clear-all { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.clear-all .btn { width: auto; }
.user-row > div { min-width: 0; overflow-wrap: anywhere; }

/* dashboard + services */
.topbar { width: 100%; max-width: 460px; display: flex; justify-content: space-between; align-items: center; margin: 0 0 6px; }
.topbar .brand { margin: 8px 0 12px; }
.topbar form { margin: 0; }
.dash { width: 100%; max-width: 460px; display: grid; gap: 16px; }
.card h2 { font-size: 18px; margin: 0 0 4px; }
.avatar.lg { width: 88px; height: 88px; }
.profile h1 { font-size: 20px; margin-bottom: 4px; }
.svc-list { display: grid; gap: 10px; margin-bottom: 16px; }
.svc { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.svc input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.svc:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.svc:focus-within { box-shadow: 0 0 0 4px var(--focus); }
.svc.off { opacity: .55; cursor: not-allowed; }
.svc-body { display: grid; gap: 2px; }
.svc-body small { color: var(--muted); font-size: 13px; }
.svc-meta { font-size: 13px; font-weight: 700; color: var(--primary-strong); margin-top: 4px; }
.svc.off .svc-meta { color: var(--muted); }
.app-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 14px; }
.app-row:first-of-type { border-top: 0; }
.app-main { min-width: 0; overflow-wrap: anywhere; }
.app-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill.wait { background: #fff4db; color: #b45309; border-color: transparent; }
.pill.info { background: #e8f0fe; color: #1d4ed8; border-color: transparent; }
.pill.ok { background: var(--primary-soft); color: var(--primary-strong); border-color: transparent; }
.pill.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
@media (prefers-color-scheme: dark) {
  .pill.wait { background: rgba(251, 191, 36, .14); color: #fbbf24; }
  .pill.info { background: rgba(96, 165, 250, .14); color: #93c5fd; }
}
.note { margin: 6px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }

/* apply flow */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-strong); margin: 0 0 6px; }
.fee-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-strong); margin: 0 0 16px; }
.fee-row strong { font-size: 18px; }
.notice-list { margin: 0 0 18px; padding-left: 22px; display: grid; gap: 10px; font-size: 15px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; margin: 0 0 14px; cursor: pointer; font-weight: 600; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
select.input { appearance: auto; }
.center { text-align: center; }
.btn.block { display: flex; width: 100%; margin: 6px auto 0; }
.alert.warn { background: #fff4db; color: #92400e; }
@media (prefers-color-scheme: dark) { .alert.warn { background: rgba(251, 191, 36, .12); color: #fbbf24; } }

/* modals */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 24, .55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
@media (min-width: 520px) { .modal { align-items: center; } }
.modal-card { position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border-radius: 18px; padding: 24px 20px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); text-align: center; animation: modal-in .18s ease-out; }
@keyframes modal-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h2 { font-size: 20px; margin: 0 0 6px; }
.modal-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.rule-list { text-align: left; margin: 12px 0 18px; padding-left: 20px; display: grid; gap: 10px; font-size: 15px; }
.rule-list li::marker { color: #b45309; }
.pay-options { display: grid; gap: 10px; margin: 14px 0 12px; text-align: left; }
.pay-option { display: flex; gap: 12px; align-items: center; width: 100%; padding: 14px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pay-option:hover { border-color: var(--primary); }
.pay-option:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.pay-option strong { display: block; font-size: 15px; }
.pay-option small { color: var(--muted); font-size: 13px; }
.po-icon { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong); font-size: 20px; font-weight: 800; }
.pay-option[disabled] { opacity: .7; }
.validate-form { text-align: left; margin-bottom: 12px; }
.validate-form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.pay-result { text-align: left; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.pay-result p { margin: 0 0 10px; }
.pay-result .btn { margin-top: 4px; }
.filter-chips { margin: 0 0 12px; }
.filter-chips a { font-size: 13px; padding: 6px 10px; }
.app-actions { display: grid; gap: 10px; }
.app-actions .textarea { min-height: 60px; }
.setting-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.setting-row .check { flex: 1 1 auto; margin: 0; }
.price-input { display: flex; align-items: center; gap: 6px; flex: 0 0 130px; }
.price-input .input { height: 48px; }

/* face capture guide */
.guide-art { display: flex; justify-content: center; margin: 4px 0 14px; }
.guide-art .ga-phone { fill: var(--surface-2); stroke: var(--border); stroke-width: 2; }
.guide-art .ga-notch { fill: var(--border); }
.guide-art .ga-body, .guide-art .ga-head { fill: var(--primary-soft); stroke: var(--primary-strong); stroke-width: 1.5; }
.guide-art .ga-feature { fill: var(--primary-strong); }
.guide-art .ga-smile { fill: none; stroke: var(--primary-strong); stroke-width: 1.5; stroke-linecap: round; }
.guide-art .ga-oval { fill: none; stroke: var(--primary); stroke-width: 2; stroke-dasharray: 4 3; }
.guide-art .ga-tick-bg { fill: var(--primary); }
.guide-art .ga-tick { fill: none; stroke: var(--on-primary); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.guide-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; text-align: left; }
.guide-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.guide-steps strong { display: block; font-size: 15px; }
.guide-steps small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.gs-icon { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong); }

/* RRR */
.rrr-box { margin: 14px 0 6px; padding: 16px 12px; border-radius: 14px; background: var(--primary-soft); border: 1.5px dashed var(--primary); }
.rrr-number { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 28px; font-weight: 800; letter-spacing: .04em; color: var(--primary-strong); white-space: nowrap; }
@media (max-width: 360px) { .rrr-number { font-size: 23px; } }
.test-flag { display: inline-block; margin: 4px 0 10px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fff4db; color: #b45309; }
@media (prefers-color-scheme: dark) { .test-flag { background: rgba(251, 191, 36, .14); color: #fbbf24; } }
.rrr-kv { margin: 10px 0 12px; text-align: left; }
.mono-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .05em; }
.rule-list.info li::marker { color: var(--primary); }
.modal-card .btn + .btn { margin-top: 10px; }
