/* 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-inline-start: 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-primary:disabled { background: #B8BCC7; border-color: #B8BCC7; color: #fff; cursor: not-allowed; }
.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: start; 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: end; }
.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; }
.slot-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.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 { --auth-width: 420px; min-height: 100vh; display: grid; align-items: start; background: var(--surface);
  grid-template-columns: minmax(0, calc(var(--auth-width) + 2 * clamp(24px, 5vw, 64px))) minmax(240px, 1fr); }
/* Left: the form on a white panel; each child keeps a readable width (--auth-width, wider on the signup page) */
.login > .card { margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 5vw, 64px); }
.login > .card > * { width: 100%; max-width: var(--auth-width); margin-left: auto; margin-right: auto; }
.login > .card > [hidden] { display: none; }
.login .logo { display: flex; align-items: center; gap: 10px; color: var(--primary); font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.login .logo .icon { font-size: 34px; }
.login input:not([type=checkbox]):not([type=radio]) { min-height: 46px; }
/* Right: patrol photo, blue tint from the form side, caption at the bottom */
.login-photo { position: sticky; top: 0; height: 100vh; overflow: hidden; background: #1A2463 url("img/auth_bg.jpg") 50% 35% / cover no-repeat;
  background-image: image-set(url("img/auth_bg.webp") type("image/webp"), url("img/auth_bg.jpg") type("image/jpeg")); }
.login-photo::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(42, 57, 144, .55) 0%, rgba(42, 57, 144, .12) 38%, rgba(14, 18, 38, 0) 60%),
              linear-gradient(0deg, rgba(14, 18, 38, .78) 0%, rgba(14, 18, 38, 0) 45%); }
.login-caption { position: absolute; left: clamp(24px, 4vw, 56px); right: clamp(24px, 4vw, 56px); bottom: clamp(24px, 6vh, 56px); max-width: 520px; color: #fff; }
.login-caption-title { font-size: clamp(24px, 2.4vw, 34px); line-height: 1.15; font-weight: 600; margin-bottom: 10px; }
.login-caption p { margin: 0; color: rgba(255, 255, 255, .86); font-size: 16px; }
.login-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.login-chips span { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-photo { position: relative; order: -1; height: 200px; background-position: 60% 30%;
    background-image: image-set(url("img/auth_bg_small.webp") type("image/webp"), url("img/auth_bg_small.jpg") type("image/jpeg")); }
  .login-caption { bottom: 16px; }
  .login-caption-title { font-size: 21px; margin: 0; }
  .login-caption p, .login-chips { display: none; }
  .login > .card { min-height: 0; justify-content: flex-start; padding: 28px 20px 40px; }
}

/* 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; } }
/* Forms with a map (site, point): fields on the left, map on the right when there is room */
@media (min-width: 1100px) {
  .card.form-map { max-width: 1240px; }
  form.with-map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 28px; align-items: start; }
  form.with-map > * { grid-column: 1; }
  form.with-map > .map-box { grid-column: 2; grid-row: 1 / span 40; position: sticky; top: 16px; }
  form.with-map .map-picker { height: 460px; }
}

