:root {
  --navy: #0f2a47;
  --navy-2: #173a61;
  --accent: #e8a317;
  --green: #1f9d55;
  --red: #c8372d;
  --amber: #c77d00;
  --grey: #6b7785;
  --line: #e3e7ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: #1c2733;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ---------- Kiosk ---------- */
.kiosk { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 1fr) minmax(300px, 420px); }
@media (max-width: 860px) { .kiosk { grid-template-columns: 1fr; } }
.kiosk-main { background: linear-gradient(160deg, var(--navy), var(--navy-2)); color: #fff; padding: 32px 28px; display: flex; flex-direction: column; align-items: center; }
.brand { align-self: stretch; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600; letter-spacing: .3px; }
.brand .logo { display: flex; min-width: 0; gap: 12px; align-items: center; font-size: 18px; }
.tti-logo { display: block; width: auto; height: 44px; flex: 0 0 auto; }
.logo-label { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .brand .tti-logo { height: 34px; }
  .brand .logo { font-size: 15px; }
}
.brand a { color: #c9d6e6; font-size: 13px; text-decoration: none; }
.clock { font-size: clamp(56px, 10vw, 104px); font-weight: 300; margin: 28px 0 0; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.date { color: #c9d6e6; margin-bottom: 8px; font-size: 18px; }
.hours { color: #9fb3c9; font-size: 13px; margin-bottom: 22px; }
.pin-display { display: flex; gap: 12px; margin-bottom: 18px; height: 22px; }
.pin-display i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #9fb3c9; display: inline-block; }
.pin-display i.on { background: #fff; border-color: #fff; }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; }
.keypad button { height: 72px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 28px; transition: background .15s; }
.keypad button:hover { background: rgba(255,255,255,.2); }
.keypad button:active { background: rgba(255,255,255,.3); }
.keypad button.go { background: var(--accent); color: var(--navy); font-size: 17px; font-weight: 700; }
.keypad button.small { font-size: 16px; }
.hint { color: #9fb3c9; font-size: 14px; margin-top: 18px; text-align: center; }
.location-hint { color: #c9d6e6; font-size: 14px; margin: 2px 0 0; text-align: center; }
.location-hint a { display: block; margin-top: 6px; color: #fff; }
.location-hint a.hidden { display: none; }
.keypad button:disabled { opacity: .7; cursor: wait; }

.toast { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,25,45,.55); z-index: 20; }
.toast .box { background: #fff; border-radius: 20px; padding: 34px 38px; max-width: 440px; width: calc(100% - 40px); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.toast .icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 30px; color: #fff; }
.toast .icon.ok { background: var(--green); }
.toast .icon.warn { background: var(--amber); }
.toast .icon.err { background: var(--red); }
.toast h2 { margin: 0 0 6px; font-size: 22px; }
.toast p { margin: 0; color: var(--grey); }
.toast .actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; }

/* ---------- Pills & buttons ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.in { background: #e3f5ea; color: var(--green); }
.pill.out { background: #eceff3; color: var(--grey); }
.pill.notin { background: #fff3e0; color: var(--amber); }
.pill.leave { background: #e8eefc; color: #3a5bd9; }
.pill.late, .pill.early { background: #fde8e6; color: var(--red); }
.pill.ok { background: #e3f5ea; color: var(--green); }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--navy); color: #fff; font-weight: 600; }
.btn:hover { background: var(--navy-2); }
.btn.light { background: #eef1f5; color: var(--navy); }
.btn.accent { background: var(--accent); color: var(--navy); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

/* ---------- Admin ---------- */
.topbar { background: var(--navy); color: #fff; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar .logo { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.topbar .tti-logo { height: 34px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: transparent; border: 0; color: #c9d6e6; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.tabs button.active, .tabs button:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .me { font-size: 13px; color: #c9d6e6; display: flex; gap: 10px; align-items: center; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border-radius: var(--radius); padding: 20px 22px; box-shadow: 0 1px 2px rgba(16,32,55,.06); margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 19px; color: var(--navy); }
.card .muted { color: var(--grey); font-size: 13px; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(16,32,55,.06); }
.stat .n { font-size: 30px; font-weight: 700; color: var(--navy); }
.stat .l { font-size: 13px; color: var(--grey); }
.stat.red .n { color: var(--red); } .stat.amber .n { color: var(--amber); } .stat.green .n { color: var(--green); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--grey); padding: 10px 8px; border-bottom: 2px solid var(--line); }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fafbfd; }
.table-scroll { overflow-x: auto; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--grey); font-weight: 600; }
label.f input, label.f select, label.f textarea { border: 1px solid #cfd6df; border-radius: 9px; padding: 9px 11px; color: #1c2733; background: #fff; min-width: 140px; }
label.f input:focus, label.f select:focus { outline: 2px solid #9fc0e6; border-color: #6d97c9; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.attendance-alert-note { margin: 4px 0 0; }
.attendance-alerts:not(:empty) { margin-top: 14px; }
.attendance-alert { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg); min-width: 0; }
.attendance-alert h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; margin: 0 0 8px; }
.attendance-alert ul { list-style-type: none; margin: 0; padding: 0; font-size: 13px; }
.attendance-alert li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; overflow-wrap: anywhere; }
.attendance-alert li time { color: var(--grey); font-variant-numeric: tabular-nums; }
.msg { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-top: 12px; }
.msg.ok { background: #e3f5ea; color: #17663a; }
.msg.err { background: #fde8e6; color: #8f241d; }
.msg.warn { background: #fff3e0; color: #8a5300; }

.modal { position: fixed; inset: 0; background: rgba(10,25,45,.5); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 20px; }
.modal .box { background: #fff; border-radius: 16px; padding: 22px 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 14px; color: var(--navy); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--navy), var(--navy-2)); padding: 20px; }
.login .box { background: #fff; border-radius: 18px; padding: 30px; width: 100%; max-width: 400px; }
.login-brand { display: flex; justify-content: center; background: var(--navy); border-radius: 10px; padding: 12px; margin-bottom: 20px; }
.login-brand .tti-logo { height: 55px; max-width: 100%; object-fit: contain; }
.login h1 { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
.login form { display: grid; gap: 12px; margin-top: 18px; }
