:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --brand: #c34b29;
  --band: var(--brand);
  --ok: #15803d;
  --okbg: #ecfdf3;
  --err: #b42318;
  --errbg: #fef3f2;
  --infobg: #eff6ff;
  --info: #1d4ed8;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.brand a { font-size: 18px; font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 10px; }
.brand span { color: var(--brand); }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-text { color: var(--ink); }
.brand-text span { color: var(--brand); }
.topbar nav { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 14px; }
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 14px; padding: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
.muted { color: var(--muted); }

.page-head { display: flex; align-items: center; gap: 12px; border-left: 6px solid var(--band); padding-left: 12px; margin: 6px 0 4px; }
.page-head h1 { font-size: 22px; margin: 0; }
.badge { background: var(--band); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.status { margin: 4px 0 22px; }

.flash { border-radius: 8px; padding: 12px 14px; margin: 14px 0; font-size: 14px; }
.flash ul { margin: 8px 0 0; padding-left: 18px; }
.flash-success { background: var(--okbg); color: var(--ok); border: 1px solid #abefc6; }
.flash-error { background: var(--errbg); color: var(--err); border: 1px solid #fecdca; }
.flash-info { background: var(--infobg); color: var(--info); border: 1px solid #bfdbfe; }
.flash-msg { font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.tile { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tile h3 { margin: 0; font-size: 16px; }
.tile .step { position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; border-radius: 999px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.tile input[type=file] { font-size: 13px; }
.tile .date { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.tile input[type=date] { padding: 7px; border: 1px solid var(--line); border-radius: 7px; }

.btn { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink); }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(0.95); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.readiness { display: flex; gap: 8px; margin: 2px 0 2px; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.chip.ok { background: var(--okbg); color: var(--ok); }
.chip.wait { background: #fff7ed; color: #c2410c; }
.gate-note { font-size: 12px; margin: 2px 0 0; }

.recip-form { display: flex; gap: 10px; align-items: flex-end; margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.recip-form label { flex: 1; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.recip-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; }
.btn-row { display: flex; gap: 10px; margin: 14px 0; }

.recent-head { display: flex; align-items: baseline; justify-content: space-between; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list thead th { background: #fafafa; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.list tr:last-child td { border-bottom: 0; }
.actions { white-space: nowrap; }
.pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill.on { background: var(--okbg); color: var(--ok); }
.pill.off { background: #f3f4f6; color: var(--muted); }

/* report matrix */
.report-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table.matrix { border-collapse: collapse; font-size: 13px; min-width: 1000px; width: 100%; }
table.matrix th, table.matrix td { padding: 6px 8px; text-align: center; border: 1px solid var(--line); white-space: nowrap; }
table.matrix thead .groups th { background: #fafafa; font-weight: 700; }
table.matrix thead .groups span { font-weight: 400; font-size: 11px; color: var(--muted); }
table.matrix thead .sub th { background: var(--band); color: #fff; font-size: 11px; }
table.matrix .lbl { text-align: left; }
table.matrix td.pn { text-align: left; font-weight: 700; }
table.matrix td.nm { text-align: left; }
table.matrix td.ypdh { font-weight: 700; }
table.matrix tr.subtotal td { background: #fdf3ee; font-weight: 700; }
table.matrix tr.totals td { background: #f3f4f6; font-weight: 800; }

/* login */
.login-card { max-width: 360px; margin: 8vh auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px; text-align: center; }
.login-logo { margin: 0; font-size: 26px; }
.login-logo span { color: var(--brand); }
.login-logo-img { max-width: 240px; width: 100%; height: auto; display: block; margin: 0 auto 6px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.login-form input { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }

@media (max-width: 760px) { .tiles { grid-template-columns: 1fr; } }
