/* Exploration Operations — concept demo v3.
   Stanmore palette: navy frame, bright blue = clickable, charcoal text.
   Red / amber / green are reserved exclusively for status meaning. */

:root {
  --navy: #1a487e;          /* primary brand — top bar, headings, primary buttons */
  --navy-deep: #143a67;
  --blue: #0094cf;          /* interactive — links, active states, clickable IDs */
  --blue-soft: #e3f2fa;
  --ink: #4a4e52;           /* body text — charcoal */
  --ink-soft: #7a7f85;
  --paper: #f4f7fa;         /* page background — light blue-grey */
  --card: #ffffff;
  --line: #dde4ec;

  /* status semantics — reserved */
  --green: #2e7d32;  --green-soft: #e6f2e7;
  --amber: #b07000;  --amber-soft: #fdf3df;
  --red:   #c62828;  --red-soft:   #fbe7e7;
  --grey:  #8a8f96;  --grey-soft:  #eef1f4;

  /* activity colours — blue family, same meaning everywhere */
  --act-drilling: #1a487e;
  --act-seismic:  #0094cf;
  --act-siteprep: #5b7fa6;
  --act-enviro:   #00838f;
  --act-inactive: #8a8f96;

  /* metric colours for charts — same meaning on every chart */
  --m-take5: #0094cf;
  --m-sit: #1a487e;
  --m-pto: #7b96b5;

  --shadow: 0 1px 3px rgba(26, 72, 126, 0.08), 0 4px 14px rgba(26, 72, 126, 0.06);
  --shadow-lift: 0 2px 6px rgba(26, 72, 126, 0.12), 0 10px 26px rgba(26, 72, 126, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue); }

/* ---------- inline SVG icons ---------- */

.icn { display: inline-block; vertical-align: -3px; margin-right: 6px; }
.icn svg { display: block; width: 16px; height: 16px; }

/* ---------- header / nav — navy frame ---------- */

header.topbar {
  background: var(--navy);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 600;
  box-shadow: 0 2px 8px rgba(20, 58, 103, 0.3);
}

.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; white-space: nowrap; color: #fff; }
.brand .sub { display: block; font-weight: 400; font-size: 11.5px; color: rgba(255, 255, 255, 0.65); }

nav.mainnav { display: flex; gap: 2px; flex-wrap: wrap; }

nav.mainnav a {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  font-size: 14px;
}

nav.mainnav a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
nav.mainnav a.active { background: var(--blue); color: #fff; font-weight: 600; }

.tour-btn {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-family: inherit;
}

.tour-btn:hover { border-color: #fff; color: #fff; }

/* ---------- layout ---------- */

main { max-width: 1360px; margin: 0 auto; padding: 26px 24px 80px; }

h1 { font-size: 25px; margin: 0 0 4px; letter-spacing: -0.2px; color: var(--navy); }
h2 { font-size: 17px; margin: 32px 0 12px; color: var(--navy); }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--navy); }

.page-sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 14px; }

.backlink {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 12px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
}
.backlink:hover { border-color: var(--blue); }

footer.sitefoot {
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 18px 24px 26px;
  background: var(--card);
}

/* ---------- KPI strip ---------- */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}

