/* ==================================================================
   RevoTwo app foundation: base type, shell, shared components.
   Feature styles live in their own files (inbox.css, perf.css, ...)
   and may only add or specialise. Tokens: tokens.css.
   ================================================================== */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body.rv {
    margin: 0; min-height: 100vh; background: var(--rv-paper); color: var(--rv-ink);
    font-family: var(--rv-font); font-size: 15px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    scrollbar-color: var(--rv-border-strong) transparent;
}
::selection { background: color-mix(in srgb, var(--rv-accent) 20%, transparent); }
h1, h2, h3 { font-family: var(--rv-font-display); font-weight: 700; letter-spacing: -.022em; line-height: 1.15; margin: 0; }
h1 { font-size: 1.6rem; text-wrap: balance; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--rv-accent-dark); text-underline-offset: 3px; }
a:hover { color: var(--rv-ink); }
img, svg { max-width: 100%; }
code, .rv-mono { font-family: var(--rv-font-mono); font-size: .86em; }
.rv-muted { color: var(--rv-ink-soft); }
.rv-faint { color: var(--rv-ink-faint); }
.rv-small { font-size: .86rem; }
.rv-num { font-variant-numeric: tabular-nums; }
.rv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rv-stack { display: grid; gap: 20px; }
.rv-stack-tight { display: grid; gap: 12px; }
.rv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-spacer { flex: 1 1 auto; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--rv-accent); outline-offset: 2px;
}

/* --- buttons ---------------------------------------------------------- */
.rv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: .5rem 1rem;
    border-radius: var(--rv-btn-radius); border: 1px solid var(--rv-border-strong); background: var(--rv-surface); color: var(--rv-ink);
    font: inherit; font-size: .9rem; font-weight: 600; letter-spacing: -.005em; text-decoration: none; cursor: pointer; white-space: nowrap;
    box-shadow: var(--rv-shadow-sm);
    transition: background-color var(--rv-dur) var(--rv-ease), border-color var(--rv-dur) var(--rv-ease), color var(--rv-dur) var(--rv-ease);
}
.rv-btn svg { flex: none; }
.rv-btn:hover { background: var(--rv-surface-sunk); color: var(--rv-ink); }
.rv-btn-primary {
    background: var(--rv-accent); border-color: var(--rv-accent); color: var(--rv-accent-contrast);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--rv-accent) 35%, transparent), inset 0 1px 0 color-mix(in srgb, var(--rv-accent-contrast) 14%, transparent);
}
.rv-btn-primary:hover { background: var(--rv-accent-dark); border-color: var(--rv-accent-dark); color: var(--rv-accent-contrast); }
.rv-btn-danger { color: var(--rv-danger); border-color: color-mix(in srgb, var(--rv-danger) 40%, var(--rv-border)); }
.rv-btn-danger:hover { background: var(--rv-danger-soft); color: var(--rv-danger); }
.rv-btn-success { background: var(--rv-success); border-color: var(--rv-success); color: #fff; }
.rv-btn-success:hover { background: color-mix(in srgb, var(--rv-success) 85%, #000); color: #fff; }
.rv-btn-sm { min-height: 34px; padding: .35rem .8rem; font-size: .86rem; border-radius: var(--rv-radius-sm); }
.rv-btn-lg { min-height: 48px; padding: .6rem 1.3rem; font-size: 1rem; }
.rv-btn-ghost { border-color: transparent; background: none; box-shadow: none; color: var(--rv-ink-soft); }
.rv-btn-ghost:hover { background: var(--rv-surface-sunk); }
.rv-btn:disabled, .rv-btn[aria-disabled="true"] { opacity: .55; cursor: default; box-shadow: none; pointer-events: none; }
.rv-btn-block { width: 100%; }
.rv-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0;
    border-radius: var(--rv-radius-sm); background: none; color: var(--rv-ink-faint); cursor: pointer;
    transition: background-color var(--rv-dur) var(--rv-ease), color var(--rv-dur) var(--rv-ease);
}
.rv-icon-btn:hover { background: var(--rv-surface-sunk); color: var(--rv-ink); }
.rv-inline-form { display: inline; margin: 0; }

/* --- forms ----------------------------------------------------------- */
.rv-input, .rv-select, .rv-textarea {
    width: 100%; min-height: 40px; padding: .45rem .8rem; border-radius: var(--rv-radius-sm); border: 1px solid var(--rv-border-strong);
    background: var(--rv-surface); color: var(--rv-ink); font: inherit; font-size: .9rem;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--rv-ink) 4%, transparent);
    transition: border-color var(--rv-dur) var(--rv-ease), box-shadow var(--rv-dur) var(--rv-ease);
}
.rv-textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.rv-textarea.is-code { font-family: var(--rv-font-mono); font-size: .82rem; min-height: 320px; }
.rv-select { padding-right: 2rem; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center; }
.rv-select.is-auto { width: auto; }
.rv-input::placeholder, .rv-textarea::placeholder { color: var(--rv-ink-faint); }
.rv-input:focus, .rv-select:focus, .rv-textarea:focus { border-color: var(--rv-accent); box-shadow: var(--rv-ring); outline: none; }
.rv-label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 6px; }
.rv-help { margin-top: 6px; font-size: .8rem; color: var(--rv-ink-faint); }
.rv-field { display: block; }
.rv-field + .rv-field { margin-top: 16px; }
.rv-field-error { margin-top: 6px; color: var(--rv-danger); font-size: .82rem; font-weight: 550; }
.rv-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.rv-check { display: flex; align-items: flex-start; gap: 10px; font-size: .9rem; cursor: pointer; }
.rv-check input { margin-top: 3px; accent-color: var(--rv-accent); width: 16px; height: 16px; }
.rv-form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

