/* ==========================================================================
   WMAS Radio Communications Hub — Stylesheet
   Design system — colours, typography, layout, cards, responsive.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS (CSS variables)
   Change these to re-theme the whole dashboard from one place.
   -------------------------------------------------------------------------- */
:root {
  /* Brand colours */
  --navy-900: #0b1f3b;      /* dark navy header/sidebar */
  --navy-800: #142a4d;
  --navy-700: #1d3a63;
  --wmas-green: #17a673;    /* WMAS-style green accent */
  --wmas-green-dark: #12855c;
  --nhs-blue: #005eb8;      /* NHS blue secondary accent */
  --nhs-blue-dark: #004a92;

  /* Card accent palette (summary cards, categories, dots) */
  --accent-teal: #0fb5ae;
  --accent-amber: #f5a623;
  --accent-violet: #7c6cf0;
  --accent-coral: #f2685c;
  --accent-green: #17a673;
  --accent-blue: #005eb8;
  --accent-orange: #ef8b2c;
  --accent-red: #e5484d;

  /* Neutral / surface colours (light theme) */
  --bg-page: #f3f5f8;
  --bg-card: #ffffff;
  --bg-subtle: #eef1f5;
  --border-color: #e2e6ec;
  --text-primary: #16202e;
  --text-secondary: #5b6675;
  --text-muted: #8993a4;

  /* Typography */
  --font-heading: 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Shape & elevation */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, 0.12);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 72px;

  /* Motion */
  --transition-fast: 150ms ease;
  --transition-med: 250ms ease;
}

/* Dark theme overrides — activated via data-theme="dark" on <html> */
[data-theme="dark"] {
  --bg-page: #0d1520;
  --bg-card: #141d2b;
  --bg-subtle: #1a2434;
  --border-color: #263144;
  --text-primary: #eef1f5;
  --text-secondary: #aab3c2;
  --text-muted: #778394;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-med), color var(--transition-med);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  margin: 0;
  color: var(--text-primary);
}

p {
  margin: 0;
  color: var(--text-secondary);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* Accessible keyboard focus state — visible on every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--nhs-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link — hidden until focused */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--nhs-blue);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--transition-fast);
}
.skip-link:focus {
  top: 1rem;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   3. APP LAYOUT (sidebar + main column)
   -------------------------------------------------------------------------- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform var(--transition-med);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
}

.emblem {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wmas-green), var(--nhs-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.sidebar-brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.sidebar-brand-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
}

.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.15rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-link.active {
  background: linear-gradient(90deg, var(--wmas-green), var(--wmas-green-dark));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.sidebar-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: background var(--transition-fast);
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Overlay behind mobile drawer */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 59, 0.5);
  z-index: 90;
}

/* ---- Main column ---- */
.main-column {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   4. TOP BAR
   -------------------------------------------------------------------------- */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
}
.menu-toggle span {
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1rem;
  margin-left: 1rem;
}
.topbar-search input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  font-size: 0.88rem;
  color: var(--text-primary);
  font-family: inherit;
}
.topbar-search input::placeholder {
  color: var(--text-muted);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.icon-btn {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.icon-btn:hover {
  background: var(--bg-page);
  transform: translateY(-1px);
}
.notif-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}
.notif-dot.hidden {
  display: none;
}

/* ---- Notification dropdown ---- */
.notif-wrapper {
  position: relative;
}
.notif-dropdown {
  display: none; /* toggled to block via JS */
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
  animation: notif-drop-in 0.18s ease;
}
.notif-dropdown.open {
  display: block;
}
@keyframes notif-drop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.88rem;
}
.notif-clear-btn {
  background: none;
  border: none;
  color: var(--nhs-blue);
  font-size: 0.76rem;
  font-weight: 600;
}
.notif-clear-btn:hover {
  text-decoration: underline;
}
.notif-list {
  max-height: 320px;
  overflow-y: auto;
}
.notif-list li {
  display: flex;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
}
.notif-list li:last-child {
  border-bottom: none;
}
.notif-list li.unread {
  background: var(--bg-subtle);
}
.notif-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.notif-body {
  min-width: 0;
}
.notif-text {
  color: var(--text-primary);
  line-height: 1.4;
}
.notif-time {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.notif-empty {
  padding: 1.5rem 1rem !important;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.82rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-color);
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nhs-blue), var(--wmas-green));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.topbar-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.topbar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
}
.topbar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   5. CONTENT LAYOUT
   -------------------------------------------------------------------------- */