.kpi:hover { box-shadow: var(--shadow-lift); }
.kpi .n { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi .n.alert { color: var(--red); }
.kpi .l { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }

/* ---------- headline banner ---------- */

.headline-banner {
  display: flex;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: 10px;
  margin-bottom: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.headline-banner a {
  flex: 1 1 220px;
  padding: 15px 20px;
  text-decoration: none;
  color: var(--ink);
  border-right: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
}

.headline-banner a:last-child { border-right: none; }
.headline-banner a:hover { background: var(--blue-soft); }
.headline-banner a .hint { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }

/* ---------- cards ---------- */

/* min() keeps a single track from overflowing narrow phones; desktop unchanged */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card.clickable { cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.card.clickable:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }

.site-card h3 {
  margin: 0 0 4px;
  font-size: 21px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card .meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 12px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; border-top: 1px solid var(--paper); }
.kv:first-of-type { border-top: none; }
.kv .k { color: var(--ink-soft); }
.kv .v { font-weight: 600; text-align: right; color: var(--ink); }

.open-hint { margin-top: 12px; font-size: 12.5px; color: var(--blue); font-weight: 600; }

/* ---------- section tiles (card-tile navigation) ---------- */

.card.tile {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
}
.card.tile h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile-val { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1.15; }
.tile-val.text { font-size: 17px; font-weight: 700; }
.tile-val.alert { color: var(--red); }
.tile-val .unit { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.tile-val .badge { vertical-align: 3px; font-size: 12px; }
.tile-hint { font-size: 13px; color: var(--ink-soft); margin-top: 8px; flex: 1 1 auto; }
.card.tile .open-hint { margin-top: 14px; }

/* status dots, chips and badges */

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red   { background: var(--red); }
.dot.blue  { background: var(--blue); }
.dot.navy  { background: var(--navy); }
.dot.grey  { background: var(--grey); }

.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-radius: 20px;
  padding: 3px 11px;
  white-space: nowrap;
  color: #fff;
}

.chip.drilling { background: var(--act-drilling); }
.chip.seismic  { background: var(--act-seismic); }
.chip.siteprep { background: var(--act-siteprep); }
.chip.enviro   { background: var(--act-enviro); }
.chip.inactive { background: var(--act-inactive); }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  padding: 2px 8px;
  white-space: nowrap;
}

.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red   { background: var(--red-soft);   color: var(--red); }
.badge.grey  { background: var(--grey-soft);  color: var(--ink-soft); }
.badge.blue  { background: var(--blue-soft);  color: var(--navy); }

.safety-strip { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- entity links — blue means clickable ---------- */

.elink {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px dotted #9fcce4;
  cursor: pointer;
  font-weight: 600;
}
.elink:hover { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------- site sub-navigation ---------- */

.subnav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  margin: 18px 0 22px;
}

.subnav a {
  padding: 9px 16px;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.subnav a:hover { color: var(--navy); }
.subnav a.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------- tables ---------- */

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }

table.data th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--navy);
  padding: 11px 12px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  background: var(--card);
}

table.data td { padding: 9px 12px; border-bottom: 1px solid var(--paper); vertical-align: top; }
table.data tbody tr:nth-child(even) td { background: #f8fafc; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.flag-red td { background: var(--red-soft) !important; }
table.data tr.flag-amber td { background: var(--amber-soft) !important; }
table.data tr.subtotal td { font-weight: 700; border-top: 2px solid var(--line); background: var(--card) !important; }
table.data tr.rowlink { cursor: pointer; }
table.data tr.rowlink:hover td { background: var(--blue-soft) !important; }

.tick { color: var(--green); font-weight: 700; }
.cross { color: var(--ink-soft); }

/* ---------- flags / alerts ---------- */

.flag-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.flag-card.red { border-left-color: var(--red); }
.flag-card.green { border-left-color: var(--green); }
.flag-card h3 { margin: 0 0 6px; }
.flag-card .impact { font-weight: 700; color: var(--ink); }
.flag-card .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--navy);
}

.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-deep); color: #fff; }
.btn[disabled] { opacity: 0.55; cursor: default; }

.alert-banner {
  background: var(--red-soft);
  border: 1px solid #efc7c7;
  border-left: 4px solid var(--red);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 14px 0;
  font-weight: 600;
  color: var(--ink);
}

.audit-trail {
  background: var(--grey-soft);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-soft);
}
.audit-trail div { padding: 2px 0; }

/* ---------- info (explainer) panels ---------- */

details.info {
  background: var(--blue-soft);
  border: 1px solid #c9e4f2;
  border-radius: 10px;
  margin: 22px 0;
  font-size: 14px;
}

details.info summary { cursor: pointer; padding: 11px 16px; font-weight: 600; color: var(--navy); list-style: none; }
details.info summary::before { content: "\24D8\00a0\00a0"; }
details.info summary::-webkit-details-marker { display: none; }
details.info .info-body { padding: 0 16px 14px; }
details.info dt { font-weight: 600; margin-top: 8px; color: var(--navy); }
details.info dd { margin: 2px 0 0 0; color: var(--ink); }

/* progressive disclosure */

details.disclose { margin: 14px 0; }
details.disclose > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--navy);
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  list-style: none;
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::after { content: "\00a0\00a0\25BE"; color: var(--ink-soft); }
details.disclose[open] > summary { border-radius: 10px 10px 0 0; border-bottom: none; }
details.disclose[open] > summary::after { content: "\00a0\00a0\25B4"; }
details.disclose .disclose-body { border: 1px solid var(--line); border-top: none; border-radius: 0 0 10px 10px; background: var(--card); padding: 4px 0 0; }
details.disclose .disclose-body .tablewrap { border: none; box-shadow: none; border-radius: 0 0 10px 10px; }

/* ---------- charts ---------- */

