/* CPBC Enquiry System — accessible stylesheet.
 *
 * The PRD (R8) specified brand text #8B7BB8 on background #C9C1DC. That pairing
 * fails WCAG contrast badly — light purple on light purple — and Legacy shipped
 * it as-is (part of its bad-UI defects). We keep the CPBC purple identity but
 * fix the contrast: a dark purple ink on a near-white ground, and accent
 * buttons dark enough to carry white text at AA. Accessibility is treated as
 * non-negotiable here, not a Phase-2 nicety.
 */
:root {
  --ink: #2b2140;          /* near-black purple: high contrast on white */
  --brand: #4a3b7a;        /* headings / links: ~7:1 on white */
  --brand-strong: #3d2f66; /* buttons: white text ~8:1 */
  --ground: #f7f5fb;       /* page background */
  --card: #ffffff;
  --line: #d9d3e6;
  --error: #8a1c1c;
  --ok: #1c5a2e;
  --focus: #1b57d6;
}

* { box-sizing: border-box; }

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

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brand-strong); color: #fff; padding: .5rem 1rem;
}
.skip-link:focus { left: 0; z-index: 10; }

a { color: var(--brand); }
a:focus, button:focus, input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--focus); outline-offset: 1px;
}

.bar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  justify-content: space-between;
  background: var(--brand-strong); color: #fff; padding: .75rem 1.25rem;
}
.bar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.bar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.bar nav a { color: #fff; text-decoration: none; }
.bar nav a:hover { text-decoration: underline; }

.wrap { max-width: 940px; margin: 1.5rem auto; padding: 0 1.25rem; }

h1, h2, h3 { color: var(--brand); line-height: 1.2; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 1.5rem; max-width: 460px; margin: 2rem auto;
}

form label { display: block; margin: .75rem 0 .25rem; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: .55rem .6rem; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 6rem; }

button, .btn {
  display: inline-block; margin-top: 1rem; padding: .6rem 1.1rem;
  background: var(--brand-strong); color: #fff; border: 0; border-radius: 6px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand); }
.linkish {
  background: none; color: #fff; padding: 0; margin: 0; font-weight: 400;
  text-decoration: underline; cursor: pointer;
}
form.inline { display: inline; margin: 0; }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #6b1414; }

table { width: 100%; border-collapse: collapse; margin: 1rem 0; background: #fff; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
th { background: #efeaf6; color: var(--brand); }

.detail th { width: 12rem; }

.flashes { margin: 1rem 0; }
.flash { padding: .6rem .8rem; border-radius: 6px; border: 1px solid; }
.flash-error { color: var(--error); border-color: var(--error); background: #fdecec; }
.flash-info, .flash-status { color: var(--ok); border-color: var(--ok); background: #eaf6ee; }

.badge {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; border: 1px solid var(--line);
  background: #efeaf6; color: var(--brand);
}
.badge-warn { background: #fdf0d8; border-color: #a9701a; color: #6b4410; }

.notes .note {
  border-left: 3px solid var(--line); padding: .3rem .8rem; margin: .6rem 0;
}
.note .meta { font-size: .85rem; color: #5a5470; }

.muted { color: #5a5470; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.stat .n { font-size: 2rem; font-weight: 700; color: var(--brand); }

.disclaimer { font-size: .85rem; color: #5a5470; margin-top: 1rem; }
.foot { text-align: center; color: #5a5470; padding: 2rem 1rem; font-size: .85rem; }

.actions { margin: 1rem 0; display: flex; gap: .75rem; flex-wrap: wrap; }
