/* -----------------------------------------------------------------------
   Team Scheduler — global stylesheet
   Brand: Northmore Gordon — page 22 priority order
   Navy dominant · Sky blue secondary · Gold highlight · Silver utility
----------------------------------------------------------------------- */

:root {
  /* NG Brand tokens */
  --ng-navy:   #34374C;   /* 1. dominant: structure, sidebar, headings, body text */
  --ng-sky:    #21AAFF;   /* 2. secondary: actions, links, active states, key data */
  --ng-gold:   #F4C24B;   /* 3. highlight: one accent per view */
  --ng-silver: #D9D9D9;   /* 4. utility: borders, gridlines, inactive */
  --ng-white:  #FFFFFF;
  --ng-grey:   #F5F6F8;   /* shell & card backgrounds */

  /* Accessible status system. Status is also expressed through text, border
     and shape; colour is never the only signal. "Good" deliberately uses NG
     blue rather than green so the traffic-light system is colour-blind safe. */
  --status-good:          #34374C;
  --status-good-bg:       #CBE9FC;
  --status-good-border:   #087EBE;
  --status-good-fill:     #168ED1;
  --status-warning:       #5C3A00;
  --status-warning-bg:    #FFE29A;
  --status-warning-border:#9A6500;
  --status-warning-fill:  #B87900;
  --status-watch:         #6F3200;
  --status-watch-bg:      #F5C99C;
  --status-watch-border:  #B85200;
  --status-critical:      #711616;
  --status-critical-bg:   #F4C2C2;
  --status-critical-border:#A82626;
  --status-critical-fill: #B52F2F;
  --status-neutral:       #454854;
  --status-neutral-bg:    #DEE1E6;
  --status-neutral-border:#7A7D88;
  --status-over:          #442761;
  --status-over-bg:       #DDCFF0;
  --status-over-border:   #69458C;

  /* Semantic aliases used throughout the app */
  --bg:          #F5F6F8;
  --surface:     #FFFFFF;
  --header-bg:   #34374C;
  --header-fg:   #FFFFFF;
  --nav-active:  #21AAFF;
  --accent:      #21AAFF;
  --accent-dark: #087EBE;
  --text:        #34374C;
  --text-muted:  #656875;
  --border:      #D9D9D9;
  --green:       var(--status-good-fill); /* legacy alias: good status is NG blue */
  --amber:       #7A4E00;
  --red:         #991B1B;
  --green-bg:    var(--status-good-bg);
  --amber-bg:    var(--status-warning-bg);
  --red-bg:      var(--status-critical-bg);
  --radius:      8px;
  --shadow:      0 1px 2px rgba(52,55,76,.08);

  /* Typography */
  --font-heading: "Bahnschrift Condensed", "Bahnschrift", "Arial Narrow", Arial, sans-serif;
  --font-body:    Arial, Helvetica, "Liberation Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.45;
  overflow-x: hidden;
}

