/* PDFWatt — pro tool chrome. Graphite workspace, hairline borders, Lucide
   icons, Watt-orange accent. No emoji, no toy buttons. */
* { box-sizing: border-box; margin: 0; }
:root {
  --chrome: #16181d;
  --chrome2: #1d2027;
  --well: #23262e;
  --line: rgba(255,255,255,0.09);
  --text: #e8eaf0;
  --muted: #9aa1ad;
  --accent: #f97316;
  --accent-hi: #fb8b3c;
  --focus: rgba(56,189,248,0.7);
  --radius: 9px;
}
html, body { height: 100%; }
body {
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--well); color: var(--text);
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button { font: inherit; cursor: pointer; color: var(--text); background: none; border: none; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button:disabled { opacity: 0.35; cursor: default; }

/* ── top bar ── */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px;
  background: var(--chrome); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; user-select: none; display: flex; align-items: center; gap: 8px; }
.brand .mark { width: 26px; height: 26px; stroke: none; }
.drop-mark { width: 74px; height: 74px; stroke: none; margin-bottom: 2px; filter: drop-shadow(0 8px 24px rgba(249,115,22,0.25)); }
.brand span, .drop-logo span { color: var(--accent); }
.filebtns { display: flex; gap: 8px; }
.zoomgrp { display: flex; align-items: center; gap: 2px; background: var(--chrome2); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; }
.zbtn { width: 32px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: background 200ms ease, color 200ms ease; }
.zbtn:hover { background: #262a33; color: var(--text); }
.zbtn.active { background: var(--accent); color: #fff; }
.zlabel { min-width: 52px; height: 30px; font-size: 12px; font-weight: 600; color: var(--text); border-radius: 7px; }
.zlabel:hover { background: #262a33; }
.filebtns button {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: var(--radius);
  transition: background 200ms ease, border-color 200ms ease, transform 150ms ease;
}
button.ghost { border: 1px solid var(--line); background: var(--chrome2); color: var(--text); }
button.ghost:hover:not(:disabled) { background: #262a33; border-color: rgba(255,255,255,0.18); }
button.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hi); }
button.primary:active { transform: translateY(1px); }
button.big { font-size: 14.5px; padding: 11px 22px; }
.filewrap { position: relative; display: flex; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; width: 264px; background: var(--chrome); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 16px 50px rgba(0,0,0,0.55); z-index: 70; }
.menu[hidden] { display: none; }
.menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 8px; text-align: left; font-size: 13px; }
.menu button:hover { background: var(--chrome2); }
.menu button span { font-size: 11px; color: var(--muted); font-weight: 400; }
.menu.rowmenu { width: 248px; }
.menu.rowmenu button { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.menu.rowmenu button svg { width: 15px; height: 15px; color: var(--muted); }
.menu.rowmenu button:hover svg { color: var(--text); }
.menu.rowmenu kbd { margin-left: auto; font: 600 10.5px/1 Inter, sans-serif; color: var(--muted); background: var(--well); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; }
.menu.rowmenu .mnote { margin-left: auto; font-size: 10.5px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.menu.rowmenu button.danger { color: #f87171; }
.menu.rowmenu button.danger svg { color: #f87171; }

/* ── layout ── */
#main { flex: 1; display: flex; min-height: 0; }

/* ── tool rail ── */
#rail {
  width: 56px; background: var(--chrome); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0;
}
#rail .tool {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px solid transparent;
  transition: background 200ms ease, color 200ms ease;
}
#rail .tool:hover { background: var(--chrome2); color: var(--text); }
#rail .tool.active { background: var(--accent); color: #fff; }
.rail-sep { width: 28px; height: 1px; background: var(--line); margin: 6px 0; }
.grpbtn { position: relative; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: background 200ms ease, color 200ms ease; }
.grpbtn:hover { background: var(--chrome2); color: var(--text); }
.grpbtn.active { background: var(--accent); color: #fff; }
.grpbtn .gicon { display: flex; }
.grpbtn .gicon svg { width: 17px; height: 17px; }
.grpbtn .caret { position: absolute; right: 4px; bottom: 4px; width: 0; height: 0; border-left: 4px solid transparent; border-top: 4px solid currentColor; opacity: 0.65; transform: rotate(-45deg); }
#flyout { width: 208px; }
#flyout [data-grouppanel] { display: flex; flex-direction: column; gap: 2px; }
#flyout [data-grouppanel][hidden] { display: none; }
.frow { display: flex !important; align-items: center; gap: 10px; width: 100%; padding: 9px 10px !important; border-radius: 8px !important; font-size: 13px; font-weight: 500; color: var(--text) !important; height: auto !important; }
.frow:hover { background: var(--chrome2) !important; }
.frow.active { background: var(--accent) !important; color: #fff !important; }
.frow svg { width: 15px; height: 15px; flex-shrink: 0; }
.frow kbd { margin-left: auto; font: 600 10.5px/1 Inter, sans-serif; color: var(--muted); background: var(--well); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; }
#stylechip { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--chrome2); display: flex; align-items: center; justify-content: center; transition: border-color 200ms ease; }
#stylechip:hover { border-color: rgba(255,255,255,0.3); }
#stylechipdot { width: 16px; height: 16px; border-radius: 99px; background: var(--curcolor, #faff00); border: 2px solid rgba(255,255,255,0.7); }
#stylepop { width: 236px; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
#fontfam { width: 42px; font-size: 11px; padding: 4px 2px; border-radius: 7px; background: var(--chrome2); color: var(--text); border: 1px solid var(--line); cursor: pointer; }
.bbtn { width: 26px; height: 24px; border-radius: 7px; font-weight: 800; font-size: 13px; color: var(--muted); border: 1px solid var(--line); background: var(--chrome2); }
.bbtn:hover { color: var(--text); }
.bbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#viewer.erasing .pagewrap { cursor: crosshair; }
/* right-click markup editor */
#ctxmenu { position: fixed; width: 224px; z-index: 80; }
.ctx-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 4px 8px 6px; }
.ctx-colors { display: flex; gap: 6px; align-items: center; padding: 2px 8px 8px; flex-wrap: wrap; }
.ctx-colors .csw { width: 17px; height: 17px; }
#ctxcolor { width: 24px; height: 20px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 0; cursor: pointer; }
.ctx-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 6px 8px; }
.ctx-row[hidden] { display: none; }
.ctx-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.ctx-row input[type="number"] { width: 56px; font: inherit; color: var(--text); background: var(--chrome2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.ctx-row select { font: inherit; font-size: 12px; color: var(--text); background: var(--chrome2); border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.csw { width: 15px; height: 15px; border-radius: 99px; background: var(--c); border: 2px solid transparent; padding: 0; transition: transform 150ms ease, border-color 150ms ease; }
.csw:hover { transform: scale(1.2); }
.csw.active { border-color: #fff; }
.penws { display: flex; flex-direction: column; gap: 3px; width: 34px; }
.pw { display: flex; align-items: center; justify-content: center; height: 16px; border-radius: 5px; padding: 0 4px; }
.pw i { display: block; width: 100%; border-radius: 3px; background: var(--muted); }
.pw:hover i { background: var(--text); }
.pw.active { background: var(--chrome2); }
.pw.active i { background: var(--accent); }
.swatch {
  width: 30px; height: 30px; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); position: relative;
}
.swatch input { position: absolute; inset: -6px; width: 42px; height: 42px; border: none; padding: 0; cursor: pointer; }
#fontsize {
  width: 42px; font-size: 12px; text-align: center; padding: 5px 2px; border-radius: 8px;
  background: var(--chrome2); color: var(--text); border: 1px solid var(--line);
  appearance: none; cursor: pointer;
}

/* ── page thumbnails ── */
#sidebar {
  width: 138px; overflow-y: auto; background: var(--chrome2);
  border-right: 1px solid var(--line); padding: 10px;
  display: none; flex-direction: column; gap: 10px;
}
#sidebar.on { display: flex; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 4px; }
.side-head span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.side-head button { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 7px; background: var(--well); color: var(--muted); border: 1px solid var(--line); transition: color 200ms ease, background 200ms ease; }
.side-head button:hover { color: var(--text); background: #2b2f39; }
#extractbtn { position: sticky; bottom: 0; margin-top: 2px; font-size: 12px; font-weight: 700; padding: 9px 8px; border-radius: 9px; background: var(--accent); color: #fff; border: none; box-shadow: 0 -6px 16px rgba(29,32,39,0.9); }
#extractbtn:hover { background: var(--accent-hi); }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 5px; background: var(--chrome); transition: border-color 200ms ease; }
.thumb .pick { position: absolute; top: 9px; left: 9px; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; opacity: 0.6; transition: opacity 200ms ease; z-index: 2; }
.thumb:hover .pick, .thumb .pick:checked { opacity: 1; }
.thumb:hover { border-color: rgba(255,255,255,0.25); }
.thumb.dropmark { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb { cursor: grab; }
.thumb canvas { width: 100%; display: block; border-radius: 5px; background: #fff; }
.thumb .pn { text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.thumb .tb { display: flex; justify-content: center; gap: 3px; margin-top: 4px; opacity: 0.55; transition: opacity 200ms ease; }
.thumb:hover .tb { opacity: 1; }
.thumb .tb button {
  padding: 3px 7px; font-size: 11px; border-radius: 6px;
  background: var(--well); color: var(--muted); border: 1px solid var(--line);
}
.thumb .tb button:hover { color: var(--text); background: #2b2f39; }

/* ── search ── */
.searchgrp { display: flex; align-items: center; gap: 6px; background: var(--chrome2); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 4px 2px 10px; }
.searchgrp > svg { width: 14px; height: 14px; color: var(--muted); }
#searchbox { width: 190px; background: none; border: none; color: var(--text); font: inherit; font-size: 13px; padding: 7px 2px; outline: none; }
#searchbox::placeholder { color: var(--muted); }
#searchcount { font-size: 11.5px; color: var(--muted); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.trun.hit { background: rgba(255, 212, 0, 0.45); border-radius: 2px; }
.trun.cur { background: rgba(249, 115, 22, 0.6); }

/* ── viewer / canvas well ── */
#viewwrap { flex: 1; min-width: 0; position: relative; display: flex; }
#viewer { flex: 1; overflow: auto; position: relative; background: var(--well); }
#viewer.hand { cursor: grab; }
#viewer.hand.panning, #viewer.panning { cursor: grabbing; }

#measurebar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; z-index: 20;
  background: var(--chrome); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 6px; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#measurebar[hidden] { display: none; }
#measurebar button { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 99px; color: var(--muted); }
#measurebar button:hover { color: var(--text); background: var(--chrome2); }
#measurebar button.active { background: var(--accent); color: #fff; }
#mm-scale { font-size: 11.5px; color: var(--muted); padding: 0 6px; }

/* ── bottom page bar ── */
#pagebar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  background: var(--chrome); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); z-index: 20;
}
#pagebar[hidden] { display: none; }
.pgtext { font-size: 12.5px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
#pgnum {
  width: 42px; text-align: center; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text); background: var(--chrome2); border: 1px solid var(--line);
  border-radius: 7px; padding: 4px 2px; -moz-appearance: textfield;
}
#pgnum::-webkit-outer-spin-button, #pgnum::-webkit-inner-spin-button { -webkit-appearance: none; }
#pgtotal { color: var(--text); font-weight: 600; }
#pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 22px 14px 80px; width: max-content; min-width: 100%; }
#viewer.panning { cursor: grabbing; }
.pagewrap { position: relative; background: #fff; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 12px 40px rgba(0,0,0,0.45); }
.pagewrap canvas.pg { display: block; }

/* ── empty state ── */
#drop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#drop.hidden { display: none; }
.drop-inner { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.drop-logo { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.drop-sub { font-size: 13px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.drop-card {
  margin-top: 18px; padding: 34px 44px; border: 1.5px dashed rgba(255,255,255,0.18);
  border-radius: 16px; background: rgba(255,255,255,0.02);
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  transition: border-color 200ms ease, background 200ms ease;
}
#drop.drag .drop-card { border-color: var(--accent); background: rgba(249,115,22,0.06); }
.drop-card svg { width: 34px; height: 34px; color: var(--muted); stroke-width: 1.5; }
.drop-card p strong { font-size: 15px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ── text layer & annotations (functional styles) ── */
.textlayer { position: absolute; inset: 0; }
.textlayer .trun { position: absolute; color: transparent; cursor: text; white-space: pre; transform-origin: 0 0; user-select: text; }
.textlayer .trun::selection { background: rgba(37, 99, 235, 0.38); }
.textlayer .trun:hover { outline: 1px dashed rgba(249,115,22,0.85); background: rgba(249,115,22,0.07); border-radius: 2px; }

.formlayer { position: absolute; inset: 0; }
.ffield { position: absolute; background: rgba(37, 99, 235, 0.09); border: 1px solid rgba(37, 99, 235, 0.4); border-radius: 2px; font-family: Helvetica, Arial, sans-serif; color: #16181d; padding: 0 3px; box-sizing: border-box; }
.ffield:focus { outline: 2px solid rgba(37, 99, 235, 0.65); background: #fff; }
.ffield[type="checkbox"] { accent-color: #2563eb; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.annot { position: absolute; touch-action: none; pointer-events: auto; }
.annot.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.annot .del {
  position: absolute; top: -13px; right: -13px; width: 22px; height: 22px;
  border-radius: 99px; background: #dc2626; color: #fff; border: 2px solid #fff;
  font-size: 11px; line-height: 1; display: none; padding: 0;
}
.annot .rz { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 4px; background: var(--accent); border: 2px solid #fff; display: none; cursor: nwse-resize; }
.annot.sel .del, .annot.sel .rz { display: block; }
.annot.text .ed, .annot.edit .ed { outline: none; min-width: 24px; min-height: 1em; line-height: 1.25; font-family: Helvetica, Arial, sans-serif; overflow-wrap: anywhere; }
.annot.whiteout { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); }
.annot.img img { width: 100%; height: 100%; display: block; }
.annot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.annot.arrow .rz, .annot.callout .rz { display: none !important; } /* these redraw rather than stretch */
.anntable { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; background: rgba(255,255,255,0.95); }
.anntable td { border: var(--bw, 1.5px) solid var(--bc, #334155); padding: 2px 5px; outline: none; overflow: hidden; vertical-align: top; font-family: Helvetica, Arial, sans-serif; color: #16181d; }
.anntable tr.hd td { background: #e9edf4; font-weight: 700; }

/* ── toast ── */
#selpop { position: fixed; z-index: 75; display: flex; gap: 2px; background: var(--chrome); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: 0 10px 34px rgba(0,0,0,0.5); }
#selpop[hidden] { display: none; }
#selpop button { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 7px; color: var(--text); }
#selpop button:hover { background: var(--chrome2); }
.annot.callout .ed { position: absolute; border: 2px solid; background: rgba(255,255,255,0.96); border-radius: 8px; padding: 4px 7px; outline: none; line-height: 1.25; font-family: Helvetica, Arial, sans-serif; overflow-wrap: anywhere; }
.annot.area svg polygon { vector-effect: non-scaling-stroke; }
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(6px);
  background: var(--chrome); color: var(--text); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 99px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  opacity: 0; transition: opacity 250ms ease, transform 250ms ease; pointer-events: none; z-index: 99;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── insert modal ── */
.modal { position: fixed; inset: 0; background: rgba(8,10,14,0.72); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal[hidden] { display: none; }
.modal-card { width: 420px; max-width: calc(100vw - 32px); background: var(--chrome); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.modal-card h3 { font-size: 15px; font-weight: 700; }
.ins-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 14px; border: 1.5px dashed rgba(255,255,255,0.2); border-radius: 12px; cursor: pointer; color: var(--muted); font-size: 13px; transition: border-color 200ms ease, background 200ms ease; text-align: center; }
.ins-drop:hover, .ins-drop.drag { border-color: var(--accent); background: rgba(249,115,22,0.06); color: var(--text); }
.ins-drop.hasfile { border-style: solid; border-color: var(--accent); color: var(--text); font-weight: 600; }
.ins-drop svg { width: 26px; height: 26px; stroke-width: 1.5; }
.linklike { align-self: center; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 2px 6px; }
.linklike:hover { color: var(--text); }
.linklike.picked { color: var(--accent); font-weight: 700; text-decoration: none; }
.ins-where { display: flex; flex-direction: column; gap: 2px; }
.ins-where label { display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 8px 10px; border-radius: 9px; cursor: pointer; transition: background 200ms ease; }
.ins-where label[hidden] { display: none; }
.ins-where label:hover { background: var(--chrome2); }
.ins-where input { accent-color: var(--accent); width: 15px; height: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.modal-actions button { font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 9px; }

.stampgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px; }
.stampbtn { border: 2.5px solid var(--c); color: var(--c); background: rgba(255,255,255,0.04); border-radius: 8px; padding: 10px 6px; font-weight: 800; font-size: 13px; letter-spacing: 0.08em; transition: transform 150ms ease, background 200ms ease; }
.stampbtn:hover { transform: scale(1.04); background: rgba(255,255,255,0.09); }
#sigcanvas { display: block; margin: 6px auto 0; background: #fff; border-radius: 10px; cursor: crosshair; touch-action: none; }
.annot.stamp { display: flex; align-items: center; justify-content: center; border: 3px solid; border-radius: 8px; background: rgba(255,255,255,0.85); font-weight: 800; letter-spacing: 0.08em; text-align: center; user-select: none; font-family: Helvetica, Arial, sans-serif; }
.cseg { display: flex; gap: 6px; padding: 0 8px; }
.cseg button { flex: 1; padding: 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--chrome2); color: var(--muted); font-size: 13px; font-weight: 600; transition: all 200ms ease; }
.cseg button:hover { color: var(--text); }
.cseg button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chartgrid { display: grid; grid-template-columns: 1fr 300px; gap: 12px; padding: 0 8px; align-items: start; }
#chartprev { background: #fff; border-radius: 10px; border: 1px solid var(--line); width: 300px; height: 210px; }
#chartrows { display: flex; flex-direction: column; gap: 6px; }
.crow { display: flex; gap: 6px; align-items: center; }
.crow input { font: inherit; font-size: 12.5px; color: var(--text); background: var(--chrome2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; min-width: 0; }
.crow .cl { flex: 1.4; } .crow .cv { flex: 1; }
.crow button { color: var(--muted); font-size: 13px; padding: 4px; }
.crow button:hover { color: #f87171; }
@media (max-width: 640px) { .chartgrid { grid-template-columns: 1fr; } #chartprev { width: 100%; } }

.helpcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.helpcols p, .helptip { font-size: 12.5px; color: var(--text); padding: 3px 8px; line-height: 1.55; }
.helpcols kbd, .helptip kbd { font: 600 10.5px/1 Inter, sans-serif; color: var(--muted); background: var(--well); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; }
.helptip b { color: var(--accent-hi); font-weight: 650; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (max-width: 720px) {
  #sidebar { display: none !important; }
  .filebtns button { padding: 8px 10px; }
  .filebtns button svg + * { display: none; } /* icons only on phones */
}
