@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap");

:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4B2FB6;
  --brand-dark: #3A2391;
  --good: #16a34a;
  --good-bg: #dcfce7;
  --bad: #dc2626;
  --bad-bg: #fee2e2;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(2, 8, 23, 0.12);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #f1f5f9, #e2e8f0);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 18px; }
.wrap.wide { max-width: 1100px; }

.brandbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; color: #fff;
  background: linear-gradient(120deg, #3A2391, #4B2FB6);
}
/* White chip so the Finmile logo (any colour version) always shows clearly */
.brand-chip {
  background: #fff; border-radius: 9px; padding: 5px 10px;
  display: inline-flex; align-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.brand-chip img.brand-logo { height: 22px; width: auto; display: block; }
.brand-chip .wm {
  font-family: "Fredoka", system-ui, sans-serif; font-weight: 700; font-size: 20px;
  color: var(--brand); line-height: 1; letter-spacing: .2px;
}
.brand-tag { font-size: 13.5px; color: #fff; font-weight: 500; opacity: .92; }

.bell {
  position: relative; background: #ffffff22; border: 1px solid #ffffff44; color: #fff;
  width: auto; padding: 7px 11px; border-radius: 9px; cursor: pointer; font-size: 15px; margin: 0;
}
.bell:hover { background: #ffffff33; }
.badge {
  position: absolute; top: -7px; right: -7px; background: #ef4444; color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center;
  box-shadow: 0 0 0 2px #4B2FB6;
}
.brandbar .spacer { flex: 1; }
.brandbar a, .brandbar button {
  color: #fff; background: #ffffff22; border: 1px solid #ffffff33;
  padding: 7px 12px; border-radius: 9px; font-size: 13px; cursor: pointer; text-decoration: none;
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin: 16px 0;
}
.card h2 { margin: 0 0 4px; font-size: 19px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 12px 13px; font-size: 16px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 11px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; font-size: 16px; font-weight: 650;
  border: none; border-radius: 12px; cursor: pointer; margin-top: 14px;
  background: var(--brand); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #eef2ff; color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn.small { width: auto; padding: 9px 14px; font-size: 14px; margin: 0; }

.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps .dot { flex: 1; height: 6px; border-radius: 4px; background: var(--line); }
.steps .dot.done { background: var(--good); }
.steps .dot.active { background: var(--brand); }

.example {
  border: 1.5px dashed #cbd5e1; border-radius: 12px; background: #f8fafc;
  padding: 12px; margin: 6px 0 14px; text-align: center;
}
.example svg { width: 100%; max-width: 320px; height: auto; }
.example .cap { font-size: 12px; color: var(--muted); margin-top: 6px; }

.do-dont { display: flex; gap: 10px; margin: 10px 0 4px; }
.do-dont > div { flex: 1; border-radius: 10px; padding: 8px; font-size: 12px; }
.do-dont .do { background: var(--good-bg); color: #166534; }
.do-dont .dont { background: var(--bad-bg); color: #991b1b; }

.preview { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; margin: 10px 0; }

/* Sticky capture action bar — keeps Take/Use/Retake always on screen */
.action-bar {
  position: -webkit-sticky; position: sticky; bottom: 0; z-index: 5;
  margin: 8px -20px -20px; padding: 12px 20px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 35%);
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
}
.action-bar .btn { margin-top: 0; }
.action-bar .btn + .btn { margin-top: 8px; }

.banner { border-radius: 11px; padding: 12px 14px; font-size: 14px; margin: 10px 0; }
.banner.good { background: var(--good-bg); color: #166534; }
.banner.bad { background: var(--bad-bg); color: #991b1b; }
.banner.warn { background: var(--warn-bg); color: #92400e; }
.banner.info { background: #e0f2fe; color: #075985; }

.hidden { display: none !important; }
.center { text-align: center; }
.spin { width: 22px; height: 22px; border: 3px solid #cbd5e1; border-top-color: var(--brand); border-radius: 50%; animation: sp 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }

.tile {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; margin: 10px 0; cursor: pointer;
}
.tile:hover { border-color: var(--brand); }
.tile.sel { border-color: var(--brand); background: #f5f3ff; }
.tile .ic { font-size: 26px; }
.tile b { display: block; font-size: 16px; }
.tile span { font-size: 13px; color: var(--muted); }

/* Dashboard */
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tabs button { width: auto; background: #fff; border: 1.5px solid var(--line); color: #334155; padding: 9px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs button.user-hidden { display: none; }
.tabs button.tab-tool { padding: 9px 12px; }

.row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi .n { font-size: 26px; font-weight: 700; }
.kpi .l { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 11px 12px; font-size: 14px; border-bottom: 1px solid var(--line); }
th { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr { cursor: pointer; }
tr:hover td { background: #f8fafc; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.flagged { background: var(--bad-bg); color: #991b1b; }
.pill.reviewed { background: var(--good-bg); color: #166534; }
.pill.submitted { background: #e0f2fe; color: #075985; }
.pill.start { background: #ede9fe; color: #5b21b6; }
.pill.end { background: #ffedd5; color: #9a3412; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.photowrap { position: relative; display: block; }
.dmgbox { position: absolute; border: 2px solid #ef4444; border-radius: 4px; box-shadow: 0 0 0 1px #fff; pointer-events: none; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

.modal-bg { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; padding: 20px; }
.lightbox { z-index: 60; }
.lightbox img { max-width: 86vw; max-height: 88vh; border-radius: 10px; }
.lb-nav {
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: #ffffffcc; color: #0f172a; font-size: 30px; line-height: 1; flex: 0 0 auto;
  display: grid; place-items: center; margin: 0 10px;
}
.lb-nav:hover { background: #fff; }
.lb-close {
  position: fixed; top: 16px; right: 18px; width: 40px; height: 40px; border-radius: 50%;
  border: none; cursor: pointer; background: #ffffffcc; color: #0f172a; font-size: 18px;
}
.lb-count {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #0f172acc; color: #fff; padding: 5px 14px; border-radius: 999px; font-size: 14px;
}

.muted-link { color: var(--brand); cursor: pointer; text-decoration: underline; font-size: 13px; }

/* Print / Save-as-PDF: show only the open check report */
@media print {
  body * { visibility: hidden; }
  #modal-root, #modal-root * { visibility: visible; }
  #modal-root { position: absolute; inset: 0; }
  .modal-bg { background: #fff !important; display: block !important; padding: 0 !important; }
  .modal { box-shadow: none !important; max-width: 100% !important; max-height: none !important; overflow: visible !important; }
  .no-print { display: none !important; }
  .gallery { grid-template-columns: repeat(2, 1fr) !important; }
  .gallery img { cursor: default; }
  figure { break-inside: avoid; }
}
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 80;
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; text-align: center;
}
.toast.good { background: var(--good); }
.toast.bad { background: var(--bad); }

.queue-badge {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 40;
  background: #1e293b; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
