:root {
  /* Philippines x Kuwait: PH blue, sun yellow, the shared red, Kuwait green and black */
  --ph-blue: #0038A8;
  --ph-red: #CE1126;
  --sun: #FCD116;
  --kw-green: #007A3D;
  --kw-black: #141414;
  --flag-stripe: linear-gradient(90deg, var(--ph-blue) 0 30%, var(--ph-red) 30% 50%, var(--sun) 50% 58%, var(--kw-green) 58% 82%, var(--kw-black) 82% 100%);

  --ink: #0B1F4D;          /* text and dark surfaces: deep Philippine blue */
  --ink-2: #2E3F6B;
  --muted: #55607A;
  --brand: var(--ph-blue); /* main buttons */
  --brand-deep: #002878;
  --line: #DCE3F1;
  --field: #B7C2DC;
  --paper: #F4F6FB;
  --card: #FFFFFF;
  --tint: #E9EFFC;         /* light blue panels */
  --accent: var(--sun);
  --good: var(--kw-green);
  --warn: #B45309;
  --bad: var(--ph-red);
  --radius: 16px;
  font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); border-top: 6px solid transparent; border-image: var(--flag-stripe) 1; font-size: 18px; line-height: 1.45; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 24px; font-weight: 800; }
h3 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
a { color: var(--ink); }
.en { display: block; color: var(--muted); font-size: 0.85em; font-weight: 500; }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.wrap.wide { max-width: 1100px; }
.topbar { display: flex; align-items: center; gap: 8px; }
.topbar .brand { margin-right: auto; min-width: 0; }
.topbar .tag, .topbar #langBtn { flex: none; }
#langBtn { min-height: 40px; padding: 6px 12px; font-size: 14px; border-radius: 999px; }
@media (max-width: 400px) {
  .brand { font-size: 13px; letter-spacing: 0.02em; gap: 8px; }
  .tag { font-size: 12px; padding: 3px 8px; }
}
.brand { font-weight: 800; font-size: 15px; letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--ink); font-size: 13px; font-weight: 700; }

.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card.dark { background: linear-gradient(160deg, var(--brand), var(--ink)); color: #fff; border-color: var(--brand-deep); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid2.dates { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
input[type="datetime-local"] { font-size: 18px; min-width: 0; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 17px; }
label .hint { font-weight: 500; color: var(--muted); font-size: 14px; }
input, select, textarea {
  font: inherit; font-size: 20px; padding: 12px 14px; min-height: 54px; border-radius: 12px;
  border: 2px solid var(--field); background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--sun); outline-offset: 1px; border-color: var(--brand); }
input.pin { letter-spacing: 0.5em; text-align: center; font-size: 28px; max-width: 220px; }
.check { flex-direction: row; align-items: flex-start; gap: 12px; font-weight: 500; }
.check input { width: 28px; min-height: 28px; height: 28px; flex: none; margin-top: 2px; }

button, .btn {
  font: inherit; font-size: 20px; font-weight: 800; min-height: 58px; padding: 12px 20px; border-radius: 14px;
  border: 2px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-align: center;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button.secondary, .btn.secondary { background: #fff; color: var(--brand); }
button:not(.secondary):not(.link):not(.good):not(.bad):hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }
button.secondary:hover:not(:disabled), .btn.secondary:hover { background: var(--tint); }
button.small, .btn.small { font-size: 16px; min-height: 48px; padding: 8px 14px; border-radius: 12px; }
button.good { background: var(--good); border-color: var(--good); }
button.bad { background: var(--bad); border-color: var(--bad); }
button:disabled { opacity: 0.55; cursor: progress; }
button:active:not(:disabled), .btn:active { transform: scale(0.98); }
button, .btn { transition: transform 80ms ease, background-color 120ms ease; -webkit-tap-highlight-color: transparent; }
button:focus-visible, .btn:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--bad); background: #FFF6F7; }
button.link { background: none; border: none; color: var(--ink); text-decoration: underline; min-height: 48px; padding: 4px; font-weight: 600; font-size: 16px; }