a { color: #006CA8; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 9px 14px;
  border-radius: 5px;
  background: var(--ng-white);
  color: var(--ng-navy);
  border: 2px solid var(--ng-sky);
  box-shadow: var(--shadow);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

:focus-visible {
  outline: 3px solid rgba(33,170,255,.55);
  outline-offset: 2px;
}

::selection { background: var(--status-good-bg); color: var(--ng-navy); }

/* ------------------------------------------------------------------
   Header & Nav
------------------------------------------------------------------ */

header {
  background: var(--header-bg);
  color: var(--header-fg);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

header .brand img { vertical-align: -5px; margin-right: 7px; }

header .brand {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .3px;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

nav a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
nav a.active { background: var(--nav-active); color: var(--ng-navy); font-weight: 700; }

.nav-admin { position:relative; flex:0 0 auto; }
.nav-admin summary {
  list-style:none;
  cursor:pointer;
  color:rgba(255,255,255,.78);
  padding:6px 10px;
  border-radius:6px;
  font-size:13px;
  white-space:nowrap;
}
.nav-admin summary::-webkit-details-marker { display:none; }
.nav-admin summary::after { content:"\2304"; margin-left:5px; font-size:10px; }
.nav-admin summary:hover,
.nav-admin[open] summary,
.nav-admin.has-active summary { background:rgba(255,255,255,.1); color:var(--ng-white); }
.nav-admin.has-active summary { box-shadow:inset 0 -2px 0 var(--ng-sky); }
.nav-admin-menu {
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  z-index:250;
  min-width:180px;
  padding:6px;
  border:1px solid var(--border);
  border-radius:7px;
  background:var(--surface);
  box-shadow:0 8px 24px rgba(52,55,76,.18);
}
.nav-admin-menu a {
  display:block;
  padding:8px 10px;
  border-radius:5px;
  color:var(--text);
  text-decoration:none;
  font-size:13px;
}
.nav-admin-menu a:hover { background:var(--ng-grey); }
.nav-admin-menu a.active { background:var(--status-good-bg); color:var(--ng-navy); font-weight:700; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
}

#account-chip { color: rgba(255,255,255,.78) !important; }
#account-chip .btn-secondary { background:transparent; color:var(--ng-white); border-color:rgba(255,255,255,.4); }

.header-meta .sync-time { font-variant-numeric: tabular-nums; }

/* Sync button — gold highlight (one accent per view) */
#sync-btn {
  background: var(--ng-gold) !important;
  color: var(--ng-navy) !important;
  font-weight: 600;
  border: none;
}
#sync-btn:hover { background: #e5b33d !important; }
#sync-btn:disabled { opacity: .6; }

/* ------------------------------------------------------------------
   Layout
------------------------------------------------------------------ */

main {
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

.page-subtitle {
  max-width: 850px;
  margin: -12px 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: .2px;
  color: var(--text);
  margin: 0 0 20px;
}

/* ------------------------------------------------------------------
   KPI Cards
------------------------------------------------------------------ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi-value.pending {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 2.4;
}

.kpi-unit {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ------------------------------------------------------------------
   Cards & Sections
------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  max-width: 100%;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .15px;
  color: var(--text);
  margin: 0;
}

.card > .card-title:first-child { padding: 16px 20px 0; }

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ------------------------------------------------------------------
   Tables
------------------------------------------------------------------ */

.table-wrap { max-width:100%; min-width:0; overflow-x: auto; }

.current-period-head {
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
}
.current-period-flag {
  display:inline-block;
  padding:2px 6px;
  border:1px solid var(--ng-sky);
  border-radius:10px;
  background:var(--status-good-bg);
  color:var(--ng-navy);
  font-size:9px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--ng-grey);
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--ng-grey); }

tbody td {
  padding: 11px 16px;
  color: var(--text);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.member-table-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-weight: 500; }

/* ------------------------------------------------------------------
   Utilisation badges & bars
------------------------------------------------------------------ */

.util-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  gap: 5px;
}

.util-green { background: var(--status-good-bg); color: var(--status-good); border-color: var(--status-good-border); }
.util-amber { background: var(--status-warning-bg); color: var(--status-warning); border-color: var(--status-warning-border); }
.util-red   { background: var(--status-critical-bg); color: var(--status-critical); border-color: var(--status-critical-border); }
.util-none  { background: var(--status-neutral-bg); color: var(--status-neutral); border-color: var(--status-neutral-border); }

.util-green::before { content: "\2713"; }
.util-amber::before { content: "\25B2"; font-size: .72em; }
.util-red::before   { content: "!"; font-weight: 800; }

.burn-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.burn-bar {
  flex: 1;
  height: 8px;
  background: var(--ng-silver);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}

.burn-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}

