:root {
  --teal: #007981;
  --teal-dark: #005a60;
  --green: #2e7d32;
  --red: #c62828;
  --amber: #ef6c00;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --bg: #f4f6f7;
  --card: #ffffff;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--teal);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; }
.topbar nav a {
  color: #d7eff0;
  text-decoration: none;
  margin-left: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
}
.topbar nav a.active { background: rgba(255,255,255,0.2); color: #fff; }

.view { max-width: 560px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

h2 { margin: 0 0 14px; font-size: 20px; }
h3 { margin: 4px 0 12px; }
h4 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sub { color: var(--muted); text-align: center; margin: 6px 0; }
.err { color: var(--red); min-height: 18px; font-size: 14px; text-align: center; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.hint code { background: #eef2f4; padding: 1px 5px; border-radius: 4px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input, label select { margin-top: 4px; }

input, select {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--teal); border-color: transparent; }

.btn {
  display: inline-block;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  cursor: pointer;
}
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.secondary { background: #e6f2f3; color: var(--teal-dark); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 10px; margin: 12px 0; align-items: center; justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid input, .grid select, .grid label { margin-bottom: 0; }
.grid label { margin-bottom: 0; }

.gps { text-align: center; font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.gps.ok { color: var(--green); }
.gps.fail { color: var(--red); }

.clock-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 8px auto;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transition: transform 0.08s ease;
}
.clock-btn:active { transform: scale(0.96); }
.clock-btn.green { background: var(--green); }
.clock-btn.red { background: var(--red); }
.clock-btn.amber { background: var(--amber); }
.clock-sub { display: block; font-size: 14px; font-weight: 500; margin-top: 4px; opacity: 0.9; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 14px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.tbl td button { padding: 3px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }

.chk label { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-size: 14px; color: var(--ink); }
.chk input { width: auto; }

/* kiosk mode (door tablet) */
.kiosk { max-width: 520px; }
.kiosk h2 { text-align: center; font-size: 26px; }
.kiosk-names { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kiosk-names button {
  padding: 30px 10px; font-size: 21px; font-weight: 700; min-height: 100px;
  border: none; border-radius: 16px; background: var(--teal); color: #fff; cursor: pointer;
}
.kiosk-names button:active { background: var(--teal-dark); }
.kiosk-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.kiosk-pad button {
  padding: 22px 0; font-size: 26px; font-weight: 700;
  border: 1px solid var(--border); border-radius: 14px; background: #fff; cursor: pointer;
}
.kiosk-pad button:active { background: #eef2f4; }
.kiosk-pad button.kiosk-go { background: var(--green); color: #fff; border-color: var(--green); }
.kiosk-pad button.kiosk-del { background: #fbe9e7; }
.kiosk-pin-display { text-align: center; font-size: 32px; letter-spacing: 10px; min-height: 44px; margin: 6px 0 16px; }
.kiosk-exit { display: block; text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; text-decoration: none; }