.chart-block { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.chart-block h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.chart-block h4 .swatch-inline { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
svg.minichart { width: 100%; height: 96px; display: block; }
svg.minichart text { font-size: 9px; fill: var(--ink-soft); font-family: inherit; }
svg.minichart text.val { font-size: 9.5px; font-weight: 700; }
svg.minichart line.axis { stroke: var(--line); stroke-width: 1; }
svg.minichart line.ref { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3,3; }

/* ---------- detail pages ---------- */

.detail-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head h1 { margin: 0; }
.cert-list .kv .v { font-weight: 500; }

/* ---------- pre-start facsimile ---------- */

.prestart-pair { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 20px; align-items: start; }

.paper-form {
  background: #fffdf5;
  border: 1px solid #d8d2bd;
  box-shadow: 3px 5px 14px rgba(0,0,0,0.18);
  transform: rotate(-1.6deg);
  padding: 18px 16px;
  font-size: 12.5px;
  color: #3a3a33;
}

.paper-form .form-title { font-weight: 700; text-align: center; border-bottom: 2px solid #3a3a33; padding-bottom: 4px; margin-bottom: 10px; font-size: 13px; }
.paper-form .form-line { border-bottom: 1px solid #c9c2a8; padding: 5px 0 2px; }
.paper-form .form-line .lbl { font-size: 10px; text-transform: uppercase; color: #8a8468; display: block; }
.paper-form .hand { font-style: italic; color: #2b3a55; }
.paper-form .photo-note { margin-top: 10px; font-size: 10.5px; color: #8a8468; text-align: center; }

@media (max-width: 760px) { .prestart-pair { grid-template-columns: 1fr; } }

/* ---------- map ---------- */

#mapwrap { position: relative; }
#map, .scoped-map { height: 620px; border: 1px solid var(--line); border-radius: 10px; background: #e9eef2; box-shadow: var(--shadow); }
.scoped-map { height: 420px; }

.map-disclaimer {
  position: absolute; bottom: 12px; left: 12px; z-index: 500;
  background: rgba(255,255,255,0.92); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; font-size: 12px; color: var(--ink-soft);
}

.map-legend {
  position: absolute; top: 12px; right: 12px; z-index: 500;
  background: rgba(255,255,255,0.95); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 14px; font-size: 12.5px;
}

.map-legend .row { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.map-legend .swatch { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }

.site-label {
  background: rgba(255,255,255,0.92); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 7px; font-size: 11.5px; font-weight: 700;
  color: var(--navy); white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.leaflet-popup-content { font-size: 13px; line-height: 1.45; }
.leaflet-popup-content .pop-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--navy); }

.map-fallback {
  height: 620px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-soft);
  text-align: center; padding: 30px;
}

/* ---------- modals ---------- */

.overlay {
  position: fixed; inset: 0; background: rgba(16, 32, 52, 0.55); z-index: 800;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}

.modal {
  position: relative;
  background: var(--card); border-radius: 12px; max-width: 640px; width: 100%;
  max-height: 85vh; overflow-y: auto; padding: 22px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.modal h3 { margin-top: 0; padding-right: 30px; }

.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  font-size: 16px; line-height: 1; color: var(--ink-soft);
  cursor: pointer; font-family: inherit;
}
.modal-close:hover { color: var(--navy); border-color: var(--navy); }

.mock-email { border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; margin: 12px 0; overflow: hidden; }
.mock-email .email-head { background: var(--paper); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mock-email .email-head div { padding: 1px 0; }
.mock-email .email-head .h { color: var(--ink-soft); display: inline-block; width: 64px; }
.mock-email .email-body { padding: 12px 14px; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.layer-pick label { display: block; padding: 6px 4px; font-size: 14px; cursor: pointer; }
.layer-pick input { margin-right: 8px; }

/* ---------- toast ---------- */

#toast-area { position: fixed; bottom: 22px; left: 22px; z-index: 950; display: flex; flex-direction: column; gap: 8px; }

.toast {
  background: var(--navy); color: #fff; border-radius: 8px; padding: 12px 18px;
  font-size: 14px; max-width: 380px; box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  animation: toast-in 0.25s ease-out;
}

.toast.success { border-left: 4px solid #66bb6a; }
.toast.warn { border-left: 4px solid var(--amber); }

@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- ask the system ---------- */

.ask-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .ask-layout { grid-template-columns: 1fr; } }

.chat-panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 540px; box-shadow: var(--shadow); }
.chat-log { flex: 1; padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }

.msg { max-width: 85%; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.msg.user { align-self: flex-end; background: var(--blue-soft); border: 1px solid #c9e4f2; }
.msg.system { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; font-family: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.chat-input input:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestions button {
  font-family: inherit; text-align: left; font-size: 13.5px; background: var(--card);
  border: 1px solid var(--line); border-radius: 7px; padding: 10px 13px; cursor: pointer; color: var(--navy);
}
.suggestions button:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- floating assistant ---------- */

#chat-bubble {
  position: fixed; bottom: 24px; right: 24px; z-index: 760;
  background: var(--blue); color: #fff;
  border: none; border-radius: 30px;
  padding: 13px 20px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 110, 160, 0.45);
}
#chat-bubble:hover { background: #0083b8; }

#chat-dock {
  position: fixed; bottom: 24px; right: 24px; z-index: 770;
  width: 390px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - 100px);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 48px rgba(16, 32, 52, 0.35);
  display: flex; flex-direction: column;
  overflow: hidden;
}

#chat-dock .dock-head {
  background: var(--navy); color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
#chat-dock .dock-head .title { font-weight: 700; font-size: 14.5px; }
#chat-dock .dock-head .identity {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 14px; padding: 3px 10px;
  white-space: nowrap;
}
#chat-dock .dock-close {
  background: none; border: none; color: rgba(255,255,255,0.8);
  font-size: 18px; cursor: pointer; padding: 0 0 0 8px; font-family: inherit;
}
#chat-dock .dock-close:hover { color: #fff; }

#chat-dock .dock-log { flex: 1; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#chat-dock .msg { font-size: 13.5px; }
#chat-dock .dock-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
#chat-dock .dock-chips button {
  font-family: inherit; font-size: 12px; color: var(--navy);
  background: var(--blue-soft); border: 1px solid #c9e4f2; border-radius: 14px;
  padding: 5px 11px; cursor: pointer;
}
#chat-dock .dock-chips button:hover { border-color: var(--blue); color: var(--blue); }
#chat-dock .dock-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
#chat-dock .dock-input input { flex: 1; font-family: inherit; font-size: 13.5px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; }
#chat-dock .dock-input input:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

/* ---------- guided tour ---------- */

#tour-dim {
  position: fixed; inset: 0; z-index: 850;
  background: rgba(16, 32, 52, 0.45);
  backdrop-filter: blur(1.5px);
}

.tour-box {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 900;
  background: var(--navy); color: #fff; border-radius: 12px; padding: 18px 22px;
  max-width: 580px; width: calc(100% - 48px); box-shadow: 0 10px 36px rgba(0,0,0,0.45);
}

.tour-box h4 { margin: 0 0 6px; font-size: 15px; color: #fff; }
.tour-box p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.5; color: #dce6f2; }
.tour-box .tour-source { font-size: 12px; color: #9fc3e8; margin: 0 0 12px; }
.tour-box .tour-controls { display: flex; align-items: center; gap: 10px; }
.tour-box .tour-step { font-size: 12px; color: #9bb3cf; margin-right: auto; }
.tour-box .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.tour-box .btn:hover { border-color: #fff; color: #fff; }
.tour-box .btn.primary { background: var(--blue); border-color: var(--blue); }

/* ---------- misc ---------- */

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* small screens — phone / narrow iPad; desktop layout unchanged */
@media (max-width: 600px) {
  header.topbar { padding: 0 14px; }
  .topbar-inner { gap: 8px 12px; padding: 8px 0; }
  .brand { font-size: 15px; }
  .brand .sub { font-size: 11px; }
  nav.mainnav { gap: 1px; }
  nav.mainnav a { padding: 6px 9px; font-size: 13px; }
  .tour-btn { margin-left: 0; padding: 6px 12px; font-size: 13px; }
  main { padding: 18px 14px 72px; }
  h1 { font-size: 22px; }
  /* daily report document: tighter padding, stack the label/value tables */
  .daily-report-doc { padding: 16px 14px; }
  table.dr-table th { width: 130px; }
  /* gantt keeps its own horizontal scroll inside .gantt-wrap */
}

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.mt0 { margin-top: 0; }
.section-gap { margin-top: 30px; }

ul.clean { padding-left: 20px; margin: 8px 0; }
ul.clean li { margin: 5px 0; }

ul.timeline { list-style: none; padding-left: 0; margin: 8px 0; }
ul.timeline li { padding: 7px 0 7px 22px; position: relative; border-left: 2px solid var(--line); margin-left: 8px; }
ul.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 13px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--blue); border: 2px solid var(--card);
}
ul.timeline li .tdate { font-size: 12px; color: var(--ink-soft); display: block; }

.tier-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--blue); }
.nowrap { white-space: nowrap; }

/* ---------- roster Gantt (§2) ----------
   The GeoDraw colours are the real roster scheme and are intentional here:
   DS green, NS red, Travel yellow, Leave blue, Standby purple, Training magenta. */

.gantt-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.gantt-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }

table.gantt { border-collapse: collapse; font-size: 12.5px; width: 100%; }
table.gantt th, table.gantt td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; white-space: nowrap; }
table.gantt thead th { background: var(--navy); color: #fff; font-size: 11px; position: sticky; top: 0; }
table.gantt th.gname, table.gantt td.gname { text-align: left; min-width: 160px; position: sticky; left: 0; z-index: 2; background: var(--card); }
table.gantt thead th.gname { background: var(--navy); z-index: 3; }
table.gantt td.gname .gsub { display: block; font-size: 11px; color: var(--ink-soft); }
table.gantt td.gmeta { text-align: left; color: var(--ink-soft); font-size: 11.5px; }
table.gantt th.gc-day { min-width: 30px; }
table.gantt th.gc-day .gdow { display: block; font-size: 9.5px; opacity: 0.8; }
table.gantt th.gc-day .gdom { display: block; font-weight: 700; }
table.gantt th.gc-day.wknd { background: var(--navy-deep); }

table.gantt tr.gtally td { font-weight: 700; background: #eef3f8; color: var(--navy); font-variant-numeric: tabular-nums; }
table.gantt tr.gtally td.gname { background: #eef3f8; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.4px; }
table.gantt tr.gtally.on td.gname { color: var(--green); }
table.gantt tr.gtally.trv td.gname { color: var(--amber); }

.gcell { font-size: 10.5px; font-weight: 800; color: #fff; }
.gc-DS { background: #2e7d32; color: #fff; }
.gc-NS { background: #c62828; color: #fff; }
.gc-Break { background: repeating-linear-gradient(45deg, #e7ebf0, #e7ebf0 4px, #d7dde5 4px, #d7dde5 8px); color: transparent; }
.gc-Travel { background: #e3b505; color: #3a2f00; }
.gc-Leave { background: #0094cf; color: #fff; }
.gc-Standby { background: #6a3fb5; color: #fff; }
.gc-Training { background: #b5179e; color: #fff; }

.gantt-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--ink); }
.gantt-legend .gl { display: inline-flex; align-items: center; gap: 6px; }
.gantt-legend .gl-sw { display: inline-block; width: 16px; height: 13px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.15); }

/* ---------- rendered daily report (§3) ---------- */

.daily-report-doc {
  background: #fff; border: 1px solid #c9cfd6; border-radius: 8px;
  padding: 26px 30px; margin-top: 18px; max-width: 880px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.10);
  font-size: 13.5px; color: #2b2f33;
}
.daily-report-doc .dr-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 6px; }
.daily-report-doc .dr-title { font-size: 20px; font-weight: 800; color: var(--navy); }
.daily-report-doc .dr-sub { font-size: 12.5px; color: var(--ink-soft); }
.daily-report-doc .dr-meta { font-size: 11px; color: var(--red); text-align: right; font-weight: 600; }
.daily-report-doc h4.dr-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--navy); margin: 20px 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
table.dr-table { width: 100%; border-collapse: collapse; margin: 4px 0; font-size: 13px; }
table.dr-table th, table.dr-table td { border: 1px solid #d4dae1; padding: 6px 9px; text-align: left; vertical-align: top; }
table.dr-table th { background: #f1f5f9; font-weight: 700; color: var(--navy); width: 210px; }
table.dr-table.dr-grid th { width: auto; }
table.dr-table.dr-grid td.num, table.dr-table.dr-grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.daily-report-doc .dr-rig { margin: 8px 0 14px; }
.daily-report-doc .dr-rig h4 { font-size: 13.5px; color: var(--navy); margin: 8px 0 4px; }
.log-badge { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 4px; font-weight: 800; font-size: 11px; color: #fff; }
.log-C { background: var(--green); }
.log-P { background: var(--amber); }
.log-B { background: var(--red); }
.log-A { background: var(--grey); }

/* ---------- QGIS / draft "opening" state ---------- */

.qgis-opening { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--navy); margin: 10px 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--blue-soft); border-top-color: var(--blue);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; background: var(--grey-soft); padding: 1px 5px; border-radius: 4px; }