.burn-green { background: var(--status-good-fill); }
.burn-amber { background: repeating-linear-gradient(135deg,var(--status-warning-fill) 0 5px,#E7B84E 5px 9px); }
.burn-red   { background: repeating-linear-gradient(90deg,var(--status-critical-fill) 0 6px,#A82626 6px 9px); }

.burn-pct {
  font-size: 12px;
  font-weight: 600;
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------
   Buttons
------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 36px;
  transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--accent);
  color: var(--ng-navy);
  border-color: var(--accent);
}
.btn-primary:hover { background: #70C9FF; border-color: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: var(--ng-grey);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #e8eaed; }

.btn-danger {
  background: var(--status-critical-bg);
  color: var(--status-critical);
  border-color: var(--status-critical-border);
}
.btn-danger:hover { background:#F8D9D9; }

button:disabled, .btn:disabled { cursor:not-allowed; opacity:.58; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.3;
  max-width:100%;
}

.btn, button { max-width:100%; }
img, svg, canvas { max-width:100%; }
.kpi-grid > *, .form-grid > *, .period-bar > *, .card-header > * { min-width:0; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-dark); }

/* ------------------------------------------------------------------
   Status & alerts
------------------------------------------------------------------ */

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot-green { background: var(--status-good-fill); box-shadow: 0 0 0 2px var(--status-good-bg); }
.dot-amber { background: var(--status-warning-fill); border-radius: 2px; transform: rotate(45deg); }
.dot-red   { background: var(--status-critical-fill); border-radius: 1px; }
.dot-grey  { background: var(--status-neutral-border); }

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-warning {
  background: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--status-warning);
}
.alert-info {
  background: var(--status-good-bg);
  border-color: var(--status-good-border);
  color: var(--ng-navy);
}

.alert-error {
  background: var(--status-critical-bg);
  border-color: var(--status-critical-border);
  color: var(--status-critical);
}

.status-label {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:3px 8px;
  border:1px solid var(--status-neutral-border);
  border-radius:5px;
  background:var(--status-neutral-bg);
  color:var(--status-neutral);
  font-size:11px;
  font-weight:700;
}
.status-label::before { content:"\2014"; }
.status-label.status-good { background:var(--status-good-bg); border-color:var(--status-good-border); color:var(--status-good); }
.status-label.status-good::before { content:"\2713"; }
.status-label.status-warning { background:var(--status-warning-bg); border-color:var(--status-warning-border); color:var(--status-warning); }
.status-label.status-warning::before { content:"\25B2"; font-size:.72em; }
.status-label.status-critical { background:var(--status-critical-bg); border-color:var(--status-critical-border); color:var(--status-critical); }
.status-label.status-critical::before { content:"!"; }

/* ------------------------------------------------------------------
   Empty states
------------------------------------------------------------------ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state p { margin: 0 0 8px; }
.empty-state .empty-icon { display: none; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text); }
.empty-state .empty-desc  { font-size: 13px; }

/* ------------------------------------------------------------------
   Spinner
------------------------------------------------------------------ */

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner-dark {
  border-color: rgba(0,0,0,.1);
  border-top-color: var(--accent);
}

/* .spinner sets display, which outranks the user-agent [hidden] rule, so a
   spinner toggled with el.hidden would otherwise never disappear. */
.spinner[hidden] { display:none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior:auto !important;
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}

/* ------------------------------------------------------------------
   Forms (login / setup)
------------------------------------------------------------------ */

.form-card {
  max-width: 420px;
  margin: 80px auto 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 32px;
}

.form-card h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 6px;
}

.form-card p.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.form-group input, .form-group select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-group input:focus, .form-group select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(33,170,255,.18);
}

.form-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0 18px;
}
.form-span-2 { grid-column:1 / -1; }
.form-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:8px; }
.account-results, .search-results {
  border:1px solid var(--border); border-radius:6px; max-height:180px;
  overflow-y:auto; margin-top:4px; background:var(--surface);
}
.account-result, .search-result {
  width:100%; border:0; border-bottom:1px solid var(--border); background:transparent;
  color:var(--text); padding:8px 10px; text-align:left; cursor:pointer;
}
.account-result:last-child, .search-result:last-child { border-bottom:0; }
.account-result:hover,.account-result:focus,
.search-result:hover,.search-result:focus { background:var(--status-good-bg); outline:2px solid var(--ng-sky); }
.search-result-sub { display:block; font-size:11px; color:var(--text-muted); margin-top:2px; }
.search-searching { padding:8px 10px; font-size:13px; color:var(--text-muted); }