/* 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-inline-end: 44px; }
.pwd-eye { position: absolute; inset-inline-end: 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-links { margin-right: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tour-links .btn-link { padding: 0; font-size: 13px; color: var(--muted); }
.tour-links .tour-skip { color: var(--primary); }
.tour-done { font-size: 12px; font-weight: 600; color: var(--success); margin-left: 4px; }
.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; }

/* Signup: plan cards */
.plans { border: 0; padding: 0; margin: 0 0 18px; }
.plans legend { margin-bottom: 8px; }
.plan { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.plan:hover { border-color: var(--primary); }
.plan:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.plan input { margin-top: 4px; accent-color: var(--primary); }
.plan-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.plan-head { display: flex; align-items: center; gap: 8px; }
.plan-price { margin-inline-start: auto; font-weight: 600; color: var(--primary); white-space: nowrap; }
.plan-price small { font-weight: 400; color: var(--muted); }
.plan-badge { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #fff;
  background: var(--primary); border-radius: 999px; padding: 2px 8px; }
.plan-for, .plan-limits, .plan-features { font-size: 13px; color: var(--muted); }
.plan-limits { color: var(--text); }

/* SOS alarm bar (static/web/sos_alarm.js), above everything */
.sos-alarm { position: fixed; left: 0; right: 0; top: 0; z-index: 9500; display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--sos, #C8102E); color: #fff; box-shadow: 0 6px 20px rgba(200, 16, 46, .45);
  animation: sos-pulse 1s ease-in-out infinite alternate; }
.sos-alarm .grow { flex: 1; }
.sos-alarm .icon { font-size: 26px; }
.sos-alarm .btn { background: #fff; color: #C8102E; border-color: #fff; font-weight: 600; }
@keyframes sos-pulse { from { background: #C8102E; } to { background: #9E0B23; } }
@media (prefers-reduced-motion: reduce) { .sos-alarm { animation: none; } }

/* Languages (D68): links at the top of the public pages and in the side menu; Arabic is right to left */
.lang-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 12px; font-size: 14px; margin-bottom: 20px; }
.lang-switch .icon { font-size: 18px; color: var(--muted, #5F5F60); }
.lang-switch a { color: var(--muted, #5F5F60); text-decoration: none; }
.lang-switch a:hover { color: var(--primary); text-decoration: underline; }
.lang-switch strong { color: var(--primary); font-weight: 600; }
.sidebar .lang-switch { justify-content: flex-start; margin: 12px 0 0; font-size: 13px; }
.sidebar .lang-switch .icon, .sidebar .lang-switch a { color: rgba(255, 255, 255, .75); }
.sidebar .lang-switch strong { color: #fff; }
.accent { color: var(--primary); font-weight: 600; }
[dir=rtl] .flip-rtl { transform: scaleX(-1); display: inline-block; }
[dir=rtl] .login-photo::before {
  background: linear-gradient(270deg, rgba(42, 57, 144, .55) 0%, rgba(42, 57, 144, .12) 38%, rgba(14, 18, 38, 0) 60%),
              linear-gradient(0deg, rgba(14, 18, 38, .78) 0%, rgba(14, 18, 38, 0) 45%); }

/* Above the new point form: points left for the guided tour and for the plan */
.counters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; max-width: 1240px; }
.counter { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: #fff;
  border: 1px solid var(--border); min-width: 240px; flex: 1 1 240px; }
.counter .icon { font-size: 26px; color: var(--primary); }
.counter strong { font-size: 16px; }
.counter .small { color: var(--muted); }
.counter-tour { background: #E3E7FA; border-color: #C5CDF2; }
.counter-full { background: #FDECEA; border-color: #F5C2BD; }
.counter-full .icon { color: #B3261E; }

/* Messages (D70): conversations on the left, the open conversation on the right */
.chat { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-list { max-height: calc(100vh - 200px); overflow-y: auto; margin: 0; }
.chat-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.chat-item:hover { background: #F4F5F9; }
.chat-item.active { background: #E3E7FA; }
.chat-item-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-item-body .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-icon { color: var(--primary); }
.chat-item .count { background: var(--primary); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 8px; font-weight: 600; }
.chat-main { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 420px; margin: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-head .icon { color: var(--primary); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #F7F7F8; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.msg-bubble { max-width: min(520px, 80%); background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; }
.msg.mine .msg-bubble { background: #E3E7FA; border-color: #C5CDF2; }
.msg-from { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-time { font-size: 11px; color: var(--muted); text-align: end; margin-top: 2px; }
.msg-photo { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; }
.msg audio { width: 260px; max-width: 100%; }
.msg-file { font-weight: 500; overflow-wrap: anywhere; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-form textarea { flex: 1; resize: vertical; min-height: 42px; max-height: 160px; }
.btn-icon { padding: 9px; justify-content: center; }
#chat-mic.recording { background: #C8102E; border-color: #C8102E; color: #fff; }
.chat-hint { padding: 0 14px 10px; min-height: 18px; }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; }
  .chat-list { max-height: 220px; }
  .chat-main { height: 70vh; }
}

/* Points of a round template: drag to reorder */
.points-order .drag-cell { white-space: nowrap; padding-inline-end: 0; }
.drag-handle { cursor: grab; color: var(--muted); vertical-align: middle; }
.points-order tr.dragging { opacity: .45; background: #E3E7FA; }
.move-btns { display: inline-flex; vertical-align: middle; }
.move-btns .btn-link { padding: 0; color: var(--muted); }
.move-btns .icon { font-size: 18px; }

/* Teams in rotation: 14 next days, a dot when the team works */
.teams th.day, .teams td.day { text-align: center; padding-inline: 4px; width: 34px; font-size: 12px; }
.teams th.today { color: var(--primary); }
.work-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #E3E4E8; }
.work-dot.on { background: var(--primary); }
.nowrap { white-space: nowrap; }

/* Assistant « Nouveau site » */
.wizard-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; }
.wizard-steps li { display: inline-flex; align-items: center; gap: 6px; }
.wizard-steps li { border: 1px solid #CDD1DB; border-radius: 999px; padding: 6px 12px; font-size: 14px; color: var(--muted, #5F5F60); background: #fff; }
.wizard-steps li a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.wizard-steps li.done { border-color: var(--success, #1B7F4B); color: var(--success, #1B7F4B); }
.wizard-steps li.current { background: var(--primary, #2A3990); border-color: var(--primary, #2A3990); color: #fff; font-weight: 600; }
.wizard-list { margin: 0 0 16px; padding-inline-start: 22px; }
.wizard-summary { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.wizard-summary li { display: flex; gap: 8px; align-items: center; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.choice-card { border: 1px solid #CDD1DB; border-radius: 12px; padding: 14px; display: grid; gap: 4px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--primary, #2A3990); box-shadow: 0 0 0 2px rgba(42, 57, 144, .15); }
.choice-card.disabled { opacity: .55; cursor: not-allowed; }

/* Paramétrage après l'inscription (D79) */
.setup { min-height: 100vh; background: var(--bg, #F5F6FA); }
.setup-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: #fff; border-bottom: 1px solid #E3E5EC; }
.setup-head .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; color: var(--primary); }
.setup-main { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
.setup-main h1 { margin: 0 0 4px; }
.setup-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.setup-actions .btn[hidden] { visibility: hidden; display: inline-flex; }
.setup-skip { text-align: center; margin-top: 24px; }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.setup-list, .setup-grid { display: grid; gap: 10px; margin-top: 12px; }
.setup-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.setup-list label { display: grid; gap: 4px; font-weight: 600; }
.setup-group { border: 1px solid #E3E5EC; border-radius: 12px; padding: 12px 16px 16px; margin: 0 0 14px; }
.setup-group legend { font-weight: 700; padding: 0 6px; }
.setup-count { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.setup-count input { width: 80px; }
.setup-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 10px 0; }
.setup-row input[type=number] { width: 80px; }
.setup-team { border-top: 1px dashed #E3E5EC; padding-top: 10px; margin-top: 10px; }
.setup-team .team-name { font-weight: 600; max-width: 260px; }
.setup-team td input { width: 100%; }
.setup-limit { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; margin-top: 10px; }
.setup-limit.over { color: var(--danger, #B3261E); font-weight: 600; }
.setup-price { background: var(--primary-soft); border-radius: 12px; padding: 12px 16px; }
.setup-price h3 { margin: 0 0 8px; }
.setup-price .num { text-align: end; white-space: nowrap; }
.setup-price tr.total td { font-weight: 700; font-size: 17px; }
.setup input.missing { border-color: var(--danger, #B3261E); background: #FDF2F1; }
.setup-period { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 10px 0; padding: 12px 14px; background: #fff; border-radius: 10px; }
.setup-period strong { font-size: 22px; color: var(--primary); }
.period-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.period-card { display: grid; gap: 4px; text-align: start; padding: 12px; border: 1px solid #CDD1DB; border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.period-card strong { font-size: 20px; color: var(--primary); }
.period-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(42, 57, 144, .25); }
.period-months { font-weight: 700; }
.period-discount { justify-self: start; font-size: 12px; font-weight: 700; color: #fff; background: var(--success); border-radius: 999px; padding: 1px 8px; }
.period-discount.none { background: #E3E5EC; color: var(--muted); }
.period-save { color: var(--success); font-weight: 600; }
.setup-relay { display: grid; gap: 6px; margin: 10px 0; }
.setup-days { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; padding: 6px; border-radius: 10px; }
.setup-days.missing { outline: 1px solid var(--danger); background: #FDF2F1; }
.day-chip { display: inline-flex; align-items: center; padding: 4px 10px; border: 1px solid #CDD1DB; border-radius: 999px; cursor: pointer; font-size: 14px; user-select: none; }
.day-chip input { display: none; }
.day-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.alert-stats a.stat { text-decoration: none; color: inherit; cursor: pointer; transition: box-shadow .15s; }
.alert-stats a.stat:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.alert-stats a.stat.selected { outline: 2px solid var(--primary); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px; }
.day-chips-field ul, .day-chips-field div[id^="id_work_days"] { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.setup-times { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 10px; }
.setup-times input[type=time] { width: 130px; }
.signup-steps { font-weight: 600; color: var(--primary); margin: 4px 0 14px; }
input.missing { border-color: var(--danger, #B3261E) !important; background: #FDF2F1; }

/* Month calendars (team working days, rounds of a planning) */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; }
.cal-nav h2 { margin: 0; min-width: 200px; text-align: center; }
table.cal { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 4px; }
table.cal th { text-align: center; font-size: 13px; color: var(--muted); }
table.cal td { vertical-align: top; border-radius: 8px; padding: 6px; height: 70px; border: 1px solid #E3E5EC; }
table.cal td.out { border: 0; }
table.cal td.work { background: var(--primary-soft, #E8EBF7); border-color: transparent; }
table.cal td.rest { background: #fff; color: var(--muted); }
table.cal td.today { outline: 2px solid var(--primary); }
table.cal .num { font-weight: 700; }
table.cal .cal-time { font-weight: 600; color: var(--primary); }
table.cal td.changed { box-shadow: inset 0 0 0 2px var(--warning, #B26A00); }
table.cal .cal-edit { float: right; color: var(--muted); text-decoration: none; }
table.cal .cal-edit .icon { font-size: 16px; }
table.cal .cal-surprise { color: var(--warning, #B26A00); font-weight: 600; }
.day-time { display: inline-flex; align-items: center; gap: 2px; }

/* 05/12: Patrol logo (shield + P), tinted with the text colour */
.logo-mark { display: inline-block; width: 1.25em; height: 1.4em; flex: none; background: currentColor;
  -webkit-mask: url("img/logo.png") center / contain no-repeat; mask: url("img/logo.png") center / contain no-repeat; }
.brand-name { display: flex; align-items: center; gap: 8px; }
.login .logo .logo-mark { font-size: 30px; }
.signup-cta { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--border, #e3e4e8); }
.space-list { display: grid; gap: 8px; margin-bottom: 8px; }
.space-list .btn { justify-content: flex-start; text-align: start; white-space: normal; padding: 10px 14px; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
