/* App chrome around the resume. Nothing here may affect the printed resume: every screen element is
   hidden in print, and print-only rules at the bottom reset the sheet to its natural page layout. */
:root{
  --canvas:#EEEAEB; --surface:#FFFFFF; --line:#E2D9DC; --line-strong:#CDBFC4;
  --c-ink:#2B2327; --c-text:#4C4247; --c-muted:#7D7076; --accent:#A24A62; --accent-ink:#FFFFFF;
  --accent-soft:#F7E6EB; --focus:#A24A62; --ph:#B4A5AB; --ok:#2F7A55; --warn:#9A6A12; --bad:#A93A3A;
  --radius:6px; --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box}
html{background:var(--canvas)}
body{margin:0;font:14px/1.45 var(--font);color:var(--c-text);background:var(--canvas)}
button{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---- header: toolbar + status line, one sticky block so nothing below ever shifts ---- */
.top{position:sticky;top:0;z-index:20;background:var(--surface);border-bottom:1px solid var(--line);box-shadow:0 1px 0 rgba(43,35,39,.03)}
.bar{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:10px 16px}
.brand{display:flex;align-items:center;gap:8px;font-weight:650;color:var(--c-ink);white-space:nowrap}
.brand svg{flex:none}
.group{display:flex;align-items:center;gap:6px}
.group-label{font-size:12px;color:var(--c-muted);margin-right:2px}
.spacer{flex:1}
.btn{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border:1px solid var(--line-strong);border-radius:var(--radius);
  background:var(--surface);color:var(--c-ink);cursor:pointer;white-space:nowrap;transition:background .12s,border-color .12s}
.btn:hover{background:#FAF6F7;border-color:#BBA9B0}
.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.45;cursor:default;transform:none}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:600}
.btn.primary:hover{background:#8E3D54;border-color:#8E3D54}
.btn.danger{color:var(--bad);border-color:#E3C3C3}
.btn .chev{font-size:10px;color:var(--c-muted)}
.btn.primary .chev{color:inherit}
.doc-btn{max-width:240px}
.doc-btn .doc-name{overflow:hidden;text-overflow:ellipsis}

.seg{display:inline-flex;border:1px solid var(--line-strong);border-radius:var(--radius);overflow:hidden;background:var(--surface)}
.seg button{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:0;background:none;cursor:pointer;color:var(--c-text)}
.seg button+button{border-left:1px solid var(--line)}
.seg button[aria-checked="true"]{background:var(--accent-soft);color:var(--c-ink);font-weight:600}
.swatch{width:14px;height:14px;border-radius:50%;border:1px solid rgba(43,35,39,.18);flex:none}

/* one fixed line: a long message is shortened (full text on hover), it never pushes the page down */
.statusbar{display:flex;flex-wrap:nowrap;align-items:center;gap:14px;padding:0 16px;height:36px;border-top:1px solid var(--line);background:#FBF9F9;font-size:13px;white-space:nowrap}
.status{display:flex;align-items:center;gap:10px;color:var(--c-text);flex:1 1 auto;min-width:0}
#status-text{overflow:hidden;text-overflow:ellipsis;min-width:0}
#status-actions{flex:none;display:flex;gap:4px}
.pages{flex:none}
.status .dot-ok{width:7px;height:7px;border-radius:50%;background:var(--ok);flex:none}
.status.is-problem .dot-ok{background:var(--bad)}
.status.is-notice .dot-ok{background:var(--warn)}
.linkbtn{border:0;background:none;padding:2px 4px;border-radius:4px;color:var(--accent);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.linkbtn:hover{background:var(--accent-soft)}
.pages{color:var(--c-muted)}
.hint{color:var(--c-muted);flex:none}
@media (max-width:1279px){.hint{display:none}}
.hint kbd{font:12px/1 var(--font);border:1px solid var(--line-strong);border-bottom-width:2px;border-radius:4px;padding:1px 4px;background:var(--surface)}

/* ---- menus ---- */
.menu-wrap{position:relative}
.menu-pop{position:absolute;top:calc(100% + 6px);left:0;z-index:40;min-width:240px;max-width:340px;max-height:70vh;overflow:auto;padding:6px;
  background:var(--surface);border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 12px 32px rgba(43,35,39,.14)}
.menu-pop.right{left:auto;right:0}
.menu-item{display:flex;flex-direction:column;align-items:flex-start;width:100%;padding:7px 10px 7px 28px;border:0;border-radius:5px;background:none;text-align:left;cursor:pointer;position:relative;color:var(--c-ink)}
.menu-item:hover,.menu-item:focus{background:var(--accent-soft);outline:none}
.menu-item[aria-checked="true"]::before{content:"✓";position:absolute;left:10px;top:7px;color:var(--accent);font-weight:700}
.menu-item.danger .menu-label{color:var(--bad)}
.menu-item[aria-disabled="true"]{opacity:.45;cursor:default}
.menu-hint{font-size:12px;color:var(--c-muted)}
.menu-sep{height:1px;background:var(--line);margin:5px 4px}
.menu-heading{font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--c-muted);padding:8px 10px 4px}

/* ---- stage + sheet ---- */
.stage{padding:28px 16px 64px;overflow-x:hidden}
.sheet-fit{margin:0 auto;width:210mm}
.sheet{position:relative;width:210mm;background:var(--paper);box-shadow:0 1px 2px rgba(43,35,39,.06),0 10px 34px rgba(43,35,39,.10);border-radius:2px;
  padding-bottom:12mm;transform-origin:top left}
.sheet .resume{min-height:285mm}

/* editing affordances, screen only */
@media screen{
  .resume .f{border-radius:2px;cursor:text;transition:background-color .12s}
  .resume .f:hover{background:rgba(162,74,98,.06)}
  .resume .f:focus{outline:none;background:rgba(162,74,98,.07);box-shadow:0 0 0 2px rgba(162,74,98,.28)}
  .resume .f.is-empty::after{content:attr(data-ph);color:var(--ph);font-style:italic;font-weight:400;cursor:text}
  .resume h2 .f.is-empty::after{font-family:var(--font);font-size:12pt}
  .resume [data-node].is-selected{box-shadow:0 0 0 1px rgba(162,74,98,.35),0 0 0 4px rgba(162,74,98,.08);border-radius:3px}
  .resume .masthead.is-selected{box-shadow:inset 0 0 0 1px rgba(162,74,98,.35)}
  .resume .job:not(.is-selected):not(:focus-within) .ctx:has(> .is-empty){display:none}
}

/* page guide: where Chrome will start each printed page */
.guides{position:absolute;inset:0;pointer-events:none}
.pg{position:absolute;left:-14px;right:-14px;border-top:1px dashed #C9A3AF}
.pg span{position:absolute;right:0;top:-10px;transform:translateX(calc(100% + 6px));font-size:11px;color:var(--c-muted);background:var(--canvas);padding:1px 6px;border-radius:10px;border:1px solid var(--line);white-space:nowrap}

/* measuring mode mirrors the print rules for empty fields (switched on for a moment while measuring) */
.sheet.measuring .resume .is-empty:not(:focus),
.sheet.measuring .resume .org:has(> .is-empty):not(:focus-within),
.sheet.measuring .resume .ctx:has(> .is-empty):not(:focus-within),
.sheet.measuring .resume .where:has(> .loc.is-empty):not(:focus-within) .dot,
.sheet.measuring .resume .where:not(:has(.f:not(.is-empty))):not(:focus-within),
.sheet.measuring .resume .items .sep:has(+ wbr + .it.is-empty:not(:focus)),
.sheet.measuring .resume .items .sep:has(+ br + wbr + .it.is-empty:not(:focus)),
.sheet.measuring .resume .items .it.is-empty:first-child:not(:focus) + .sep{display:none}

/* ---- control bar for the selected part ---- */
.ctl{position:absolute;z-index:15;display:flex;flex-direction:column;align-items:stretch;gap:4px;width:150px;padding:8px;
  background:var(--surface);border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 8px 24px rgba(43,35,39,.12);transition:top .14s ease}
.ctl[hidden]{display:none}
.ctl-label{font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--c-muted);padding:0 4px 2px}
.ctl button{height:30px;padding:0 10px;border:1px solid var(--line);border-radius:5px;background:var(--surface);cursor:pointer;text-align:left;color:var(--c-ink)}
.ctl button:hover{background:#FAF6F7;border-color:var(--line-strong)}
.ctl button.bold{font-weight:700}
.ctl button[aria-pressed="true"]{background:var(--accent-soft);border-color:#E3BFC9}
.ctl button.quiet-danger{color:var(--bad)}
.ctl.docked{position:fixed;left:50%;right:auto;top:auto;bottom:12px;transform:translateX(-50%);flex-direction:row;flex-wrap:wrap;justify-content:center;width:auto;max-width:calc(100vw - 24px);transition:none}
.ctl.docked .ctl-label{align-self:center}
.ctl.docked button{text-align:center}

/* ---- dialogs ---- */
dialog.dlg{border:1px solid var(--line-strong);border-radius:10px;padding:0;width:min(520px,calc(100vw - 32px));color:var(--c-text);box-shadow:0 24px 60px rgba(43,35,39,.22)}
dialog.dlg.wide{width:min(860px,calc(100vw - 32px))}
dialog.dlg::backdrop{background:rgba(43,35,39,.32)}
.dlg-body{padding:20px 22px}
.dlg h2{margin:0 0 6px;font-size:18px;color:var(--c-ink)}
.dlg p{margin:0 0 12px}
.dlg ol{margin:0 0 14px;padding-left:20px}
.dlg ol li{margin:4px 0}
.dlg-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:14px 22px;border-top:1px solid var(--line);background:#FBF9F9;border-radius:0 0 10px 10px}
.dlg-actions .left{margin-right:auto;display:flex;align-items:center;gap:6px;font-size:13px}
.muted{color:var(--c-muted)}
.drop{display:flex;flex-direction:column;align-items:center;gap:10px;padding:28px 16px;border:1.5px dashed var(--line-strong);border-radius:8px;background:#FCFAFA;text-align:center}
.drop.over{border-color:var(--accent);background:var(--accent-soft)}
.ats-summary{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-weight:600;color:var(--c-ink)}
.checks{list-style:none;margin:0 0 16px;padding:0;border:1px solid var(--line);border-radius:8px;overflow:hidden}
.checks li{display:grid;grid-template-columns:76px 1fr;gap:4px 12px;padding:10px 14px;background:var(--surface)}
.checks li+li{border-top:1px solid var(--line)}
.badge{align-self:start;justify-self:start;font-size:12px;font-weight:600;padding:2px 8px;border-radius:999px;border:1px solid}
.badge.pass{color:var(--ok);border-color:#BFDCCB;background:#F1F8F4}
.badge.warn{color:var(--warn);border-color:#E7D2A6;background:#FBF6EA}
.badge.fail{color:var(--bad);border-color:#E9C2C2;background:#FBF1F1}
.badge.info{color:var(--c-muted);border-color:var(--line);background:#F7F4F5}
.check-title{font-weight:600;color:var(--c-ink)}
.check-detail{grid-column:2;color:var(--c-text);font-size:13px;overflow-wrap:anywhere}
details.textview{border:1px solid var(--line);border-radius:8px;margin:0 0 10px;background:var(--surface)}
details.textview summary{cursor:pointer;padding:9px 14px;font-weight:600;color:var(--c-ink)}
details.textview pre{margin:0;padding:12px 14px;border-top:1px solid var(--line);max-height:320px;overflow:auto;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;color:var(--c-text);background:#FCFAFA}
.check-input{display:none}

@media (max-width:899px){
  .hint{display:none}
  .stage{padding:16px 12px 120px}
  .sheet-fit{width:auto}
}
@media (max-width:599px){
  .bar{gap:8px;padding:8px 12px}
  .group-label,.brand-text,.seg .lbl{display:none}
  .seg button{padding:0 10px}
  .doc-btn{max-width:150px}
  .statusbar{padding:0 12px}
}
@media (prefers-reduced-motion:reduce){*{transition:none !important}}

/* ---- print: only the resume, exactly as designed ---- */
@media print{
  html,body{background:var(--paper)}
  .top,.ctl,.guides,dialog,.check-input,.skip{display:none !important}
  .stage{padding:0;overflow:visible}
  .sheet-fit{width:auto !important;height:auto !important;margin:0}
  .sheet{position:static;width:auto;box-shadow:none;border-radius:0;padding:0;transform:none !important}
  .sheet .resume{min-height:0}
}
