/* Postaki app and auth pages (sign-in, sign-up, 2FA, legal, /app/). Loads after site.css; tokens and rules: docs/design/DESIGN.md. */

/* ---------- page frame ---------- */
main { min-height: 60vh; }
.page { padding-block: clamp(32px, 6vw, 72px) clamp(48px, 8vw, 96px); }
.page > * + * { margin-top: var(--s-4); }
.page-title { font-size: var(--step-3); font-weight: 750; font-variation-settings: "FLAR" 100, "VOLM" 25; }
.page-subtitle { margin-top: var(--s-7); font-size: var(--step-2); font-weight: 720; font-variation-settings: "FLAR" 100, "VOLM" 20; }
.muted { color: var(--ink-soft); }
.list { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); max-width: 40rem; }
.list li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 56px; padding: 10px var(--s-5); border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
.list li.unread { font-weight: 700; }
.page code, .auth-card code { font-variant-numeric: tabular-nums; background: var(--carbon-50); padding: 2px 6px; border-radius: var(--r-chip); }

/* signed-in navigation under the header */
.app-nav { background: var(--paper); border-bottom: 1px solid var(--rule); }
.app-nav .wrap { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; }
.app-nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); font-weight: 600; text-decoration: none; color: var(--carbon-700); white-space: nowrap; border-bottom: 3px solid transparent; }
.app-nav a:hover { background: var(--carbon-50); color: var(--carbon-900); }

/* ---------- messages ---------- */
.messages { list-style: none; margin: var(--s-5) 0 0; padding: 0; display: grid; gap: var(--s-2); }
.message, .alert { padding: 12px 16px; border-radius: var(--r-control); background: var(--carbon-50); border: 1.5px solid var(--rule-strong); color: var(--ink); line-height: 1.45; }
.message--success { background: var(--ok-bg); border-color: var(--ok); color: #0f4d31; }
.message--warning, .message--error, .alert { background: var(--wait-bg); border-color: var(--wait); color: #5e3d00; }

/* ---------- legal documents ---------- */
.prose { max-width: 65ch; margin-inline: auto; background: var(--paper); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); padding: clamp(20px, 4vw, 48px); }
.prose h1 { font-size: var(--step-3); font-weight: 750; font-variation-settings: "FLAR" 100, "VOLM" 25; margin-bottom: var(--s-5); }
.prose h2 { font-size: var(--step-2); font-weight: 720; font-variation-settings: "FLAR" 100, "VOLM" 20; margin: var(--s-7) 0 var(--s-3); }
.prose h3 { margin: var(--s-5) 0 var(--s-2); }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--s-4); }
.prose li { margin-bottom: var(--s-2); }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.doc-meta { max-width: 65ch; margin: var(--s-5) auto 0; color: var(--ink-soft); font-size: var(--step--1); }

