:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1d2733; --muted: #66727f; --line: #d9dee4;
  --brand: #1f5f99; --on-brand: #fff; --ok: #1e7b46; --bad: #b3261e; --wait: #9a6700;
  --field: #fff; --sig-line: #9aa5b1;
  --ok-bg: #dcf3e5; --bad-bg: #fbe1df; --wait-bg: #fff4d6;
  /* the report and the signatures are always black on white, like paper */
  --paper: #fff; --paper-ink: #000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171d; --card: #1b222b; --ink: #e4e9ef; --muted: #9aa6b2; --line: #2f3a46;
    --brand: #3d82c4; --ok: #5cc98a; --bad: #f08a80; --wait: #e5b84f;
    --field: #141a21; --ok-bg: #173a27; --bad-bg: #44201d; --wait-bg: #3d3115;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12171d; --card: #1b222b; --ink: #e4e9ef; --muted: #9aa6b2; --line: #2f3a46;
  --brand: #3d82c4; --ok: #5cc98a; --bad: #f08a80; --wait: #e5b84f;
  --field: #141a21; --ok-bg: #173a27; --bad-bg: #44201d; --wait-bg: #3d3115;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--brand); color: var(--on-brand); flex-wrap: wrap; }
.brand { font-weight: 700; } .brand span { font-weight: 400; opacity: .85; }
.who { font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.who button { padding: 4px 10px; }
.badge { background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 99px; }

main { max-width: 1100px; margin: 0 auto; padding-block: 16px; padding-inline: 16px; }
.center { min-height: 70vh; display: grid; place-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.narrow { width: 100%; max-width: 420px; }
h1, h2 { margin: 0 0 12px; } h1 { font-size: 22px; } h2 { font-size: 18px; }

label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-weight: 600; font-size: 14px; flex: 1; min-width: 160px; }
label.check { flex-direction: row; align-items: center; font-weight: 400; min-width: 0; flex: 0 1 auto; margin: 0; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); width: 100%; }
input[type=checkbox] { width: auto; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--field); color: var(--ink); cursor: pointer; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.link { border: 0; padding: 0 4px; color: var(--bad); background: none; font-size: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.tight { gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.ask-form p { margin: 0 0 12px; }
#ask-input { margin-bottom: 12px; }
.demo-bar { background: var(--wait-bg); color: var(--ink); padding: 8px 16px; font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; align-items: center; }
.grow { flex: 1; }
.msg { min-height: 1em; margin: 8px 0 0; font-size: 14px; } .msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; }
.tabs button { white-space: nowrap; }
.tabs button.active { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.count:not(:empty) { margin-left: 6px; background: var(--bad); color: var(--card); border-radius: 99px; padding: 0 7px; font-size: 12px; }

.sig-block { margin-bottom: 12px; }
.sig-head { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
canvas.sig { width: 100%; height: 160px; border: 1px dashed var(--sig-line); border-radius: 8px; background: var(--paper); touch-action: none; display: block; margin-bottom: 8px; }
.sig-view { max-height: 70px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }

.req { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.reason { margin: 4px 0; white-space: pre-wrap; }
.req-sigs { display: flex; gap: 8px; }
.req-sigs figure { margin: 0; text-align: center; font-size: 11px; color: var(--muted); }
.req-sigs img { height: 48px; max-width: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.req-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.status { text-transform: capitalize; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.status.pending { background: var(--wait-bg); color: var(--wait); }
.status.approved { background: var(--ok-bg); color: var(--ok); }
.status.rejected { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 640px) { .req { grid-template-columns: 1fr; } .req-side { flex-direction: row; align-items: center; flex-wrap: wrap; } }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
table.list input { padding: 5px 7px; } .w-num { width: 60px; }
#teachers-list, #time-list, #report { overflow-x: auto; }

dialog { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 16px; width: min(560px, 94vw); }
dialog::backdrop { background: #0006; }

/* ---------- lesson plan monitoring ---------- */
.scroll { overflow-x: auto; }
.lp-grid td, .lp-grid th { white-space: nowrap; }
.lp-grid th.c, .lp-grid td.c { text-align: center; }
.lp-grid select { width: auto; }
.lp-grid input[data-f="note"] { min-width: 140px; }
.link-btn { border: 0; background: none; padding: 0 4px; color: var(--brand); font-size: 12px; text-decoration: underline; }
.mono { font-variant-numeric: tabular-nums; margin: 6px 0 0; font-size: 14px; }
.deped { line-height: 1.35; }
.lp-meta { font-size: 13px; margin: 6px 0; }
.lp-table th.lp-small { font-size: 10px; max-width: 80px; }
.lp-table td { height: 34px; vertical-align: middle; }
.lp-sig { height: 30px; max-width: 110px; display: block; }

.files { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
.files .link-btn { font-size: 14px; padding: 0; text-align: left; word-break: break-all; }
.link-btn.danger-link { color: var(--bad); font-size: 12px; }
.dlp-box { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.upload-btn { display: inline-flex; flex-direction: row; align-items: center; min-width: 0; flex: 0 0 auto; margin: 0; padding: 8px 14px;
  border-radius: 8px; background: var(--brand); color: var(--on-brand); cursor: pointer; font-weight: 600; }
.upload-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-btn:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.upload-btn.busy { opacity: .6; pointer-events: none; }
.upload-btn.busy::after { content: "…"; }
dialog.viewer { width: min(900px, 96vw); }
#viewer-img { display: block; max-width: 100%; max-height: 75vh; margin: 10px auto 0; background: var(--paper); }

/* ---------- letterhead ---------- */
:root { --form-head: #ecd3ae; --form-rule: #8c1d22; }
.blackletter { font-family: "UnifrakturMaguntia", "Old English Text MT", serif; font-size: 15px; line-height: 1.1; }
.blackletter.big { font-size: 20px; }
.lh-seal { display: block; height: 64px; margin: 0 auto 4px; }
.lh-region { font-size: 12px; letter-spacing: .04em; }
.lh-division, .lh-school { font-weight: 700; font-size: 13px; letter-spacing: .03em; }
.lh-rule { height: 2px; background: var(--form-rule); margin: 6px 6% 10px; }
.lp-table thead th { background: var(--form-head); }
.lh-banner { display: block; width: 100%; margin-top: 18px; }
.lh-slots { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
@media (max-width: 640px) { .lh-slots { grid-template-columns: 1fr; } }
.lh-slot { min-width: 0; display: grid; gap: 8px; align-content: start; }
.lh-preview { min-height: 80px; border: 1px dashed var(--line); border-radius: 8px; background: var(--paper); display: grid; place-items: center; padding: 8px; gap: 4px; }
.lh-preview img { max-height: 90px; max-width: 100%; }
.lh-preview span { color: #666; }

/* ---------- the monthly report (screen + print) ---------- */
.report { background: var(--paper); color: var(--paper-ink); padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.report-head { text-align: center; margin-bottom: 10px; font-size: 13px; }
.report-head h3 { margin: 8px 0 2px; font-size: 14px; text-decoration: underline; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th, .report-table td { border: 1px solid var(--paper-ink); padding: 3px 5px; vertical-align: top; }
.report-table th { font-weight: 600; text-align: center; }
.report-table td.c { text-align: center; }
.conforme { cursor: pointer; min-width: 120px; } .conforme.auto { color: #666; font-style: italic; }
.report-notes { margin: 8px 0 0 24px; font-size: 13px; }
.signers { display: flex; justify-content: space-between; margin-top: 24px; font-size: 13px; gap: 24px; }
.signer-sig { display: block; height: 50px; margin: 4px 0 -6px; }
.signer-space { height: 44px; }

@media print {
  @page { size: landscape; margin: 10mm; }
  body { background: #fff; }
  .no-print, .topbar, .tabs { display: none !important; }
  main { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; }
  .conforme.auto { color: #000; font-style: normal; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