.rv-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--rv-btn-radius); background: var(--rv-paper-deep); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.rv-seg a, .rv-seg button {
    display: inline-flex; align-items: center; min-height: 34px; padding: .3rem .85rem; border: 0; border-radius: 7px; background: none; color: var(--rv-ink-soft);
    font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background-color var(--rv-dur) var(--rv-ease), color var(--rv-dur) var(--rv-ease);
}
.rv-seg a:hover, .rv-seg button:hover { color: var(--rv-ink); }
.rv-seg [aria-current="true"], .rv-seg [aria-pressed="true"], .rv-seg [aria-current="page"] { background: var(--rv-surface); color: var(--rv-ink); box-shadow: var(--rv-shadow-sm); }

/* --- shell ------------------------------------------------------------ */
.rv-shell { display: grid; grid-template-columns: var(--rv-sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.rv-logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--rv-font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.035em; color: var(--rv-ink); text-decoration: none; line-height: 1; }
.rv-logo:hover { color: var(--rv-ink); }
.rv-logo svg { width: 28px; height: 28px; flex: none; }
.rv-logo span { color: var(--rv-accent); }

.rv-sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; display: flex; flex-direction: column; gap: 18px;
    padding: 22px 14px 16px; background: var(--rv-surface); border-right: 1px solid var(--rv-line);
}
.rv-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 10px 0; min-height: 36px; }
.rv-nav { display: grid; gap: 2px; }
.rv-nav-title { padding: 0 12px 6px; font-size: .72rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--rv-ink-faint); }
.rv-nav-item {
    display: flex; align-items: center; gap: 11px; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; background: none;
    border-radius: var(--rv-radius-sm); font: inherit; font-size: .9rem; font-weight: 550; color: var(--rv-ink-soft);
    text-decoration: none; text-align: left; cursor: pointer;
    transition: background-color var(--rv-dur) var(--rv-ease), color var(--rv-dur) var(--rv-ease);
}
.rv-nav-item svg { flex: none; color: var(--rv-ink-faint); }
.rv-nav-item > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-nav-item:hover { background: var(--rv-surface-sunk); color: var(--rv-ink); }
.rv-nav-item[aria-current="page"] { background: var(--rv-accent-soft); color: var(--rv-accent-dark); font-weight: 650; }
.rv-nav-item[aria-current="page"] svg { color: var(--rv-accent); }
.rv-nav-count { font-style: normal; font-size: .72rem; font-weight: 700; min-width: 22px; height: 20px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--rv-radius-pill); background: var(--rv-paper-deep); color: var(--rv-ink-soft); font-variant-numeric: tabular-nums; }
.rv-nav-count.is-warn { background: var(--rv-warn-soft); color: var(--rv-warn); }
.rv-nav-item[aria-current="page"] .rv-nav-count { background: var(--rv-accent); color: var(--rv-accent-contrast); }