.content {
  padding: 1.5rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.section {
  margin-bottom: 1.25rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.content-col-main,
.content-col-side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   6. CARD BASE STYLE
   Shared "bubble card" look: rounded corners + soft shadow + hover lift.
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--transition-med), transform var(--transition-med);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   7. DASHBOARD COMPONENTS
   -------------------------------------------------------------------------- */

/* ---- 7.1 Welcome card ---- */
.welcome-card {
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  background: linear-gradient(120deg, var(--nhs-blue) 0%, var(--wmas-green) 100%);
  box-shadow: var(--shadow-md);
  color: #fff;
}
.welcome-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.welcome-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}
.edit-dashboard-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background var(--transition-fast);
}
.edit-dashboard-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.welcome-text h2 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}
.welcome-date {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}
.welcome-message {
  color: rgba(255, 255, 255, 0.92);
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

/* Big, friendly clock — the headline element of the header rather than a
   small badge. Large tabular-nums digits so it reads clearly at a glance
   from across a room, which is the point of it sitting on a shared screen. */
.welcome-clock-large {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.5rem;
  text-align: center;
}
.welcome-clock-digits {
  display: block;
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums; /* stops digits jittering the width every second */
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.welcome-clock-caption {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 700;
  margin-top: 0.2rem;
}

/* Glassmorphism meta row: version + last updated — sits below the status
   strip, translucent "frosted glass" pills over the gradient */
.welcome-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}
.welcome-meta-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}
.welcome-meta-icon {
  font-size: 0.85rem;
}

/* ---- 7.1b Top-level status strip (on-call, engineers, vehicles, projects, RFCs) ---- */
.welcome-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  color: #fff;
  flex-shrink: 0;
  transition: transform var(--transition-fast), background var(--transition-fast);
  /* Subtle fade-in-up on load — staggered per pill below */
  animation: status-pill-in 0.4s ease backwards;
}
.status-pill:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-2px);
}
.status-pill:nth-child(1) { animation-delay: 0s; }
.status-pill:nth-child(2) { animation-delay: 0.05s; }
.status-pill:nth-child(3) { animation-delay: 0.1s; }
.status-pill:nth-child(4) { animation-delay: 0.15s; }
.status-pill:nth-child(5) { animation-delay: 0.2s; }

@keyframes status-pill-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-pill-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}
.status-pill-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.status-pill-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 700;
}
.status-pill-value {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The on-call pill is emphasised — item 6 of the Phase B brief asks for the
   current on-call engineer to stand out clearly near the top of the page */
.status-pill-oncall {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.4);
}
.status-pill-oncall .status-pill-value {
  white-space: normal; /* name + dates can wrap rather than truncate */
}

/* ---- 7.2 Summary cards ---- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}
.summary-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.summary-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
}
/* When a card has a linkTo target, its icon becomes a clickable "jump to
   full section" button — cursor and a gentle scale on hover signal that,
   without relying on colour alone (see aria-label set in JS). */
.summary-icon-link {
  cursor: pointer;
  border: none;
  padding: 0;
  transition: transform var(--transition-fast);
}
.summary-icon-link:hover,
.summary-icon-link:focus-visible {
  transform: scale(1.08);
}
.summary-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.summary-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* ---- 7.3 Important This Week list ---- */
.important-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
}
.important-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.important-tag {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-pill);
  color: #fff;
  margin-top: 0.1rem;
}
.tag-change   { background: var(--accent-violet); }
.tag-meeting  { background: var(--accent-blue); }
.tag-fleet    { background: var(--accent-teal); }
.tag-important{ background: var(--accent-red); }