.msg { padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.msg.error { background: #FCE8EA; color: var(--bad); }
.msg.ok { background: #E3F3EA; color: var(--good); }
.msg.info { background: var(--tint); color: var(--ink); }

/* ---------- Event Pass ---------- */
.pass { background: linear-gradient(165deg, var(--brand) 0%, var(--ink) 75%); color: #fff; border-radius: 24px; padding: 24px 20px 30px; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pass .label { font-size: 14px; font-weight: 800; letter-spacing: 0.14em; color: var(--accent); }
.pass .who { font-size: 30px; font-weight: 800; line-height: 1.1; }
.pass .what { font-size: 18px; color: #D6E0F7; }
.pass::after, .member-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--flag-stripe); }
.pass .qr { background: #fff; padding: 14px; border-radius: 16px; }
.pass .qr img, .pass .qr canvas { display: block; width: 220px; height: 220px; }
.pass .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: 0.08em; }
.pass .live { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pass .dot { width: 18px; height: 18px; border-radius: 50%; background: #3DDC84; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 1; transform: scale(1); } to { opacity: 0.35; transform: scale(0.75); } }
.daycolour { width: 100%; border-radius: 12px; padding: 10px; font-weight: 800; font-size: 18px; color: #fff; border: 3px solid rgba(255,255,255,0.9); }
.present { background: var(--good); border-radius: 14px; padding: 12px 16px; font-weight: 800; font-size: 20px; width: 100%; }

.notice { border-left: 0; border-radius: 12px; padding: 14px; background: #fff; border: 2px solid var(--line); }
.notice.warning { border-color: #E0A800; background: #FFF8DC; }
.notice.emergency { border-color: var(--bad); background: #FCE8EA; }
.notice .k { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Staff scan result ---------- */
.result { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; color: #fff; text-align: center; }
.result.good { background: var(--good); }
.result.warn { background: var(--warn); }
.result.bad { background: var(--bad); }
.result .big { font-size: 44px; font-weight: 800; line-height: 1.05; }
.result .name { font-size: 32px; font-weight: 700; }
.result button { background: #fff; color: var(--ink); border-color: #fff; min-width: 220px; }
#reader { width: 100%; max-width: 420px; margin: 0 auto; border-radius: 16px; overflow: hidden; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { background: #fff; color: var(--brand); border-color: var(--line); font-size: 16px; min-height: 46px; }
.tabs button[aria-selected="true"] { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: inset 0 -4px 0 var(--sun); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat b.small { font-size: 22px; }
.stat span { color: var(--muted); font-size: 14px; font-weight: 600; }
.table-box { overflow-x: auto; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--tint); font-weight: 800; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.chip.sent, .chip.open { background: #E3F3EA; color: var(--good); }
.chip.pending_approval, .chip.scheduled { background: #FFF4D6; color: var(--warn); }
.chip.cancelled { background: var(--tint); color: var(--muted); }
.chip.rejected, .chip.closed { background: #FCE8EA; color: var(--bad); }
.modal { position: fixed; inset: 0; background: rgba(11, 31, 77, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal .card { max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; }
.small-print { font-size: 14px; color: var(--muted); }

@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute; inset: 0; border: none; }
  .printable button { display: none; }
}

/* ---------- Member card (credit-card shape, prints at real size) ---------- */
.member-card { background: linear-gradient(150deg, var(--brand) 0%, var(--ink) 80%); color: #fff; position: relative; overflow: hidden; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 420px; width: 100%; margin: 0 auto; aspect-ratio: 85.6 / 54; }
.mc-top { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; color: var(--accent); }
.mc-body { display: flex; gap: 14px; align-items: center; flex: 1; }
.mc-qr { background: #fff; padding: 8px; border-radius: 10px; flex: none; }
.mc-qr img, .mc-qr canvas { display: block; width: 120px; height: 120px; }
.mc-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mc-name { font-size: 20px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.mc-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: 0.08em; }
.mc-since { font-size: 12px; color: #D6E0F7; }
.mc-note { font-size: 11px; color: #D6E0F7; line-height: 1.3; }
@media print {
  .member-card.printable { position: absolute; inset: 10mm auto auto 10mm; width: 85.6mm; height: 54mm; max-width: none; aspect-ratio: auto; padding: 4mm; border-radius: 3mm; gap: 2mm;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .member-card .mc-qr img, .member-card .mc-qr canvas { width: 30mm; height: 30mm; }
  .member-card .mc-name { font-size: 12pt; } .member-card .mc-code { font-size: 9pt; }
  .member-card .mc-top, .member-card .mc-since, .member-card .mc-note { font-size: 6.5pt; }
}

/* ---------- Feedback rating ---------- */
.rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rating button { flex-direction: column; gap: 2px; font-size: 30px; padding: 8px 2px; min-height: 76px; background: #fff; color: var(--ink); border-color: var(--line); }
.rating button span { font-size: 12px; font-weight: 700; }
.rating button[aria-checked="true"] { background: var(--sun); border-color: var(--brand); }

/* ---------- Member page: welcome, register steps, account ---------- */
.steps-intro { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps-intro li { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.steps-intro b { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--ink); display: grid; place-items: center; font-size: 17px; }
.steps-intro + h2 { padding-top: 14px; border-top: 2px solid var(--line); }

.stepper { display: flex; flex-direction: column; gap: 8px; }
.stepper-label { font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stepper-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stepper-bar i { height: 8px; border-radius: 99px; background: var(--line); }
.stepper-bar i.on { background: var(--brand); }
.stepper-bar i.on:last-child { background: var(--kw-green); }
.step { display: flex; flex-direction: column; gap: 14px; }
#vRegister .notice { font-size: 16px; }
#vRegister .notice ul { line-height: 1.4; }

/* <details> can't be a flex box everywhere, so space its children directly */
details.card { display: block; }
details.card > * + *, details details > * + * { margin-top: 14px; }
details.card > button, details.card > label { width: 100%; }
details.card > button.link { width: auto; }
details summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: ""; width: 10px; height: 10px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); margin-right: 6px; flex: none; transition: transform 150ms ease; }
details[open] > summary::after { transform: rotate(-135deg); }
#vAccount > summary { font-size: 20px; }
#vAccount details { border-top: 2px solid var(--line); padding-top: 4px; }
#vAccount label.check { flex-direction: row; }

/* Pass screen: event details sit under the pass */
#vPass + #eventHead { margin-top: -4px; }
#vPass + #eventHead > span.small-print:first-child { display: none; }
#vPass + #eventHead h1 { font-size: 22px; }

.notice-more > summary { min-height: 44px; }
.notice-more > summary b::after { content: " · tap to read"; font-weight: 600; color: var(--muted); }
.notice-more[open] > summary b::after { content: ""; }
html[lang="fil"] .notice-more > summary b::after { content: " · pindutin para mabasa"; }
html[lang="fil"] .notice-more[open] > summary b::after { content: ""; }
.brand { line-height: 1.2; }
@media (max-width: 400px) { .brand-sub { display: none; } }

/* Flag-colour touches */
.tag { border-color: var(--brand); color: var(--brand); }
h1, h2 { color: var(--ink); }
.card.dark h1, .card.dark h2, .result h1, .result h2 { color: #fff; }
.steps-intro b { background: var(--sun); color: var(--ink); }
.steps-intro li:nth-child(2) b { background: var(--ph-red); color: #fff; }
.steps-intro li:nth-child(3) b { background: var(--kw-green); color: #fff; }
.mc-top { color: var(--sun); }
.pass .label { color: var(--sun); }
@media print { body { border-top: 0; } }
