/* ============================================================================
   REET · CBM P10354 field assessment system.
   Built for tablets and phones used in rural schools: high contrast, large
   touch targets, and long forms that stay readable one column wide.
============================================================================ */

:root {
  --ink: #17212b;
  --forest: #123b5d;
  --navy: #123b5d;
  --reet-cyan: #16a9d4;
  --reet-blue: #1d8db8;
  --reet-orange: #f5a400;
  --green: #217b5b;
  --amber: #c98200;
  --red: #a64038;
  --blue: #287fa8;
  --line: #d8e2e9;
  --bg: #f4f7f9;
  --muted: #617180;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; }

.shell { max-width: 1320px; margin: auto; padding: 18px; }

/* --- Top bar and navigation ---------------------------------------------- */
.top {
  background: #fff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(18,59,93,.07);
}
.topin {
  max-width: 1320px; margin: auto; padding: 10px 18px;
  display: flex; gap: 18px; justify-content: space-between; align-items: center;
}
.brand {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  color: inherit; text-decoration: none;
}
.brand img {
  width: 170px; height: auto; display: block; flex: 0 0 auto;
}
.brand-copy { min-width: 0; }
.brand b, .brand small { display: block; }
.brand b { font-size: 13px; color: var(--navy); letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.project-tag {
  display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px;
  background: #e9f6fb; color: #136784; border: 1px solid #c8e9f3;
  font-size: 11px; font-weight: 800; letter-spacing: .03em;
}
.online {
  padding: 6px 10px; border-radius: 99px; background: #e3f4eb;
  color: #1d603e; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.sync-button { border: 1px solid transparent; cursor: pointer; }
.sync-button:hover { filter: brightness(.97); }
.sync-stack{display:flex;flex-direction:column;align-items:flex-end;gap:2px}.sync-meta{font-size:10px;color:#d9e7df;line-height:1.25;white-space:nowrap}.sync-button{font-size:12px}

.offline { background: #fff0d6; color: #805c10; border-color: #f0d49c; }

.nav-band { background: var(--navy); }
.nav {
  max-width: 1320px; margin: auto; padding: 0 18px; display: flex; gap: 4px;
  overflow-x: auto;
}
.nav a {
  padding: 12px 14px; color: #d8ebf4; text-decoration: none; white-space: nowrap;
  font-size: 14px; border-bottom: 3px solid transparent;
}
.nav a:hover, .nav a.active { background: rgba(22,169,212,.16); color: #fff; border-bottom-color: var(--reet-orange); }

/* --- Page headings -------------------------------------------------------- */
.heading { display: flex; justify-content: space-between; gap: 15px; align-items: start; margin: 22px 0; }
.heading h1 { margin: 0; font-size: 27px; letter-spacing: -.6px; }
.heading p { margin: 6px 0 0; color: var(--muted); }
.section-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; flex-wrap: wrap; }
.section-head h2 { margin: 0 0 4px; }

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 1px 2px #112e1708;
  margin-bottom: 14px;
}
.pad { padding: 18px; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card h3 { margin: 16px 0 8px; font-size: 15px; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 14px; }
.two { display: grid; grid-template-columns: 1.15fr .85fr; gap: 15px; align-items: start; }

.metric { padding: 16px; border-top: 4px solid var(--forest); margin: 0; }
.metric small, .label {
  display: block; color: var(--muted); font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.metric b { display: block; margin-top: 4px; font-size: 26px; }
.metric .help { margin: 4px 0 0; }
.metric.amber { border-color: var(--amber); }
.metric.green { border-color: var(--green); }
.metric.blue { border-color: var(--blue); }
.metric.red { border-color: var(--red); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  border: 0; border-radius: 7px; padding: 10px 14px;
  background: var(--forest); color: #fff; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.12); }
.btn.secondary { border: 1px solid #b6c9ba; background: #fff; color: #244d3c; }
.btn.danger { background: var(--red); }
.btn.large { padding: 13px 17px; font-size: 15px; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- Notices -------------------------------------------------------------- */
.notice {
  margin: 14px 0; padding: 12px 14px; border-left: 4px solid var(--amber);
  background: #fff4dc; color: #684e15; border-radius: 5px;
}
.notice.red { border-color: var(--red); background: #fff0ef; color: #7d3029; }
.notice.green { border-color: var(--green); background: #eaf6ee; color: #1d5b3d; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice li { margin-bottom: 4px; }
.notice a { font-weight: 700; }

/* --- Tabs ----------------------------------------------------------------- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; margin: 4px 0 16px;
  padding-bottom: 4px; border-bottom: 2px solid var(--line);
}
.tab {
  border: 0; border-bottom: 3px solid transparent; background: none;
  padding: 10px 13px; font: inherit; font-weight: 650; color: var(--muted);
  cursor: pointer; white-space: nowrap; border-radius: 6px 6px 0 0;
}
.tab:hover { background: #eaf1eb; color: var(--ink); }
.tab.active { color: var(--forest); border-bottom-color: var(--forest); background: #fff; }
.tabbadge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 99px;
  background: var(--amber); color: #fff; font-size: 11px;
}

/* --- Tables --------------------------------------------------------------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e9efea; text-align: left; vertical-align: top; }
th {
  background: #fbfcfa; color: #516158; font-size: 10px;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
tr:last-child td { border: 0; }
tr.rowalert td { background: #fff7f6; }

/* --- Pills ---------------------------------------------------------------- */
.pill {
  display: inline-block; padding: 3px 8px; border-radius: 4px;
  background: #e5ece6; color: #395348; font-size: 10px;
  font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.pill.draft, .pill.notassessed, .pill.notstarted, .pill.pending, .pill.open, .pill.nottested,
.pill.notrated, .pill.notgraded, .pill.notcleared, .pill.notstarted { background: #e5ece6; color: #53675a; }
.pill.inprogress, .pill.requiresfollowup, .pill.underreview, .pill.requiresclarification,
.pill.partiallyverified, .pill.medium, .pill.partial { background: #fff0d5; color: #795714; }
.pill.submitted, .pill.qaapproved, .pill.approved, .pill.assessed, .pill.verified, .pill.active,
.pill.cleared, .pill.resolved, .pill.confirmed, .pill.yes, .pill.finalized, .pill.accepted { background: #dcf0e2; color: #205f40; }
.pill.notapplicable, .pill.na, .pill.inactive, .pill.notrequired { background: #e6e6ef; color: #50506a; }
.pill.disputed, .pill.unverified, .pill.alert, .pill.critical, .pill.high, .pill.withdrawn,
.pill.no, .pill.blocked, .pill.unconfirmed, .pill.locked { background: #fde1dd; color: #903b32; }
.pill.nv { background: #e6e6ef; color: #50506a; }
.pill.r0, .pill.r1 { background: #fde1dd; color: #903b32; }
.pill.r2 { background: #fff0d5; color: #795714; }
.pill.r3, .pill.r4 { background: #dcf0e2; color: #205f40; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }

/* --- Forms ---------------------------------------------------------------- */
.field { display: block; margin: 0 0 12px; }
.field > span {
  display: block; margin-bottom: 5px; color: #53645a; font-size: 11px;
  font-weight: 750; text-transform: uppercase; letter-spacing: .04em;
}
input, select, textarea {
  width: 100%; padding: 10px; border: 1px solid #cbd8ce; border-radius: 6px;
  background: #fff; color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
input:disabled, select:disabled, textarea:disabled { background: #f3f6f3; color: #6d7c72; }
textarea { min-height: 78px; resize: vertical; }
input[type="file"] { padding: 7px; font-size: 12px; }

.fieldgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 14px; }
.fieldgrid .field.wide, .field.wide { grid-column: 1 / -1; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: flex; align-items: center; gap: 6px; padding: 8px 11px;
  border: 1px solid #cbd8ce; border-radius: 6px; background: #fff;
  font-size: 13px; cursor: pointer;
}
.check input { width: auto; margin: 0; }
.check:has(input:checked) { border-color: var(--green); background: #eaf6ee; font-weight: 650; }

/* --- Record cards --------------------------------------------------------- */
.record {
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 10px; overflow: hidden;
}
.record > summary {
  list-style: none; cursor: pointer; padding: 14px 15px;
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
}
.record > summary::-webkit-details-marker { display: none; }
.record > summary:hover { background: #f7faf7; }
.record[open] > summary { border-bottom: 1px solid var(--line); background: #f6faf6; }
.record h3 { margin: 0; font-size: 15px; font-weight: 700; }
.record summary small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.record-body { padding: 16px; }

.reference {
  margin: 0 0 16px; padding: 12px 14px; border-left: 3px solid #b6c9ba;
  background: #f7faf7; border-radius: 0 5px 5px 0; font-size: 13px;
}
.reference p { margin: 0 0 7px; }
.reference p:last-child { margin: 0; }

.subcard {
  margin: 14px 0 0; padding: 14px; border: 1px solid var(--line);
  border-radius: 7px; background: #fcfdfc;
}
.subcard.leader { border-color: #b6c9ba; background: #f4f9f5; }
.subcard h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #3e5a4a; }

.group-head { background: var(--forest); color: #fff; border: 0; }
.group-head h2 { margin: 0; color: #fff; font-size: 16px; }

/* --- Registers ------------------------------------------------------------ */
.register-row {
  padding: 14px; margin-bottom: 10px; border: 1px solid var(--line);
  border-radius: 7px; background: #fcfdfc;
}
.register-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}

/* --- Evidence ------------------------------------------------------------- */
.evidence {
  margin-top: 14px; padding: 12px; border: 1px dashed #a7c0ad;
  border-radius: 6px; background: #fbfdfb;
}
.evidence-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #e7eee8; align-items: center;
}
.evidence-item:last-of-type { border: 0; }
.evidence-item small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.streamgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 10px 0; }
.stream { padding: 11px; border: 1px solid var(--line); border-radius: 6px; background: #fbfdfb; }
.stream b { display: block; margin-bottom: 3px; }
.stream small { color: var(--muted); font-size: 12px; }

/* --- Progress ------------------------------------------------------------- */
.progress { height: 9px; border-radius: 99px; background: #e2eae4; overflow: hidden; }
.progress.small { height: 6px; min-width: 90px; }
.progress i { display: block; height: 100%; background: var(--green); }

.summary {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  padding: 12px 0 0; margin-top: 12px; border-top: 1px solid var(--line); color: #43584b;
}
.summary b { color: var(--forest); }
.summary .warn b { color: var(--red); }

/* --- Misc ----------------------------------------------------------------- */
.help { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.warn { color: var(--red); }
.hidden { display: none; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.locked { opacity: .75; }
.locked input, .locked select, .locked textarea { pointer-events: none; }
.steps { margin: 8px 0 0; padding-left: 20px; }
.steps li { margin-bottom: 7px; }
.history p { margin: 0 0 6px; font-size: 13px; }
code { background: #eef3ef; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* --- REET visual language ------------------------------------------------- */
.brand-accent {
  display: inline-block; width: 5px; height: 26px; border-radius: 3px;
  background: linear-gradient(180deg, var(--reet-cyan), var(--reet-orange));
}
.report-header {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  padding: 4px 0 16px; border-bottom: 2px solid var(--line); margin-bottom: 16px;
}
.report-header img { width: 170px; max-width: 45%; height: auto; }
.report-header .report-meta { text-align: right; }
.hero {
  background: linear-gradient(120deg, #fff 0%, #f2f8fb 58%, #fff4db 100%);
  border: 1px solid #d7e6ee;
}
.hero h1 { color: var(--navy); }
.metric {
  border-top: 0;
  border-left: 4px solid var(--navy);
}
.metric.green { border-left-color: var(--green); }
.metric.amber { border-left-color: var(--reet-orange); }
.metric.blue { border-left-color: var(--reet-cyan); }
.metric.red { border-left-color: var(--red); }
.command { border-top: 0; border-left: 5px solid var(--reet-cyan); }
.progress i { background: linear-gradient(90deg, var(--reet-cyan), var(--reet-blue)); }
.group-head { background: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--reet-orange); }
.btn { background: var(--navy); }
.btn:hover { filter: brightness(1.08); }
.btn.secondary:hover { border-color: #9ec8d8; background: #f1f9fc; color: var(--navy); }
input:focus, select:focus, textarea:focus { outline-color: var(--reet-cyan); }

/* --- Evidence Library ----------------------------------------------------- */
.evidence-filters { align-items: end; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; padding: 24px; background: rgba(15, 32, 45, .72);
  display: flex; align-items: center; justify-content: center;
}
.modal { width: min(1100px, 96vw); max-height: 92vh; margin: 0; overflow: hidden; }
.modal-head { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:14px 16px; border-bottom:1px solid var(--line); }
.modal-head b, .modal-head small { display:block; }
.modal-head small { color:var(--muted); margin-top:3px; }
.modal-body { padding: 14px; max-height: calc(92vh - 76px); overflow: auto; background:#f4f7f9; }
.evidence-preview-image { display:block; max-width:100%; max-height:74vh; margin:0 auto; object-fit:contain; background:#fff; }
.evidence-preview-frame { width:100%; height:74vh; border:1px solid var(--line); background:#fff; }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .brand img { width: 150px; }
  .topin { gap: 10px; }

  .grid { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .topin { align-items: flex-start; }
  .brand { gap: 8px; }
  .brand img { width: 132px; }
  .brand-copy { display: none; }
  .top-actions { gap: 5px; }
  .project-tag { display: none; }
  .online { font-size: 10px; padding: 5px 8px; }

  .shell { padding: 12px; }
  .topin { padding: 12px; }
  .grid { grid-template-columns: 1fr; }
  .heading { display: block; }
  .heading .actions { margin-top: 12px; }
  .fieldgrid { grid-template-columns: 1fr; }
  .record > summary { grid-template-columns: 1fr; }
  .chips { justify-content: flex-start; }
  .nav { padding: 0 8px; }
  .section-head { display: block; }
  .section-head .actions { margin-top: 10px; }
  /* Touch targets stay large enough to use with one hand in a classroom. */
  input, select, textarea { padding: 12px; font-size: 16px; }
  .btn { padding: 12px 15px; }
}

/* --- Management additions ------------------------------------------------ */
.command { border-top: 5px solid var(--forest); }
.progress.large { height: 14px; margin: 14px 0 8px; }
.progress.large i { height: 100%; }
.grid.compact { grid-template-columns: repeat(4,1fr); margin-top: 10px; }
.score-help { grid-column: 1 / -1; margin: -4px 0 12px; padding: 9px 11px; border-left: 3px solid #b6c9ba; background: #f7faf7; color: #53645a; font-size: 12px; border-radius: 0 5px 5px 0; }
@media print { .top, .nav, .actions, .btn { display:none !important; } .report-header { display:flex !important; } .shell { max-width:none; padding:0; } .card { box-shadow:none; break-inside:avoid; } body { background:#fff; } }
@media (max-width: 850px) { .grid.compact { grid-template-columns: repeat(2,1fr); } }

.collab-status{margin-top:10px}.collab-banner{background:#eef8fb;border:1px solid #b8e2ec;border-left:4px solid #12a3b8;border-radius:10px;padding:10px 12px;color:#19333b}.conflict-value{white-space:pre-wrap;background:#f6f7f8;border:1px solid #e1e5e8;border-radius:8px;padding:10px;max-height:220px;overflow:auto;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}.conflict-card{border-left:4px solid #d97706}