.important-body p {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}
.important-body span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ---- 7.4 On call, and shared "editable card" pattern ----
   .card-header-row + .icon-edit-btn: pencil icon next to any card title.
   .oncall-form: the two-field on-call editor.
   .edit-panel: the reusable add/remove list editor used by Important This
   Week, Upcoming RFCs, and Project Overview. */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-header-row .card-title {
  margin-bottom: 0;
}
.icon-edit-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.icon-edit-btn:hover {
  background: var(--bg-page);
}

.oncall-form {
  display: none; /* toggled to flex via JS */
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.oncall-form.open {
  display: flex;
}
.oncall-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.oncall-form-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
}
.oncall-form select,
.oncall-form input[type="text"] {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-primary);
}
.oncall-form-actions {
  display: flex;
  gap: 0.6rem;
}
.btn-primary {
  background: var(--wmas-green);
  border: 1px solid var(--wmas-green-dark);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.btn-primary:hover {
  background: var(--wmas-green-dark);
}

/* ---- Reusable "edit panel" list editor (Important This Week, RFCs, Projects) ---- */
.edit-panel {
  display: none; /* toggled to block via JS */
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.edit-panel.open {
  display: block;
}
.edit-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.edit-panel-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
}
.edit-panel-row-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.edit-panel-remove-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--accent-red);
  font-size: 1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.edit-panel-remove-btn:hover {
  background: rgba(229, 72, 77, 0.12);
}

.edit-panel-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.edit-panel-form select,
.edit-panel-form input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-primary);
  width: 100%;
}
.edit-panel-form .btn-primary {
  justify-self: start;
}

/* RFCs add-form: day/month/time are short, text is long — lay out in a row on wider screens */
.rfcs-add-form {
  grid-template-columns: 70px 70px 1fr 90px auto;
  align-items: center;
}
/* Actions add-form: description is long, assignee is short */
.actions-add-form {
  grid-template-columns: 1fr 140px auto;
  align-items: center;
}
/* Vehicles add-form: callsign is short, task is long, date is medium */
.vehicles-add-form {
  grid-template-columns: 100px 1fr 120px auto;
  align-items: center;
}

.edit-panel-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

/* Editable percentage input on each project row */
.project-percent-input {
  width: 55px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--nhs-blue);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  text-align: right;
  background: var(--bg-page);
}

/* Owner / status / due-date inputs on each project edit row — smaller and
   plainer than the percent input since they're secondary fields */
.project-owner-input,
.project-duedate-input {
  width: 110px;
  font-family: inherit;
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  background: var(--bg-page);
  color: var(--text-primary);
}
.project-status-select {
  font-family: inherit;
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  background: var(--bg-page);
  color: var(--text-primary);
}

/* Owner / status / due-date shown on the main (non-editing) project card */
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
}
.project-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.project-status-badge {
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Projects add-form: name is long, everything else is short */
.projects-add-form {
  grid-template-columns: 1fr 110px 130px 130px 70px auto;
  align-items: center;
}

.oncall-block {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 0;
}
.oncall-block + .oncall-block {
  border-top: 1px solid var(--border-color);
}
.oncall-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--nhs-blue), var(--wmas-green));
}
.oncall-avatar.current {
  box-shadow: 0 0 0 4px rgba(23, 166, 115, 0.25), 0 0 0 2px var(--wmas-green);
}
.oncall-name {
  font-weight: 700;
  font-size: 0.92rem;
}
.oncall-dates {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}
.oncall-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.oncall-phone {
  margin-left: auto;
  font-size: 1.1rem;
}

/* ---- 7.5 Team availability ---- */
.team-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  font-size: 0.88rem;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-working   { background: var(--accent-green); }
.status-leave     { background: var(--accent-orange); }
.status-project   { background: var(--accent-blue); }
.status-unavailable { background: var(--accent-red); }

.team-list .team-name {
  font-weight: 600;
  color: var(--text-primary);
}
.team-list .team-detail {
  color: var(--text-muted);
  margin-left: auto;
  font-size: 0.8rem;
}

/* ---- 7.6 Annual leave ---- */
.leave-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.leave-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
}
.leave-icon {
  font-size: 1.1rem;
}
.leave-card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.leave-name {
  font-weight: 600;
  font-size: 0.86rem;
}
.leave-dates {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.leave-countdown {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--wmas-green);
  white-space: nowrap;
}

