:root {
  --blue: #28A0D8;
  --blue-dark: #1780b4;
  --orange: #F07830;
  --ink: #303030;
  --bg: #f4f8fb;
  --card: #ffffff;
  --line: #e3ecf2;
  --muted: #7b8a94;
  --danger: #d64541;
  --ok: #2e9e5b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
.hidden { display: none !important; }

/* ---------- sign-in ---------- */
#signin {
  position: fixed; inset: 0; z-index: 50;
  background: linear-gradient(135deg, #0e2a3a 0%, #123c52 55%, #0d3348 100%);
  display: flex; align-items: center; justify-content: center;
}
#netbg { position: absolute; inset: 0; width: 100%; height: 100%; }
.signin-card {
  position: relative; z-index: 2; width: min(400px, 92vw);
  background: rgba(255,255,255,.97); border-radius: 18px; padding: 34px 32px 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.wordmark { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.wordmark .t1 { color: var(--blue); }
.wordmark .t2 { color: var(--orange); }
.wordmark-sub { color: var(--muted); font-size: 13px; margin: 2px 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #51626d; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.btn {
  display: inline-block; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 14.5px; font-weight: 700; padding: 11px 20px; font-family: inherit;
  background: var(--blue); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(.93); }
.btn.orange { background: var(--orange); }
.btn.ghost { background: #eef4f8; color: var(--ink); }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #51626d; margin: 6px 0 16px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.okmsg { color: var(--ok); font-size: 13px; }

/* ---------- header ---------- */
header.app {
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 13px 26px;
  position: sticky; top: 0; z-index: 10;
}
header.app .wordmark { font-size: 20px; }
header.app nav { display: flex; gap: 6px; margin-left: 8px; }
header.app nav a {
  text-decoration: none; color: #51626d; font-size: 13.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 9px;
}
header.app nav a.on, header.app nav a:hover { background: #e8f4fb; color: var(--blue-dark); }
.spacer { flex: 1; }
.chip {
  font-size: 12.5px; background: #eef4f8; border-radius: 999px; padding: 6px 13px;
  color: #51626d; cursor: pointer; border: 0; font-family: inherit; font-weight: 600;
}
.chip:hover { background: #e0ecf4; }
.who { font-size: 13px; color: var(--muted); }

/* ---------- layout ---------- */
main { max-width: 1160px; margin: 0 auto; padding: 28px 22px 70px; }
h1 { font-size: 22px; margin: 4px 0 18px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 15px;
  padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(20,50,70,.04);
}

/* hub tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 22px; }
.tile {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 26px 24px;
  text-decoration: none; color: var(--ink); box-shadow: 0 3px 14px rgba(20,50,70,.05);
  transition: transform .12s, box-shadow .12s; display: block;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(20,50,70,.10); }
.tile .ico { font-size: 30px; margin-bottom: 12px; display: block; }
.tile b { font-size: 16.5px; display: block; margin-bottom: 6px; }
.tile p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.tile .tag { display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--blue-dark); }

/* events */
.evgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.evcard {
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--blue);
  border-radius: 13px; padding: 17px 18px; cursor: pointer; transition: box-shadow .12s;
}
.evcard:hover { box-shadow: 0 8px 22px rgba(20,50,70,.09); }
.evcard .eid { font-weight: 800; font-size: 15.5px; }
.evcard .cl { color: var(--muted); font-size: 13px; margin-top: 2px; }
.evcard .tot { margin-top: 10px; font-size: 13.5px; }
.evcard .profit { font-weight: 700; }
.profit.pos { color: var(--ok); }
.profit.neg { color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: #51626d; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.voided td { opacity: .45; text-decoration: line-through; }
tr.voided td:last-child { text-decoration: none; }
.amt { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.sub { color: var(--muted); font-size: 12px; }
.link { color: var(--blue-dark); cursor: pointer; text-decoration: underline; font-size: 12.5px; background: none; border: 0; padding: 0; font-family: inherit; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,30,42,.55); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal { background: #fff; border-radius: 16px; padding: 26px 26px 22px; width: min(560px, 96vw); max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal h2 { margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.pill.void { background: #fdecec; color: var(--danger); }
.pill.edit { background: #fff3e8; color: #c05a14; }
.pill.rcpt { background: #e8f4fb; color: var(--blue-dark); }
.filefield { border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.filefield.has { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.totline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; margin-top: 6px; }
.totline b { font-variant-numeric: tabular-nums; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 11px 22px;
  font-size: 14px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
@media (max-width: 640px) {
  header.app { flex-wrap: wrap; padding: 11px 14px; gap: 8px; }
  main { padding: 18px 12px 60px; }
  .hide-sm { display: none; }
}
