/* ═══════════════════════════════════════════════════════════════════════
   Résumé Builder (features/resume/templates/resume_builder.html)
   The layout, steps, sheet, toolbar and shared controls come from the
   builder frame (static/css/builder_frame.css). Only what is particular to
   the résumé lives here: its page size, the section editor's fields and
   lists, the score, and the header's score pill.
   ═══════════════════════════════════════════════════════════════════════ */

/* Anything the script hides stays hidden, whatever its display style. */
.rb [hidden] { display: none !important; }

/* The templates' page is 600px wide (static/css/resume_templates.css). */
.rb .rb-paper { width: 600px; }
.rb .rb-thumb-inner { width: 600px; }
.rb .bf-tpl-thumb .rt-page, .rb .rb-paper .rt-page { box-shadow: none; }
/* The page follows its wrapper's width, so the frame can lay it out a little
   wider and scale it back to fit the real PDF's page count (builder_frame.js). */
.rb .rb-paper #preview-inner .rt-page { width: 100%; }
.rb .bf-tpl-thumb .tpl-src { pointer-events: none; }
/* The PDF says one page: the screen's own estimate of a page break would
   only confuse, so it goes. */
.rb.rb-onepage .bf-pagegap { display: none; }

/* ── Header score pill ── */
.rb-scorepill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; flex-shrink: 0;
  border: 1px solid var(--color-success-border, #bbf7d0); border-radius: 999px; background: var(--color-success-bg, #f0fdf4);
  font: inherit; cursor: pointer; color: var(--bf-ink);
}
.rb-scorepill[data-band="mid"] { border-color: #fde68a; background: #fffbeb; }
.rb-scorepill[data-band="low"] { border-color: #fecaca; background: #fef2f2; }
.rb-scorepill-num { font-size: 20px; font-weight: 800; color: var(--color-success-text, #15803d); }
.rb-scorepill[data-band="mid"] .rb-scorepill-num { color: #b45309; }
.rb-scorepill[data-band="low"] .rb-scorepill-num { color: #b91c1c; }
.rb-scorepill-label { font-size: 14px; font-weight: 600; color: var(--bf-muted); }
.rb-scorepill:focus-visible { outline: 2px solid var(--bf-accent-text); outline-offset: 2px; }
.rb .bf-head { gap: 12px; }

/* ── Toolbar: the PDF's page count ── */
.rb-pages { font-size: 14px; font-weight: 600; color: var(--bf-muted); white-space: nowrap; padding: 0 4px; }
.rb-pages.rb-pages-over { color: var(--color-warning-text, #92400e); }

/* ── Section editor ── */
.rb-sec > summary { gap: 10px; }
.rb-sec-icon { width: 18px; height: 18px; color: var(--bf-accent-text); flex-shrink: 0; }
.rb-sec > summary .bf-pill { flex-shrink: 0; }
.rb .bf-sec-body { gap: 12px; }
.rb-f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--bf-muted); min-width: 0; }
.rb-f input, .rb-f textarea, .rb-item input, .rb-item textarea, .rb-addrow input {
  font: inherit; font-size: 16px; font-weight: 400; color: var(--bf-ink); width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--color-border-strong, #cbd5e1); border-radius: 10px; background: #fff;
}
.rb-f textarea, .rb-item textarea { resize: vertical; line-height: 1.5; min-height: 64px; overflow-y: hidden; }
.rb-f input:focus, .rb-f textarea:focus, .rb-item input:focus, .rb-item textarea:focus, .rb-addrow input:focus {
  outline: none; border-color: var(--bf-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-accent) 18%, transparent);
}
.rb-f-hint { font-size: 13px; font-weight: 500; color: var(--bf-faint); }
.rb-f-hint:empty { display: none; }
.rb-f-label { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--bf-muted); }
.rb-warn { color: var(--color-warning-text, #92400e) !important; }
.rb-note { margin: 0; font-size: 14px; color: var(--bf-muted); background: var(--bf-soft); border: 1px solid var(--bf-line); border-radius: 10px; padding: 10px 12px; }
.rb-note.rb-warn { background: var(--color-warning-bg, #fffbeb); border-color: #fde68a; }
.rb-note ul { margin: 4px 0; padding-left: 20px; }
.rb-note p { margin: 0; }
.rb-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rb-count { font-size: 13px; color: var(--bf-faint); font-weight: 600; }
.rb-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .rb-grid2 { grid-template-columns: minmax(0, 1fr); } }
.rb-sec-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--bf-line); }
.rb-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--color-border-strong, #cbd5e1); border-radius: 10px; background: var(--bf-card);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--bf-ink); cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.rb-tool svg { width: 16px; height: 16px; flex-shrink: 0; }
.rb-tool:hover:not([disabled]) { background: var(--bf-soft); border-color: var(--bf-muted); }
.rb-tool[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.rb-tool:focus-visible { outline: 2px solid var(--bf-accent-text); outline-offset: 2px; }
.rb-tool-danger { margin-left: auto; color: var(--color-danger-text, #b91c1c); border-color: #fca5a5; }
.rb-tool-danger:hover:not([disabled]) { background: #fef2f2; border-color: #f87171; }
.rb-tools-note { margin: 0; font-size: 13px; color: var(--bf-faint); flex: 1 1 160px; }

/* Tooltips on icon-only buttons (hover on desktop, keyboard focus anywhere) */
.rb [data-tip] { position: relative; }
.rb [data-tip]::after {
  content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 40;
  width: max-content; max-width: 230px; padding: 8px 10px; border-radius: 8px;
  background: #0f172a; color: #fff; font-size: 13px; font-weight: 500; line-height: 1.35; text-align: left; white-space: normal;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .25); pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
@media (hover: hover) { .rb [data-tip]:hover::after { opacity: 1; visibility: visible; transform: none; transition-delay: .2s; } }
.rb [data-tip]:focus-visible::after { opacity: 1; visibility: visible; transform: none; }
@media (prefers-reduced-motion: reduce) { .rb [data-tip]::after { transition: none; } }

/* Why this works */
.rb-whybox { border: 1px solid var(--bf-line); border-radius: 12px; padding: 10px 12px; background: var(--bf-card); }
.rb-why-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.rb-why { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rb-why li { position: relative; padding-left: 24px; font-size: 14px; color: var(--bf-muted); }
.rb-why li::before { content: ""; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; }
.rb-why li.ok::before { background: var(--bf-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat; }
.rb-why li.todo::before { border: 2px solid var(--color-warning, #d97706); width: 12px; height: 12px; top: 4px; }

/* Lists of lines (certifications, custom sections, bullets) */
.rb-items, .rb-bullets { display: flex; flex-direction: column; gap: 8px; }
.rb-item { display: flex; align-items: flex-start; gap: 6px; }
.rb-item input, .rb-item textarea { flex: 1; min-width: 0; }
.rb-item-over textarea { opacity: .6; }
.rb-icon-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 44px;
  border: 1px solid var(--bf-line); border-radius: 10px; background: var(--bf-card); color: var(--bf-muted);
  font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
}
.rb-icon-btn:hover:not([disabled]) { background: var(--bf-soft); color: var(--bf-ink); }
.rb-icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.rb-icon-btn svg { width: 16px; height: 16px; }
.rb-icon-btn.rb-x:hover { color: var(--color-danger-text, #b91c1c); }
.rb-icon-btn.rb-ai-sq { color: var(--bf-accent-text); border-color: var(--bf-accent-line); }
.rb-icon-btn:focus-visible, .rb-chip-x:focus-visible, .rb-link:focus-visible, .rb-seg button:focus-visible { outline: 2px solid var(--bf-accent-text); outline-offset: 2px; }

/* Add-on items (Volunteer Work, Projects...): dates and optional details */
.rb-xitem { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 8px; border: 1px solid var(--bf-line); border-radius: 12px; background: var(--bf-card); }
.rb-xitem-open { background: var(--bf-soft); gap: 8px; }
.rb-xlabel { margin: 0; }
.rb-xdates { max-width: 260px; }
.rb-xitem-open .rb-xdates { max-width: none; }
.rb-xdet { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.rb-xmore { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.rb-xtoggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px dashed var(--bf-accent-line); background: transparent; color: var(--bf-accent-text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.rb-xtoggle::before { content: "+"; font-size: 16px; line-height: 1; }
.rb-xtoggle[aria-expanded="true"] { border-style: solid; border-color: var(--bf-line); color: var(--bf-muted); }
.rb-xtoggle[aria-expanded="true"]::before { content: "\2212"; }
.rb-xtoggle:hover { background: var(--bf-accent-soft); }
.rb-xtoggle:focus-visible { outline: 2px solid var(--bf-accent-text); outline-offset: 2px; }
.rb-xmore-hint { font-size: 13px; color: var(--bf-faint); }

/* Entries (jobs, schools, references) */
.rb-entry { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--bf-line); border-radius: 12px; background: var(--bf-soft); }
.rb-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rb-entry-name { font-size: 15px; font-weight: 700; color: var(--bf-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-tools { display: flex; gap: 4px; flex-shrink: 0; }
.rb-tools .rb-icon-btn { width: 36px; height: 36px; font-size: 16px; }

/* Skills chips */
.rb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--bf-accent-soft); color: var(--bf-ink); font-size: 14px; font-weight: 600; border: 1px solid var(--bf-accent-line); }
.rb-chip-over { opacity: .45; }
.rb-chip-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--bf-muted); font-size: 18px; cursor: pointer; }
.rb-chip-x:hover { background: #fff; color: var(--color-danger-text, #b91c1c); }
.rb-addrow { display: flex; gap: 8px; }
.rb-addrow input { flex: 1; min-width: 0; }

/* References toggle */
.rb-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; }
.rb-toggle input { width: 20px; height: 20px; accent-color: var(--bf-accent); }

/* Add-a-section dialog */
.rb-add-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Design: spacing ── */
.rb-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--bf-line); border-radius: 12px; overflow: hidden; }
.rb-seg button { min-height: 44px; border: 0; border-right: 1px solid var(--bf-line); background: var(--bf-card); font: inherit; font-size: 14px; font-weight: 600; color: var(--bf-muted); cursor: pointer; }
.rb-seg button:last-child { border-right: 0; }
.rb-seg button[aria-pressed="true"] { background: var(--bf-accent-soft); color: var(--bf-accent-text); }
.rb-seg button[disabled] { opacity: .5; cursor: not-allowed; }

/* A template whose PDF has fixed colours: the colour controls stay usable
   (the choice is kept) but are dimmed, with the note above them. */

/* ── Improve: score ── */
.rb-score-top { display: flex; align-items: center; gap: 14px; }
.rb .rb-ring { width: 72px; height: 72px; }
.rb .rb-ring svg { width: 72px; height: 72px; }
.rb .rb-ring span { font-size: 22px; }
.rb-stale { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-warning-text, #92400e); }
.rb-bars { display: flex; flex-direction: column; gap: 12px; }
.rb-bar-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.rb-bar-num { color: var(--bf-muted); }
.rb-bar-track { height: 8px; border-radius: 999px; background: var(--color-gray-200, #e5e7eb); margin-top: 4px; overflow: hidden; }
.rb-bar-fill { height: 100%; border-radius: 999px; background: var(--bf-accent); }
.rb-bar-fill.low { background: var(--color-warning, #d97706); }
.rb-bar-note { margin: 4px 0 0; font-size: 13px; color: var(--bf-faint); }
.rb-priorities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: pri; }
.rb-pri { position: relative; padding: 12px 12px 12px 48px; border: 1px solid var(--bf-line); border-radius: 12px; background: var(--bf-card); counter-increment: pri; }
.rb-pri::before { content: counter(pri); position: absolute; left: 12px; top: 12px; width: 26px; height: 26px; border-radius: 8px; background: var(--bf-accent-soft); color: var(--bf-accent-text); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.rb-pri-text { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.rb-pri-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rb-link { border: 0; background: none; padding: 6px 0; min-height: 40px; font: inherit; font-size: 14px; font-weight: 700; color: var(--bf-accent-text); cursor: pointer; }

/* ── Preview: checks ── */
.rb-checks { padding: 0; border: 0; }
.rb-checks .bf-check.wait svg { color: var(--bf-faint); }

/* Narrowest phones: the toolbar keeps every tool by dropping the page count
   (the Preview step still shows it), and the score pill shows just the number. */
@container (max-width: 380px) {
  .rb .rb-pages { display: none; }
}
@media (max-width: 360px) {
  .rb .rb-scorepill { padding: 6px 10px; }
  .rb .rb-scorepill-label { display: none; }
}

/* Straight after building a kit: the welcome banner. */
.rb-ready { display: flex; align-items: center; gap: 12px; margin: 12px 16px 0; padding: 10px 14px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--bf-accent-line); background: var(--bf-accent-soft); }
.rb-ready-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--bf-accent); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rb-ready-icon svg { width: 18px; height: 18px; }
.rb-ready-body { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; color: var(--bf-muted); }
.rb-ready-body strong { font-size: 15px; color: var(--bf-ink); }
.rb-ready-x { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 22px; color: var(--bf-muted); cursor: pointer; flex-shrink: 0; }
.rb-ready-x:hover { background: #fff; }

/* ── Résumé photo (audit/resume_photo_plan.md) ───────────────────────────── */
.rb-photo-row { display: flex; align-items: center; gap: 14px; }
.rb-photo-thumb {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--bf-accent-soft); color: var(--bf-accent-text);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px var(--bf-line);
}
.rb-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rb-photo-thumb svg { width: 30px; height: 30px; }
.rb-photo-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-photo-pick { position: relative; overflow: hidden; cursor: pointer; }
.rb-photo-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }
.rb-photo-pick[aria-disabled="true"], .rb-photo-pick[aria-disabled="true"] input { opacity: .45; cursor: not-allowed; }
.rb-photo-pick:focus-within { outline: 2px solid var(--bf-accent); outline-offset: 2px; }
.rb-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--bf-ink); cursor: pointer; position: relative; }
.rb-switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.rb-switch-track { width: 44px; height: 26px; border-radius: 999px; background: var(--color-border-strong, #cbd5e1); position: relative; flex-shrink: 0; transition: background .15s; }
.rb-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3); transition: transform .15s; }
.rb-switch input:checked + .rb-switch-track { background: var(--bf-accent); }
.rb-switch input:checked + .rb-switch-track::after { transform: translateX(18px); }
.rb-switch input:focus-visible + .rb-switch-track { outline: 2px solid var(--bf-accent); outline-offset: 2px; }
.rb-switch input:disabled + .rb-switch-track { opacity: .45; }
.rb-crop { position: relative; width: min(320px, 100%); aspect-ratio: 1; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #e2e8f0; touch-action: none; }
.rb-crop canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.rb-crop canvas:active { cursor: grabbing; }
.rb-crop::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at center, transparent 0 49.4%, rgba(255, 255, 255, .95) 49.6% 50.2%, rgba(15, 23, 42, .5) 50.4%);
}
.rb-crop-zoom { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; color: var(--bf-muted); }
.rb-crop-zoom input { flex: 1; min-height: 44px; }

/* Editing on the page (click text on the résumé) */
.rb .bf-paper .rb-ed { border-radius: 2px; outline: 1px dashed transparent; outline-offset: 2px; transition: outline-color .15s, background-color .15s; cursor: text; }
@media (hover: hover) { .rb .bf-paper .rb-ed:hover { outline-color: rgba(15, 23, 42, .28); background: rgba(37, 99, 235, .05); } }
.rb .bf-paper .rb-ed:focus { outline: 1px dashed var(--bf-accent); background: rgba(37, 99, 235, .06); }
.rb .bf-paper .rb-jump { cursor: pointer; border-radius: 2px; }
@media (hover: hover) { .rb .bf-paper .rb-jump:hover { background: rgba(37, 99, 235, .06); } }
.rb.bf-clean .bf-paper .rb-ed, .rb.bf-clean .bf-paper .rb-jump { outline: none !important; background: none !important; cursor: default; }
.rb-flash { animation: rb-flash 1.5s ease; }
@keyframes rb-flash { 0%, 60% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-accent) 45%, transparent); } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .rb-ed, .rb-flash { transition: none; animation: none; } }

/* Phone header (live pages audit, 2026-10-15): the score pill matches the
   PDF button's height so the title row stays one slim line. */
@media (max-width: 720px) {
  .rb .rb-scorepill { min-height: 36px; padding: 2px 10px; gap: 5px; }
  .rb .rb-scorepill-num { font-size: 17px; }
  .rb .rb-scorepill-label { font-size: 12.5px; }
}