/* .card carries no padding of its own — pages are expected to supply it via
   .card-header / .card-title. A form rendered straight into a bare card
   therefore renders flush against the border on all four sides. */
.card-form { padding:20px; }
.card-form > .form-grid { gap:0 18px; }
.card-form .form-actions { margin-top:14px; }

.field-note { font-size:12px; color:var(--text-muted); margin-top:6px; }
.field-note-required { color:var(--text); font-weight:600; }

@media (max-width:768px) {
  main { padding:16px; }
  .form-grid { grid-template-columns:1fr; }
  .form-span-2 { grid-column:auto; }
}

.form-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
}

/* ------------------------------------------------------------------
   Setup page specifics
------------------------------------------------------------------ */

.setup-section {
  margin-bottom: 28px;
}
.setup-section h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.setup-step {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--accent);
  color: var(--ng-navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}
.step-body { flex: 1; }
.step-body p { margin: 0 0 8px; }

code, pre {
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 12px;
}
.code-block {
  background: var(--ng-grey);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  white-space: pre;
  overflow-x: auto;
  color: var(--text);
  margin-bottom: 8px;
}

/* ------------------------------------------------------------------
   Responsive tweaks
------------------------------------------------------------------ */

@media (max-width: 640px) {
  main { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  nav a { padding: 10px 8px; font-size: 12px; }
  .btn, button, input, select { min-height: 44px; }
  .card-header { flex-wrap: wrap; gap: 10px; }
  .card-header > * { min-width: 0; max-width: 100%; }
  .card > table,
  main > table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }
}

/* ------------------------------------------------------------------
   Planner screen
------------------------------------------------------------------ */

.planner-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.preset-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-preset {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  font-family: var(--font-body);
}

.btn-preset:hover { background: var(--ng-grey); color: var(--text); }
.btn-preset.active { background: var(--accent); color: var(--ng-navy); border-color: var(--accent); font-weight:700; }
.btn-preset-excluded { border-style: dashed; opacity: 0.7; }
.btn-preset-excluded:hover { opacity: 1; }
.btn-preset-excluded.active { border-style: solid; opacity: 1; }

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-nav {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
  font-family: var(--font-body);
}

.btn-nav:hover { background: var(--ng-grey); }

/* Planner grid */
.planner-grid { border-collapse: collapse; }

.planner-grid th { white-space: nowrap; }

.person-th {
  min-width: 280px;
  width: 280px;
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ng-grey);
  border-right: 2px solid var(--border);
}

.week-th {
  min-width: 110px;
  text-align: center;
  font-size: 11px;
  background: var(--ng-grey);
}

.person-td {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 280px;
  max-width: 280px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-right: 2px solid var(--border);
}

tbody tr:hover .person-td { background: var(--ng-grey); }

.plan-cell {
  position: relative;
  vertical-align: top;
  padding: 4px;
  min-width: 110px;
}

.plan-cell:hover { background: var(--ng-grey); }

.alloc-block {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1.5px solid;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 2px;
  transition: filter .1s;
  overflow: hidden;
}

.alloc-block:hover { filter: brightness(0.93); }

.block-job {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-hours {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
  opacity: 0.85;
}

.cell-total {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 0;
  text-align: right;
}

.add-alloc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  line-height: 1;
  padding: 0;
}

.plan-cell:hover .add-alloc-btn { opacity: 1; }

.add-alloc-btn:hover {
  background: var(--status-good-bg);
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
  opacity: 1;
}

/* Drag handle inside alloc-block */
.block-drag {
  flex-shrink: 0;
  cursor: grab;
  opacity: 0.45;
  font-size: 12px;
  padding-right: 2px;
  user-select: none;
  line-height: 1;
}
.block-drag:active { cursor: grabbing; }

/* SortableJS classes */
.alloc-ghost {
  opacity: 0.4;
  border-style: dashed !important;
}

.alloc-blocks-wrap {
  min-height: 4px;
}

/* While dragging, every week cell becomes a generous drop target so dropping
   into an empty week reliably registers (item 5). */