.rv-biz-switch { position: relative; }
.rv-biz-switch > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--rv-radius-md); background: var(--rv-surface-sunk); cursor: pointer; border: 1px solid var(--rv-line); }
.rv-biz-switch > summary::-webkit-details-marker { display: none; }
.rv-biz-switch > summary:hover { border-color: var(--rv-border-strong); }
.rv-biz-text { display: grid; min-width: 0; line-height: 1.3; flex: 1 1 auto; }
.rv-biz-text b { font-size: .9rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-biz-text small { font-size: .72rem; color: var(--rv-ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-biz-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; display: grid; gap: 2px; padding: 6px; background: var(--rv-surface); border: 1px solid var(--rv-line); border-radius: var(--rv-radius-md); box-shadow: var(--rv-shadow-md); max-height: 60vh; overflow: auto; }
.rv-biz-menu .rv-nav-title { padding: 8px 10px 4px; }
.rv-biz-menu a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--rv-radius-sm); text-decoration: none; color: var(--rv-ink); font-size: .88rem; font-weight: 550; }
.rv-biz-menu a:hover { background: var(--rv-surface-sunk); }
.rv-biz-menu a[aria-current="page"] { background: var(--rv-accent-soft); color: var(--rv-accent-dark); }
.rv-biz-dot { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--rv-accent); }

.rv-sidebar-foot { margin-top: auto; display: grid; gap: 4px; padding-top: 14px; border-top: 1px solid var(--rv-line); }
.rv-credit { margin: 6px 0 0; padding: 0 12px; font-size: .74rem; color: var(--rv-ink-faint); }
.rv-credit a { color: inherit; font-weight: 600; text-decoration: none; }
.rv-credit a:hover { color: var(--rv-accent-dark); text-decoration: underline; }

.rv-topbar { display: none; }
.rv-tabbar { display: none; }
.rv-backdrop { display: none; }
.rv-main { min-width: 0; padding: 30px var(--rv-gutter) 72px; }
.rv-main > * { max-width: var(--rv-maxw); margin-left: max(0px, calc((100% - var(--rv-maxw)) / 2)); margin-right: auto; }

/* --- page head ------------------------------------------------------- */
.rv-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.rv-page-head h1 { margin-bottom: 4px; overflow-wrap: anywhere; }
.rv-page-head p { color: var(--rv-ink-soft); }
.rv-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rv-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: .86rem; font-weight: 600; text-decoration: none; color: var(--rv-ink-soft); }
.rv-back:hover { color: var(--rv-ink); }
.rv-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: -8px 0 22px; border-bottom: 1px solid var(--rv-line); }
.rv-tabs a { flex: none; padding: 10px 12px; font-size: .9rem; font-weight: 600; color: var(--rv-ink-soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.rv-tabs a:hover { color: var(--rv-ink); }
.rv-tabs a[aria-current="page"] { color: var(--rv-accent-dark); border-bottom-color: var(--rv-accent); }

/* --- panels, notes, tags ---------------------------------------------- */
.rv-panel { background: var(--rv-surface); border: 1px solid var(--rv-line); border-radius: var(--rv-radius-lg); box-shadow: var(--rv-shadow-sm); padding: 22px 24px; margin-bottom: 20px; }
.rv-panel.is-flush { padding: 0; overflow: hidden; }
.rv-panel-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 16px; }
.rv-panel-title > .rv-spacer + * { margin-left: auto; }
.rv-panel-title small { font-weight: 500; color: var(--rv-ink-faint); font-size: .82rem; }
.rv-panel.is-flush .rv-panel-title { padding: 18px 22px 0; }
.rv-section-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 14px; }
.rv-section-title:first-child { margin-top: 0; }
.rv-section-title small { font-size: .86rem; font-weight: 500; color: var(--rv-ink-faint); }
.rv-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.rv-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.rv-grid-2 > .rv-panel, .rv-grid-3 > .rv-panel { margin-bottom: 0; }
.rv-grid-2, .rv-grid-3 { margin-bottom: 20px; }

