/* POM Worksheet web - Material-like styling, system fonts only (nothing downloaded). */
:root {
  --primary: #1F3A5F; --on-primary: #fff; --primary-container: #D6E4F5; --secondary-container: #E4E9F2;
  --surface: #ffffff; --bg: #F6F7F9; --on-surface: #1B1C1F; --muted: #4A4F57; --outline: #8A8F98; --line: #DADDE2;
  --error: #B3261E; --ok: #1F3A5F; --warn: #8A5A00; --shadow: 0 1px 3px rgba(0,0,0,.15);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --primary: #A9C7F0; --on-primary: #0E2440; --primary-container: #23405F; --secondary-container: #2C3440;
    --surface: #1E2126; --bg: #15171A; --on-surface: #E6E7EA; --muted: #B5BAC2; --outline: #8A8F98; --line: #3A3F47;
    --error: #F2B8B5; --ok: #A9C7F0; --warn: #F0C36D; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--on-surface);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
#app { min-height: 100vh; }
button { font: inherit; color: inherit; }
h2, h3 { margin: 8px 0; }
h2.question { font-size: 1.35rem; font-weight: 500; }
h3.section { font-size: 1.05rem; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
p { margin: 6px 0; }
.small { font-size: .82rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.okcolor { color: var(--ok); }
.errcolor { color: var(--error); }
.errtext { color: var(--error); font-size: .82rem; margin: 6px 0; }
.warntext { color: var(--warn); font-size: .82rem; margin: 6px 0; }
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; }
.ic.inline { width: 18px; height: 18px; vertical-align: -3px; }
.ic.muted { width: 18px; height: 18px; color: var(--muted); }

/* top app bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px; min-height: 56px;
  padding: calc(4px + var(--sat)) calc(4px + var(--sar)) 4px calc(4px + var(--sal)); background: var(--surface); box-shadow: var(--shadow); }
.navspace { width: 8px; }
.tb-titles { flex: 1; min-width: 0; padding: 0 4px; }
.tb-title { font-size: 1.1rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; align-items: center; }
.iconbtn { border: 0; background: none; width: 44px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:active { background: var(--secondary-container); }
.tbtn { border: 0; background: none; min-width: 40px; height: 40px; border-radius: 20px; font-size: 1rem; color: var(--primary); cursor: pointer; }
.tbtn:disabled { color: var(--outline); }

/* layout */
.content { padding: 8px calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal)); max-width: 760px; margin: 0 auto; }
.content.withbar { padding-bottom: calc(96px + var(--sab)); }
.content.home { padding-bottom: calc(100px + var(--sab)); }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.row.gap { gap: 12px; }
.row.two > * { flex: 1 1 0; min-width: 0; }
.spaced { margin-top: 16px; }
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 12px; background: var(--surface);
  padding: 12px calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal)); box-shadow: 0 -1px 3px rgba(0,0,0,.12); }
.bottombar .btn { flex: 1; }

