/* ===========================================================================
   Afrihost NOC Incident Manager — main.css
   Dark theme built on Afrihost Ocean (#001624). Colours sourced from the
   Afrihost Brand Style Guide (April 2026) — see MASTER_BRIEF §13.2.
   =========================================================================== */

:root {
  /* ── Primary Reds ── */
  --brand-plum:           #D50032;
  --brand-raspberry:      #BA0C2F;
  --brand-gradient-red:   linear-gradient(45deg, #D50032 30%, #BA0C2F 70%);

  /* ── Primary Blues ── */
  --brand-lagoon:         #005587;
  --brand-waterfall:      #0095C8;
  --brand-puddle:         #2AC4FF;
  --brand-river:          #4698CB;
  --brand-ocean:          #001624;
  --brand-gradient-blue:  linear-gradient(45deg, #2AC4FF 20%, #0095C8 80%);

  /* ── Neutrals ── */
  --brand-thunder:        #333F48;
  --brand-hazy:           #768692;
  --brand-dew:            #CED9E5;
  --brand-mist:           #EFF2F5;

  /* ── Dark Theme Surfaces ── */
  --bg-primary:           #001624;
  --bg-secondary:         #08192a;
  --bg-tertiary:          #0d2236;
  --bg-hover:             #162e46;
  --border-color:         #1c3550;
  --border-subtle:        rgba(206, 217, 229, 0.12);

  /* ── Text ── */
  --text-primary:         #EFF2F5;
  --text-secondary:       #CED9E5;
  --text-muted:           #768692;
  --text-disabled:        #3d5066;

  /* ── Severity ── */
  --color-critical:       #D50032;
  --color-high:           #F52F52;
  --color-medium:         #EA7600;
  --color-low:            #FFB500;

  /* ── Status ── */
  --color-open:           #2AC4FF;
  --color-inprogress:     #EA7600;
  --color-resolved:       #78BE20;

  /* ── Semantic ── */
  --color-success:        #78BE20;
  --color-warning:        #FFB500;
  --color-error:          #EA7600;
  --color-danger:         #EA7600; /* alias used by form validation text */
  --color-info:           #2AC4FF;
  --color-rfo-pending:    #FBE122;

  /* ── Update type badges ── */
  --color-update-badge:       #768692;
  --color-escalation-badge:   #D50032;
  --color-workaround-badge:   #FFB500;
  --color-resolution-badge:   #78BE20;

  /* ── Interactive ── */
  --brand-primary:        #D50032;
  --brand-primary-hover:  #BA0C2F;
  --brand-link:           #2AC4FF;
  --brand-link-hover:     #0095C8;
  --brand-active:         #005587;
  --brand-focus-ring:     rgba(42, 196, 255, 0.35);

  /* ── Layout ── */
  --nav-height:           60px;
  --content-max-width:    1200px;
  --border-radius:        6px;
  --border-radius-sm:     4px;
  --border-radius-lg:     10px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

a { color: var(--brand-link); text-decoration: none; }
a:hover { color: var(--brand-link-hover); }

h1, h2, h3, h4 { color: var(--text-primary); margin: 0 0 0.5em; }

.preformatted-text {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.hidden { display: none !important; }
.center { text-align: center; }
.right { text-align: right; }

/* ── Navigation ────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-secondary);
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, #2AC4FF 20%, #0095C8 80%) 1;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.nav-brand img { height: 28px; width: auto; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 0 auto;
}
.nav-links a {
  color: var(--text-secondary);
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active {
  color: var(--brand-puddle);
  border-bottom-color: var(--brand-puddle);
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.nav-user .user-name { color: var(--text-primary); font-weight: 500; }

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  margin-left: auto;
}

/* Role badges */
.role-badge {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  padding: 2px 8px; border-radius: 10px; letter-spacing: 0.4px;
}
.role-badge.admin              { background: var(--brand-lagoon); color: #fff; }
.role-badge.network_specialist { background: #0d2236; color: var(--brand-waterfall); }
.role-badge.noc_engineer       { background: #0d2236; color: var(--brand-puddle); }
.role-badge.manager            { background: #0d2236; color: var(--brand-hazy); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.main {
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
  padding: 24px 20px 60px;
}
.container { max-width: var(--content-max-width); margin: 0 auto; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; margin: 0; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px;
}
.card + .card { margin-top: 18px; }
.card h2, .panel-title { font-size: 16px; margin: 0 0 14px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px 18px;
}
.summary-card .label {
  color: var(--text-muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.summary-card .value { font-size: 30px; font-weight: 700; margin-top: 6px; }
.summary-card.accent-critical .value { color: var(--color-critical); }
.summary-card.accent-open .value { color: var(--color-open); }
.summary-card.accent-progress .value { color: var(--color-inprogress); }
.summary-card.accent-resolved .value { color: var(--color-resolved); }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
/* Severity — colour bg, white text */
.badge.sev-Critical { background: var(--color-critical); color: #fff; }
.badge.sev-High     { background: var(--color-high); color: #fff; }
.badge.sev-Medium   { background: var(--color-medium); color: #fff; }
.badge.sev-Low      { background: var(--color-low); color: #3a2a00; }

/* Status — light-opacity bg, colour text */
.badge.status-Open        { background: rgba(42,196,255,0.15); color: var(--color-open); }
.badge.status-InProgress  { background: rgba(234,118,0,0.15); color: var(--color-inprogress); }
.badge.status-Resolved    { background: rgba(120,190,32,0.15); color: var(--color-resolved); }

/* Update type */
.badge.ut-Update        { background: var(--color-update-badge); color: #fff; }
.badge.ut-Escalation    { background: var(--color-escalation-badge); color: #fff; }
.badge.ut-Workaround    { background: var(--color-workaround-badge); color: #3a2a00; }
.badge.ut-Resolution    { background: var(--color-resolution-badge); color: #14250a; }

.badge.rfo-pending { background: var(--color-rfo-pending); color: #3a3300; }

/* Change Control — status (light-opacity bg, colour text, like incident status) */
.badge.chg-proposed    { background: rgba(118,134,146,0.18); color: var(--brand-hazy); }
.badge.chg-scheduled   { background: rgba(42,196,255,0.15); color: var(--color-open); }
.badge.chg-in_progress { background: rgba(234,118,0,0.15); color: var(--color-inprogress); }
.badge.chg-completed   { background: rgba(120,190,32,0.15); color: var(--color-resolved); }
.badge.chg-failed      { background: rgba(213,0,50,0.18); color: #ff5c7c; }
.badge.chg-rolled_back { background: rgba(255,181,0,0.15); color: var(--color-low); }

/* Change type */
.badge.ct-normal    { background: rgba(118,134,146,0.18); color: var(--text-secondary); }
.badge.ct-emergency { background: var(--brand-plum); color: #fff; }

/* Change timeline update types */
.badge.cut-Update     { background: var(--color-update-badge); color: #fff; }
.badge.cut-Started    { background: rgba(42,196,255,0.15); color: var(--color-open); }
.badge.cut-Completed  { background: var(--color-resolution-badge); color: #14250a; }
.badge.cut-Failed     { background: var(--color-escalation-badge); color: #fff; }
.badge.cut-RolledBack { background: var(--color-workaround-badge); color: #3a2a00; }

/* Search result type badge (Incident vs Change) */
.badge.rt-incident { background: rgba(0,85,135,0.4); color: var(--brand-puddle); }
.badge.rt-change   { background: rgba(0,149,200,0.25); color: var(--brand-waterfall); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
table.data th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr:nth-child(even) { background: rgba(13,34,54,0.4); }
table.data tbody tr:nth-child(even):hover { background: var(--bg-hover); }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
label { color: var(--text-secondary); font-size: 13px; font-weight: 500; }
label .req { color: var(--brand-plum); margin-left: 2px; }

input, select, textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-puddle);
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-focus-ring);
}
input:disabled, select:disabled, textarea:disabled {
  color: var(--text-disabled);
  background: #0a1b2b;
  cursor: not-allowed;
}
.field-error { color: var(--color-danger); font-size: 12px; min-height: 0; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* ── Multi-select dropdown ─────────────────────────────────────────────── */
.msel { position: relative; }
.msel-toggle {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 8px 28px 8px 12px;
  font-family: inherit; font-size: 14px;
  text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msel-toggle::after {
  content: '▾'; position: absolute; right: 10px;
  color: var(--text-muted); pointer-events: none;
}
.msel-toggle.placeholder { color: var(--text-muted); }
.msel-toggle:focus {
  border-color: var(--brand-puddle);
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-focus-ring);
}
.msel-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  max-height: 240px; overflow-y: auto;
  z-index: 50; padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 8, 16, 0.5);
}
.msel-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 4px;
  font-weight: 400; cursor: pointer; color: var(--text-primary);
}
.msel-opt:hover { background: var(--bg-hover); }
.msel-opt input { width: auto; }
.msel-other { margin-top: 6px; }

/* ── Date/time picker (dd/mm/yyyy, 24h) ────────────────────────────────── */
.dtp { position: relative; width: 100%; }
.dtp-panel {
  position: absolute; top: calc(100% + 4px); left: 0;
  width: 260px; padding: 10px; z-index: 60;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: 0 8px 24px rgba(0, 8, 16, 0.5);
}
.dtp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; font-weight: 600; font-size: 13px;
}
.dtp-nav {
  background: none; border: none; color: var(--brand-puddle);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 10px;
  border-radius: 4px;
}
.dtp-nav:hover { background: var(--bg-hover); }
.dtp-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; text-align: center;
}
.dtp-dow {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; padding: 2px 0;
}
.dtp-day {
  background: none; border: none; color: var(--text-primary);
  padding: 4px 0; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-family: inherit;
}
.dtp-day:hover { background: var(--bg-hover); }
.dtp-day.today { color: var(--brand-puddle); font-weight: 700; }
.dtp-day.sel { background: var(--brand-lagoon); color: #fff; }
.dtp-time {
  display: flex; gap: 6px; align-items: center; margin-top: 10px;
  color: var(--text-muted);
}
.dtp-time select { width: auto; padding: 4px 8px; }
.dtp-done { margin-left: auto; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  padding: 8px 16px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-hover); }
.btn-secondary { background: transparent; border-color: var(--border-color); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--brand-link); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px; border-radius: var(--border-radius-sm);
  font-size: 13px; margin-bottom: 14px;
}
.alert-error { background: rgba(234,118,0,0.12); color: var(--color-error); border: 1px solid rgba(234,118,0,0.4); }
.alert-success { background: rgba(120,190,32,0.12); color: var(--color-success); border: 1px solid rgba(120,190,32,0.4); }
.alert-info { background: rgba(42,196,255,0.1); color: var(--color-info); border: 1px solid rgba(42,196,255,0.35); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,8,16,0.7);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 200; overflow-y: auto;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 100%; max-width: 640px;
  padding: 22px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; }

/* ── Login / centred auth pages ────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, #2AC4FF 20%, #0095C8 80%) 1;
  padding: 30px;
}
.auth-card .logo { text-align: center; margin-bottom: 8px; }
.auth-card .logo img { height: 40px; }
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.auth-card .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 22px; font-size: 13px; }
.auth-card .form-field { margin-bottom: 16px; }
.auth-card .btn { width: 100%; }
.qr-box { text-align: center; margin: 16px 0; }
.qr-box img { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }
.manual-code {
  font-family: monospace; background: var(--bg-tertiary);
  padding: 8px 12px; border-radius: var(--border-radius-sm);
  word-break: break-all; text-align: center; margin: 10px 0;
  border: 1px solid var(--border-color);
}

/* ── Incident detail ───────────────────────────────────────────────────── */
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.detail-header .incident-number { font-size: 26px; font-weight: 700; }
.detail-header .badges { display: flex; gap: 8px; margin: 8px 0; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px; margin-top: 8px;
}
.detail-grid .item { display: flex; flex-direction: column; gap: 2px; }
.detail-grid .item .k { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.detail-grid .item .v { color: var(--text-primary); }

/* Updates timeline */
.timeline { margin-top: 8px; }
.timeline .update {
  padding: 14px 0; border-bottom: 1px solid var(--border-color);
}
.timeline .update:last-child { border-bottom: none; }
.timeline .update.latest {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
  padding: 14px; margin: 6px 0;
}
.timeline .update .meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.timeline .update .meta .ts { color: var(--text-muted); font-size: 12px; }
.timeline .update .meta .by { color: var(--text-secondary); font-size: 12px; }

/* ── Search ────────────────────────────────────────────────────────────── */
.search-box { margin-bottom: 20px; }
.search-box input { font-size: 18px; padding: 14px 18px; }
.search-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 14px 16px; margin-bottom: 12px; cursor: pointer;
}
.search-result:hover { background: var(--bg-hover); }
.search-result .title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-result .snippet { color: var(--text-secondary); margin-top: 8px; font-size: 13px; }
.search-result .snippet mark { background: rgba(251,225,34,0.3); color: var(--text-primary); padding: 0 2px; }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 18px;
}
.pagination button { min-width: 36px; }
.pagination .page-info { color: var(--text-muted); margin: 0 8px; }

/* ── Filter bar ────────────────────────────────────────────────────────── */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; align-items: end; margin-bottom: 18px;
}
.filter-bar .form-field { gap: 4px; }
.checkbox-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.checkbox-row input { width: auto; }

/* ── Tabs (admin) ──────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border-color); margin-bottom: 18px; }
.tab {
  padding: 10px 16px; cursor: pointer; color: var(--text-secondary);
  border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none;
  font-size: 14px; font-weight: 500;
}
.tab.active { color: var(--brand-puddle); border-bottom-color: var(--brand-puddle); }

/* ── Maintenance calendar ──────────────────────────────────────────────── */
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.calendar-header .month-title { font-size: 18px; font-weight: 700; }
.calendar-nav { display: flex; gap: 8px; align-items: center; }
.calendar-legend {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 12px; color: var(--text-secondary);
}
.calendar-legend .legend-group {
  color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.4px;
}
.calendar-legend .legend-group:not(:first-child) { margin-left: 10px; }
/* Legend entries double as filters — click to hide/show that status. */
.calendar-legend .legend-item {
  display: inline-flex; align-items: center;
  cursor: pointer; user-select: none;
  padding: 2px 8px; border-radius: 10px;
  border: 1px solid transparent;
}
.calendar-legend .legend-item:hover { border-color: var(--border-color); background: var(--bg-hover); }
.calendar-legend .legend-item.off { opacity: 0.35; }
.calendar-legend .legend-item.off .swatch { background: var(--text-disabled) !important; }
.calendar-legend .swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 5px; vertical-align: baseline;
}
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
}
.calendar-dow {
  padding: 6px 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); background: var(--bg-tertiary);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.calendar-day {
  min-height: 96px; padding: 4px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
}
.calendar-day.other-month { background: var(--bg-primary); }
.calendar-day .day-num {
  font-size: 11px; color: var(--text-muted); padding: 2px 4px;
}
.calendar-day.today .day-num {
  color: var(--brand-puddle); font-weight: 700;
}
.calendar-block {
  display: block; font-size: 11px; font-weight: 600;
  padding: 2px 6px; margin: 2px 0; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; color: #fff; border-left: 3px solid transparent;
}
.calendar-block:hover { filter: brightness(1.25); color: #fff; }
/* Status colours — shared by the day-grid blocks and the legend swatches. */
.cb-scheduled   { background: rgba(0,85,135,0.55); border-left-color: var(--brand-puddle); }
.cb-proposed    { background: rgba(118,134,146,0.35); border-left-color: var(--brand-hazy); }
.cb-in_progress { background: rgba(234,118,0,0.4); border-left-color: var(--color-inprogress); }
.cb-completed   { background: rgba(120,190,32,0.28); border-left-color: var(--color-resolved); }
.cb-failed      { background: rgba(213,0,50,0.4); border-left-color: var(--color-critical); }
.cb-rolled_back { background: rgba(255,181,0,0.3); border-left-color: var(--color-low); }
/* Incident blocks (coloured by incident status; dashed edge marks the type) */
.cbi-Open       { background: rgba(42,196,255,0.3); border-left-color: var(--color-open); }
.cbi-InProgress { background: rgba(234,118,0,0.4); border-left-color: var(--color-inprogress); }
.cbi-Resolved   { background: rgba(120,190,32,0.28); border-left-color: var(--color-resolved); }
.calendar-block[class*="cbi-"] { border-left-style: dashed; }
.calendar-block .risk-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 4px; vertical-align: baseline;
}
.risk-dot.risk-Critical { background: var(--color-critical); }
.risk-dot.risk-High     { background: var(--color-high); }
.risk-dot.risk-Medium   { background: var(--color-medium); }
.risk-dot.risk-Low      { background: var(--color-low); }

/* Dashboard: overrun highlight */
.overrun { color: var(--color-critical); font-weight: 700; }

/* ── Mobile drawer ─────────────────────────────────────────────────────── */
.nav-overlay { display: none; }

@media (max-width: 768px) {
  .nav-hamburger { display: block; }
  .nav-links, .nav-user {
    position: fixed;
    top: var(--nav-height);
    right: 0;
    width: 250px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    margin: 0;
  }
  .nav.open .nav-links {
    transform: translateX(0);
    top: var(--nav-height);
    height: auto;
    border-bottom: 1px solid var(--border-color);
  }
  .nav.open .nav-user {
    transform: translateX(0);
    top: calc(var(--nav-height) + 260px); /* below the links drawer */
    border-bottom: 1px solid var(--border-color);
  }

  .calendar-day { min-height: 64px; }

  .form-grid, .detail-grid { grid-template-columns: 1fr; }

  /* Tables → cards */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr {
    margin-bottom: 12px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); padding: 6px 10px; background: var(--bg-secondary);
  }
  table.data td {
    border: none; display: flex; justify-content: space-between; gap: 12px;
    padding: 6px 0;
  }
  table.data td::before {
    content: attr(data-label);
    color: var(--text-muted); font-size: 11px; text-transform: uppercase;
    font-weight: 600; letter-spacing: 0.4px;
  }
}
