/* VERNO brand chrome for web screens (auth + cabinet).
 * Tokens are copied verbatim from the landing design authority
 * (verno-design/app/globals.css): palette, Arial stack, flat cards with
 * 1px borders (the landing uses no box shadows), pill buttons, 3px accent
 * focus ring, fade-in motion. Dark theme = the landing `.dark` palette,
 * applied via prefers-color-scheme (SSR pages carry no theme JS). */

:root {
  --background: #FAF6F0;
  --foreground: #2B2520;
  --muted: #8A7968;
  --accent: #C05621;
  --line: #E7DED4;
  --card: #FFFDFC;
  --ok-fg: #15803d;          /* landing "Truth" checklist green-700 */
  --radius-card: 20px;       /* landing rounded-[20px] cards */
  --radius-input: 12px;      /* landing rounded-xl inputs */
  --radius-pill: 999px;      /* landing rounded-full buttons/badges */
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #1C1917;
    --foreground: #E7E0D8;
    --muted: #A8A29E;
    --accent: #D97B4A;
    --line: #3B3530;
    --card: #25211F;
    --ok-fg: #4ade80;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button, a, input { font: inherit; }
a { color: var(--accent); }
a:hover { opacity: .85; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

main {
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
  animation: brand-fade-in .6s ease both;
}
@keyframes brand-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  main { animation: none; }
}

/* Brand header: "VERNO" wordmark + accent dot (landing header pattern).
 * white-space:nowrap keeps word+dot on one line on narrow viewports even
 * when the flex layout is lost (no-CSS fallback, odd engines, zoom). */
.brand {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin: 20px 0 4px;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.brand .dot { color: var(--accent); }

h1 {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 14px 0 10px;
}
h2 { font-size: 1.15rem; font-weight: 800; margin-top: 22px; }

/* Cards: flat, border-only (landing pattern), 20px radius. */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin: 10px 0;
}
.card p { margin: 8px 0; }
.card > p:first-child { margin-top: 0; }
.card > p:last-child, .card > form:last-child { margin-bottom: 0; }

.muted { color: var(--muted); font-size: 0.9rem; }

/* Badge: accent tint pill (landing "распознано" chip pattern). */
.badge {
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Semantic states: flat tints, no shadows. */
.warn {
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius-input);
  padding: 10px 14px;
}
.ok {
  background: color-mix(in srgb, var(--ok-fg) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--ok-fg) 35%, var(--line));
  border-radius: var(--radius-input);
  padding: 10px 14px;
}
.paused {
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

/* Deadline UX line (ttl / mailbox notes): quiet but findable. */
.ttl {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 6px 0 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 10px 0 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--accent); opacity: 1; }

form.inline { display: inline; }
label { display: inline-block; }

/* Inputs: landing form pattern (rounded-xl, line border, accent focus). */
input[type="text"], input[type="email"] {
  width: 100%;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  padding: 12px 16px;
  margin-top: 6px;
  outline: none;
}
input[type="text"]:focus, input[type="email"]:focus {
  border-color: var(--accent);
}
/* CSP style-src 'self': former inline widths of the acceptance/approval
 * forms live here (summary.html) — attribute selectors tie, later rule wins. */
input.field-55 { width: 55%; }
input.field-28 { width: 28%; }
input.field-90 { width: 90%; }

/* Media thumbnails (journal/summary photos, receipts): never overflow a
 * cheap phone viewport; the link opens the full-size original. */
.media-thumb { max-width: 100%; height: auto; }

input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}

/* Buttons: pill. Default = landing secondary (accent outline),
 * .primary = landing CTA (accent fill, white, bold). */
