/* Inno Patrol — web interface (light theme, D45). Colours D46/D47, font D48, icons D49. */
:root {
  --primary: #2A3990;
  --primary-hover: #223078;
  --primary-soft: #E8EAF6;
  --grey: #5F5F60;
  --text: #1C1D22;
  --muted: #6B6E78;
  --border: #E2E4EA;
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --success: #1E7D45;  --success-bg: #E5F4EB;
  --warning: #9A5B00;  --warning-bg: #FFF2DB;
  --danger: #B3261E;   --danger-bg: #FCE8E6;
  --info: #1F5BB5;     --info-bg: #E6EEFB;
  --sos: #C8102E;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 1px 8px rgba(20, 24, 40, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 600; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.icon {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 20px;
  line-height: 1; display: inline-block; vertical-align: middle; -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga"; white-space: nowrap; direction: ltr;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Layout -------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--primary); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 20px 8px; font-size: 20px; font-weight: 600; letter-spacing: .2px; }
.brand small { display: block; font-size: 13px; font-weight: 400; opacity: .75; margin-top: 2px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
  color: #fff; opacity: .85; padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; gap: 12px;
}
.nav a:hover { background: rgba(255,255,255,.1); opacity: 1; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.18); opacity: 1; font-weight: 500; }
.nav .section { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; opacity: .55; padding: 14px 12px 4px; }
.nav .count { margin-left: auto; background: #fff; color: var(--primary); border-radius: 999px; font-size: 12px; padding: 0 8px; font-weight: 600; }
.nav .count.sos { background: var(--sos); color: #fff; }
.sidebar .me { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.sidebar .me a { color: #fff; opacity: .8; }
.main { flex: 1; min-width: 0; padding: 24px 32px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Components ---------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 20px 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 2fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 4px; }
.stat.success .value { color: var(--success); } .stat.warning .value { color: var(--warning); }
.stat.danger .value { color: var(--danger); } .stat.info .value { color: var(--info); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #F0F1F5; text-decoration: none; }
.btn .icon { font-size: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #F1C6C2; }
.btn-sos { background: var(--sos); border-color: var(--sos); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-link { border: none; background: none; color: var(--primary); padding: 4px 6px; }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 500; background: #FAFBFD; }
tr:last-child td { border-bottom: none; }
tr.inactive td { opacity: .5; }
td.num, th.num { text-align: right; }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.empty .icon { font-size: 40px; display: block; margin-bottom: 8px; opacity: .6; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 6px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge .icon { font-size: 16px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #EEF0F4; color: var(--grey); }

.progress { height: 8px; background: #EEF0F4; border-radius: 999px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress.full > span { background: var(--success); }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }
.sos-banner { background: var(--sos); color: #fff; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sos-banner .icon { font-size: 32px; }
.sos-banner .grow { flex: 1; }
.sos-banner .btn { background: #fff; color: var(--sos); border-color: #fff; }

/* Forms ------------------------------------------------------------------- */
.form { max-width: 760px; }
.field { margin-bottom: 16px; }
.field label.title { display: block; font-weight: 500; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 13px; margin-top: 4px; }
.field .error { color: var(--danger); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time],
input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #CDD1DB; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.field ul label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; }
.days { display: flex; gap: 8px; flex-wrap: wrap; }
.days label { border: 1px solid #CDD1DB; border-radius: 8px; padding: 6px 12px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 16px 20px; border-top: 1px solid var(--border); background: #FAFBFD; }
.inline-form .field { margin: 0; min-width: 160px; flex: 1; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { width: auto; }

/* Login ------------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--primary) 0%, #1A2463 100%); padding: 16px; }
.login .card { width: 100%; max-width: 400px; padding: 32px; }
.login .logo { display: flex; align-items: center; gap: 10px; color: var(--primary); font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.login .logo .icon { font-size: 32px; }

/* Activation code ------------------------------------------------------------ */
.activation { text-align: center; max-width: 420px; margin: 0 auto; }
.activation svg { width: 280px; height: 280px; }
.activation .code { font-size: 28px; letter-spacing: 3px; font-weight: 600; margin: 8px 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: center; }
.timeline li:last-child { border-bottom: none; }
.timeline .time { font-variant-numeric: tabular-nums; color: var(--muted); width: 54px; flex-shrink: 0; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.checklist .icon.ok { color: var(--success); } .checklist .icon.no { color: #B8BCC7; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.props dt { color: var(--muted); } dl.props dd { margin: 0; }
.pagination { display: flex; gap: 8px; justify-content: center; padding: 16px; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .section { display: none; }
  .main { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
}

/* Photos of field reports */
img.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid #E2E4EA; vertical-align: middle; }

/* Map picker (site and checkpoint forms) */
.map-picker { height: 380px; border-radius: 12px; border: 1px solid #E2E4EA; margin: 4px 0 6px; z-index: 0; }
.map-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 640px) { .map-picker { height: 300px; } }

/* Live map */
#live-map { height: calc(100vh - 220px); min-height: 420px; }
.live-list { max-height: calc(100vh - 220px); min-height: 420px; overflow-y: auto; }
.live-row { display: block; padding: 12px 20px; border-top: 1px solid var(--border); color: inherit; }
.live-row:hover { background: #F6F7FB; text-decoration: none; }
.live-row .name { font-weight: 500; }
.live-row .progress { margin: 6px 0; }
.live-row .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.legend { font-size: 13px; color: var(--muted); gap: 6px 12px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #ccd; margin-right: -6px; }
.dot-agent { background: #1F3A93; } .dot-silent { background: #7F8C8D; } .dot-late { background: #E67E22; }
.dot-sos { background: #D7263D; } .dot-incident { background: #8E44AD; }
@media (max-width: 900px) { .grid-3.live { grid-template-columns: 1fr; } #live-map { height: 60vh; } }

/* Technical round answers */
.answer { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--success); margin-top: 4px; flex-wrap: wrap; }
.answer .icon { font-size: 16px; }
.answer strong { color: var(--text, inherit); }
.answer.problem { color: var(--danger); }
.answer img.thumb { width: 40px; height: 40px; }

/* Password fields: eye button to show / hide */
.pwd-wrap { position: relative; }
.pwd-wrap input { width: 100%; padding-right: 44px; }
.pwd-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; padding: 6px;
  background: none; border: 0; cursor: pointer; color: var(--muted); }
.pwd-eye:hover { color: var(--primary); }

/* ---------------------------------------------------------------------------
   Guided tour (static/web/tour.js)
   --------------------------------------------------------------------------- */
.tour-ring { position: fixed; z-index: 9000; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 4px var(--primary), 0 0 0 9999px rgba(16, 20, 48, .48);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; animation: tour-pulse 1.6s ease-out infinite; }
.tour-ring.none { inset: 0; width: auto !important; height: auto !important; border-radius: 0; animation: none;
  box-shadow: none; background: rgba(16, 20, 48, .48); }
@keyframes tour-pulse {
  0% { box-shadow: 0 0 0 4px var(--primary), 0 0 0 4px rgba(42, 57, 144, .55), 0 0 0 9999px rgba(16, 20, 48, .48); }
  70% { box-shadow: 0 0 0 4px var(--primary), 0 0 0 18px rgba(42, 57, 144, 0), 0 0 0 9999px rgba(16, 20, 48, .48); }
  100% { box-shadow: 0 0 0 4px var(--primary), 0 0 0 4px rgba(42, 57, 144, 0), 0 0 0 9999px rgba(16, 20, 48, .48); }
}
.tour-bubble { position: fixed; z-index: 9001; width: min(360px, calc(100vw - 24px)); background: var(--surface);
  border-radius: 14px; padding: 16px 18px 14px; box-shadow: 0 18px 50px rgba(16, 20, 48, .35);
  opacity: 0; transform: translateY(8px) scale(.97); transition: opacity .25s ease, transform .25s ease, top .25s ease, left .25s ease; }
.tour-bubble.in { opacity: 1; transform: none; }
.tour-bubble::before { content: ""; position: absolute; left: var(--arrow-x, 50%); width: 14px; height: 14px;
  background: var(--surface); transform: translateX(-50%) rotate(45deg); }
.tour-bubble[data-side="below"]::before { top: -7px; }
.tour-bubble[data-side="above"]::before { bottom: -7px; }
.tour-bubble[data-side="none"]::before { display: none; }
.tour-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.tour-step { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); }
.tour-x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px; display: flex; }
.tour-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.tour-why { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.tour-text { font-size: 15px; }
.tour-hint { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 500; }
.tour-hint .icon { font-size: 18px; animation: tour-tap 1.2s ease-in-out infinite; }
@keyframes tour-tap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.tour-progress { height: 4px; background: var(--primary-soft); border-radius: 4px; margin: 12px 0 10px; overflow: hidden; }
.tour-progress span, .tour-pill .bar span { display: block; height: 100%; background: var(--primary); border-radius: 4px;
  transition: width .6s ease; }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-foot .tour-pause { margin-right: auto; padding-left: 0; font-size: 13px; color: var(--muted); }
.tour-dots { font-size: 12px; color: var(--muted); }

.tour-modal-back { position: fixed; inset: 0; z-index: 9002; background: rgba(16, 20, 48, .55); display: grid;
  place-items: center; padding: 16px; animation: tour-fade .25s ease; }
.tour-modal { background: var(--surface); border-radius: 16px; width: min(480px, 100%); padding: 26px 26px 20px;
  box-shadow: 0 24px 60px rgba(16, 20, 48, .4); animation: tour-pop .35s cubic-bezier(.2, .9, .3, 1.2); }
.tour-modal h2 { margin: 6px 0 6px; font-size: 21px; }
.tour-modal p { color: var(--muted); margin: 0 0 12px; }
.tour-hero .icon { font-size: 44px; color: var(--primary); animation: tour-wave 1.4s ease-in-out 2; display: inline-block; }
.tour-list { list-style: none; padding: 0; margin: 0 0 6px; columns: 2; column-gap: 18px; font-size: 14px; }
.tour-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; break-inside: avoid; }
.tour-list .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 600; }
.tour-list li.done { color: var(--muted); text-decoration: line-through; }
.tour-list li.done .n { background: var(--success-bg); color: var(--success); }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.tour-pill { position: fixed; right: 18px; bottom: 18px; z-index: 8999; display: flex; align-items: center; gap: 8px;
  border: 0; cursor: pointer; background: var(--primary); color: #fff; padding: 10px 16px 14px; border-radius: 999px;
  font: inherit; font-size: 14px; box-shadow: 0 8px 24px rgba(42, 57, 144, .4); animation: tour-pop .35s ease; }
.tour-pill:hover { background: var(--primary-hover); }
.tour-pill .bar { position: absolute; left: 16px; right: 16px; bottom: 6px; height: 3px; background: rgba(255, 255, 255, .25);
  border-radius: 3px; overflow: hidden; }
.tour-pill .bar span { background: #fff; }

.tour-toast { position: fixed; left: 50%; top: 18px; z-index: 9003; transform: translateX(-50%); display: flex;
  align-items: center; gap: 8px; background: var(--success); color: #fff; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(30, 125, 69, .35); animation: tour-drop .45s cubic-bezier(.2, .9, .3, 1.3); }
.tour-toast.out { opacity: 0; transform: translate(-50%, -20px); transition: all .5s ease; }

@keyframes tour-fade { from { opacity: 0; } }
@keyframes tour-pop { from { opacity: 0; transform: scale(.9); } }
@keyframes tour-drop { from { opacity: 0; transform: translate(-50%, -30px); } }
@keyframes tour-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(18deg); } 75% { transform: rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) {
  .tour-ring, .tour-bubble, .tour-modal, .tour-pill, .tour-toast, .tour-hero .icon { animation: none !important; transition: none !important; }
}
@media (max-width: 560px) { .tour-list { columns: 1; } }

.btn.disabled { opacity: .6; pointer-events: none; }