.rv-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--rv-radius-md); background: var(--rv-surface-sunk); color: var(--rv-ink-soft); font-size: .88rem; }
.rv-note svg { flex: none; margin-top: 2px; color: var(--rv-ink-faint); }
.rv-note > :not(svg) { min-width: 0; overflow-wrap: anywhere; }
.rv-note.is-error { background: var(--rv-danger-soft); color: var(--rv-danger); }
.rv-note.is-error svg { color: var(--rv-danger); }
.rv-note.is-warn { background: var(--rv-warn-soft); color: var(--rv-warn); }
.rv-note.is-warn svg { color: var(--rv-warn); }
.rv-note.is-success { background: var(--rv-success-soft); color: var(--rv-success); }
.rv-note.is-success svg { color: var(--rv-success); }
.rv-flashes { display: grid; gap: 10px; margin-bottom: 20px; }

.rv-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--rv-radius-pill); background: var(--rv-paper-deep); color: var(--rv-ink-soft); font-size: .72rem; font-weight: 650; letter-spacing: .01em; white-space: nowrap; line-height: 1.6; }
.rv-tag.is-accent { background: var(--rv-accent-soft); color: var(--rv-accent-dark); }
.rv-tag.is-issue, .rv-tag.is-danger { background: var(--rv-danger-soft); color: var(--rv-danger); }
.rv-tag.is-opportunity, .rv-tag.is-warn { background: var(--rv-warn-soft); color: var(--rv-warn); }
.rv-tag.is-positive, .rv-tag.is-success { background: var(--rv-success-soft); color: var(--rv-success); }
.rv-tag svg { width: 12px; height: 12px; }
.rv-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--rv-ink-faint); }
.rv-dot.is-live { background: var(--rv-live); }
.rv-dot.is-warn { background: var(--rv-warn-mark); }
.rv-dot.is-off { background: var(--rv-danger); }

.rv-platform { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--rv-ink-soft); white-space: nowrap; }
.rv-platform i { width: 8px; height: 8px; border-radius: 2px; background: var(--rv-ink-faint); }
.rv-platform.is-google i { background: var(--rv-google); }
.rv-platform.is-meta i { background: var(--rv-meta); border-radius: 50%; }

.rv-empty { background: var(--rv-surface); border: 1.5px dashed var(--rv-border-strong); border-radius: var(--rv-radius-lg); padding: 40px 24px; text-align: center; color: var(--rv-ink-soft); }
.rv-empty h2 { color: var(--rv-ink); margin-bottom: 8px; }
.rv-empty p { max-width: 52ch; margin: 0 auto; }
.rv-empty .rv-btn { margin-top: 16px; }

