:root {
  --navy: #0f1d3a; --navy2: #1b2d55; --gold: #c9a96e; --gold2: #b08d4f;
  --bg: #f4f5f8; --card: #fff; --line: #e4e7ee; --text: #1c2333; --muted: #6b7280;
  --ok: #16a34a; --okbg: #dcfce7; --warn: #b45309; --warnbg: #fef3c7; --bad: #dc2626; --badbg: #fee2e2; --info: #1d4ed8; --infobg: #dbeafe;
  --r: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--navy2); }
h1 { font-size: 22px; margin: 6px 0 14px; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 22px 0 10px; }
h4 { margin: 0 0 8px; font-size: 14px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .center { text-align: center; } .right { text-align: right; }
.nowrap { white-space: nowrap; } .grow { flex: 1; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 14px 14px 96px; }
.wrap.narrow, .is-login .wrap { max-width: 440px; }
.is-admin .wrap { padding-bottom: 40px; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 600; letter-spacing: .2px; }
.brand b { color: var(--gold); }
.brand.big { font-size: 20px; margin-bottom: 8px; color: var(--navy); }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--gold); color: var(--navy); font-weight: 800; }
.who { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.link-out { color: var(--gold); text-decoration: none; }

.adminnav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; background: var(--navy2); scrollbar-width: none; position: sticky; top: 50px; z-index: 19; }
.adminnav a { color: #d6dcea; text-decoration: none; padding: 7px 11px; border-radius: 9px; white-space: nowrap; font-size: 13.5px; }
.adminnav a.on, .adminnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.adminnav i { font-style: normal; background: var(--gold); color: var(--navy); border-radius: 20px; padding: 0 6px; font-size: 11px; font-weight: 700; }

.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); text-decoration: none; font-size: 11px; }
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav a.on { color: var(--navy); font-weight: 600; }
.bottomnav a.on svg { color: var(--gold2); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.login-card { margin-top: 8vh; padding: 22px; }

.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; background: var(--okbg); color: #14532d; }
.flash.bad { background: var(--badbg); color: #7f1d1d; } .flash.warn { background: var(--warnbg); color: #78350f; }
.alert { display: block; padding: 11px 14px; border-radius: 12px; background: var(--warnbg); color: #78350f; text-decoration: none; margin-bottom: 14px; font-weight: 500; }

label { display: block; font-size: 13px; color: #374151; margin-bottom: 10px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 11px; border: 1px solid #cfd5e1; border-radius: 10px; background: #fff; color: var(--text); margin-top: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 24px; } label.check input { width: auto; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form h3:first-child { margin-top: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; margin: 0; }
form.inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.inline input, form.inline select { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }
.w50 { width: 56px !important; } .w60 { width: 64px !important; } .w80 { width: 84px !important; } .w120 { width: 120px !important; } .w160 { width: 160px !important; } .w-full { width: 100%; min-width: 160px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 11px; border: 1px solid #cfd5e1; background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.ghost { background: transparent; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.bad { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.block { width: 100%; } .btn.big { padding: 16px; font-size: 17px; border-radius: 14px; }
.btn.small { padding: 7px 12px; font-size: 13px; } .btn.tiny { padding: 5px 9px; font-size: 12.5px; border-radius: 8px; }
.linkbtn { background: none; border: 0; color: var(--bad); font-size: 12px; cursor: pointer; padding: 2px 0; }
.link { color: var(--navy2); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: #eef0f4; color: #374151; white-space: nowrap; }
.badge.ok { background: var(--okbg); color: #166534; } .badge.warn { background: var(--warnbg); color: #92400e; } .badge.bad { background: var(--badbg); color: #991b1b; } .badge.info { background: var(--infobg); color: #1e40af; }

.hello h1 { margin: 2px 0 12px; font-size: 24px; }
.presence-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; text-align: center; }
.presence-times span { display: block; font-size: 12px; } .presence-times b { font-size: 22px; color: var(--navy); }
.done { text-align: center; padding: 12px; background: var(--okbg); color: #14532d; border-radius: 12px; margin-bottom: 8px; font-weight: 600; }
.presence .link { display: block; text-align: center; margin-top: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid-2.top { align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.action { display: block; background: var(--navy); color: #fff; border-radius: var(--r); padding: 14px; text-decoration: none; }
.action b { display: block; color: var(--gold); } .action span { font-size: 12.5px; color: #c8cfdf; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stats.six { grid-template-columns: repeat(3, 1fr); }
.stat { background: #f7f8fb; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.card .stat { background: #f7f8fb; }
.stat-l { font-size: 12px; color: var(--muted); } .stat-v { font-size: 20px; font-weight: 700; color: var(--navy); } .stat-s { font-size: 11.5px; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }
.list-card { padding: 4px 14px; }
.item { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item .right { flex-shrink: 0; }
.verif-row { align-items: center; flex-wrap: wrap; }
.verif-row input { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }
.note { margin-top: 6px; padding: 6px 9px; background: #fbf7ef; border-left: 3px solid var(--gold); border-radius: 6px; font-size: 12.5px; }

details.item-d { border-bottom: 1px solid var(--line); padding: 4px 0; }
details.item-d:last-child { border: 0; }
details summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; }
details summary::-webkit-details-marker { display: none; }
details.member summary { padding: 0; }
details.member[open] summary { margin-bottom: 12px; }
details.member.off { opacity: .65; }

.table-wrap { overflow-x: auto; padding: 4px; }
.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th, .t td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.t th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f7f8fb; white-space: nowrap; }
.t .num { text-align: right; white-space: nowrap; }
.t tr.tot td { font-weight: 700; background: #f7f8fb; }
.t tr.me td { background: #fbf7ef; }
.t.mini td { padding: 6px 4px; }
.t.grid td { min-width: 64px; }
.cell-ok { background: #ecfdf3; } .cell-warn { background: #fff7e6; } .cell-bad { background: #fff1f1; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pickers { display: flex; gap: 8px; flex-wrap: wrap; }
.picker label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; }
.picker select { width: auto; margin: 0; padding: 7px 9px; font-size: 13px; }

.score-big { font-size: 38px; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 8px; }
.score-big span { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 8px; }
.bar { display: inline-block; width: 80px; height: 6px; background: #eef0f4; border-radius: 5px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); }

dialog { border: 0; max-width: 420px; width: calc(100% - 28px); }
dialog::backdrop { background: rgba(15,29,58,.45); }
textarea.code { font: 12px/1.4 ui-monospace, Consolas, monospace; background: #0f1d3a; color: #e5e7eb; }
.steps { padding-left: 18px; } .steps li { margin-bottom: 4px; }

.slip { max-width: 560px; margin: 0 auto; }
.slip-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--gold); padding-bottom: 10px; margin-bottom: 10px; }

@media (max-width: 860px) {
  .grid-2.top, .grid-3 { grid-template-columns: 1fr; }
  .stats.six { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
@media print {
  .topbar, .adminnav, .bottomnav, .noprint { display: none !important; }
  body { background: #fff; } .card { border: 0; }
}
.card > h3:first-child, .card > form > h3:first-child { margin-top: 0; }