/* ---------- auth card ---------- */
.auth { padding-block: clamp(28px, 6vw, 72px) clamp(48px, 8vw, 96px); display: flex; flex-direction: column; align-items: center; gap: var(--s-5); }
.auth-card { width: 100%; max-width: 30rem; background: var(--paper); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); padding: clamp(20px, 5vw, 40px); }
.auth-card--wide, .auth--manage .auth-card { max-width: 40rem; }
.auth-title { font-size: var(--step-2); font-weight: 720; font-variation-settings: "FLAR" 100, "VOLM" 20; padding-bottom: var(--s-3); border-bottom: 1.5px solid var(--rule-strong); margin-bottom: var(--s-5); }
.auth-subtitle { font-size: var(--step-1); font-weight: 680; line-height: 1.3; margin: var(--s-5) 0 var(--s-3); }
.auth-text { color: var(--ink-soft); margin-bottom: var(--s-4); max-width: 65ch; }
.auth-card p { margin-bottom: var(--s-4); }
.auth-card ul { padding-left: 1.25em; }
.auth-rule { border: 0; border-top: 1px solid var(--rule); margin: var(--s-5) 0; }
.auth-links { display: flex; flex-wrap: wrap; gap: 0 var(--s-4); font-size: var(--step--1); }
.auth-links a { display: inline-flex; align-items: center; min-height: 44px; }
.manage-nav { width: 100%; max-width: 40rem; display: flex; flex-wrap: wrap; gap: 0 var(--s-4); }
.manage-nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* ---------- forms ---------- */
.form { display: grid; gap: var(--s-4); }
.field-row { display: grid; gap: 6px; }
.field-row label, .fieldset legend { font-size: var(--step--1); font-weight: 600; color: var(--carbon-700); }
.field-row input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .field-row select, .field-row textarea {
  width: 100%; min-height: 52px; padding: 10px 14px; font: inherit; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--rule-strong); border-radius: var(--r-control);
  transition: border-color .2s, box-shadow .2s;
}
.field-row input::placeholder { color: var(--ink-soft); opacity: .8; }
.field-row input:hover:not(:focus), .field-row select:hover:not(:focus) { border-color: var(--carbon-700); }
.field-row input:focus-visible, .field-row select:focus-visible, .field-row textarea:focus-visible { outline: 3px solid var(--carbon-600); outline-offset: 1px; border-color: var(--carbon-700); }
.has-error input:not([type=checkbox]):not([type=radio]) { border-color: var(--serial-red); }
/* Password show/hide eye (password-toggle.js adds the button; without JS the field stays plain) */
.pw-field { position: relative; }
.pw-field--js input { padding-inline-end: 52px; }
.pw-toggle {
  position: absolute; inset-block: 0; inset-inline-end: 0; width: 48px; min-width: 44px; min-height: 44px;
  display: grid; place-items: center; padding: 0; margin: 0; background: none; border: 0;
  border-radius: 0 var(--r-control) var(--r-control) 0; color: var(--ink-soft); cursor: pointer;
}
.pw-toggle:hover { color: var(--carbon-700); }
.pw-toggle:focus-visible { outline: 3px solid var(--carbon-600); outline-offset: -3px; color: var(--carbon-700); }
.pw-toggle[aria-pressed=true] { color: var(--carbon-700); }
.field-errors, .errorlist { color: var(--serial-red); font-size: var(--step--1); font-weight: 600; }
.errorlist, .field-errors ul { list-style: none; margin: 0; padding: 0; }
.field-errors--form { padding: 12px 16px; border: 1.5px solid var(--serial-red); border-radius: var(--r-control); }
.field-help { font-size: .8125rem; color: var(--ink-soft); line-height: 1.45; }
.field-help ul { margin: 4px 0 0; padding-left: 1.25em; }
.field-row--check { grid-template-columns: 24px 1fr; align-items: start; column-gap: 12px; }
.field-row--check .field-errors, .field-row--check .field-help { grid-column: 1 / -1; }
.field-row--check label { font-size: var(--step-0); font-weight: 500; color: var(--ink); min-height: 28px; padding-block: 2px; }
.field-row--check input[type=checkbox] { margin-top: 2px; }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; margin: 0; accent-color: var(--carbon-700); }
.fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s-3); min-inline-size: 0; }
.fieldset legend { padding: 0; margin-bottom: var(--s-2); }
.choice div div { display: grid; gap: var(--s-2); }
.choice label { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-size: var(--step-0); font-weight: 500; color: var(--ink); }
.form-actions, .btn-group { display: grid; gap: var(--s-3); margin-top: var(--s-2); }
.btn-group { margin-top: 0; }
.form-actions .btn, .btn-group .btn, .btn--provider { width: 100%; }
.provider-list { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-3); }
.auth-card a.btn { text-decoration: none; }
.auth-card a.btn--primary { color: var(--on-carbon); }
.btn--ghost:focus-visible, .btn--primary:focus-visible { outline: 3px solid var(--carbon-600); outline-offset: 3px; }

/* ---------- panels, tables, details ---------- */
.panel { padding-block: var(--s-3); border-top: 1px solid var(--rule); }
.panel:first-child { border-top: 0; }
.panel__actions { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: var(--s-2); }
.table-wrap { overflow-x: auto; margin-bottom: var(--s-4); }
.table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; overflow-wrap: anywhere; }
.table th { color: var(--carbon-700); font-weight: 700; }
.details { border-top: 1px solid var(--rule); padding-block: var(--s-2); }
.details summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 650; }
.doc-list { list-style: none; margin: 0; padding: 0 !important; }
.doc-list li { min-height: var(--tap); display: flex; align-items: center; border-bottom: 1px solid var(--rule); }
.doc-list li:last-child { border-bottom: 0; }

@media (min-width: 600px) {
  .form-actions { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
  .form-actions .btn:only-child { grid-column: 1 / -1; }
}
.auth-card .provider-list, .auth-card .panel__actions { padding: 0; }
.field-help a { display: inline-flex; align-items: center; min-height: 44px; }
.page > .list, .page > .page-title + *, .page > .page-subtitle + * { margin-top: var(--s-4); }
.manage-nav a { text-decoration: none; }
.manage-nav a:hover { text-decoration: underline; }
.app-nav .wrap { gap: 0; }
.app-nav a { padding: 0 var(--s-2); }
@media (min-width: 560px) { .app-nav a { padding: 0 var(--s-3); } }