/* --- KPI tiles ------------------------------------------------------- */
.rv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.rv-kpi { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--rv-radius-md); background: var(--rv-surface); border: 1px solid var(--rv-line); box-shadow: var(--rv-shadow-sm); min-width: 0; }
.rv-kpi > span { color: var(--rv-ink-soft); font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-kpi > b { font-family: var(--rv-font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-kpi > small { font-size: .78rem; color: var(--rv-ink-faint); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rv-kpi.is-sunk { background: var(--rv-surface-sunk); box-shadow: none; }

.rv-delta { display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; border-radius: var(--rv-radius-pill); font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--rv-paper-deep); color: var(--rv-ink-soft); }
.rv-delta.is-good { background: var(--rv-success-soft); color: var(--rv-success); }
.rv-delta.is-bad { background: var(--rv-danger-soft); color: var(--rv-danger); }

/* --- tables ---------------------------------------------------------- */
.rv-table-wrap { overflow-x: auto; }
.rv-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.rv-table th { text-align: left; color: var(--rv-ink-faint); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--rv-line); background: var(--rv-surface-sunk); }
.rv-table td { padding: 11px 12px; border-top: 1px solid var(--rv-line); vertical-align: middle; }
.rv-table tr:first-child td { border-top: 0; }
.rv-table .is-num { text-align: right; white-space: nowrap; }
.rv-table td small { display: block; color: var(--rv-ink-faint); }
.rv-table tbody tr:hover { background: color-mix(in srgb, var(--rv-surface-sunk) 70%, transparent); }
.rv-table a { color: var(--rv-ink); font-weight: 600; text-decoration: none; }
.rv-table a:hover { color: var(--rv-accent-dark); text-decoration: underline; }
.rv-table .is-good { color: var(--rv-success); font-weight: 650; }
.rv-table .is-bad { color: var(--rv-danger); font-weight: 650; }

.rv-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 16px; margin: 0; font-size: .88rem; }
.rv-dl dt, .rv-dl dd { padding: 8px 0; border-top: 1px solid var(--rv-line); margin: 0; }
.rv-dl dt { color: var(--rv-ink-soft); }
.rv-dl dd { text-align: right; font-weight: 550; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.rv-dl dt:first-of-type, .rv-dl dt:first-of-type + dd { border-top: 0; padding-top: 0; }

/* --- prose (AI text) ------------------------------------------------- */
.rv-prose { font-size: .94rem; line-height: 1.6; color: var(--rv-ink); }
.rv-prose > * + * { margin-top: .7em; }
.rv-prose ul, .rv-prose ol { padding-left: 1.3em; margin: .5em 0; }
.rv-prose h2, .rv-prose h3 { margin-top: 1.2em; }
.rv-prose table { border-collapse: collapse; font-size: .86rem; }
.rv-prose th, .rv-prose td { border: 1px solid var(--rv-line); padding: 4px 8px; }
.rv-ai-mark { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--rv-accent); }

/* --- charts ---------------------------------------------------------- */
.rv-chart { width: 100%; min-height: 240px; }
.rv-chart .u-legend { font-size: .8rem; color: var(--rv-ink-soft); }
.rv-chart .u-axis { color: var(--rv-ink-faint); }
.rv-spark { display: block; width: 100%; height: 36px; }

/* --- dialog / sheet -------------------------------------------------- */
dialog.rv-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--rv-radius-lg); background: var(--rv-surface); color: var(--rv-ink); box-shadow: var(--rv-shadow-md); }
dialog.rv-dialog::backdrop { background: color-mix(in srgb, var(--rv-ink) 40%, transparent); backdrop-filter: blur(2px); }
.rv-dialog-body { padding: 22px 24px; }
.rv-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 18px; border-top: 1px solid var(--rv-line); }

/* --- auth screens ---------------------------------------------------- */
.rv-auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.rv-auth-card { width: min(420px, 100%); }
.rv-auth-card .rv-logo { margin-bottom: 22px; }
.rv-auth-card .rv-panel { padding: 28px; }
.rv-auth-card h1 { font-size: 1.35rem; margin-bottom: 6px; }
.rv-auth-card .rv-lede { color: var(--rv-ink-soft); margin-bottom: 20px; font-size: .92rem; }
.rv-qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--rv-radius-md); border: 1px solid var(--rv-line); margin: 0 auto 16px; width: fit-content; }
.rv-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--rv-font-mono); font-size: .9rem; padding: 14px; background: var(--rv-surface-sunk); border-radius: var(--rv-radius-md); }