body.planner-dragging .alloc-blocks-wrap {
  min-height: 34px;
  border: 1.5px dashed transparent;
  border-radius: 4px;
}
body.planner-dragging .plan-cell:hover .alloc-blocks-wrap {
  border-color: var(--accent);
  background: var(--status-good-bg);
}

/* Editable expanded job-row cells (items 1 & 2) */
.jx-cell.plan-cell:hover {
  background: var(--status-good-bg) !important;
  outline: 1px solid rgba(33,170,255,0.45);
  outline-offset: -1px;
}
.jx-add {
  color: var(--text-muted);
  opacity: 0;
  font-weight: 700;
  transition: opacity .15s;
}
.jx-cell:hover .jx-add { opacity: 0.8; }
.jx-addjob {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 10px;
}
.jx-addjob:hover {
  background: var(--status-good-bg);
  border-color: var(--accent);
}

/* ------------------------------------------------------------------
   Modal (allocation edit / add)
------------------------------------------------------------------ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 7px 10px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 4px;
  font-family: var(--font-body);
}

.modal-close:hover { background: var(--ng-grey); color: var(--text); }

.modal-body { padding: 20px; }

.modal-body .form-group:last-child { margin-bottom: 0; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------------
   Reports hub cards
------------------------------------------------------------------ */

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: box-shadow .15s, border-color .15s;
}

.report-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  border-color: var(--accent);
}
.report-card:focus-visible { border-color:var(--ng-sky); box-shadow:0 0 0 3px rgba(33,170,255,.22); }

.report-card-icon { display:none; }
.report-card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
}
.report-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.report-card-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  width: fit-content;
}
.badge-live { background: var(--status-good-bg); color: var(--status-good); border:1px solid var(--status-good-border); }
.badge-mc   { background: var(--status-warning-bg); color: var(--status-warning); border:1px solid var(--status-warning-border); }

/* ------------------------------------------------------------------
   Report page breadcrumb
------------------------------------------------------------------ */

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------
   Week / period selector bar
------------------------------------------------------------------ */

.period-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.period-bar label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.period-bar select,
.period-bar input[type="date"],
.period-bar input[type="week"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.period-bar .btn-export {
  margin-left: auto;
}

/* ------------------------------------------------------------------
   Sparkline canvas cells (utilisation report)
------------------------------------------------------------------ */

.sparkline-td { padding: 8px 16px !important; }
canvas.sparkline { display: block; }

/* week-heat columns in utilisation table */
.week-pct-cell {
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 8px 6px !important;
  min-width: 48px;
}

/* NG job number badge — the MC "Project Number" (Project_Code_Num__c) shown as a
   prefix on MC job names. Muted monospace so it reads as an identifier, not part
   of the title. Manual jobs have no code and get no badge. */
.job-code {
  display: inline-block;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 0.82em;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--ng-grey);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  margin-right: 2px;
  vertical-align: baseline;
  cursor: help;
}

/* Project names sit inside coloured planner chips, so the link cannot take an
   accent colour without wrecking the chip's contrast. It still has to LOOK
   clickable though — with colour:inherit and no underline there was no
   affordance at all, and the only clickable-looking names were the ones that
   happened to carry a grey code badge. A dotted underline in the inherited
   colour reads as a link in every chip palette. */
.project-link {
  color:inherit;
  text-decoration:underline;
  text-decoration-style:dotted;
  text-decoration-thickness:1px;
  text-underline-offset:2px;
  cursor:pointer;
}
.project-link:hover, .project-link:focus-visible {
  text-decoration-style:solid;
  text-decoration-thickness:2px;
}
/* Leave / team time: deliberately not a link. */
.project-plain { color:inherit; }
/* A local placeholder job with no Mission Control record behind it. */
.job-placeholder {
  display:inline-block;
  padding:0 4px;
  border:1px dashed currentColor;
  border-radius:3px;
  font-size:9px;
  font-weight:700;
  letter-spacing:.02em;
  text-transform:uppercase;
  opacity:.75;
  vertical-align:1px;
}

