:root {
  --ink: #142033;
  --muted: #5d6b80;
  --line: #e3e8f0;
  --bg: #f3f5f8;
  --card: #ffffff;
  --blue: #1d4ed8;
  --blue-dark: #0f2744;
  --teal: #0f766e;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(20, 32, 51, 0.06);
  font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.app { max-width: 720px; margin: 0 auto; min-height: 100vh; padding: 16px 16px 96px; }
.app.wide { max-width: 1100px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.brand { display: flex; gap: 10px; align-items: center; }
.mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--blue-dark); color: white;
  display: grid; place-items: center; font-weight: 700;
}
.brand h1, .panel h2, .card h2, .card h3 { margin: 0; }
.brand h1 { font-size: 18px; }
.brand p, .muted { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px; }
.card { padding: 14px; margin-bottom: 12px; }
.card.click { width: 100%; text-align: left; }

.login { max-width: 440px; margin: 8vh auto 0; }
.login h1 { font-size: 28px; margin: 12px 0 6px; }

label { display: block; font-size: 13px; font-weight: 650; margin: 14px 0 6px; }
input, textarea, select {
  width: 100%;
  border: 1px solid #cfd6e2;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }

.btn {
  border: 0; border-radius: 12px; padding: 12px 14px;
  background: var(--blue); color: white; font-weight: 700;
}
.btn.secondary, .btn.ghost { background: #eef2f7; color: var(--ink); }
.btn.block { width: 100%; margin-top: 14px; }
.btn.small { padding: 8px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; }
.stats.six { grid-template-columns: repeat(3, 1fr); }

.search { margin: 8px 0 14px; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pill { background: #eef4ff; color: #1e3a8a; border-radius: 999px; padding: 4px 8px; font-size: 12px; }

.banner {
  background: #fef3f2; color: var(--danger); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 14px;
}
.ok { background: #ecfdf3; color: #067647; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.demo { background: #f8fafc; border-radius: 12px; padding: 10px 12px; margin-top: 14px; font-size: 13px; }

.tabs, .crumbs { display: flex; gap: 8px; overflow: auto; padding-bottom: 4px; }
.tab, .crumb {
  border: 1px solid var(--line); background: white; border-radius: 999px;
  padding: 8px 12px; white-space: nowrap;
}
.tab.on { background: var(--blue-dark); color: white; border-color: var(--blue-dark); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { font-size: 12px; color: var(--muted); background: #f8fafc; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fbff; }
.right { text-align: right; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px; justify-content: center;
  background: white; border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.nav button { flex: 1; max-width: 220px; }

.photo {
  width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; background: #eef2f7;
}
.visit { display: flex; gap: 10px; }
.visit img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #eef2f7; }
.admin-photo { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; background: #eef2f7; }
.split { display: grid; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.check input { width: auto; }
code { font-size: 12px; }

@media (min-width: 800px) {
  .stats.six { grid-template-columns: repeat(4, 1fr); }
  .split { grid-template-columns: 1fr 1fr; }
}