/* --- responsive ------------------------------------------------------ */
@media (max-width: 1080px) {
    .rv-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
    .rv-shell { grid-template-columns: minmax(0, 1fr); }
    .rv-sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s var(--rv-ease); box-shadow: var(--rv-shadow-md); }
    .rv-shell.is-open .rv-sidebar { transform: none; }
    .rv-shell.is-open .rv-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: color-mix(in srgb, var(--rv-ink) 35%, transparent); }
    .rv-topbar {
        display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; min-height: 56px;
        padding: max(6px, env(safe-area-inset-top)) 10px 6px; background: color-mix(in srgb, var(--rv-surface) 92%, transparent);
        backdrop-filter: blur(10px); border-bottom: 1px solid var(--rv-line);
    }
    .rv-topbar .rv-logo { font-size: 1.1rem; }
    .rv-topbar .rv-logo svg { width: 24px; height: 24px; }
    .rv-topbar-biz { flex: 1 1 auto; min-width: 0; text-align: center; font-weight: 650; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .rv-main { padding: 20px 16px calc(var(--rv-tabbar-h) + 32px + env(safe-area-inset-bottom)); }
    .rv-tabbar {
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset: auto 0 0 0; z-index: 30;
        padding: 4px 4px max(4px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--rv-surface) 95%, transparent);
        backdrop-filter: blur(10px); border-top: 1px solid var(--rv-line);
    }
    .rv-tabbar a { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 6px 2px; border-radius: var(--rv-radius-sm); color: var(--rv-ink-faint); text-decoration: none; font-size: .68rem; font-weight: 650; }
    .rv-tabbar a[aria-current="page"] { color: var(--rv-accent); }
    .rv-tabbar a em { position: absolute; top: 2px; left: calc(50% + 6px); font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rv-danger); color: #fff; font-size: .66rem; line-height: 18px; text-align: center; }
    .rv-grid-2, .rv-grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    h1 { font-size: 1.35rem; }
    .rv-panel { padding: 18px 16px; border-radius: var(--rv-radius-md); }
    .rv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .rv-kpi { padding: 12px; }
    .rv-kpi > b { font-size: 1.35rem; }
    .rv-input, .rv-select, .rv-textarea { font-size: 16px; }
    .rv-btn { min-height: 44px; }
    .rv-page-head { margin-bottom: 18px; }
    .rv-head-actions { width: 100%; }
    /* tables become stacked cards when marked .is-stack */
    .rv-table.is-stack thead { display: none; }
    .rv-table.is-stack, .rv-table.is-stack tbody, .rv-table.is-stack tr, .rv-table.is-stack td { display: block; width: 100%; }
    .rv-table.is-stack tr { padding: 12px 14px; border-top: 1px solid var(--rv-line); }
    .rv-table.is-stack tr:first-child { border-top: 0; }
    .rv-table.is-stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .rv-table.is-stack td::before { content: attr(data-label); color: var(--rv-ink-faint); font-size: .78rem; font-weight: 600; text-align: left; }
    .rv-table.is-stack td:first-child { display: block; text-align: left; font-size: .95rem; padding-bottom: 6px; }
    .rv-table.is-stack td:first-child::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.rv-only-mobile { display: none; }
@media (max-width: 991px) { .rv-only-mobile { display: inline-flex; } .rv-topbar-logo b { display: none; } }

/* --- progressive disclosure (<x-details>) ------------------------------ */
.rv-details { margin-top: 12px; }
.rv-details > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px 4px 6px; border-radius: var(--rv-radius-sm); color: var(--rv-ink-soft); font-size: .86rem; font-weight: 600; cursor: pointer; user-select: none; }
.rv-details > summary::-webkit-details-marker { display: none; }
.rv-details > summary::marker { content: ''; }
.rv-details > summary:hover { background: var(--rv-surface-sunk); color: var(--rv-ink); }
.rv-details > summary svg { transition: rotate var(--rv-dur) var(--rv-ease); }
.rv-details[open] > summary svg { rotate: 90deg; }
.rv-details-body { padding-top: 10px; }
.rv-mode-switch { color: var(--rv-accent-dark); }
.rv-mode-switch svg { color: var(--rv-accent); }