/* ---- 7.7 Quick actions — modern coloured "app tile" design ---- */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.quick-action-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
/* Thin coloured accent strip along the top — ties each tile to its --tile-color
   custom property, set inline per-tile from data/quicklinks.json */
.quick-action-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tile-color, var(--nhs-blue));
}
.quick-action-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--tile-color, var(--nhs-blue));
}
.quick-action-icon-badge {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: var(--radius-md);
  background: var(--tile-color, var(--nhs-blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform var(--transition-fast);
}
.quick-action-tile:hover .quick-action-icon-badge {
  transform: scale(1.08);
}
.quick-action-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
}
.quick-action-description {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ---- 7.8 Upcoming work / RFC timeline ---- */
.timeline li {
  display: flex;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
}
.timeline li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.timeline-date {
  flex-shrink: 0;
  width: 78px;
  text-align: center;
}
.timeline-day {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  color: var(--nhs-blue);
  line-height: 1.1;
}
.timeline-month {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.timeline-body p {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}
.timeline-body span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ---- 7.9 Project overview / progress bars ---- */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.project-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.project-name {
  font-size: 0.88rem;
  font-weight: 600;
}
.project-percent {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--nhs-blue);
}
.progress-track {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  width: 0%; /* animated to target width via JS on load */
  background: linear-gradient(90deg, var(--nhs-blue), var(--wmas-green));
  transition: width 1s ease;
}

/* ---- 7.10 Weekly meeting notes ---- */
.meeting-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.meeting-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}
.meeting-subhead {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
/* Distinct colour cues for the two action columns — not the only signal
   (the heading text itself says "Outstanding"/"Completed"), just reinforcement */
.meeting-subhead-outstanding {
  color: var(--accent-amber);
}
.meeting-subhead-completed {
  color: var(--wmas-green);
}
.meeting-list li {
  font-size: 0.86rem;
  color: var(--text-primary);
  padding: 0.4rem 0;
  padding-left: 1.1rem;
  position: relative;
}
.meeting-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wmas-green);
}
/* Completed actions read as done — struck through, muted, green dot */
.meeting-list-completed li {
  color: var(--text-muted);
  text-decoration: line-through;
}
.meeting-list-completed li::before {
  background: var(--wmas-green);
}
/* Empty-state text when a column has nothing to show */
.meeting-list-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 1.1rem;
}

.btn-secondary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.btn-secondary:hover {
  background: var(--bg-page);
}

/* ---- 7.11 Latest documents ---- */
.document-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.86rem;
}
.document-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.doc-icon {
  font-size: 1.05rem;
}
.doc-name {
  font-weight: 500;
  color: var(--text-primary);
}
.doc-date {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- 7.11b Open Actions ---- */
.actions-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}
.actions-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.actions-list li.done .action-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.action-checkbox {
  margin-top: 0.15rem;
  width: 17px;
  height: 17px;
  accent-color: var(--wmas-green);
  cursor: pointer;
  flex-shrink: 0;
}
.action-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.action-text {
  color: var(--text-primary);
  font-weight: 500;
}
.action-assignee {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ---- 7.11c Vehicles Scheduled ---- */
.vehicles-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.vehicles-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.vehicle-callsign {
  font-weight: 700;
  color: var(--nhs-blue);
  font-size: 0.8rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.5rem;
  flex-shrink: 0;
}
.vehicle-task {
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}
.vehicle-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- 7.12 Training and resources ---- */
.training-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.training-card {
  border-radius: var(--radius-md);
  padding: 1rem 0.85rem;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform var(--transition-fast);
}
.training-card:hover {
  transform: translateY(-2px);
}
.training-icon {
  font-size: 1.3rem;
}

/* ---- 7.13 Latest update news card ---- */
.news-card {
  overflow: hidden;
}
.news-graphic {
  height: 110px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--navy-900), var(--nhs-blue) 60%, var(--wmas-green));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.news-graphic::before,
