:root {
  --navy: #1f3864;
  --accent: #2e75b6;
  --light: #deeaf6;
  --grey: #595959;
  --red: #c00000;
  --green: #1e6b3a;
  --amber: #b8860b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Calibri, Arial, sans-serif;
  margin: 0;
  background: #f4f6f9;
  color: #1a1a1a;
}
[data-theme="dark"] body { background: #14181f; color: #eaeaea; }

.container { max-width: 960px; margin: 0 auto; padding: 24px; }
.container-wide { max-width: 1280px; margin: 0 auto; padding: 24px; }

.topbar {
  background: var(--navy); color: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar nav a { margin-left: 18px; opacity: .9; font-size: 14px; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }

.card {
  background: #fff; border-radius: var(--radius); padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px;
}
[data-theme="dark"] .card { background: #1c212b; }

h1, h2, h3 { color: var(--navy); margin-top: 0; }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: #9fc2e8; }

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; }
input[type=text], input[type=email], input[type=tel], input[type=password], select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 16px; font-family: inherit;
}
.btn {
  display: inline-block; padding: 13px 22px; border-radius: 8px; border: none;
  font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #235d92; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn-lg { width: 100%; padding: 18px; font-size: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecea; color: var(--red); border: 1px solid #f5c6cb; }
.alert-success { background: #e8f5e9; color: var(--green); border: 1px solid #c3e6cb; }
.alert-info { background: var(--light); color: var(--navy); border: 1px solid #b7d3ee; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-pending { background: #fff3cd; color: #8a6d00; }
.badge-ground { background: var(--light); color: var(--navy); }
.badge-floor { background: #e0f2f1; color: #00695c; }
.badge-out { background: #eceff1; color: #455a64; }

/* Round 4.5.2 — reception queue wait-time flag: 0-10 min green, 10-30 orange, 30+ red. */
.wait-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-left: 6px; }
.wait-green { background: #e5f4ec; color: #1f7a4d; }
.wait-orange { background: #fdecd2; color: #a15c00; }
.wait-red { background: #fce8e7; color: #b83430; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.visitor-card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.1); border-left: 6px solid #ccc; }
.visitor-card.status-pending { border-left-color: #f0ad4e; }
.visitor-card.status-ground_checked_in { border-left-color: var(--accent); }
.visitor-card.status-floor_checked_in { border-left-color: #00897b; }
.visitor-card.status-checked_out { border-left-color: #90a4ae; }
.visitor-card img.photo { width: 100%; height: 160px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; background: #eee; }
.visitor-card h3 { margin: 0 0 4px; font-size: 17px; }
.visitor-card .meta { font-size: 13px; color: var(--grey); margin: 2px 0; }

.step-indicator { display: flex; gap: 8px; margin-bottom: 24px; }
.step-indicator span { flex: 1; height: 6px; border-radius: 3px; background: #ddd; }
.step-indicator span.active { background: var(--accent); }
.step-indicator span.done { background: var(--green); }

.center { text-align: center; }
.muted { color: var(--grey); font-size: 14px; }
.qr-box { background: #fff; padding: 16px; border-radius: 12px; display: inline-block; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { text-align: left; padding: 10px; border-bottom: 1px solid #eee; }
table.simple th { color: var(--grey); font-size: 13px; text-transform: uppercase; }

.kiosk-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; text-align: center; }
.kiosk-wrap .qr-box { padding: 24px; }
.kiosk-wrap h1 { color: #fff; font-size: 32px; }

/* Round 4.4, item 21 — searchable employee picker (assets/js/employee_picker.js),
   replacing a long native <select> everywhere a host/employee is chosen. */
.emp-picker { position: relative; }
.emp-picker-row { position: relative; display: flex; align-items: center; }
.emp-picker-input {
  width: 100%; padding: 12px 40px 12px 14px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 16px; font-family: inherit; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat right 12px center / 18px 18px;
}
.emp-picker-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
[data-theme="dark"] .emp-picker-input { background-color: #232935; border-color: #3a4252; color: #eaeaea; }
.emp-picker-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: none; background: transparent; color: var(--grey);
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: 50%;
}
.emp-picker-clear:hover { background: #eee; color: #1a1a1a; }
[data-theme="dark"] .emp-picker-clear:hover { background: #2a313d; color: #eaeaea; }
.emp-picker-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid #ccc;
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
[data-theme="dark"] .emp-picker-menu { background: #1c212b; border-color: #3a4252; }
.emp-picker-option { padding: 9px 14px; cursor: pointer; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.emp-picker-option .emp-picker-name { font-size: 14.5px; color: #1a1a1a; }
[data-theme="dark"] .emp-picker-option .emp-picker-name { color: #eaeaea; }
.emp-picker-option .emp-picker-sub { font-size: 12.5px; color: var(--grey); white-space: nowrap; }
.emp-picker-option:hover, .emp-picker-option.active { background: var(--light); }
[data-theme="dark"] .emp-picker-option:hover, [data-theme="dark"] .emp-picker-option.active { background: #26364a; }
.emp-picker-empty, .emp-picker-more { padding: 10px 14px; font-size: 13px; color: var(--grey); }
.kiosk-wrap p { font-size: 18px; opacity: .85; }

/* Round 4.10.4 — keep the top menu in view while scrolling long pages
   (wide screens only; on phones the menu wraps and would take too much room). */
@media (min-width: 861px) {
  .topbar { position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
}
/* Round 4.10.4 — "Saved" / error message pop-up after a save further down the page. */
.vp-toast-wrap { position: fixed; top: 64px; right: 16px; z-index: 60; max-width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; }
.vp-toast { margin: 0 !important; box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: pointer; animation: vpToastIn .2s ease-out; }
@keyframes vpToastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 5.0.6 — "This number is on WhatsApp" tick: a clear green box, never pre-ticked.
   Lives here because app.css loads on the visitor form and walk-in form in both looks;
   the #id keeps it ahead of the new look's generic checkbox rules. */
label.wa-optin { display: flex !important; align-items: center; gap: 10px; margin: 8px 0 4px !important; padding: 10px 12px; border: 1.5px solid #1e9e4a; border-radius: 8px; background: #effaf2; color: #14532d; font-weight: 600 !important; font-size: 13.5px !important; line-height: 1.35; cursor: pointer; }
label.wa-optin input#mobile_is_whatsapp { -webkit-appearance: none; appearance: none; flex: none; width: 24px !important; height: 24px !important; margin: 0 !important; padding: 0; border: 2.5px solid #1e9e4a; border-radius: 5px; background: #fff; cursor: pointer; display: grid; place-content: center; box-shadow: none; }
label.wa-optin input#mobile_is_whatsapp::before { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
label.wa-optin input#mobile_is_whatsapp:checked { background: #1e9e4a; }
label.wa-optin input#mobile_is_whatsapp:checked::before { opacity: 1; }
label.wa-optin input#mobile_is_whatsapp:focus-visible { outline: 3px solid rgba(30,158,74,.4); outline-offset: 2px; }
label.wa-optin .wa-optin-note { display: block; font-weight: normal; font-size: 12.5px; opacity: .85; }
[data-theme="dark"] label.wa-optin { background: rgba(37,211,102,.10); border-color: #2fbf63; color: #c9f5d6; }
[data-theme="dark"] label.wa-optin input#mobile_is_whatsapp { background: #11161d; border-color: #2fbf63; }
[data-theme="dark"] label.wa-optin input#mobile_is_whatsapp:checked { background: #2fbf63; }
/* 5.0.7 — generic green message icon between the box and the text (not the WhatsApp logo). */
label.wa-optin svg.wa-optin-icon { flex: none; width: 26px; height: 26px; color: #1e9e4a; }
[data-theme="dark"] label.wa-optin svg.wa-optin-icon { color: #2fbf63; }

/* ---------- 5.0.8 — visitor form helpers (both looks) ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.step-label { margin: 0 4px 6px; font-size: 13px; font-weight: 700; color: var(--grey, #5A6474); }
.lbl-note { font-weight: 500; }
.notice-fold.is-folded { max-height: 11.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.notice-more { display: inline-block; margin: -4px 0 12px; padding: 6px 0; background: none; border: 0; font: inherit; font-weight: 700; font-size: 14px; color: var(--brand-text, #0B5394); text-decoration: underline; cursor: pointer; }
.notice-more[hidden] { display: none; }
.tick-hint { margin: 8px 0 0; text-align: center; font-size: 14px; }
.tick-hint[hidden] { display: none; }
input.field-error, select.field-error, textarea.field-error { border: 2px solid #B42318 !important; background-color: #FFF8F7 !important; }
.field-msg { margin: 6px 0 0; color: #B42318; font-size: 13.5px; font-weight: 700; }
.resend-link { font-weight: 700; }
.vno, .visitor-no { white-space: nowrap; font-variant-numeric: tabular-nums; }
#bulkBar[hidden] { display: none !important; }
table.report-table td { white-space: nowrap; }
table.report-table td.vno { font-variant-numeric: tabular-nums; }
/* 5.0.8 — on phones, tables marked stack-sm become one small card per row (label on the left, value on the right) */
@media (max-width: 640px) {
  table.stack-sm, table.stack-sm tbody { display: block !important; width: 100%; overflow: visible !important; }
  table.stack-sm tr:first-child { display: none; }
  table.stack-sm tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border, #D9DEE5); }
  table.stack-sm td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0 !important; border: 0 !important; text-align: right; }
  table.stack-sm td::before { content: attr(data-label); font-weight: 600; color: var(--grey, #5A6474); text-align: left; flex-shrink: 0; }
  table.stack-sm td:not([data-label]) { justify-content: flex-end; }
  table.stack-sm td:not([data-label])::before { content: none; }
}
.btn-warn-outline { color: #B42318 !important; border-color: #E8B4AE !important; }
/* 5.0.8 — long code words (e.g. {{developer_credit_html}}) wrap instead of pushing the page sideways on phones */
code, .mono { overflow-wrap: anywhere; word-break: break-word; }

/* 5.0.8: wide admin tables scroll inside their card on phones */
.table-scroll{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}

/* 5.0.9 — code box hint fits on a phone in the classic look too */
#otp_code::placeholder { letter-spacing: normal; font-size: 16px; }
