:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1d2433;
  --muted: #5c6b7a;
  --accent: #1a73e8;
  --ok: #1b8a4a;
  --bad: #c0392b;
  --line: #e2e8ef;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #16324f;
  color: #fff;
}
.app-header a { color: #fff; text-decoration: none; margin-left: 12px; }
.app-logo { font-weight: 700; }
.app-main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.app-hero, .app-card, .app-auth {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 16px;
}
.app-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-app, .app-form button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  text-decoration: none;
  font-size: 16px;
}
.btn-app-alt { background: #0f9d58; }
.btn-app-ghost { background: #44566c; }
.app-form { display: grid; gap: 12px; }
.app-form label { display: grid; gap: 6px; font-size: 14px; }
.app-form input[type=email], .app-form input[type=password] {
  font-size: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.chk { display: flex !important; flex-direction: row; align-items: center; gap: 8px; }
.app-error { color: var(--bad); margin-bottom: 12px; }
.app-ok { border-left: 4px solid var(--ok); }
.app-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.app-card-link {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); padding: 16px; border-radius: 12px;
  text-decoration: none; color: inherit; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.app-org { font-size: 15px; color: var(--muted); margin: 20px 0 8px; }
.journal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.journal { border-collapse: collapse; min-width: 100%; background: #fff; }
.journal th, .journal td { border: 1px solid var(--line); padding: 8px; text-align: center; white-space: nowrap; }
.journal .sticky { position: sticky; left: 0; background: #fff; text-align: left; z-index: 1; }
.journal-date span { color: var(--muted); font-weight: 400; }
.mark { cursor: pointer; font-weight: 700; }
.is-present { background: #e8f8ee; color: var(--ok); }
.is-absent { background: #fdecea; color: var(--bad); }
.is-empty { color: #9aa8b5; }
.qr-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}
.qr-open:hover { background: #1558b0; }
.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(22, 50, 79, .45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.qr-modal.is-open { display: flex; }
.qr-modal-dialog {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px 16px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.qr-modal-dialog h2 { margin: 0 28px 8px; font-size: 18px; }
.qr-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}
#qrcode { display: flex; justify-content: center; margin: 12px 0; }
#qrcode img, #qrcode canvas, #qrcode svg { width: min(72vw, 240px); height: auto; }
.qr-url { word-break: break-all; font-size: 13px; color: var(--muted); }
.qr-hint { font-size: 13px; color: var(--muted); }
.qr-present { text-align: left; margin: 8px 0 0; padding-left: 18px; }
@media (min-width: 720px) {
  .app-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .app-grid { grid-template-columns: repeat(3, 1fr); }
}
