/* =====================================================================
   PressFlow (Node.js) - sign-in pages and app shell
   Look of the Lumen reference: iris #5b55d9 with a teal end of the gradient,
   calm white form side, 8px radii, font Inter (self-hosted).
   ===================================================================== */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --brand: #5b55d9;
  --brand-600: #4b44bd;
  --brand-700: #3e3899;
  --brand-50: #f3f3ff;
  --brand-100: #e7e7ff;
  --accent: #1b8079;
  --accent-soft: #5fd3c6;
  --danger: #b42318;
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #eaecf0;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --ok: #15803d;   --ok-bg: #ecfdf3;
  --err: #b91c1c;  --err-bg: #fef3f2;
  --info: #4b44bd; --info-bg: #f3f3ff;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow-lg: 0 24px 60px rgba(21, 34, 56, .22);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--surface); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); font-weight: 500; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- split screen ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }

.hero { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 32px; padding: 48px; color: #fff;
  background: radial-gradient(900px 500px at 0 0, rgba(255, 255, 255, .14), transparent 60%),
              linear-gradient(150deg, var(--brand-700) 0, var(--brand) 55%, var(--accent) 120%); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12); pointer-events: none; }
.hero::before { width: 780px; height: 780px; right: -390px; bottom: -390px; background: rgba(255, 255, 255, .04); border-width: 80px; border-color: rgba(255, 255, 255, .05); }
.hero::after { width: 520px; height: 520px; right: -260px; bottom: -260px; border-width: 60px; border-color: rgba(255, 255, 255, .05); }
.hero > * { position: relative; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; letter-spacing: -.02em; color: #fff; }
.logo:hover { text-decoration: none; }
.logo img { width: 30px; height: 30px; }
.logo--dark { color: var(--text); }

.hero-body { margin: auto 0 0; max-width: 520px; }
.hero h1 { margin: 0 0 14px; font-size: 30px; font-weight: 600; line-height: 1.17; letter-spacing: -.025em; white-space: pre-line; }
.hero .lead { margin: 0; font-size: 16px; line-height: 1.65; opacity: .82; max-width: 470px; }
.hero-card { max-width: 460px; margin: 0 0 auto; padding: 20px; border-radius: 16px; background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(6px); }
.hero-card blockquote { margin: 0 0 16px; font-size: 16px; line-height: 1.6; }
.hero-card figcaption { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.hero-card figcaption strong { display: block; font-weight: 600; }
.hero-card figcaption span span { opacity: .8; }
.hero-card__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--accent); }
.hero-card__mark .icon { width: 18px; height: 18px; }
.facts-row { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; padding: 0; list-style: none; }
.facts-row b { display: block; font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.facts-row span { display: block; font-size: 13px; opacity: .75; }

/* ---------- form side ---------- */
.panel { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 24px 24px; background: var(--surface); }
.lang { position: absolute; top: 20px; right: 24px; display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.lang button { min-width: 42px; padding: 5px 10px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(21, 34, 56, .12); }
.lang button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.panel .mobile-logo { display: none; margin-bottom: 24px; }
.box { width: min(440px, 100%); display: flex; flex-direction: column; gap: 16px; margin: auto 0; }
.box h2 { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.box .sub { margin: -6px 0 6px; color: var(--text-2); }
.panel-foot { margin-top: 32px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.panel-foot a { color: var(--text-3); font-weight: 400; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
label { font-size: 14px; font-weight: 500; color: var(--text); }
.req { color: var(--danger); margin-left: 3px; }
.input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  font-size: 15px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: #98a2b3; }
.input:hover { border-color: #b8c2d0; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.input[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 3px #fde3e1; }
.with-toggle { display: flex; gap: 8px; }
.toggle-pw { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--text-2); }
.toggle-pw:hover { border-color: var(--brand); color: var(--brand); }
.toggle-pw:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.field-error { font-size: 13px; color: var(--err); }
.hint { font-size: 13px; color: var(--text-3); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin: 2px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-3); }
.rules li { display: flex; align-items: center; gap: 6px; }
.rules li::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px solid #b8c2d0; }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat; }

/* ---------- sign-in option (one-time / 365 days) ---------- */
.stay { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.stay legend { grid-column: 1 / -1; padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.stay-option { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 34px 12px 12px; border: 1px solid var(--border-strong);
  border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 400; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.stay-option:hover { border-color: var(--brand); }
.stay-option input { position: absolute; opacity: 0; pointer-events: none; }
.stay-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--bg); color: var(--text-2); }
.stay-icon .icon { width: 16px; height: 16px; }
.stay-text { display: grid; gap: 2px; min-width: 0; }
.stay-text strong { font-size: 14px; font-weight: 600; line-height: 1.3; }
.stay-text span { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.stay-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand); }
.stay-option:has(input:checked) .stay-icon { background: var(--brand); color: #fff; }
.stay-option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.stay-option::after { content: ""; position: absolute; top: 10px; right: 10px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: #fff; }
.stay-option:has(input:checked)::after { border: 5px solid var(--brand); }
.stay-state { margin-top: 6px !important; font-size: 13.5px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid rgba(0, 0, 0, .075);
  font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100), 0 0 0 1px var(--brand); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-primary { width: 100%; background: var(--brand); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--brand-600); }
.btn-soft { width: 100%; background: var(--brand-50); border-color: #d9d7fb; color: var(--brand-600); font-weight: 500; }
.btn-soft:hover:not([disabled]) { background: var(--brand-100); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); }
.btn-link { height: auto; padding: 0; border: 0; background: none; color: var(--brand); font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-link:hover:not([disabled]) { text-decoration: underline; }
.btn-link[disabled] { color: var(--text-3); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-soft .spinner, .btn-ghost .spinner { border-color: var(--brand-100); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.divider { display: flex; align-items: center; gap: 14px; color: var(--text-3); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.switch-line { margin: 2px 0 0; text-align: center; color: var(--text-3); font-size: 15px; }
.back-line { margin: 4px 0 0; text-align: center; font-size: 15px; }
.back-line a { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- messages ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 14.5px; line-height: 1.45; }
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--err-bg); color: var(--err); border: 1px solid #fecdca; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #abefc6; }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--brand-100); }

/* ---------- 6-digit code ---------- */
.code-hero { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--brand-50); color: var(--brand); }
.code-hero .icon { width: 26px; height: 26px; }
.code-inputs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.code-inputs input { width: 100%; height: 58px; padding: 0; border: 1px solid var(--border-strong); border-radius: 12px; text-align: center;
  font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface); }
.code-inputs input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.code-inputs.is-wrong input { border-color: var(--err); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.resend-line { display: flex; justify-content: center; gap: 6px; font-size: 14.5px; color: var(--text-3); }

/* ---------- Google Authenticator setup ---------- */
.mfa-steps { display: grid; gap: 14px; margin: 0; padding: 0 0 0 20px; color: var(--text-2); font-size: 14.5px; }
.mfa-steps li::marker { color: var(--brand); font-weight: 600; }
.mfa-steps strong { display: block; color: var(--text); font-weight: 600; }
.qr-card { display: flex; gap: 16px; align-items: center; margin-top: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); }
.qr-card img { flex: none; width: 160px; height: 160px; padding: 6px; border-radius: 10px; background: #fff; border: 1px solid var(--border); }
.qr-key { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; }
.qr-key code { padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--border); font: 600 14px/1.5 ui-monospace, Consolas, monospace; letter-spacing: .04em; word-break: break-all; color: var(--text); }
.qr-key .btn-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 13px; }
.qr-key .btn-link .icon { width: 15px; height: 15px; }
.qr-key small { color: var(--text-3); overflow-wrap: anywhere; }
.mfa-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.mfa-card > div { flex: 1 1 260px; }
.mfa-card h2 { margin: 0 0 4px; font-size: 18px; }
.mfa-card .btn { width: auto; }

/* ---------- registration dialog ---------- */
dialog.modal { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal::backdrop { background: rgba(21, 34, 56, .55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 6px; }
.modal-head h2 { margin: 0; font-size: 24px; }
.modal-head p { margin: 4px 0 0; color: var(--text-2); }
.modal-close { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--bg); cursor: pointer; color: var(--text-2); }
.modal-close:hover { background: var(--brand-50); color: var(--brand); }
.modal-close:focus-visible { outline: 2px solid var(--brand); }
.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 28px 26px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.plan { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); font-size: 13px; color: var(--text-3); }
.plan strong { display: block; color: var(--text); font-size: 14px; }

/* ---------- signed-in shell ---------- */
.app { min-height: 100vh; background: var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px; color: #fff;
  background: linear-gradient(110deg, var(--brand-700), var(--brand) 70%, var(--accent) 140%); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .lang { position: static; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); }
.topbar .lang button { color: rgba(255, 255, 255, .75); }
.topbar .lang button[aria-pressed="true"] { background: #fff; color: var(--brand-700); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; }
.user-chip small { display: block; font-size: 12.5px; opacity: .8; }
.topbar .btn-ghost { height: 38px; background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; font-size: 14px; }
.topbar .btn-ghost:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .08); }
.demo-banner { display: flex; align-items: center; gap: 10px; padding: 8px 28px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 500; }
.app-main { max-width: 1100px; margin: 0 auto; padding: 32px 28px; display: grid; gap: 20px; }
.card { padding: 26px 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.card h1 { margin: 0 0 6px; font-size: 26px; }
.card p { margin: 0; color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0; }
.fact { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.fact dt { font-size: 13px; color: var(--text-3); }
.fact dd { margin: 4px 0 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { padding: 40px 36px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 28px 24px 32px; gap: 20px; }
  .hero-body { margin: 0; }
  .hero h1 { font-size: 26px; }
  .hero-card, .facts-row { display: none; }
  .panel { padding: 72px 20px 24px; }
  .panel .lang { top: 16px; right: 16px; }
}
@media (max-width: 600px) {
  .grid-2, .plans, .stay { grid-template-columns: minmax(0, 1fr); }
  .code-inputs { gap: 6px; }
  .qr-card { flex-direction: column; align-items: stretch; }
  .qr-card img { align-self: center; }
  .code-inputs input { height: 52px; font-size: 22px; }
  .modal-head, .modal-body { padding-left: 20px; padding-right: 20px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .user-chip small, .user-chip .name { display: none; }
  .app-main { padding: 20px 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
