/* v4 additions: settings tabs, toasts, dialogs, search palette, banners, breadcrumbs, empty states, charts. */
.skip { position: absolute; left: -999px; top: 8px; background: var(--ocean); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
.push { margin-left: auto; }
kbd { font: 500 .66rem/1 var(--mono); padding: 3px 6px; border-radius: 6px; border: 1px solid currentColor; opacity: .7; letter-spacing: .04em; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 20px; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
.tabs a:hover { color: var(--ink); text-decoration: none; background: var(--hover); }
.tabs a.on { color: var(--ocean); border-bottom-color: var(--ocean); font-weight: 600; }
.tabs a.push { margin-left: auto; font-size: .85rem; }
.formbar { display: flex; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(0deg, var(--bg) 70%, transparent); z-index: 5; }

.crumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin: -6px 0 12px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ocean); }
.crumbs [aria-current] { color: var(--ink); font-weight: 500; }

.searchbtn { display: flex; align-items: center; gap: 10px; width: 100%; margin: 2px 0 6px; padding: 9px 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #cfdcf6; border-radius: 10px; }
.searchbtn:hover { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .3); }
.searchbtn svg { width: 16px; height: 16px; }
.searchbtn span { flex: 1; text-align: left; }
.side-help { font-size: .78rem; color: #9db9ea; padding: 0 6px; }
.mobilebar .iconbtn { margin-left: auto; }

#toasts { position: fixed; top: 16px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { position: relative; pointer-events: auto; margin: 0 !important; padding-right: 40px !important; background: var(--card) !important; box-shadow: 0 12px 32px rgba(10, 20, 40, .2); animation: toast-in 240ms cubic-bezier(.2, .8, .2, 1); }
.toast.out { opacity: 0; transform: translateX(16px); transition: all 200ms ease; }
.toast-x { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; color: inherit; opacity: .7; }
.toast-x svg { width: 15px; height: 15px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }

.modal { border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(5, 12, 30, .45); }
.modal::backdrop, .palette::backdrop { background: rgba(6, 14, 34, .55); backdrop-filter: blur(2px); }
.modal h2 { margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.palette { border: 0; padding: 0; background: transparent; width: min(640px, calc(100vw - 24px)); margin-top: 12vh; max-height: 72vh; color: var(--ink); overflow: visible; }
.pal-box { background: var(--card); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 30px 80px rgba(5, 12, 30, .5); overflow: hidden; }
.pal-field { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pal-field svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.pal-field input { border: 0 !important; box-shadow: none !important; padding: 4px 0 !important; font-size: 1.02rem; background: transparent; flex: 1; }
.pal-box ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.pal-head, .pal-empty { padding: 8px 12px; font: 500 .66rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.pal-item.on, .pal-item:hover { background: color-mix(in srgb, var(--ocean) 12%, transparent); }
.pal-type { font: 500 .62rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ocean); width: 64px; flex: none; }
.pal-main b { display: block; font-weight: 600; }
.pal-main small { display: block; color: var(--muted); }

.announce { display: flex; gap: 10px; align-items: center; padding: 10px 28px; font-weight: 500; border-bottom: 1px solid transparent; }
.announce svg { width: 18px; height: 18px; flex: none; }
.announce.info { background: color-mix(in srgb, var(--ocean) 11%, var(--card)); color: var(--ocean); border-color: color-mix(in srgb, var(--ocean) 22%, transparent); }
.announce.warning { background: color-mix(in srgb, var(--amber) 14%, var(--card)); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 28%, transparent); }
.announce.critical { background: color-mix(in srgb, var(--error) 13%, var(--card)); color: var(--error); border-color: color-mix(in srgb, var(--error) 28%, transparent); }

.empty { text-align: center; padding: 38px 16px 30px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--ocean) 11%, transparent); color: var(--ocean); }
.empty-icon svg { width: 26px; height: 26px; }
.empty b { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.empty p { max-width: 42ch; margin: 0 auto 14px; }

.copybtn { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.copybtn svg { width: 15px; height: 15px; }
.copybtn.done { color: var(--success); border-color: var(--success); }

button.busy { position: relative; color: transparent !important; pointer-events: none; }
button.busy::after { content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid; border-color: var(--on-accent) transparent var(--on-accent) transparent; animation: spin 700ms linear infinite; }
button:not(.primary).busy::after { border-color: var(--ink) transparent var(--ink) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; }
.chart .bar { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--ocean) 55%, transparent); transition: background var(--t); }
.chart .bar:hover { background: var(--ocean); }
.chart .bar.none { background: var(--line-strong); opacity: .5; }
.chart-axis { display: flex; justify-content: space-between; font: 500 .66rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.filterbox { max-width: 320px; margin-bottom: 14px; }
@media (max-width: 920px) { .announce { padding: 10px 16px; } .tabs a.push { display: none; } }

/* ---------- logo ---------- */
.brandmark img { display: block; height: auto; max-width: 100%; }
.brandmark.stack { flex-direction: column; align-items: flex-start; gap: 10px; padding: 2px 8px 18px; }
.brandmark.stack small { margin: 0; }
.auth-hero .brandmark.stack img { width: min(300px, 70vw); }
.mobilebar .brandmark img { width: 124px; }
.on-dark { display: none; }
:root[data-theme="dark"] .on-light { display: none; }
:root[data-theme="dark"] .on-dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .on-light { display: none; } :root:not([data-theme="light"]) .on-dark { display: block; } }
.r-title .rlogo { display: block; margin: 0 auto 12px; width: 150px; }
.r-title .rlogo img { width: 150px; height: auto; margin: 0 auto; }

