/* ===========================================================================
   THEME — change these variables to re-skin the whole app.
   Current theme: black & dark gold.
   =========================================================================== */
:root {
  --gold: #bd9a4e;          /* antique gold — matches Pride Promotions brand */
  --gold-soft: #dcbe78;     /* lighter gold for hovers/highlights */
  --gold-deep: #7f6329;     /* deeper bronze-gold */

  --bg: #0c0c0e;            /* app background (near-black) */
  --card: #16161a;         /* card surface */
  --card-2: #1e1e24;       /* slightly raised surface (inputs, chips) */
  --ink: #f4f1e9;          /* primary text (warm off-white) */
  --muted: #9b9689;        /* secondary text */
  --line: #2b2b31;         /* borders / dividers */

  --in: var(--gold);        /* check-in / primary action */
  --out: #b9822f;          /* check-out (bronze-amber) */
  --danger: #e05656;
  --success: var(--gold);

  --radius: 14px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---- layout ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: #000;
  border-bottom: 1px solid var(--gold-deep);
  color: var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; }
.brand-name { color: var(--gold); }
/* White "plate" so a dark logo stays visible on the black theme. */
.logo { height: 30px; width: auto; display: block; background: #fff; border-radius: 6px; padding: 3px 6px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.main { padding: 16px; max-width: 720px; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 14px; }
.view.center { min-height: 70vh; justify-content: center; align-items: center; }

/* ---- cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px;
}
.card h1 { margin: 0 0 6px; font-size: 22px; color: var(--gold); }
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--gold-soft); }
.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.login-logo { max-height: 120px; width: auto; align-self: center; margin-bottom: 8px; background: #fff; border-radius: 14px; padding: 14px 18px; }

/* ---- inputs / buttons ---- */
.input, textarea.qtext, select.input {
  width: 100%; padding: 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-2); color: var(--ink);
}
.input::placeholder, textarea::placeholder { color: #7a766c; }
.input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
select.input option { background: var(--card-2); color: var(--ink); }
.lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.fieldrow { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form { display: flex; flex-direction: column; }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 15px; }

.btn {
  appearance: none; border: none; cursor: pointer;
  padding: 12px 16px; font-size: 16px; font-weight: 700; border-radius: 10px;
  color: #12100a; background: var(--gold);
}
.btn:hover { background: var(--gold-soft); }
.btn:disabled { opacity: .55; }
.btn--big { width: 100%; padding: 18px; font-size: 18px; margin-top: 8px; }
.btn--in { background: var(--gold); color: #12100a; }
.btn--in:hover { background: var(--gold-soft); }
.btn--out { background: var(--out); color: #140f06; }
.btn--out:hover { filter: brightness(1.1); }
.btn--photo { background: transparent; color: var(--gold); border: 1px solid var(--gold-deep); }
.btn--photo:hover { background: rgba(201, 162, 39, 0.12); }

.link { background: none; border: none; color: var(--gold); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }
.link-danger { background: none; border: none; color: var(--danger); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }

/* ---- key/value ---- */
.kv { display: flex; flex-direction: column; gap: 6px; }
.kv-row { display: flex; gap: 8px; font-size: 14px; }
.kv-k { color: var(--muted); min-width: 78px; }
.kv-v { color: var(--ink); }
.kv-v a, .kv a, .side a { color: var(--gold-soft); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--gold-soft); font-weight: 600; }
.error { color: var(--danger); }

/* ---- history ---- */
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: none; }
.h-site { font-weight: 600; }
.h-times { font-size: 13px; color: var(--muted); }
.sep { opacity: .5; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tab {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer;
}
.tab.active { background: var(--gold); color: #12100a; border-color: var(--gold); }
.tab-body { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.filters { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.results { display: flex; flex-direction: column; gap: 14px; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.line:last-child { border-bottom: none; }

/* ---- comparison ---- */
.compare-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { margin-left: auto; background: rgba(201,162,39,.15); color: var(--gold-soft); border: 1px solid var(--gold-deep); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side h4 { margin: 0 0 8px; font-size: 14px; color: var(--gold-soft); }
.side h5 { margin: 12px 0 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.shot { background: #000; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 90px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.shot img { width: 100%; display: block; }
.answers { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.answers li { padding: 3px 0; }
.a-q { color: var(--muted); }
.a-v { font-weight: 600; }

/* ---- question form ---- */
.qform { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.qfield { display: flex; flex-direction: column; gap: 8px; }
.qlabel { font-weight: 600; font-size: 15px; }
.req { color: var(--danger); }
.yesno { display: flex; gap: 8px; }
.yesno input { display: none; }
.chip { padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); background: var(--card-2); }
.yesno input:checked + .chip { background: var(--gold); color: #12100a; border-color: var(--gold); }

/* ---- modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .7);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal {
  background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
@media (min-width: 620px) { .modal-overlay { align-items: center; } .modal { border-radius: 18px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; color: var(--gold); }
.x { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.geo-ok { background: rgba(201,162,39,.12); color: var(--gold-soft); border: 1px solid var(--gold-deep); padding: 8px 12px; border-radius: 10px; font-size: 14px; margin: 0; }
.photo-preview { width: 100%; border-radius: 12px; }
.hidden { display: none; }

/* ---- live camera ---- */
.cam-overlay {
  position: fixed; inset: 0; z-index: 400; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cam-overlay video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.cam-hint {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 999px; font-size: 13px; margin: 0; z-index: 1;
}
.cam-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
}
.cam-bar > span { width: 64px; } /* spacer to keep shutter centered */
.cam-cancel { width: 64px; background: none; border: none; color: #fff; font-size: 15px; cursor: pointer; }
.cam-shutter {
  width: 72px; height: 72px; border-radius: 50%; cursor: pointer;
  background: var(--gold); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--gold-deep);
}
.cam-shutter:active { transform: scale(.94); }

/* ---- copyable credentials ---- */
.cred-box { border-color: var(--gold-deep); }
.cred-pre { white-space: pre-wrap; word-break: break-word; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; color: var(--ink); margin: 8px 0 12px; }

/* ---- view switch (admin/staff) ---- */
.view-switch { display: flex; gap: 8px; margin-bottom: 8px; }
.view-switch button { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.view-switch button.active { background: var(--gold); color: #12100a; border-color: var(--gold); }

/* ---- staff multi-picker ---- */
.staff-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card-2); }
.staff-check { display: flex; align-items: center; gap: 6px; font-size: 14px; }
@media (max-width: 480px) { .staff-picker { grid-template-columns: 1fr; } }

/* ---- incident ---- */
.card.has-incident { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset, var(--shadow); }
tr.row-incident td { background: rgba(220,80,80,.08); }

/* ---- report table ---- */
.report-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.report { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.report th, table.report td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.report th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--card); }
table.report tr:hover td { background: rgba(201,162,39,.05); }
table.report input.rph-hours { width: 92px; padding: 6px 8px; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid var(--line); }
.tag--ok { color: var(--gold-soft); border-color: var(--gold-deep); background: rgba(201,162,39,.12); }
.tag--late { color: #e8b04b; border-color: #7a5f26; background: rgba(232,176,75,.12); }
.tag--miss { color: #e58b8b; border-color: #7a2e2e; background: rgba(220,80,80,.12); }
.tag--extra { color: #a9b0bd; border-color: #3a3a42; background: rgba(160,170,190,.10); }
.detail-row td { background: var(--card-2); }
.answer-detail { display: flex; flex-direction: column; gap: 3px; font-size: 12px; white-space: normal; padding: 4px 2px; }
.report-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.report-nav strong { text-align: center; flex: 1; }
.report-summary { margin-top: 8px; }
.report-summary .line { font-size: 13px; }

/* ---- demo hint ---- */
.demo-hint { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.demo-hint p { margin: 0; }
.demo-chip { text-align: left; background: var(--card-2); border: 1px solid var(--gold-deep); color: var(--gold); padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.demo-chip:hover { background: rgba(201,162,39,.14); }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120%);
  background: #000; color: var(--ink); border: 1px solid var(--gold-deep);
  padding: 12px 18px; border-radius: 10px;
  font-size: 14px; max-width: 90%; box-shadow: var(--shadow);
  transition: transform .25s ease; z-index: 200; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast--error { background: #2a1212; border-color: var(--danger); color: #f3b6b6; }
.toast--success { background: #1e1a0d; border-color: var(--gold); color: var(--gold-soft); }