/* cards */
.card { background: var(--surface); border-radius: 12px; padding: 12px; margin: 8px 0; box-shadow: var(--shadow); }
.card.info { background: var(--secondary-container); box-shadow: none; }
.card.info b { display: block; margin-bottom: 2px; }
.card.info .btn { margin-top: 8px; }
.card.preview .label { font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.prow { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; padding: 1px 0; }
.prow.total { margin-top: 4px; }
.empty { padding: 16px 8px; }
.empty h2 { font-size: 1.15rem; font-weight: 500; }

/* buttons */
.btn { border: 0; border-radius: 22px; min-height: 44px; padding: 10px 20px; background: var(--primary); color: var(--on-primary); font-weight: 500; cursor: pointer; }
.btn:disabled { background: var(--line); color: var(--outline); cursor: default; }
.btn.outline { background: transparent; color: var(--primary); border: 1px solid var(--outline); }
.btn.outline:disabled { color: var(--outline); border-color: var(--line); }
.btn.text { background: transparent; color: var(--primary); padding: 8px 12px; }
.btn.text:disabled { color: var(--outline); }
.btn.danger { color: var(--error); }
.btn.wide { display: block; width: 100%; margin-top: 8px; }
.btn.sq { min-width: 48px; padding: 0 12px; font-size: 1.3rem; }
.fab { position: fixed; right: calc(16px + var(--sar)); bottom: calc(16px + var(--sab)); z-index: 11; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 16px; min-height: 56px; padding: 0 20px; background: var(--primary-container); color: var(--on-surface); font-weight: 600;
  box-shadow: 0 3px 8px rgba(0,0,0,.25); cursor: pointer; }
.chip { border: 1px solid var(--outline); background: var(--surface); border-radius: 8px; min-height: 40px; padding: 6px 16px; cursor: pointer; font-size: .95rem; }
.chip.sel { background: var(--primary-container); border-color: var(--primary-container); font-weight: 600; }
.chip .tick { margin-right: 6px; }

/* fields */
.field { display: block; margin: 10px 0; }
.flabel { display: block; font-size: .8rem; color: var(--muted); margin: 0 0 4px 2px; }
.field input { display: block; width: 100%; min-height: 48px; padding: 10px 12px; font-size: 16px; color: var(--on-surface);
  background: var(--surface); border: 1px solid var(--outline); border-radius: 6px; -webkit-appearance: none; appearance: none; }
.field input[type="date"] { min-width: 0; line-height: 26px; }
.field input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.field input:disabled { color: var(--muted); background: var(--bg); }
.field.err input { border-color: var(--error); }
.field.err .flabel, .field.err .fhint { color: var(--error); }
.fhint { display: block; font-size: .78rem; color: var(--muted); margin: 3px 0 0 2px; min-height: 1em; }
.stepper { display: flex; align-items: flex-end; gap: 8px; margin: 4px 0; }
.stepper .field { width: 120px; margin: 0; }
.stepper .btn { margin-bottom: 2px; }
.stepper .fhint { display: none; }

/* wizard */
.progress { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--primary); }
.steplabel { color: var(--muted); }
.q { margin: 10px 0 14px; }
.qtitle { font-size: 1.05rem; font-weight: 500; margin: 4px 0 2px; }
.qhint { font-size: .82rem; color: var(--muted); margin: 0 0 8px; }
.q .row { margin-top: 6px; }

/* home list */
.wsrow { display: flex; align-items: flex-start; gap: 4px; padding: 10px 4px 10px 12px; cursor: pointer; }
.wsmain { flex: 1; min-width: 0; font-size: .92rem; }
.wstitle { font-weight: 700; }
.menuwrap { position: relative; }
.menu { position: absolute; right: 4px; top: 40px; z-index: 20; min-width: 160px; background: var(--surface); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25); padding: 6px 0; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 12px 16px; font-size: 1rem; cursor: pointer; }
.menu button:active { background: var(--secondary-container); }
.install .row { margin-top: 6px; }

/* review */
.sheettitle { font-weight: 700; font-size: 1.02rem; }
.link { cursor: pointer; }
.lrow { display: flex; align-items: center; gap: 6px; padding: 5px 0; }
.lrow.head { justify-content: space-between; font-size: .78rem; color: var(--muted); }
.lrow.line { cursor: pointer; border-radius: 6px; }
.lrow.line:active { background: var(--secondary-container); }
.lrow .no { width: 26px; flex: none; }
.lrow .item { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .92rem; }
.lrow .basis { font-size: .78rem; color: var(--muted); }
.lrow .adjusted { font-size: .72rem; font-weight: 700; color: var(--error); text-transform: none; }
.lrow .amt { font-weight: 500; text-align: right; white-space: nowrap; }
.lrow.tot { font-weight: 700; }
.radio, .check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.radio input, .check input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); flex: none; }
.check input:disabled + span { color: var(--outline); }

/* preview */
.previewbg { background: var(--secondary-container); max-width: none; overflow-x: auto; padding-left: 8px; padding-right: 8px; min-height: calc(100vh - 56px); }
.pages { margin: 0; }
.page { margin: 0 0 8px; border: .5px solid #888; background: #fff; line-height: 0; }
.pdfpage { width: 100%; height: auto; display: block; }
.pdfpage text { font-family: Helvetica, Arial, "Liberation Sans", "Nimbus Sans", sans-serif; white-space: pre; }

/* dialog */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 20px; padding: 20px; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.dialog h3 { font-size: 1.1rem; font-weight: 500; margin-top: 0; }
.dlgbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