/* ---------- system health ---------- */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 28px; }
.health-title { font: 500 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 10px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.health-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.health-row:last-child { border-bottom: 0; }
.health-line { display: flex; justify-content: space-between; gap: 12px; font-weight: 500; }
.health-line b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.health-line b.ok { color: var(--success); } .health-line b.warn { color: var(--amber); } .health-line b.bad { color: var(--error); } .health-line b.unknown { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--faint); }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 25%, transparent); }
.dot.bad { background: var(--error); box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 25%, transparent); }

/* ---------- help and guides ---------- */
.help { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; align-items: start; }
.help-toc { position: sticky; top: 16px; font-size: .88rem; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--card); }
.help-toc b { display: block; font: 500 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.help-toc ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.help-toc a { color: var(--ink); }
.help-toc a:hover { color: var(--ocean); }
.help-body { max-width: 78ch; line-height: 1.65; }
.help-body section { padding: 6px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 22px; scroll-margin-top: 16px; }
.help-body section:last-child { border-bottom: 0; }
.help-body h2 { margin: 0 0 10px; font-size: 1.35rem; }
.help-body h3 { margin: 20px 0 6px; font-size: 1.02rem; }
.help-body p, .help-body li, .help-body dd { color: var(--ink); }
.help-body ul, .help-body ol { padding-left: 22px; }
.help-body li { margin: 5px 0; }
.help-body .steps { list-style: none; counter-reset: s; padding-left: 0; }
.help-body .steps > li { counter-increment: s; position: relative; padding-left: 40px; margin: 12px 0; }
.help-body .steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ocean) 14%, transparent); color: var(--ocean); font: 600 .8rem/1 var(--mono); }
.help-body .note { margin: 14px 0; padding: 12px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ocean) 25%, transparent); background: color-mix(in srgb, var(--ocean) 8%, var(--card)); }
.help-body .note.warn { border-color: color-mix(in srgb, var(--amber) 35%, transparent); background: color-mix(in srgb, var(--amber) 11%, var(--card)); }
.help-body table.kv { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: .94rem; }
.help-body table.kv th, .help-body table.kv td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.help-body table.kv th { width: 30%; font-weight: 600; white-space: normal; }
.help-body .faq dt { font-weight: 600; margin-top: 14px; }
.help-body .faq dd { margin: 3px 0 0; }
.help-body .mono { font-family: var(--mono); font-size: .86em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 6px; border-radius: 6px; }
@media (max-width: 1000px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; } }
@media print {
    .side, .mobilebar, .tabs, .actions, .announce, #toasts, .skip { display: none !important; }
    .shell { display: block; } .content { margin: 0; }
    .help { display: block; } .help-toc { border: 0; padding: 0; margin-bottom: 16px; }
    .help-body { max-width: none; } .help-body section { break-inside: avoid-page; }
    body { background: #fff; color: #000; }
}

/* ---------- alert preferences, retention fields ---------- */
fieldset.alertprefs, fieldset.retention { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px 16px; margin: 0 0 14px; }
fieldset.alertprefs legend, fieldset.retention legend { font: 500 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0 8px; }
fieldset.alertprefs .indent { margin: 4px 0 0 30px; display: grid; gap: 4px; }
fieldset.retention .grid { margin-top: 4px; }

/* ---------- guided setup, accessibility ---------- */
.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; }
.req { color: var(--muted); font-weight: 400; }
.easy label { font-size: 1.02rem; font-weight: 600; }
.easy label.check { font-weight: 500; }
.easy input[type=text], .easy input[type=email], .easy input[type=number], .easy textarea, .easy select { font-size: 1.1rem; padding: 14px 14px; min-height: 52px; }
.easy .hint { font-size: .95rem; }
button.big, .btn.big { font-size: 1.1rem; padding: 15px 26px; min-height: 54px; }
.donelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.donelist li { display: flex; gap: 12px; align-items: flex-start; font-size: 1.02rem; line-height: 1.5; }
.donelist .mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.donelist li.bad .mark { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.donelist li.bad { font-weight: 600; }
:focus-visible { outline: 3px solid var(--ocean); outline-offset: 2px; }
#done-title:focus, #error-summary:focus { outline: none; }
.theme-float { display: flex; gap: 8px; align-items: center; }

.passkey-block { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.passkey-block button { width: 100%; }
.passkey-block h2 { margin-bottom: 8px; }

/* ---------- footer ---------- */
.legal { font-size: .78rem; line-height: 1.5; color: var(--muted); text-align: center; padding: 22px 16px 26px; }
.legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.legal a:hover { color: var(--ocean); }
.receipt .legal { padding: 14px 0 0; }
@media print { .legal { padding-top: 12px; } }
