:root {
  --g: #275024; --g2: #3c7a37; --ink: #1f2a22; --mut: #66736a; --line: #e2e7e3; --bg: #f5f7f5; --card: #fff;
  --r: #b3261e; --warn: #fff1cc; --ok: #dcefd9; --cell: #fffde7; --hd: #e8efe7;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; font: 14px/1.45 'Segoe UI', system-ui, sans-serif; color: var(--ink); background: var(--bg) }
header.top { display: flex; align-items: center; gap: 14px; background: var(--g); color: #fff; padding: 0 16px; height: 50px; position: sticky; top: 0; z-index: 5 }
.brand { font-weight: 700; font-size: 16px }
#nav { display: flex; gap: 2px; overflow-x: auto }
#nav a { color: #e7f0e6; text-decoration: none; padding: 7px 11px; border-radius: 7px; white-space: nowrap }
#nav a.on, #nav a:hover { background: rgba(255, 255, 255, .16); color: #fff }
.sp { flex: 1 }
.who { font-size: 12.5px; opacity: .9; white-space: nowrap }
.demobar { background: #fff7e0; border-bottom: 1px solid #f0dca0; padding: 6px 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap }
main { padding: 18px; max-width: 1400px; margin: 0 auto }
h2 { margin: 4px 0 14px; font-size: 20px } h3 { margin: 0 0 8px; font-size: 15px }
.muted { color: var(--mut) } .small { font-size: 12.5px }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; text-decoration: none; color: inherit; display: block }
.card:hover { border-color: var(--g2) }
.card .t { font-weight: 650 } .card .s { color: var(--mut); font-size: 12.5px }
.prog { height: 7px; background: #edf0ed; border-radius: 5px; overflow: hidden; margin: 8px 0 4px } .prog i { display: block; height: 100%; background: var(--g2) }
.btn { border: 1px solid #cfd8d1; background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer }
.btn:hover { border-color: var(--g) } .btn:disabled { opacity: .5; cursor: default }
.btn.primary { background: var(--g); border-color: var(--g); color: #fff } .btn.danger { color: var(--r); border-color: #e6c3c3 }
.btn.sm { padding: 4px 9px; font-size: 12.5px }
select, input.inp, textarea { font: inherit; padding: 6px 9px; border: 1px solid #cfd8d1; border-radius: 7px; background: #fff }
.pill { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: #eef0ee; white-space: nowrap }
.pill.Draft { background: #eef0ee } .pill.Submitted { background: #e3ecfb; color: #1d4a8f } .pill.Approved { background: var(--ok); color: #1e4d1b }
.pill.Returned { background: #f6d3d3; color: #7d1d1f } .pill.Archived { background: #ececec; color: #555 } .pill.Open { background: var(--ok); color: #1e4d1b } .pill.Locked { background: #fde6c8; color: #7a4a00 }
table.tbl { width: 100%; border-collapse: collapse; background: #fff }
.tbl th { text-align: left; font-size: 12px; color: var(--mut); font-weight: 600; border-bottom: 1px solid var(--line); padding: 7px 8px }
.tbl td { border-bottom: 1px solid #f0f2f0; padding: 7px 8px; vertical-align: middle }
/* marks grid */
.sheetwrap { overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--line); border-radius: 10px; background: #fff }
table.marks { border-collapse: separate; border-spacing: 0; font-size: 13px }
.marks th, .marks td { border-right: 1px solid #dfe5e0; border-bottom: 1px solid #dfe5e0; padding: 0; text-align: center; white-space: nowrap }
.marks thead th { position: sticky; background: var(--hd); font-weight: 650; padding: 5px 6px; z-index: 2 }
.marks thead tr.r1 th { top: 0; background: var(--g); color: #fff } .marks thead tr.r2 th { top: 29px } .marks thead tr.r3 th { top: 58px; background: #fff2cc }
.marks th.stick, .marks td.stick { position: sticky; left: 0; z-index: 3; background: #fff; text-align: left; padding: 4px 8px }
.marks td.stick2, .marks th.stick2 { position: sticky; left: 46px; z-index: 3; background: #fff; text-align: left; padding: 4px 8px; min-width: 210px }
.marks thead th.stick, .marks thead th.stick2 { z-index: 4; background: var(--g); color: #fff }
.marks td input { width: 64px; border: 0; padding: 6px 4px; text-align: center; font: inherit; background: var(--cell); outline: none }
.marks td input:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--g2) }
.marks td input.bad { background: #f8d7d7; box-shadow: inset 0 0 0 2px var(--r) }
.marks td input:disabled { background: #fafafa; color: var(--ink) }
.marks td.tot { background: #f3f3f3; font-weight: 650; padding: 4px 8px; min-width: 56px }
.marks tr.alt td.stick, .marks tr.alt td.stick2 { background: #fafbfa }
.savestate { font-size: 12.5px; color: var(--mut) } .savestate.err { color: var(--r); font-weight: 650 }
.note { background: #eef3ed; border: 1px solid #cfe0cc; border-radius: 10px; padding: 9px 13px; margin-bottom: 12px } .note.warn { background: #fff7e0; border-color: #f0dca0 } .note.err { background: #fbe9e9; border-color: #efc4c4 }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(30px); background: #1f2a22; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 30; max-width: 80vw; pointer-events: none }
.toast.show { opacity: 1; transform: translateX(-50%) } .toast.err { background: var(--r) }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px }
.mbox { background: #fff; border-radius: 14px; width: min(640px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .25) }
.mhead { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line) } .mhead h3 { margin: 0 }
.mbody { padding: 14px 16px } .mfoot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end }
.x { border: 0; background: none; font-size: 20px; color: #999; cursor: pointer }
.loading { padding: 40px; text-align: center; color: var(--mut) }
pre.log { background: #10140f; color: #cfe8cb; padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; font-size: 12px; white-space: pre-wrap }
.form { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center }
/* help */
.guide h3 { margin-top: 4px } .guide li { margin-bottom: 6px; line-height: 1.5 } .guide [dir=rtl] { font-family: Arial, 'Segoe UI', sans-serif; font-size: 15px }
.guide hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0 }
#printArea { display: none }
@media print {
  body[data-print=help] > *:not(#printArea) { display: none !important }
  body[data-print=help] #printArea { display: block !important; padding: 10mm }
  body[data-print=help] .panel { border: 0; break-inside: avoid; padding: 0 0 8mm }
}
/* phone mark entry */
.ph-head h2 { font-size: 17px } .ph-head { gap: 6px 8px }
#grid.phone { max-width: 560px; margin: 0 auto; padding-bottom: 80px }
.ph-tabs { display: flex; background: #e9eee8; border-radius: 12px; padding: 4px; margin-bottom: 10px }
.ph-tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font: inherit; font-weight: 650; color: var(--mut) }
.ph-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12) }
.ph-pick { display: flex; gap: 8px; align-items: center; margin-bottom: 6px }
.ph-pick select { flex: 1; min-width: 0; height: 46px; font-size: 16px; border-radius: 10px }
.ph-pick .btn { width: 46px; height: 46px; font-size: 22px; padding: 0 }
.ph-max { color: var(--mut); font-size: 13px; margin: 2px 2px 8px }
.ph-list { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden }
.ph-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid #eef1ee; min-height: 60px }
.ph-row:last-child { border-bottom: 0 }
.ph-name { flex: 1; font-size: 15.5px; line-height: 1.25; overflow-wrap: anywhere } .ph-name small { display: block; color: var(--mut); font-size: 12.5px }
.ph-in-wrap { display: flex; gap: 6px; flex: none }
.ph-in { width: 76px; height: 46px; font-size: 20px; text-align: center; border: 1.5px solid #cfd8d1; border-radius: 10px; background: var(--cell); font-family: inherit }
.ph-in:focus { outline: none; border-color: var(--g2); background: #fff; box-shadow: 0 0 0 3px rgba(60, 122, 55, .18) }
.ph-in.bad { border-color: var(--r); background: #f8d7d7 }
.ph-in:disabled { background: #f5f5f5; color: var(--ink) }
.ph-abs { width: 46px; height: 46px; border-radius: 10px; border: 1.5px solid #cfd8d1; background: #fff; font: inherit; font-weight: 700; font-size: 17px; color: var(--mut) }
.ph-abs.on { background: #fde6c8; border-color: #e0a94a; color: #7a4a00 }
.ph-tot { background: #f6f8f6 } .ph-tot b { font-size: 20px; padding-right: 8px }
.ph-next { width: 100%; height: 50px; margin-top: 12px; font-size: 16px }
.ph-submit { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); z-index: 6 }
.ph-submit .btn { width: 100%; height: 50px; font-size: 16px }
@media (max-width: 700px) { main { padding: 12px } .form { grid-template-columns: 1fr } .who { display: none }
  header.top { padding: 0 10px; gap: 8px } .brand { font-size: 14px } #nav a { padding: 7px 8px }
  .grid-cards { grid-template-columns: 1fr } .card { padding: 14px 16px } .card .t { font-size: 16px }
  .btn { min-height: 38px } .mbox { width: 100% } .toast { bottom: 84px } }