.news-graphic::after {
  content: '';
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}
.news-graphic::before {
  width: 140px;
  height: 140px;
}
.news-graphic::after {
  width: 190px;
  height: 190px;
}
.news-graphic-icon {
  font-size: 2.2rem;
  z-index: 1;
}
.news-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   8. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 200;
}
.toast {
  background: var(--navy-900);
  color: #fff;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  max-width: 300px;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   9. MODAL
   -------------------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 59, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 90%;
  padding: 1.75rem;
}
.modal-title {
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}
.modal-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}
.modal-body code {
  background: var(--bg-subtle);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* Wider modal variant — used by Edit Dashboard since it now has real controls,
   not just an info paragraph */
.modal-wide {
  max-width: 560px;
}
.modal-section {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border-color);
}
.modal-section:first-of-type {
  border-top: none;
  padding-top: 0.25rem;
}
.modal-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.modal-section-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

/* Colour theme swatches */
.theme-swatch-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.theme-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}
.theme-swatch:hover {
  transform: scale(1.08);
}
.theme-swatch.active {
  border-color: var(--text-primary);
}
.theme-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---- Rearrange (drag-and-drop card reorder) mode ---- */
/* Applied to .content-col-main / .content-col-side while active, and to
   each .section within them, so cards get a visible "this can move" cue */
.rearrange-active {
  position: relative;
  cursor: grab;
  outline: 2px dashed var(--border-color);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
  transition: outline-color var(--transition-fast);
}
.rearrange-active:hover {
  outline-color: var(--nhs-blue);
}
.rearrange-active.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.rearrange-active.drag-over {
  outline-color: var(--wmas-green);
  outline-style: solid;
}
.drag-handle {
  display: none; /* only shown while rearrange mode is active */
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.rearrange-active .drag-handle {
  display: flex;
}

/* Utility: hide items filtered out by the search box */
.search-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   10. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 2rem 1rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   11. RESPONSIVE BREAKPOINTS
   Desktop (1920 / laptop) -> tablet -> mobile.
   Sidebar becomes an off-canvas drawer below 1024px.
   -------------------------------------------------------------------------- */

/* Laptop / smaller desktops: slightly tighter side column */
@media (max-width: 1280px) {
  .content-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

/* Tablet-ish widths: 3 columns gets cramped before full mobile stacking kicks in */
@media (max-width: 1400px) and (min-width: 641px) {
  .meeting-columns {
    grid-template-columns: 1fr 1fr;
  }
  .meeting-columns > div:first-child {
    grid-column: 1 / -1; /* Key Decisions spans full width above the two action columns */
  }
}

/* Tablet and below: 4 summary cards become 2x2 */
@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet and below: stack the two-column layout, collapse sidebar */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close {
    display: block;
  }
  .sidebar-overlay.open {
    display: block;
  }

  .main-column {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    display: none; /* save space; brand already shown via menu */
  }
}

/* Mobile phones */
@media (max-width: 640px) {
  .topbar {
    padding: 0 1rem;
    gap: 0.6rem;
  }
  .topbar-search {
    margin-left: 0;
  }
  .topbar-user-text {
    display: none; /* keep just the avatar to save space */
  }
  .topbar-date {
    display: none;
  }
  .content {
    padding: 1rem;
  }
  .card {
    padding: 1.15rem;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .rfcs-add-form {
    grid-template-columns: 1fr;
  }
  .actions-add-form,
  .vehicles-add-form,
  .projects-add-form {
    grid-template-columns: 1fr;
  }
  /* Mobile: status strip scrolls horizontally rather than wrapping to many
     rows, so the welcome card doesn't grow tall and push content down */
  .welcome-status-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.3rem; /* room for the scrollbar without clipping pills */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .status-pill {
    scroll-snap-align: start;
  }
  .welcome-card {
    padding: 1.5rem;
  }
  .welcome-side {
    align-items: stretch;
    width: 100%;
  }
  .welcome-clock-digits {
    font-size: 1.6rem;
  }
  .welcome-clock-large {
    padding: 0.6rem 1rem;
  }
  .quick-actions-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .timeline-date {
    width: 60px;
  }
  .meeting-columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .training-grid {
    grid-template-columns: 1fr;
  }
}
