:root { --ink:#111; --grid:#222; --head:#d0d0d0; --muted:#6b6b6b; --accent:#1f4e79; --ok:#2e7d32; --bad:#b3261e; }
* { box-sizing: border-box; }
body { margin:0; font-family: Arial, Helvetica, sans-serif; color:var(--ink); background:#eef0f2; font-size:14px; }
a { color: var(--accent); }
.muted { color: var(--muted); } .bad { color: var(--bad); } .pad { padding: 24px; }
button { font: inherit; cursor: pointer; }
button.link { background:none; border:0; color:var(--accent); padding:0; text-decoration:underline; }
button.link.small { font-size:12px; margin-left:8px; }
button.primary { background:var(--accent); color:#fff; border:0; border-radius:4px; padding:10px 22px; font-weight:700; }
button.secondary { background:#fff; color:var(--accent); border:1px solid var(--accent); border-radius:4px; padding:8px 16px; margin-top:12px; }
button:disabled { opacity:.6; cursor:default; }

/* top bar */
.topbar { display:flex; gap:16px; align-items:center; flex-wrap:wrap; background:#fff; border-bottom:1px solid #ccc; padding:10px 16px; position:sticky; top:0; z-index:5; }
.brand { font-weight:700; text-decoration:none; color:var(--ink); }
.topbar nav { display:flex; gap:14px; }
.topbar nav a { text-decoration:none; padding:4px 2px; }
.topbar nav a.active { border-bottom:2px solid var(--accent); font-weight:700; }
.me { margin-left:auto; color:var(--muted); font-size:13px; }
.status { position:fixed; right:14px; bottom:14px; background:#fff; border:1px solid #ccc; border-radius:14px; padding:4px 12px; font-size:12px; z-index:6; }
.status:empty { display:none; } .status.ok { color:var(--ok); } .status.saving { color:var(--muted); } .status.bad { color:var(--bad); border-color:var(--bad); }

main { max-width:1180px; margin:0 auto; padding:14px; }
.meta { margin:4px 0 12px; }

/* the paper sheet */
.sheet { background:#fff; border:2px solid var(--grid); margin:0 0 22px; box-shadow:0 1px 4px rgba(0,0,0,.12); }
.sheet-title { display:flex; justify-content:space-between; align-items:baseline; padding:8px 12px; border-bottom:2px solid var(--grid); font-weight:700; letter-spacing:.5px; font-size:12px; }
.sheet-title .big { font-size:26px; letter-spacing:3px; }
.orgrow { display:flex; align-items:center; gap:8px; padding:8px 12px; border-bottom:2px solid var(--grid); }
.orgrow .flabel { font-weight:700; white-space:nowrap; }
.orgrow .f { flex:1; }
.vgrid { display:grid; grid-template-columns: 3fr 2fr; }
.vleft { border-right:2px solid var(--grid); }
.vrow { display:grid; grid-template-columns: 150px 1fr; border-bottom:1px solid var(--grid); }
.vrow:last-child { border-bottom:0; }
.vrow > .cellhead { border-right:1px solid var(--grid); }
.cellhead { background:var(--head); font-weight:700; padding:8px 10px; font-size:13px; letter-spacing:.3px; display:flex; justify-content:space-between; align-items:flex-start; gap:6px; }
.vright > .cellhead, .tcol > .cellhead { border-bottom:1px solid var(--grid); justify-content:center; position:relative; }
.vright > .cellhead .cbtn, .tcol > .cellhead .cbtn { position:absolute; right:6px; top:5px; }
.cellbody { padding:6px 10px 10px; }
.tgrid { display:grid; grid-template-columns: 1fr 1fr 1fr; }
.tcol + .tcol { border-left:2px solid var(--grid); }

/* fields */
.f { position:relative; border-radius:3px; transition: background .6s; }
.f.flash { background:#fff6c7; }
textarea.in { width:100%; border:0; border-bottom:1px solid #bbb; resize:none; font:inherit; padding:3px 2px; line-height:1.35; background:transparent; overflow:hidden; display:block; min-height:24px; }
textarea.in:focus { outline:none; border-bottom-color:var(--accent); background:#f4f8fc; }
textarea.in[readonly] { border-bottom-color:#e2e2e2; }
textarea.in.multi { border:1px solid #d3d3d3; border-radius:2px; }
textarea.in.multi[readonly] { border-color:#ececec; }
.who { font-size:10px; color:#9a9a9a; text-align:right; min-height:0; line-height:1.2; opacity:.0; transition:opacity .2s; }
.f:hover .who, .f:focus-within .who { opacity:1; }
@media (hover:none) { .who { opacity:.85; } }
.lrow { display:grid; grid-template-columns: 110px 1fr; gap:6px; align-items:start; margin:4px 0; }
.lrow.stack { grid-template-columns: 1fr; gap:2px; }
.flabel { font-weight:700; font-size:13px; padding-top:4px; }
.num-row { display:grid; grid-template-columns: 22px 1fr; gap:4px; align-items:start; margin:2px 0; }
.num-row.with-who { grid-template-columns: 22px 1fr 70px; }
.num { padding-top:4px; font-weight:700; text-align:right; }
.group { margin-top:8px; }
.glabel { display:flex; justify-content:space-between; font-weight:700; font-size:13px; margin-bottom:2px; }
.whohead { width:70px; text-align:center; }
.note { margin-top:12px; font-weight:700; font-size:12px; }
.cbtn { background:#fff; border:1px solid #999; border-radius:10px; font-size:11px; padding:1px 6px; line-height:1.4; }

.submitbar { display:flex; gap:14px; align-items:center; flex-wrap:wrap; background:#fff; border:1px solid #ccc; padding:14px; margin-bottom:16px; }
.sublist { width:100%; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.pill { background:#eef3f8; border:1px solid #c9d6e3; border-radius:12px; padding:2px 10px; text-decoration:none; font-size:12px; }
.history { background:#fff; border:1px solid #ccc; padding:10px 14px; }
.histbody { max-height:320px; overflow:auto; font-size:12px; margin-top:8px; }
.hrow { padding:2px 0; border-bottom:1px dotted #ddd; }

/* comments */
.comments { background:#fff; border:1px solid #ccc; padding:14px 18px; }
.comments h2 { margin:0 0 10px; font-size:18px; }
.comment { border-left:3px solid var(--accent); padding:6px 10px; margin:8px 0; background:#fafbfc; }
.cbody { white-space:pre-wrap; margin-top:4px; }
.tag { display:inline-block; background:var(--head); font-size:11px; padding:0 6px; margin-left:8px; border-radius:3px; }
.cform textarea { width:100%; font:inherit; padding:8px; border:1px solid #bbb; border-radius:3px; }
.crow { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:6px; flex-wrap:wrap; }

/* lists */
.listpage { background:#fff; border:1px solid #ccc; padding:14px 18px; }
table.list { width:100%; border-collapse:collapse; }
table.list th, table.list td { text-align:left; border-bottom:1px solid #e3e3e3; padding:8px 6px; }
table.list th { background:var(--head); }

/* sign-in */
.login-body { display:flex; min-height:100vh; align-items:center; justify-content:center; }
.login-card { background:#fff; border:2px solid var(--grid); padding:28px; width:min(420px, 92vw); }
.login-card h1 { margin:0 0 6px; font-size:22px; }
.login-card label { display:block; font-weight:700; margin:16px 0 6px; }
.login-card input { width:100%; font:inherit; font-size:16px; padding:10px; border:1px solid #999; border-radius:3px; }
.login-card button[type=submit] { margin-top:14px; width:100%; background:var(--accent); color:#fff; border:0; padding:11px; font-weight:700; border-radius:3px; }
.login-card .link { margin-top:10px; }
.msg { min-height:1.2em; } .msg.bad { color:var(--bad); }

/* mobile */
@media (max-width: 860px) {
  .vgrid, .tgrid { grid-template-columns: 1fr; }
  .vleft { border-right:0; border-bottom:2px solid var(--grid); }
  .tcol + .tcol { border-left:0; border-top:2px solid var(--grid); }
  .vrow { grid-template-columns: 1fr; }
  .vrow > .cellhead { border-right:0; border-bottom:1px solid var(--grid); }
  .sheet-title .big { font-size:20px; }
  .me { margin-left:0; width:100%; }
}
@media (max-width: 480px) { .lrow { grid-template-columns: 1fr; gap:2px; } .sheet-title { flex-direction:column; } }

/* print: two clean pages, no chrome */
@media print {
  @page { size: letter landscape; margin: 0.35in; }
  body { background:#fff; font-size:11px; }
  .no-print, .who, .cbtn { display:none !important; }
  main { max-width:none; padding:0; }
  .sheet { box-shadow:none; margin:0; }
  .page2 { break-before: page; }
  textarea.in, textarea.in.multi { border:0; border-bottom:1px solid #bbb; }
  .vgrid { grid-template-columns: 3fr 2fr; } .tgrid { grid-template-columns: 1fr 1fr 1fr; }
}
