:root { --bg:#f1f1f1; --card:#fff; --ink:#303030; --sub:#616161; --line:#e3e3e3; --brand:#303030; --ok:#0c5132; --okbg:#cdfee1; --warn:#5e4200; --warnbg:#ffeb78; --bad:#8e0b21; --badbg:#fed1d7; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, sans-serif; }
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 0 16px; position: sticky; top: 0; z-index: 2; }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 10px; font: inherit; color: var(--sub); cursor: pointer; white-space: nowrap; border-radius: 0; }
nav button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h2 { font-size: 15px; margin: 24px 0 6px; }
.hint { color: var(--sub); font-size: 13px; margin: 4px 0 12px; display: block; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
button { background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 8px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }
button.secondary { background: #fff; color: var(--ink); border-color: #c9c9c9; }
button.link { background: none; border: 0; color: #005bd3; padding: 4px 0; font-weight: 500; }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 5px 8px; border: 1px solid #b5b5b5; border-radius: 8px; background: #fff; }
textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }
.grid { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,.07); }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.grid th { font-size: 12px; color: var(--sub); font-weight: 600; background: #f7f7f7; }
.grid td.n, .grid th.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid tr:last-child td { border-bottom: 0; }
.grid .empty { color: var(--sub); text-align: center; padding: 20px; }
.card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 0 rgba(0,0,0,.07); }
.card label { display: block; margin-bottom: 12px; }
.badge, .pill { display: inline-block; border-radius: 8px; padding: 1px 8px; font-size: 12px; font-weight: 600; background: #e3e3e3; }
.pill { background: var(--badbg); color: var(--bad); }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.bad { background: var(--badbg); color: var(--bad); }
.msg { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; background: var(--okbg); color: var(--ok); }
.msg.err { background: var(--badbg); color: var(--bad); }
.bar { height: 6px; background: #e3e3e3; border-radius: 3px; width: 120px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.bar i { display: block; height: 100%; background: #29845a; }
.neg { color: var(--bad); }
dialog { border: 0; border-radius: 12px; padding: 20px; width: min(460px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog h3 { margin-top: 0; }
.splitRow { display: flex; gap: 8px; margin-bottom: 8px; }
.splitRow select { flex: 1; }
.splitRow input { width: 5.5em; }
.tiers .tierRow { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.tiers input { width: 7em; }
.example { background: #f7f7f7; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 13px; }
/* tables scroll sideways inside their own box on small screens instead of hiding columns */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 4px; }
.tablewrap > .grid { min-width: 640px; }
.staffGrid { min-width: 860px; }
@media (max-width: 700px) {
  main { padding: 12px; }
  .row.between { flex-direction: column; align-items: stretch; }
  .card label input[style*="width:22em"] { width: 100% !important; }
}
[hidden] { display: none !important; }
.paywall { border-left: 4px solid #29845a; }
.paywall h2 { margin-top: 0; }
dialog.wide { width: min(760px, 94vw); }
.doc { white-space: pre-wrap; font: 13px/1.5 Georgia, "Times New Roman", serif; background: #fafafa; border: 1px solid var(--line); border-radius: 8px; padding: 16px; max-height: 60vh; overflow: auto; }
.doc-sig { margin: 10px 0; font-size: 13px; }
.history { font-size: 12px; color: var(--sub); margin: 4px 0 8px; }
.card textarea { font-family: inherit; font-size: 13px; }
@media print {
  body:not(.printingExplain) > *:not(#agreementDialog) { display: none !important; }
  #agreementDialog { position: static; box-shadow: none; width: auto; max-width: none; }
  .doc { max-height: none; overflow: visible; border: 0; background: none; padding: 0; }
  .noprint { display: none !important; }
}
.effBar { background: #f7f7f7; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.effBar label { display: inline-block; margin: 0 8px 0 0; }
.schedule { font-size: 13px; margin: 0 0 12px; display: grid; gap: 4px; }
.loading { color: var(--sub); }
.setup { border-left: 4px solid #005bd3; }
.setup h2 { margin-top: 0; }
.setup ol { margin: 0; padding-left: 20px; }
.setup li { margin: 4px 0; }
tr.dirty td:first-child, .planForm.dirty { box-shadow: inset 3px 0 0 #b98900; }
.staffGrid .hint { margin: 2px 0 0; font-size: 12px; }
.splitRow .fDel { padding: 0 6px; font-size: 18px; color: var(--sub); }
nav { scrollbar-width: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid #005bd3; outline-offset: 2px; }
.msg { cursor: pointer; }
.warnText { color: var(--warn); }
.planForm select, .card select { max-width: 100%; }
.grid td.empty { text-align: left; position: sticky; left: 0; }
.mobileOnly { display: none; }
@media (max-width: 700px) { .mobileOnly { display: block; } .setup ol { font-size: 13px; } }
input:disabled, select:disabled, textarea:disabled { background: #f1f1f1; color: #8a8a8a; }
button.link:disabled { color: #8a8a8a; text-decoration: none; cursor: default; }

.grid th { vertical-align: bottom; }
#statements td:first-child { white-space: nowrap; }
.notice { background: #eaf4ff; border: 1px solid #b5d4f4; border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; max-width: 1070px; margin-inline: auto; }
.sigPhoto { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.sigPhoto img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
button.tip { border: 0; background: none; color: var(--sub); font-size: 14px; line-height: 1; padding: 2px 4px; margin-left: 2px; cursor: help; vertical-align: baseline; min-width: 24px; min-height: 24px; }
button.tip:hover, button.tip:focus-visible, button.tip[aria-expanded="true"] { color: #005bd3; }
.tipText { display: block; font-weight: 400; font-size: 13px; color: var(--ink); background: #f4f8fd; border: 1px solid #cfe0f5; border-radius: 6px; padding: 6px 8px; margin: 4px 0; max-width: 46em; white-space: normal; text-align: left; }
th .tipText { position: absolute; z-index: 5; min-width: 16em; }
th { position: relative; }
.warnCard { border-left: 4px solid #e5a500; max-width: 1070px; margin: 0 auto 12px; }
.warnCard h2 { margin: 0 0 6px; font-size: 15px; }
.warnCard ul { margin: 0; padding-left: 20px; }
.warnCard li { margin: 4px 0; }
/* ---- design review round 5 ---- */
.hint { max-width: 72ch; }
.pill { background: #e3e3e3; color: var(--ink); }
.badge.info { background: #e0f0ff; color: #00527c; }
a { color: #005bd3; }
nav button:focus-visible { outline-offset: -3px; }
/* first column stays put while wide tables scroll sideways (iPad, phone) */
.tablewrap .grid td:first-child, .tablewrap .grid th:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; }
.tablewrap .grid th:first-child { background: #f7f7f7; }
@media (max-width: 1024px) { .mobileOnly { display: block; } }
/* one Save per staff row only when that row has changes */
.staffGrid tr:not(.dirty) .sSave { visibility: hidden; }
/* explanations open as a small popover instead of pushing the field around */
label, h2, h3, th, [data-tipfor] { position: relative; }
.tipText { position: absolute; left: 0; top: 100%; z-index: 20; min-width: 18em; max-width: 34em; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
button.danger { background: #c70a24; border-color: #c70a24; color: #fff; }
#askTitle { margin: 0 0 8px; font-size: 16px; }
#askText { white-space: pre-line; }
.emptyCard { text-align: left; }
.emptyCard h2 { margin: 0 0 6px; font-size: 16px; }
body:not([data-tab="pay"]) #conflicts, body:not([data-tab="pay"]) #setup { display: none !important; }
table.explain td { vertical-align: top; }
table.explain tr.total td { border-top: 2px solid var(--ink); }
#explainDialog h4 { margin: 16px 0 6px; }
@media print {
  body.printingExplain > *:not(#explainDialog) { display: none !important; }
  body.printingExplain #explainDialog { position: static; border: 0; box-shadow: none; max-width: none; width: 100%; }
}
.savebar { position: sticky; bottom: 0; z-index: 2; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin: 0 0 12px; box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.savebar .hint { margin: 0 auto 0 0; }
.savebar.dirty .hint { color: var(--ink); font-weight: 600; }
