/* Guards-specific styles; the design tokens and base components come from app.css (same as HRMS). */

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.page-head p { margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 16px; min-width: 120px; }
.stat b { display: block; font-size: 24px; font-family: var(--font-display); }
.stat span { font-size: 12px; color: var(--text-dim); }
.stat.warn b { color: var(--amber); }
.stat.bad b { color: var(--red); }
.stat.good b { color: var(--green); }

/* ---- Dashboard ---- */
.dash-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
/* The side panel stays put while the page scrolls: as tall as the screen under the top menu, its own scroll if the list is long. */
.dash-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; position: sticky; top: 64px;
             height: calc(100vh - 84px); overflow-y: auto; }
.side-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.side-stats .stat { min-width: 0; padding: 8px 10px; }
.side-stats .stat b { font-size: 22px; }
.side-stats .stat.wide { grid-column: 1 / -1; }
.dash-side h3 { margin-bottom: 6px; }
.dash-side .check { display: flex; margin: 6px 0; }
/* The maps are the first thing on the page and fill one screen: a fixed height (screen minus top menu), so 1, 2 or 4 premises always fit a basic desktop. */
.dash-maps { display: grid; gap: 12px; height: max(560px, calc(100vh - 84px)); grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.dash-maps.count-0, .dash-maps.count-1 { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.dash-maps.count-2 { grid-template-rows: minmax(0, 1fr); }
.dash-maps.count-3 .map-card:nth-child(3) { grid-column: 1 / -1; }
.dash-alerts { margin-top: 16px; }
.map-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column;  min-height: 0; }
.map-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.map-card-head h3 { margin: 0; }
/* The map is its own stacking context: Leaflet's panes and controls use z-index up to 1000 and must stay under the top menu and its dropdowns. */
.map { height: 420px; width: 100%; background: var(--surface-2); position: relative; z-index: 0; isolation: isolate; }
.dash-maps .map { flex: 1 1 auto; height: auto; min-height: 160px; }
.dash-maps .map-card-head { padding: 6px 12px; }
.dash-maps .guard-list { max-height: 78px; overflow-y: auto; flex: 0 0 auto; }
.map.tall { height: 560px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 8px 14px; font-size: 12px; color: var(--text-dim); border-top: 1px solid var(--line); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.ON_DUTY, .dot.INSIDE { background: #2fbf71; }
.dot.OUTSIDE { background: #e5484d; }
.dot.NO_SIGNAL, .dot.UNCERTAIN { background: #f4a52c; }
.dot.NOT_STARTED, .dot.UPCOMING, .dot.NODUTY { background: #8b93a1; }
.dot.SPOOFED { background: #b04ad9; }
.guard-list { list-style: none; margin: 0; padding: 6px 14px 10px; display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; }
.guard-list li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.guard-list .muted { white-space: nowrap; }

/* Leaflet markers: a coloured disc with the guard's initials. */
.gm-pin span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: #101010;
  font: 700 12px/1 var(--font-body); border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .55); }
.leaflet-tooltip.gm-tip { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font: 13px/1.4 var(--font-body); padding: 8px 10px; }
.leaflet-tooltip.gm-tip::before { display: none; }
.leaflet-container { font-family: var(--font-body); }

/* ---- Editor ---- */
.editor-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.editor-side { display: flex; flex-direction: column; gap: 12px; }
.editor-side .card { padding: 14px; }
.search-row { display: flex; gap: 8px; margin: 8px 0; }
.search-row input { flex: 1; }

/* ---- Lists and details ---- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 20px; margin: 12px 0; }
.kv div b { display: block; font-size: 18px; font-family: var(--font-display); }
.kv div span { font-size: 12px; color: var(--text-dim); }
.code-box { font: 700 30px/1.2 Consolas, 'Courier New', monospace; letter-spacing: .12em; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: var(--radius-md);
  padding: 16px; text-align: center; margin: 12px 0; user-select: all; }
.weekdays { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; }
.sev-CRITICAL { color: var(--red); }
.sev-WARN { color: var(--amber); }
.sev-INFO { color: var(--text-dim); }
.settings-row { display: grid; grid-template-columns: minmax(180px, 280px) 160px 1fr; gap: 10px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.settings-row .hint { margin: 0; }
.report-grid .e-headercell { white-space: normal; }
.row-click { cursor: pointer; }

@media (max-width: 1100px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-side { position: static; height: auto; }
  .dash-maps, .dash-maps.count-1, .dash-maps.count-2 { height: auto; grid-template-columns: 1fr; grid-template-rows: none; }
  .dash-maps .map { flex: none; height: 340px; }
  .dash-maps.count-3 .map-card:nth-child(3) { grid-column: auto; }
  .editor-layout { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-maps { grid-template-columns: 1fr; }
  .map.tall { height: 340px; }
}
