/* The Sanggunian's records room behind deep blue, with red for action and attention.
   Fonts are built into Windows, so the page requests nothing from outside this PC. */
:root {
  --navy: #0a2556; --navy-2: #0f3a85; --blue: #1558c0; --red: #c8102e; --red-dark: #a00c25; --white: #ffffff;
  --surface: #ffffff; --surface-2: #f2f6fc; --sunken: #e4ebf6; --fg: #0d1f3f; --muted: #51627f; --line: #d3deee;
  --accent: #1558c0; --accent-soft: #dfeafb;
  --alert: #c8102e; --alert-soft: #fde6e9;
  --done: #0f3a85; --done-fg: #ffffff; --found: #dfeafb; --found-fg: #0f4aa8;
  --serif: Georgia, "Times New Roman", serif;
  --font: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}
@media (prefers-color-scheme: dark) { :root {
  --surface: #122546; --surface-2: #0e1e3a; --sunken: #0b1830; --fg: #eaf1fc; --muted: #a9bbd6; --line: #2a406a;
  --accent: #79aeff; --accent-soft: #1b3766;
  --alert: #ff8797; --alert-soft: #4a1722;
  --done: #79aeff; --done-fg: #081a38; --found: #1b3766; --found-fg: #b7d2ff;
  color-scheme: dark;
} }
* { box-sizing: border-box; }
html { background: var(--navy); }
body { margin: 0; color: var(--fg); font: 14px/1.5 var(--font); min-height: 100vh; position: relative; }
#bgcanvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; display: block; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10, 37, 86, .62) 0, rgba(10, 37, 86, .84) 260px, rgba(8, 28, 66, .93) 100%); }
h1, h2, h3, p { margin: 0; text-wrap: balance; }
h1 { font: 700 29px/1.15 var(--serif); letter-spacing: .002em; }
h2 { font: 700 21px/1.2 var(--serif); }
h3 { font-size: 14.5px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #ffb4bf; outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header */
.band { color: var(--white); border-bottom: 4px solid var(--red); background: linear-gradient(90deg, rgba(10, 37, 86, .9), rgba(15, 58, 133, .55)); }
.band-in { max-width: 1320px; margin: 0 auto; padding: 18px 16px; display: flex; flex-wrap: wrap; gap: 14px 20px; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 420px; }
.seals { display: flex; gap: 8px; flex: none; }
.seals canvas { width: 76px; height: 76px; border-radius: 50%; background: #fff; padding: 2px; box-shadow: 0 3px 12px rgba(0, 0, 0, .35); display: block; }
.brandtext { min-width: 0; }
.eyebrow { color: #cfe0fb; font-size: 13.5px; }
.band .btn { background: rgba(255, 255, 255, .1); color: var(--white); border-color: rgba(255, 255, 255, .6); }
.band .btn:hover { background: var(--red); border-color: var(--red); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-block; text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 7px 13px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.danger { color: var(--alert); }
.btn.small { padding: 3px 9px; font-size: 13px; }

/* Panels sitting directly on the photo */
.setup, .notice, .linkbox { background: var(--surface); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); }
.setup { padding: 16px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: end; border-top: 4px solid var(--red); }
.inlineform { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.notice { padding: 8px 12px; overflow-wrap: anywhere; }
.scanning { color: #fff; font-weight: 500; }
.linkbox { border-top: 4px solid var(--red); padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; }
.linktext { display: grid; gap: 2px; min-width: 0; }
.linktext h2 { font: 600 14.5px var(--font); }
.linkurl { font: 600 15px var(--mono); color: var(--accent); overflow-wrap: anywhere; user-select: all; }

.searchrow { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
#search { flex: 1 1 280px; min-width: 0; padding: 11px 14px; font-size: 16px; border-color: transparent; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
input[type=search], input[type=text], input[type=password], input[type=date], select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; max-width: 100%; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 13px; font-weight: 500; }
label.inline select { color: var(--fg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid rgba(255, 255, 255, .55); background: rgba(10, 37, 86, .55); color: #fff; padding: 5px 12px; border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.chip:hover { background: rgba(255, 255, 255, .18); }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); }

/* Register + open record */
.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; align-items: start; }
.list, .detail { background: var(--surface); border-radius: 8px; box-shadow: 0 8px 26px rgba(0, 0, 0, .28); }
.list { overflow: hidden; }
.row { display: grid; gap: 5px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--red); }
.row:focus-visible { outline-offset: -3px; outline-color: var(--accent); }
.rowline { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; min-width: 0; }
.name { font-weight: 600; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.count { font: 13px var(--mono); white-space: nowrap; }
.sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; min-width: 0; }

/* Status is carried by form as well as hue: solid = settled, outline = needs action. */
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--sunken); border: 1px solid transparent; }
.pill.incomplete, .pill.missing { background: var(--alert); color: var(--surface); }
.pill.review, .pill.detected { background: var(--found); color: var(--found-fg); }
.pill.complete, .pill.verified { background: var(--done); color: var(--done-fg); }
.pill.landunset, .pill.redo { background: var(--alert-soft); color: var(--alert); border-color: var(--alert); }
.pill.pending { background: var(--surface); color: var(--muted); border-color: var(--line); }
.pill.notrequired { background: var(--sunken); color: var(--muted); }
.bar { height: 7px; border-radius: 4px; background: var(--sunken); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .v { background: var(--done); }
.bar .d { background: #6ea2ea; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); display: grid; gap: 10px; justify-items: center; }

.detail { padding: 18px; display: grid; gap: 16px; position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow-y: auto; min-width: 0; border-top: 4px solid var(--navy-2); }
.detail section { display: grid; gap: 8px; min-width: 0; }
.dhead { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; align-items: flex-start; }
.back { display: none; }
.field { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.field > input, .field > select, .field > textarea { color: var(--fg); font-size: 14px; width: 100%; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
.check { display: flex; gap: 7px; align-items: center; font-size: 14px; align-self: end; padding-block: 6px; }
.hint { font-size: 13px; color: var(--muted); }
.warnline { background: var(--alert-soft); color: var(--alert); padding: 7px 10px; border-radius: 6px; font-weight: 500; }
.badline { background: var(--alert); color: var(--surface); padding: 7px 10px; border-radius: 6px; font-weight: 600; }
.okline { background: var(--done); color: var(--done-fg); padding: 7px 10px; border-radius: 6px; font-weight: 600; }
.infoline { background: var(--found); color: var(--found-fg); padding: 7px 10px; border-radius: 6px; font-weight: 500; }
.reqs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.req { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 9px 10px; border-bottom: 1px solid var(--line); align-items: start; }
.req:last-child { border-bottom: 0; }
.req.off { background: var(--surface-2); }
.req.off .rn { color: var(--muted); font-weight: 400; }
.rn { font-weight: 500; overflow-wrap: anywhere; }
.rd { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.rright { display: grid; gap: 5px; justify-items: end; }
.req select { font-size: 13px; padding: 3px 5px; max-width: 170px; }
.req .noteinput { grid-column: 1 / -1; width: 100%; font-size: 13px; padding: 4px 8px; }
.pagelinks { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; }
.pagelinks a, .files a { color: var(--accent); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.log li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.log time { color: var(--muted); }
.note { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Sign-in welcome, shown while applications are locked */
body.locked .summary, body.locked .detail { display: none; }
body.locked .layout { grid-template-columns: minmax(0, 480px); justify-content: center; padding-top: 5vh; }
.welcome { padding: 32px 28px; text-align: center; display: grid; gap: 12px; justify-items: center; border-top: 4px solid var(--red); }
.welcome .seals canvas { width: 92px; height: 92px; box-shadow: 0 2px 8px rgba(10, 37, 86, .3); }
.welcome p { color: var(--muted); }

dialog { background: var(--surface); color: var(--fg); border: 0; border-top: 4px solid var(--red); border-radius: 10px; padding: 20px; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(5, 18, 45, .7); }
dialog form { display: grid; gap: 12px; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.formgrid .full { grid-column: 1 / -1; }
.dlgfoot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.formerror { color: var(--alert); font-weight: 500; }
#toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--navy); color: #fff; border: 1px solid rgba(255, 255, 255, .4); padding: 8px 14px; border-radius: 6px; max-width: calc(100vw - 32px); z-index: 20; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; max-height: none; }
  body.has-sel .summary, body.has-sel .listcol { display: none; }
  body:not(.has-sel) .detail { display: none; }
  .back { display: inline-block; justify-self: start; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .brand { flex-wrap: wrap; flex-basis: 100%; }
  .seals canvas { width: 58px; height: 58px; }
  .formgrid { grid-template-columns: minmax(0, 1fr); }
  .req { grid-template-columns: minmax(0, 1fr); }
  .rright { justify-items: start; }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
