/* Re:Vault Tools - page shell + shared controls + per-tool layouts.
   Loads after theme.css, so it inherits all the theme variables. */

/* tool pages scroll (theme.css locks the app shell, but tools are documents) */
html { height: auto; overflow: auto; }
body.rv-tools-body { height: auto; min-height: 100%; overflow: visible; display: flex; flex-direction: column; color: var(--fg-2); }

.rv-tools-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 18px; background: var(--bg); border-bottom: 1px solid var(--line); }
.rv-tools-brand { display: flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 600; text-decoration: none; }
.rv-tools-brand svg { width: 20px; height: 20px; }
.rv-tools-name { color: var(--muted); font-size: inherit; font-weight: inherit; margin: 0; }
.rv-tools-name::before { content: "/ "; content: "/ " / ""; }
.rv-tools-name:empty { display: none; }
.rv-tools-root { width: 100%; max-width: 880px; margin: 0 auto; padding: 22px; }
.rv-tools-intro { color: var(--muted); margin-bottom: 18px; }

/* launcher grid */
.rv-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.rv-tool-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); text-align: left; transition: transform 0.12s ease, border-color 0.12s ease; }
.rv-tool-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.rv-tool-card-icon { width: 30px; height: 30px; color: var(--accent-ink); }
.rv-tool-card-icon svg { width: 100%; height: 100%; }
.rv-tool-card-name { color: var(--fg); font-weight: 600; }
.rv-tool-card-blurb { color: var(--muted); font-size: 12px; }

/* shared tool controls */
.rv-tool { display: flex; flex-direction: column; gap: 14px; }
.rv-tool-title { color: var(--fg); font-size: 18px; }
.rv-tool-sub { color: var(--fg); font-size: 14px; margin-top: 4px; }
.rv-tnote { color: var(--muted); font-size: 12px; }
.rv-trow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-tcol { display: flex; flex-direction: column; gap: 10px; }
.rv-field { display: flex; flex-direction: column; gap: 5px; }
.rv-field-label { font-size: 12px; color: var(--muted); }
.rv-tbtn { display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: var(--radius); font-size: 13px; }
.rv-tbtn:hover { border-color: var(--accent-2); }
.rv-tbtn-accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.rv-tbtn-accent:hover { background: var(--accent-2); }
.rv-tbtn.op { background: var(--surface-2); }
.rv-tinput, .rv-tselect, .rv-tarea { background: var(--bg); border: 1px solid var(--line-strong); color: var(--fg); border-radius: var(--radius); font: inherit; font-size: 13px; padding: 8px 11px; outline: none; }
.rv-tinput:focus, .rv-tselect:focus, .rv-tarea:focus { border-color: var(--accent); }
.rv-tarea { min-height: 120px; resize: vertical; line-height: 1.5; width: 100%; }
input[type="color"].rv-tinput { padding: 2px; height: 34px; width: 48px; }
input[type="range"] { accent-color: var(--accent); }

/* calculator */
.rv-calc { max-width: 360px; margin: 0 auto; }
.rv-calc-top { display: flex; align-items: center; gap: 10px; }
.rv-calc-deg { height: 28px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted-2); border-radius: var(--radius-sm); font-size: 11px; }
.rv-calc-out { flex: 1; text-align: right; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; overflow: hidden; }
.rv-calc-display { width: 100%; text-align: right; font-size: 26px; height: 52px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); padding: 0 12px; outline: none; font-variant-numeric: tabular-nums; }
.rv-calc-display:focus { border-color: var(--accent); }
.rv-calc-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.rv-calc-key { height: 46px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: var(--radius); font-size: 15px; }
.rv-calc-key:hover { border-color: var(--accent-2); }
.rv-calc-key.op { background: var(--surface-2); }
.rv-calc-key.eq { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }

/* notes */
.rv-notes { flex-direction: row; gap: 14px; height: calc(100vh - 130px); min-height: 360px; }
.rv-notes-list { width: 220px; flex: none; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--surface); }
.rv-notes-head { padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.rv-notes-item { display: flex; align-items: center; gap: 6px; padding: 9px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.rv-notes-item.active { background: var(--surface-2); }
.rv-notes-item-title { flex: 1; min-width: 0; border: 0; background: none; padding: 0; font: inherit; text-align: left; min-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.rv-notes-del { width: 22px; height: 22px; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); }
.rv-notes-del:hover { background: var(--bg); color: var(--danger); }
.rv-notes-editor { flex: 1; min-height: 0; resize: none; }

/* todo */
.rv-todo { max-width: 560px; margin: 0 auto; width: 100%; }
.rv-todo-input { width: 100%; }
.rv-todo-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rv-todo-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rv-todo-item.done .rv-todo-text { color: var(--muted); text-decoration: line-through; }
.rv-todo-text { flex: 1; color: var(--fg-2); }
.rv-todo-del { width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); }
.rv-todo-del:hover { color: var(--danger); }
.rv-todo-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.rv-todo-filters { display: flex; gap: 6px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* converter */
.rv-conv-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; }
.rv-conv-swap { align-self: end; height: 34px; }
.rv-conv-result { background: var(--surface); }

/* timer */
.rv-timer { align-items: center; }
.rv-timer-tabs { display: flex; gap: 8px; }
.rv-timer-body { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.rv-timer-display { font-size: clamp(48px, 12vw, 80px); color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.rv-timer-display.done { color: var(--accent-ink); }
.rv-timer-phase { color: var(--accent-ink); font-size: 16px; }
.rv-timer-sitting { margin-bottom: -10px; }
.rv-timer-focus { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.rv-timer-focus[hidden] { display: none; }
.rv-timer-row { display: flex; align-items: center; gap: 10px; }
.rv-timer-num { width: 70px; text-align: center; }
.rv-timer-colon { font-size: 22px; color: var(--muted); }
.rv-timer-laps { list-style: decimal inside; color: var(--muted-2); display: flex; flex-direction: column; gap: 3px; font-variant-numeric: tabular-nums; }

/* world clock */
.rv-wclock-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.rv-wclock-card { position: relative; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rv-wclock-city { color: var(--fg); font-weight: 600; }
.rv-wclock-time { font-size: 26px; color: var(--fg); font-variant-numeric: tabular-nums; margin-top: 4px; }
.rv-wclock-date { color: var(--muted); font-size: 12px; }
.rv-wclock-del { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); }
.rv-wclock-del:hover { color: var(--danger); }

/* color */
.rv-color-conv { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.rv-color-swatch { width: 64px; height: 64px; border-radius: var(--radius-lg); border: 1px solid var(--line); }
.rv-color-vals { display: flex; flex-direction: column; gap: 6px; }
.rv-color-readout { font-variant-numeric: tabular-nums; color: var(--fg-2); cursor: pointer; }
.rv-color-readout:hover { color: var(--accent-ink); }
.rv-color-palette { display: flex; gap: 8px; }
.rv-color-chip { width: 56px; height: 44px; border-radius: var(--radius); border: 1px solid var(--line); position: relative; }
.rv-color-chip.copied::after { content: "Copied"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; background: rgba(0, 0, 0, 0.45); border-radius: var(--radius); }
.rv-contrast-preview { display: flex; align-items: center; justify-content: center; height: 70px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 30px; font-weight: 700; }
.rv-contrast-ratio { font-variant-numeric: tabular-nums; color: var(--fg-2); }

/* password */
.rv-pass { max-width: 540px; margin: 0 auto; width: 100%; }
.rv-pass-outrow { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-pass-out { flex: 1 1 180px; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }
.rv-pass-meter { height: 7px; border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.rv-pass-bar { height: 100%; width: 0; background: var(--danger); transition: width 0.2s ease; }
.rv-pass-bar[data-level="fair"] { background: #e0a341; }
.rv-pass-bar[data-level="strong"] { background: #27c093; }
.rv-pass-bar[data-level="very"] { background: var(--accent); }
.rv-pass-opts { display: flex; gap: 16px; flex-wrap: wrap; }
.rv-pass-opt { display: flex; align-items: center; gap: 6px; color: var(--fg-2); }
.rv-pass-len { color: var(--fg); font-variant-numeric: tabular-nums; min-width: 26px; }

/* qr */
.rv-qr { align-items: flex-start; }
.rv-qr-input { min-height: 80px; width: 100%; }
.rv-qr-canvas { max-width: 320px; width: 100%; height: auto; image-rendering: pixelated; border-radius: var(--radius); background: #fff; }

/* text */
.rv-text-stats { color: var(--muted); font-size: 12px; }
.rv-text-ops { display: flex; gap: 7px; flex-wrap: wrap; }
.rv-text-out { background: var(--surface); }

/* random */
.rv-rand { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.rv-rand-block { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.rv-rand-out { font-size: 22px; color: var(--fg); font-variant-numeric: tabular-nums; min-height: 28px; }
.rv-rand-num { width: 80px; }
.rv-rand-list { min-height: 90px; }

/* calendar */
.rv-cal-head { display: flex; align-items: center; gap: 8px; }
.rv-cal-title { margin: 0; flex: 1; text-align: center; color: var(--fg); font-size: 16px; font-weight: 600; }
.rv-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.rv-cal-dow { text-align: center; color: var(--muted); font-size: 11px; padding: 4px 0; }
.rv-cal-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--fg-2); background: var(--surface); }
.rv-cal-cell.empty { border: 0; background: transparent; }
.rv-cal-cell.today { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.rv-cal-tool { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }

/* whiteboard */
.rv-wb-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-wb-canvas { width: 100%; height: 60vh; min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; touch-action: none; cursor: crosshair; }

/* markdown */
.rv-md-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: calc(100vh - 170px); min-height: 340px; }
.rv-md-editor { resize: none; height: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rv-md-preview { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; overflow: auto; line-height: 1.6; color: var(--fg-2); }
.rv-md-preview h1, .rv-md-preview h2, .rv-md-preview h3 { color: var(--fg); margin: 0.6em 0 0.3em; }
.rv-md-preview a { color: var(--accent-ink); }
.rv-md-preview code { background: var(--bg); padding: 1px 5px; border-radius: var(--radius-sm); font-family: ui-monospace, Menlo, Consolas, monospace; }
.rv-md-preview pre { background: var(--bg); padding: 10px; border-radius: var(--radius-sm); overflow: auto; }
.rv-md-preview blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted-2); margin: 0.5em 0; }
.rv-md-preview ul, .rv-md-preview ol { padding-left: 22px; }

/* regex */
.rv-regex-pat { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rv-regex-flags { width: 80px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rv-regex-test { min-height: 100px; }
.rv-regex-out { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; min-height: 60px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; color: var(--fg-2); }
.rv-regex-hit { background: var(--accent); color: var(--on-accent); border-radius: 2px; }
.rv-regex-groups { display: flex; flex-direction: column; gap: 4px; }
.rv-regex-group { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted-2); }

/* flashcards */
.rv-fc { flex-direction: row; gap: 16px; align-items: flex-start; }
.rv-fc-decks { width: 220px; flex: none; display: flex; flex-direction: column; gap: 6px; }
.rv-fc-decks-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.rv-fc-decks-title { color: var(--fg); font-weight: 600; }
.rv-fc-deck { width: 100%; font: inherit; color: inherit; text-align: left; display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.rv-fc-deck:hover { border-color: var(--accent-2); }
.rv-fc-deck.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.rv-fc-deck-name { flex: 1; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-fc-deck-count { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rv-fc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.rv-fc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-fc-title { flex: 1; min-width: 140px; font-size: 15px; font-weight: 600; }
.rv-fc-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.rv-fc-bulk { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; }
.rv-fc-bulk > summary { cursor: pointer; color: var(--fg-2); font-size: 13px; }
.rv-fc-bulk-ta { width: 100%; min-height: 120px; margin-top: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.rv-fc-bulk-note { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.rv-fc-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.rv-fc-list { display: flex; flex-direction: column; gap: 6px; }
.rv-fc-card-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rv-fc-card-front { flex: 0 1 40%; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-fc-card-sep { color: var(--muted); flex: none; }
.rv-fc-card-back { flex: 1; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-fc-card-del { width: 26px; height: 26px; flex: none; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); font-size: 12px; }
.rv-fc-card-del:hover { background: var(--surface-2); color: var(--danger); }

/* flashcards - study mode */
.rv-fc-study { align-items: center; gap: 16px; }
.rv-fc-study-bar { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px; }
.rv-fc-study-name { flex: 1; color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-fc-study-prog { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rv-fc-flip { width: min(560px, 100%); height: 300px; perspective: 1400px; cursor: pointer; }
.rv-fc-flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.45s cubic-bezier(0.4, 0.1, 0.2, 1); transform-style: preserve-3d; }
.rv-fc-flip.flipped .rv-fc-flip-inner { transform: rotateY(180deg); }
.rv-fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; align-items: center; justify-content: center; text-align: center; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--fg); font-size: 22px; line-height: 1.4; overflow: auto; }
.rv-fc-face-back { transform: rotateY(180deg); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--fg); }
.rv-fc-flip-hint { color: var(--muted); font-size: 12px; }
.rv-fc-study-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rv-fc-done { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px; text-align: center; }
.rv-fc-done-title { color: var(--fg); font-size: 20px; font-weight: 600; }
.rv-fc-done-sub { color: var(--muted-2); }
@media (prefers-reduced-motion: reduce) { .rv-fc-flip-inner { transition-duration: 0.01ms; } }

/* citations */
.rv-cite-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.rv-cite-out { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.rv-cite-preview { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; min-height: 56px; line-height: 1.6; color: var(--fg); word-break: break-word; }
.rv-cite-preview i { font-style: italic; }
.rv-cite-saved { display: flex; flex-direction: column; gap: 8px; }
.rv-cite-saved-head { display: flex; align-items: center; gap: 10px; }
.rv-cite-saved-head .rv-tool-sub { flex: 1; }
.rv-cite-saved-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rv-cite-saved-badge { flex: none; font-size: 10px; font-weight: 700; color: var(--accent-ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 5px; margin-top: 2px; }
.rv-cite-saved-text { flex: 1; line-height: 1.55; color: var(--fg-2); word-break: break-word; }
.rv-cite-saved-text i { font-style: italic; }

/* grades */
.rv-grade-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.rv-grade-panel { display: flex; flex-direction: column; gap: 14px; }
.rv-grade-rows { display: flex; flex-direction: column; gap: 8px; }
.rv-grade-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; }
.rv-grade-row > * { min-width: 0; }
.rv-grade-row input, .rv-grade-row select { width: 100%; }
.rv-grade-gpa-row { grid-template-columns: 2fr 1fr 1fr 1.3fr auto; }
.rv-grade-head { color: var(--muted); font-size: 11px; padding: 0 2px; }
.rv-grade-head span { padding-left: 2px; }
.rv-grade-result { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.rv-grade-big { font-size: 40px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; line-height: 1.1; }
.rv-grade-letter { font-size: 16px; font-weight: 600; color: var(--accent-ink); }

@media (max-width: 640px) {
	.rv-notes { flex-direction: column; height: auto; }
	.rv-notes-list { width: 100%; max-height: 200px; }
	.rv-md-split { grid-template-columns: 1fr; height: auto; }
	.rv-md-editor, .rv-md-preview { min-height: 240px; }
	.rv-conv-grid { grid-template-columns: 1fr; }
	.rv-conv-swap { justify-self: center; }
	.rv-fc { flex-direction: column; }
	.rv-fc-decks { width: 100%; }
	.rv-fc-add { grid-template-columns: 1fr; }
	.rv-grade-row { grid-template-columns: 1fr 1fr; }
	.rv-grade-gpa-row { grid-template-columns: 1fr 1fr; }
	.rv-grade-head { display: none; }
}

.rv-tinput:focus-visible, .rv-tselect:focus-visible, .rv-tarea:focus-visible, .rv-calc-display:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }

/* notes: Study Helper menu above the editor */
.rv-notes-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rv-notes-helper { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rv-notes-helper-label { color: var(--muted); font-size: 12px; }
.rv-notes-main .rv-notes-editor { flex: 1; }

/* Study Helper */
.hp { display: flex; flex-direction: column; gap: 12px; min-height: calc(100vh - 120px); }
.hp-in-panel .rv-tools-head { display: none; }
.hp-in-panel .rv-tools-root { padding: 12px 14px; max-width: none; }
.hp-panel { min-height: calc(100vh - 24px); height: calc(100vh - 24px - var(--kb, 0px)); }
.hp-head { display: flex; align-items: center; gap: 8px; }
.hp-title { flex: 1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 16px; color: var(--fg); }
.hp-title-tag { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 1px 8px; }
.hp-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-width: 24px; border: 1px solid transparent; background: transparent; color: var(--fg-2); border-radius: var(--radius); }
.hp-icon-btn:hover { border-color: var(--line-strong); }
.hp-icon-btn svg { width: 18px; height: 18px; }
.hp-modes, .hp-subtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.hp-mode, .hp-subtab { height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); border-radius: var(--radius-pill); font-size: 13px; }
.hp-mode[aria-checked="true"], .hp-subtab[aria-checked="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--on-accent); }
.hp-subtab { height: 30px; font-size: 12px; }
.hp-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.hp-select { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); max-width: 100%; min-width: 0; }
.hp-select .rv-tselect { min-width: 0; max-width: 100%; }
.hp-select .rv-tselect, .hp-select .rv-tinput { padding: 5px 8px; }
.hp-conv-wrap { flex: 1; min-height: 160px; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.hp-in-panel .hp-conv-wrap { overscroll-behavior: contain; }
.hp-empty { color: var(--muted); margin: 12px 0; }
.hp-conv { display: flex; flex-direction: column; gap: 10px; }
.hp-msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); color: var(--fg-2); line-height: 1.55; overflow-wrap: anywhere; }
.hp-msg:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.hp-msg-u { align-self: flex-end; max-width: 88%; background: var(--surface-2); color: var(--fg); }
.hp-msg-text { margin: 0; white-space: pre-wrap; }
.hp-msg-attach, .hp-msg-src { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.hp-msg-body > * + * { margin-top: 8px; }
.hp-msg-body ul, .hp-msg-body ol { padding-left: 22px; }
.hp-msg-body code { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 4px; }
.hp-msg-body pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; overflow: auto; }
.hp-msg-body table { border-collapse: collapse; }
.hp-msg-body th, .hp-msg-body td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.hp-msg-body[aria-busy="true"]:empty::after { content: "Thinking…"; color: var(--muted); }
.hp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hp-actions .rv-tbtn { height: 30px; padding: 0 10px; font-size: 12px; }
.hp-notice { border-style: dashed; }
.hp-soft { margin: 8px 0 0; font-size: 13px; color: var(--fg-2); }
.hp-link-btn { border: 0; background: none; padding: 2px 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; font: inherit; font-size: 12px; min-height: 24px; }
.hp-support { border: 2px solid var(--accent-ink); background: var(--surface); }
.hp-support-h { margin: 0 0 6px; font-size: 15px; color: var(--fg); }
.hp-support-list { padding-left: 18px; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.hp-support-text { display: block; color: var(--fg); }
.hp-support-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hp-support-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--accent-ink); color: var(--fg); border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.hp-support-btn:hover { background: var(--surface-2); }
.hp-support.hp-collapsed > :not(.hp-support-h) { display: none; }
.hp-support-link { align-self: flex-start; border: 1px solid var(--accent-ink); background: var(--surface); color: var(--fg); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 12px; min-height: 28px; }
.hp-composer { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
/* In the panel the conversation scrolls on its own, so the composer can stay put above it. */
.hp-panel .hp-composer { position: sticky; bottom: var(--kb, 0px); background: var(--bg); }
.hp-input-row { display: flex; gap: 8px; align-items: flex-end; }
.hp-input { flex: 1; min-height: 44px; max-height: 40vh; resize: vertical; background: var(--bg); border: 1px solid var(--line-strong); color: var(--fg); border-radius: var(--radius); font: inherit; font-size: 14px; padding: 9px 11px; line-height: 1.45; }
.hp-input:focus { border-color: var(--accent); outline: none; }
.hp-input:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
.hp-send { min-width: 72px; height: 44px; }
.hp-hint { margin: 0; font-size: 12px; color: var(--muted); white-space: pre-line; }
.hp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.hp-count { margin-left: auto; }
.hp-ai-note { margin: 0; font-size: 12px; color: var(--muted); }
.hp-chip { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); font-size: 12px; color: var(--fg); background: var(--surface); }
.hp-chip-x { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--fg-2); border-radius: 50%; }
.hp-chip-x svg { width: 14px; height: 14px; }
.hp-pii { border: 1px solid var(--accent-ink); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); color: var(--fg); }
.hp-pii p { margin: 0; }
.hp-menu { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); max-height: 240px; overflow: auto; }
.hp-menu-item { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 8px 10px; min-height: 36px; font: inherit; font-size: 13px; }
.hp-menu-item:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.hp-menu-empty { padding: 10px; margin: 0; color: var(--muted); font-size: 13px; }
.hp-intro { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.hp-intro-h { margin: 0 0 8px; font-size: 15px; color: var(--fg); }
.hp-intro-list { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; line-height: 1.5; }
.hp-steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hp-step { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.hp-step-line { font-size: 14px; color: var(--fg); background: none; border: 0; }
.hp-step-mark { font-size: 12px; color: var(--muted); }
.hp-step-mark::before { content: "✓ "; content: "✓ " / ""; }
.hp-step-start .hp-step-mark::before { content: ""; }
.hp-step-wrong { border: 2px solid var(--danger); }
.hp-step-wrong .hp-step-mark { color: var(--fg); font-weight: 600; }
.hp-step-wrong .hp-step-mark::before, .hp-step-unsupported .hp-step-mark::before { content: "! "; content: "! " / ""; }
.hp-step-hint { flex-basis: 100%; margin: 4px 0 0; color: var(--fg); }
.hp-steps-sum { font-weight: 600; color: var(--fg); margin: 0; }
.hp-quiz { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hp-quiz-q { font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.hp-choice { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.hp-choice input { accent-color: var(--accent); width: 18px; height: 18px; }
.hp-quiz .rv-tbtn { align-self: flex-start; margin-top: 4px; }
.hp-quiz-fb { margin: 4px 0 0; color: var(--fg); }
.hp-quiz-sum { font-weight: 600; color: var(--fg); }
.hp-cards-h { margin: 0 0 8px; }
.hp-card-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hp-card { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 6px; align-items: center; }
.hp-card input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.hp-card .rv-tinput { min-width: 0; padding: 6px 8px; }
.hp-cards-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.hp-settings { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.hp-panel .hp-settings { position: absolute; inset: 52px 10px 10px; overflow: auto; z-index: 3; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.hp-set-h { margin: 0; font-size: 15px; color: var(--fg); }
.hp-set-sub { margin: 0 0 6px; font-size: 13px; color: var(--fg); }
.hp-set-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hp-set-group legend { font-size: 13px; color: var(--fg); margin-bottom: 4px; font-weight: 600; }
.hp-radio, .hp-check { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; min-height: 28px; }
.hp-radio input, .hp-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hp-radio-desc { grid-column: 2; font-size: 12px; color: var(--muted); }
.hp-hist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.hp-hist li { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.hp-model { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hp-model-name { margin: 0; color: var(--fg); }
.hp-progress { width: 100%; height: 10px; accent-color: var(--accent); }
.hp-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hp-confirm p { flex-basis: 100%; margin: 0; color: var(--fg); }
.hp-panel { position: relative; }
@media (any-pointer: coarse) {
	.hp-mode, .hp-subtab, .hp-actions .rv-tbtn, .hp-icon-btn, .hp-menu-item, .hp-choice, .hp-support-link, .hp-support-btn { min-height: 44px; }
	.hp-icon-btn { width: 44px; }
	.hp-chip-x { width: 36px; height: 36px; }
	.hp-link-btn { min-height: 36px; }
}
@media (max-width: 520px) {
	.hp-card { grid-template-columns: auto 1fr auto; }
	.hp-card .rv-tinput:nth-of-type(3) { grid-column: 2; grid-row: 2; }
}
.hp-start { border-color: var(--accent-ink); font-weight: 600; }
.hp-settings > .rv-tbtn, .hp-set-group > .rv-tbtn { align-self: flex-start; }