/* W16 two-tier actuals reports: open team aggregates above scoped person rows. */
.team-summary-panel { margin-bottom:20px; }
.team-summary-heading { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:16px 20px 10px; }
.team-summary-heading strong { display:block; font-family:var(--font-heading); color:var(--ng-navy); font-size:17px; }
.team-summary-heading span:not(.scope-chip) { display:block; color:var(--text-muted); font-size:12px; margin-top:2px; }
.scope-chip { display:inline-flex; padding:5px 9px; border-radius:5px; background:var(--status-good-bg); color:var(--ng-navy); border:1px solid var(--status-good-border); font-size:11px; font-weight:700; }
.team-summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:10px; padding:0 20px 18px; }
.team-summary-card { border:1px solid var(--border); border-radius:8px; padding:13px 14px; background:#fff; min-width:0; }
.team-summary-title { font-weight:700; color:var(--ng-navy); }
.team-summary-count { color:var(--text-muted); font-size:11px; margin:2px 0 10px; }
.team-summary-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.team-summary-metrics span { display:block; color:var(--text-muted); font-size:10px; text-transform:uppercase; letter-spacing:.04em; }
.team-summary-metrics strong { display:block; margin-top:2px; font-size:15px; color:var(--text); }
.team-summary-suppressed { color:var(--text-muted); font-size:12px; padding:8px 0; }
.team-summary-empty { color:var(--text-muted); font-size:13px; }
@media (max-width:700px) { .team-summary-heading { align-items:flex-start; flex-direction:column; } }

/* Common visual helpers used when migrating legacy inline styles. */
.text-muted { color:var(--text-muted) !important; }
.text-critical { color:var(--status-critical) !important; }
.text-warning { color:var(--status-warning) !important; }
.text-good { color:var(--status-good) !important; }
.surface-muted { background:var(--ng-grey) !important; }
.is-hidden { display:none !important; }
.compact { font-size:12px; }
.icon-button { min-width:36px; min-height:36px; padding:7px; justify-content:center; }

/* Legacy page-local names retained for compatibility, visually normalised to
   the accessible status system. */
.kpi-card.kpi-good { border-left:3px solid var(--status-good-border); }
.kpi-card.kpi-good .kpi-value { color:var(--ng-navy) !important; }
.kpi-card.kpi-warn { border-left:3px solid var(--status-warning-border); }
.kpi-card.kpi-warn .kpi-value { color:var(--status-warning) !important; }
.kpi-card.kpi-low { border-left:3px solid var(--status-critical-border); }
.kpi-card.kpi-low .kpi-value { color:var(--status-critical) !important; }
.load-green { background:var(--status-good-fill) !important; }
.load-amber { background:repeating-linear-gradient(135deg,var(--status-warning-fill) 0 5px,#E7B84E 5px 9px) !important; }
.load-red { background:repeating-linear-gradient(90deg,var(--status-critical-fill) 0 6px,#A82626 6px 9px) !important; }
.load-over { background:var(--status-over-border) !important; }
.cell-full { background:var(--status-good-bg) !important; }
.avail-positive { color:var(--ng-navy) !important; font-weight:600; }
.person-chip.active { background:var(--ng-sky) !important; color:var(--ng-navy) !important; border-color:var(--ng-sky) !important; font-weight:700; }
.diff-up { color:var(--status-good) !important; text-decoration:underline; text-decoration-color:var(--status-good-border); text-underline-offset:2px; }

@media (max-width: 900px) {
  header { height:auto; min-height:56px; padding:9px 14px; gap:10px; flex-wrap:wrap; }
  header .brand { font-size:16px; }
  header .brand img { display:none; }
  nav {
    order:3;
    flex-basis:calc(100% + 28px);
    margin:0 -14px -9px;
    padding:0 14px 7px;
    overflow-x:auto;
    scrollbar-width:none;
  }
  nav::-webkit-scrollbar { display:none; }
  #account-chip > span { display:none; }
  .header-meta .sync-time { display:none; }
  main { padding:20px 16px; }
}
