/* 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); }
.rv-tools-name::before { 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); }
.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: 7px; font-size: 13px; }
.rv-tbtn:hover { border-color: var(--accent-2); }
.rv-tbtn-accent { background: var(--accent); color: #1a1500; 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); color: var(--fg); border-radius: 7px; 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: 6px; 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: 8px; 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: 8px; 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: #1a1500; 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: 8px; 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; 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: 4px; }
.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: 7px; 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: 5px; }
.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); }
.rv-timer-phase { color: var(--accent); font-size: 16px; }
.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: 8px; 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: 5px; }
.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: 10px; 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); }
.rv-color-palette { display: flex; gap: 8px; }
.rv-color-chip { width: 56px; height: 44px; border-radius: 8px; 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: 8px; }
.rv-contrast-preview { display: flex; align-items: center; justify-content: center; height: 70px; border-radius: 8px; 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; gap: 8px; }
.rv-pass-out { flex: 1; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }
.rv-pass-meter { height: 7px; border-radius: 4px; 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: 8px; 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: 8px; 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 { 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: 6px; color: var(--fg-2); background: var(--surface); }
.rv-cal-cell.empty { border: 0; background: transparent; }
.rv-cal-cell.today { background: var(--accent); color: #1a1500; border-color: var(--accent); font-weight: 700; }
.rv-cal-tool { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; 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: 8px; 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: 8px; 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); }
.rv-md-preview code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rv-md-preview pre { background: var(--bg); padding: 10px; border-radius: 6px; 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: 8px; 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: #1a1500; 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); }

@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; }
}