button, .btn {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 22px;
  min-height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
button:hover, .btn:hover { background: var(--accent); color: #fff; opacity: 1; }
button.primary, .btn.primary {
  background: var(--accent);
  color: #fff;
}
button.primary:hover, .btn.primary:hover { opacity: .9; background: var(--accent); color: #fff; }

table { width: 100%; border-collapse: collapse; }
td, th {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
th { color: var(--muted); font-size: 0.85rem; text-transform: none; }
.amount { text-align: right; white-space: nowrap; font-weight: 700; }

/* P14 D6 mobile polish — 48px taps, sticky bottom CTA (kept, re-tokened). */
.sticky-cta {
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--background) 92%, transparent);
  backdrop-filter: blur(6px);
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
@media (max-width: 640px) {
  main { padding: 12px; }
  nav a { display: inline-block; padding: 12px 8px 12px 0; }
  .amount { font-size: 1.1rem; font-weight: 700; }
  .sticky-cta { margin: 8px -12px -12px; padding: 8px 12px; }
}

/* --- Cabinet Stage 1 auth skin (v0 auth-shell language) -------------------
 * Centered 480px shell, big black title, flat card, Vera hint and pill CTA.
 * Tokens stay the landing palette; dark mode is the existing media query. */
.auth-shell { max-width: 480px; margin: 0 auto; }
.auth-head { text-align: center; margin: 8px 0 22px; }
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.auth-title {
  margin: 10px 0 0;
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -.045em;
}
.auth-lead {
  margin: 14px auto 0;
  max-width: 26rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}
.auth-card { padding: 20px 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-section { margin: 0; }
.auth-section .eyebrow { margin-bottom: 4px; }
.consent-box {
  max-height: 14rem;
  overflow-y: auto;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--background);
  font-size: .98rem;
  line-height: 1.5;
}
.consent-box:focus-visible { border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: 2px; }
.field-label { display: block; font-weight: 700; }
.field-error {
  display: flex;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--accent);
  font-weight: 700;
}
.vera-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.vera-hint img {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  object-fit: cover;
}
.vera-hint p { margin: 0; font-size: 1rem; line-height: 1.35; }
.auth-hints { color: var(--muted); font-size: .95rem; line-height: 1.5; }
.auth-hints p { margin: 4px 0; }
/* login-1 AC-1.3: opt-in «remember email» switch of the Jinja entry form. */
.auth-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .95rem;
  line-height: 1.4;
}
.auth-check-note { margin: 2px 0 0; }
.auth-submit { width: 100%; margin-top: 6px; text-align: center; }
.auth-secondary {
  width: 100%;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.auth-secondary:hover { color: var(--accent); background: transparent; opacity: 1; }
.auth-footnote { text-align: center; margin-top: 14px; }
.auth-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: 2rem;
  font-weight: 900;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; }

/* --- login-2 (ADR_LOGIN_V1 v2.1 §6): Telegram block on the entry card ---
 * Email stays the ONLY primary CTA; the TG button reuses the default
 * outline pill (secondary). Divider = quiet line with a label. The wait
 * panel is a calm spinner + honest actions (cancel / email fallback). */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 14px;
  color: var(--muted);
  font-size: .85rem;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}
.tg-hint { text-align: center; margin: 8px 0 0; }
/* login-2 gate: no-JS progressive enhancement (was an inline <style> in a
   <noscript> block - dead under CSP style-src 'self'). Server renders the
   no-js class on <html>; any script init removes it. */
.no-js .tg-login { display: none; }

.tg-wait { text-align: center; padding: 8px 0; }
.tg-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-top-color: var(--accent);
  animation: tg-spin 1s linear infinite;
}
@keyframes tg-spin { to { transform: rotate(360deg); } }
.tg-wait-title {
  margin: 14px 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.tg-wait-body { margin: 0; color: var(--muted); line-height: 1.5; }
.tg-wait-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
}
.tg-wait-actions .btn { width: 100%; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .tg-spinner { animation: none; }
}
@media (max-width: 380px) {
  .auth-title { font-size: 1.8rem; }
  .auth-card { padding: 16px; }
  .vera-hint { padding: 10px 12px; }
}
