/* ═══════════════════════════════════════════════════════════════════════════
   Rework Position Tracker — styles.css
   Desktop-first. Responsive to 768 px.
   No external dependencies.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. Design tokens ──────────────────────────────────────────────────── */
:root {
  /* ══ New warm/slate design system ══ */

  /* Surface — warm off-white, paper-like */
  --bg:           #f6f6f4;
  --surface:      #ffffff;
  --surface-2:    #fafaf8;
  --line:         #e6e5e0;
  --line-strong:  #d6d4cc;

  /* Type */
  --ink:          #0f1419;
  --ink-2:        #2c3137;
  --ink-3:        #6b6f77;
  --ink-4:        #9a9ea4;

  /* Top chrome — dark slate */
  --nav-bg:       #15171c;
  --nav-bg-2:     #1d2027;
  --nav-line:     #2a2d35;
  --nav-ink:      #d6d8dc;
  --nav-ink-2:    #8b8f97;
  --nav-accent:   #fbbf24;

  /* Status palette */
  --rose:         #b91c1c;
  --rose-bg:      #fdf2f1;
  --rose-line:    #f1d5d2;
  --amber:        #b45309;
  --amber-bg:     #fdf6ec;
  --amber-line:   #f0e0c2;
  --emerald:      #047857;
  --emerald-bg:   #effaf3;
  --emerald-line: #c8e8d4;
  --indigo:       #1e40af;
  --indigo-bg:    #eef2fb;
  --indigo-line:  #cdd7ee;
  --violet:       #6d28d9;

  /* ══ Backward-compat aliases ══
     Old code using --aws-*, --bg-*, --border-*, --text-*, etc. maps to new tokens */

  --aws-navy:        #15171c;
  --aws-navy-mid:    #1d2027;
  --aws-navy-light:  #2a2d35;   /* kept as alias; no longer used for table headers */
  --aws-orange:      #fbbf24;   /* accent → amber */
  --aws-orange-dark: #f59e0b;
  --aws-blue:        #1e40af;   /* primary action → indigo */
  --aws-blue-dark:   #1e3a8a;

  --bg-primary:   #ffffff;
  --bg-secondary: #f6f6f4;
  --bg-tertiary:  #fafaf8;

  --border-light:  #e6e5e0;
  --border-mid:    #d6d4cc;

  --text-primary:   #0f1419;
  --text-secondary: #2c3137;
  --text-muted:     #6b6f77;
  --text-inverse:   #ffffff;

  --status-red:    #b91c1c;
  --status-amber:  #b45309;
  --status-green:  #047857;
  --status-blue:   #1e40af;

  /* ── Spacing ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* ── Card ── */
  --card-padding: 14px 16px;
  --card-radius:  4px;
  --card-shadow:  0 1px 0 rgba(15,20,25,0.04);
  --card-border:  1px solid #e6e5e0;

  /* ── Typography ── */
  --font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-size-sm:   12px;
  --font-size-base: 13px;
  --font-size-md:   15px;
  --font-size-lg:   18px;
  --font-size-xl:   24px;

  --color-header-bg:    var(--nav-bg);
  --color-header-fg:    #ffffff;
  --color-header-muted: var(--nav-ink-2);
  --color-nav-bg:       var(--nav-bg-2);
  --color-nav-border:   var(--nav-line);

  --color-surface-0:    var(--surface-2);
  --color-surface-1:    var(--surface);
  --color-surface-2:    var(--surface-2);

  --color-border:       var(--line);
  --color-border-focus: var(--indigo);

  --color-text-primary:   var(--ink);
  --color-text-secondary: var(--ink-2);
  --color-text-muted:     var(--ink-3);
  --color-text-on-dark:   #ffffff;

  --color-accent:       var(--indigo);
  --color-accent-hover: #1e3a8a;
  --color-accent-light: var(--indigo-bg);

  --color-primary:     var(--indigo);
  --color-primary-rgb: 30, 64, 175;

  /* ── PFHO semantic colours ── */
  --color-overdue-bg:     var(--rose-bg);
  --color-overdue-border: var(--rose-line);
  --color-overdue-text:   var(--rose);
  --color-overdue-badge:  var(--rose);

  --color-upcoming-bg:     var(--amber-bg);
  --color-upcoming-border: var(--amber-line);
  --color-upcoming-text:   var(--amber);
  --color-upcoming-badge:  var(--amber);

  --color-ontrack-bg:     var(--emerald-bg);
  --color-ontrack-border: var(--emerald-line);
  --color-ontrack-text:   var(--emerald);
  --color-ontrack-badge:  var(--emerald);

  /* ── Stage badge colours ── */
  --color-stage-1: #1e40af;
  --color-stage-2: #6b6f77;
  --color-stage-3: #b45309;
  --color-stage-4: #92400e;
  --color-stage-5: #047857;
  --color-stage-6: #1e3a8a;
  --color-stage-7: #047857;

  /* ── Numeric spacing aliases ── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;

  /* ── Shorthand aliases ── */
  --radius:        4px;
  --radius-sm:     4px;
  --radius-md:     4px;
  --radius-lg:     6px;
  --radius-full:   999px;
  --color-text:    var(--ink);
  --color-muted:   var(--ink-3);
  --color-danger:  var(--rose);

  /* Elevation */
  --shadow-sm: 0 1px 0 rgba(15,20,25,0.04);
  --shadow-md: 0 1px 2px rgba(15,20,25,0.06), 0 1px 0 rgba(15,20,25,0.02);
  --shadow-lg: 0 4px 20px rgba(15,20,25,0.18);

  /* Typography legacy aliases */
  --font-body: var(--font-family);
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --text-xs:   11px;
  --text-sm:   12.5px;
  --text-base: 13px;
  --text-lg:   15px;
  --text-xl:   18px;
  --text-2xl:  28px;

  /* Layout */
  --header-height: 44px;
  --nav-height:    38px;
  --content-max:   1440px;
}

/* ── 2. Reset & base ────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

/* AWS-style webkit scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #8c9aa0; }

p { line-height: 1.6; }

a {
  color: var(--aws-blue);
  text-decoration: none;
}
a:hover { text-decoration: underline; color: var(--aws-blue-dark); }

ul, ol { list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

select, input, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── 3. Layout shell ────────────────────────────────────────────────────── */

/* ── 3a. Sticky header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--aws-navy);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  flex-shrink: 0;
  border-radius: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-lg);
  max-width: var(--content-max);
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-icon {
  width: 22px;
  height: 22px;
  color: var(--color-header-muted);
  flex-shrink: 0;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0;
  white-space: nowrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.user-label {
  font-size: var(--text-sm);
  color: var(--color-header-muted);
  white-space: nowrap;
}

.user-select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  color: var(--color-header-fg);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  min-width: 160px;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ── 3b. Tab navigation ── */
.tab-nav {
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-line);
  flex-shrink: 0;
}

.tab-list {
  display: flex;
  align-items: stretch;
  padding: 0 var(--space-md);
  max-width: var(--content-max);
  margin: 0 auto;
  gap: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  height: var(--nav-height);
  padding: 0 var(--space-md);
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.75);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--nav-accent);
  background: rgba(255,255,255,0.04);
}

.tab-btn.active {
  color: var(--nav-accent);
  border-bottom-color: var(--nav-accent);
  font-weight: 700;
}

.tab-btn:focus-visible {
  outline: 2px solid var(--nav-accent);
  outline-offset: -2px;
}

.tab-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Icon-only nav buttons (Settings, Help) */
.tab-btn--icon {
  padding: 0;
  width: 38px;
  min-width: 38px;
  justify-content: center;
  border-radius: 6px;
  margin: 0 2px;
}
.tab-btn--icon .tab-icon { width: 18px; height: 18px; }
.tab-btn--icon .tab-btn-label { display: none; }

/* ── 3c. Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl) var(--space-lg);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}


.tab-panel {
  display: block;
  animation: fadePanel .18s ease;
}

.tab-panel[hidden] {
  display: none;
}

@keyframes fadePanel {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.panel-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ── 4. Placeholder blocks (Phase 1 only) ───────────────────────────────── */
.placeholder-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-2xl) var(--space-lg);
  background: var(--color-surface-1);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  text-align: center;
  min-height: 280px;
}

.placeholder-block svg {
  width: 64px;
  height: 64px;
  opacity: 0.35;
}

.placeholder-block p {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 400px;
}

.placeholder-block strong {
  color: var(--aws-blue);
}

/* ── 5. Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  box-shadow: var(--card-shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── 6. Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  transition: background .15s, box-shadow .15s, border-color .15s, color .15s;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}

.btn:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}
.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.btn:disabled,
.btn[disabled] {
  background: var(--surface-2) !important;
  color: var(--ink-4) !important;
  border: 1px solid var(--line) !important;
  cursor: not-allowed !important;
  opacity: 0.65;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
}
.btn-primary:hover:not(:disabled) {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

.btn-secondary {
  background: var(--surface);
  color: var(--indigo);
  border: 1px solid var(--indigo);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--indigo-bg);
  border-color: var(--indigo);
}

.btn-danger {
  background: var(--rose);
  color: #ffffff;
  border: 1px solid var(--rose);
}
.btn-danger:hover:not(:disabled) {
  background: #991b1b;
  border-color: #991b1b;
}
.btn-danger-outline {
  background:   transparent;
  color:        var(--color-danger, #dc2626);
  border:       1px solid var(--color-danger, #dc2626);
}
.btn-danger-outline:hover:not(:disabled) {
  background:   #fef2f2;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── 7. Badges / pills ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-overdue {
  background: var(--color-overdue-bg);
  color: var(--color-overdue-text);
  border: 1px solid var(--color-overdue-border);
}

.badge-upcoming {
  background: var(--color-upcoming-bg);
  color: var(--color-upcoming-text);
  border: 1px solid var(--color-upcoming-border);
}

.badge-ontrack {
  background: var(--color-ontrack-bg);
  color: var(--color-ontrack-text);
  border: 1px solid var(--color-ontrack-border);
}

/* Stage pills — AWS-style coloured badges */
.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid;
}
/* Stage 1 RFQ */
.stage-1 { background: var(--indigo-bg); color: var(--indigo); border-color: var(--indigo-line); }
/* Stage 2 Issued to Vendor */
.stage-2 { background: #f4f4f2; color: var(--ink-2); border-color: var(--line-strong); }
/* Stage 3 Vendor SOW */
.stage-3 { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
/* Stage 4 SOW Complete */
.stage-4 { background: #fff4e6; color: #a04000; border-color: #f0c08a; }
/* Stage 5 QA Walk */
.stage-5 { background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald-line); }
/* Stage 6 FIT Uploaded */
.stage-6 { background: var(--indigo-bg); color: var(--indigo); border-color: var(--indigo-line); }
/* Stage 7 Handed Off */
.stage-7 { background: var(--emerald); color: #ffffff; border-color: var(--emerald); }

/* ── 8. Modal ────────────────────────────────────────────────────────────── */
#modal-root {
  display: none;
  position: fixed;
  inset: 0;
  /* 9999 guarantees the modal sits above every sticky/fixed element in the
     app (header z-index: 100, nav z-index: 90, filter panel z-index: 200).
     Keep this higher than any non-modal z-index in the codebase. */
  z-index: 9999;
}

#modal-root.active {
  display: block;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: overlayIn .18s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(15,20,25,0.22), 0 1px 0 rgba(15,20,25,0.06);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - var(--space-2xl) * 2);
  overflow-y: auto;
  padding: 28px 32px 32px;
  animation: panelIn .18s ease;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}

.modal-panel--wide {
  max-width: 900px;
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 20px;
  color: var(--color-text-muted);
  line-height: 1;
  transition: background .12s, color .12s;
}

.modal-close:hover {
  background: var(--color-surface-2);
  color: var(--color-text-primary);
}

.modal-close:focus-visible {
  outline: 2px solid var(--color-border-focus);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-right: var(--space-xl); /* clearance for close button */
}

/* Confirm dialog (inside modal) */
.confirm-dialog {
  padding: var(--space-sm) 0;
}

.confirm-dialog p {
  font-size: var(--text-base);
  color: var(--color-text-primary);
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ── 9. Toasts ───────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  /* 10000 — above the modal (9999) so toasts are always readable */
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 11px 14px;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(15,20,25,.18), 0 1px 0 rgba(15,20,25,.06);
  font-size: 13px;
  line-height: 1.5;
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .25s ease, transform .25s ease;
  border-left: 3px solid;
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-hiding {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast-info {
  background: var(--indigo-bg);
  border-color: var(--indigo);
  color: var(--indigo);
}

.toast-success {
  background: var(--emerald-bg);
  border-color: var(--emerald);
  color: var(--emerald);
}

.toast-warning {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

.toast-error {
  background: var(--rose-bg);
  border-color: var(--rose);
  color: var(--rose);
}

.toast span {
  flex: 1;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  opacity: 0.55;
  border-radius: var(--radius-sm);
  transition: opacity .12s;
}

.toast-close:hover { opacity: 1; }

/* ── 10. Form elements ───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: block;
}

.form-label .required {
  color: var(--color-overdue-badge);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  font-family: var(--font-family);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-bg);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-overdue-badge);
  font-weight: 500;
}

/* ── 11. Table (stub — detailed styles arrive in Phase 2) ────────────────── */
.data-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--color-surface-1);
}

.data-table thead th {
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 9px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
  font-size: 13px;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:nth-child(even) td { background-color: var(--surface-2); }

.data-table tbody tr:hover td {
  background: var(--indigo-bg);
}

/* PFHO row colouring */
.row-overdue td:first-child { border-left: 3px solid var(--color-overdue-badge); }
.row-upcoming td:first-child { border-left: 3px solid var(--color-upcoming-badge); }
.row-ontrack  td:first-child { border-left: 3px solid var(--color-ontrack-badge); }

/* ── 12. Utilities ───────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--color-text-muted); }
.text-sm    { font-size: var(--text-sm); }
.text-xs    { font-size: var(--text-xs); }

/* KVA missing-data annotation — rendered inline after totals */
.kva-missing {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 400;
  white-space: nowrap;
}

/* KVA table cell — bold when position is closed (Handed Off / Rejected) */
.cell-kva-closed { font-weight: 600; }
.text-mono  { font-family: var(--font-mono); }

.flex       { display: flex; }
.items-center { align-items: center; }
.gap-sm     { gap: var(--space-sm); }
.gap-md     { gap: var(--space-md); }

.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }

.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-2xl) var(--space-lg);
  color: var(--color-text-muted);
  text-align: center;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--aws-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 13. Print styles ────────────────────────────────────────────────────── */
/* (Expanded in Phase 6 — stub only) */
@media print {
  .app-header,
  .tab-nav,
  #toast-container,
  #modal-root {
    display: none !important;
  }

  .main-content {
    padding: 0;
    max-width: none;
  }

  .tab-panel[hidden] { display: none !important; }
  .tab-panel.active  { display: block !important; }

  body {
    background: #fff;
    color: #000;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 2 — Positions table & detail modal
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Positions toolbar ──────────────────────────────────────────────────── */
.positions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) 0 var(--space-md);
  gap: var(--space-md);
  flex-wrap: wrap;
}

#position-count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* ── Scrollable table wrapper with sticky thead ─────────────────────────── */
.positions-table-wrapper {
  overflow: auto;
  max-height: calc(100vh - 270px);
  min-height: 220px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
}

/* Override Phase 1 stub — full width table inside scroller */
.positions-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--color-surface-1);
  white-space: nowrap;
}

/* Sticky header cells */
.positions-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 var(--line);
}

.sortable-header {
  cursor: pointer;
  user-select: none;
}

.sortable-header:hover {
  background: var(--surface);
  color: var(--ink);
}

.col-sorted {
  color: var(--indigo) !important;
  background: var(--indigo-bg) !important;
}

.sort-arrow {
  margin-left: var(--space-xs);
  font-size: 9px;
  vertical-align: middle;
  color: var(--indigo);
}

/* Body cells */
.positions-data-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
  font-size: 13px;
  background: var(--surface);
}

.positions-data-table tbody tr:nth-child(even) td {
  background-color: var(--surface-2);
}

.positions-data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Row colours — PFHO status tints ───────────────────────────────────── */
/* Override the Phase 1 border-only stub for these classes */
tr.row-overdue td:first-child { border-left: none; } /* remove Phase 1 stub */
tr.row-upcoming td:first-child { border-left: none; }

tr.row-overdue {
  background-color: var(--color-overdue-bg);
}
tr.row-upcoming {
  background-color: var(--color-upcoming-bg);
}

/* Hover: preserve tint hue, just darken slightly */
tr.position-row {
  cursor: pointer;
  transition: background-color .1s;
}
tr.position-row:hover td,
tr.position-row:focus td {
  background-color: var(--indigo-bg) !important;
}
tr.row-overdue:hover td,
tr.row-overdue:focus td {
  background-color: #fce8e5 !important;
}
tr.row-upcoming:hover td,
tr.row-upcoming:focus td {
  background-color: #fdecd5 !important;
}

/* Cell helpers */
.cell-mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.cell-sm   { font-size: var(--text-xs); }
.cell-empty { color: var(--color-text-muted); }

/* ── PFHO date cell ─────────────────────────────────────────────────────── */
.pfho-date-value {
  font-weight: 600;
  font-size: var(--text-sm);
}

.pfho-sublabel {
  font-size: var(--text-xs);
  margin-top: 2px;
  font-weight: 500;
}

.pfho-sublabel--overdue  { color: var(--status-red); font-weight: 700; }
.pfho-sublabel--upcoming { color: var(--status-amber); font-weight: 600; }
.pfho-sublabel--onTrack  { color: var(--status-green); }
.pfho-sublabel--unknown  { color: var(--text-muted); }

/* Closed-position PFHO date cells in the main table — no colour coding */
.cell-pfho-achieved {
  color: var(--status-green);
  font-size: var(--text-sm);
}
.cell-pfho-rejected {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* ══════════════════════════════════════════════════════════════════════════
   Detail modal layout
   ══════════════════════════════════════════════════════════════════════════ */

/* Wide modal override (added by detail.js after showModal) */
.modal-panel--wide {
  max-width: 920px !important;
  width: 100%;
}

.detail-content {
  /* Some top breathing room below the close button */
  padding-top: var(--space-xs);
}

/* ── Priority section — tinted box at top ───────────────────────────────── */
.detail-priority-section {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.detail-batch-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.detail-sub-build-id {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-muted);
  margin-bottom: var(--space-md);
  word-break: break-all;
}

/* ── Section wrapper ────────────────────────────────────────────────────── */
.detail-section {
  padding-top: var(--space-md);
  margin-bottom: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.detail-section-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

/* ── Definition list for fields ─────────────────────────────────────────── */
.detail-fields {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 2fr;
  gap: 3px var(--space-md);
  font-size: var(--text-sm);
}

.detail-fields dt {
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: 4px 0;
  align-self: center;
}

.detail-fields dd {
  color: var(--color-text-primary);
  padding: 4px 0;
  word-break: break-word;
}

/* Bold effective PFHO date */
.detail-effective-pfho {
  font-weight: 700;
  font-size: var(--text-base);
}

/* Status cell: badge + label inline */
.detail-pfho-status-cell {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding: 4px 0;
}

.detail-pfho-label {
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ── Workflow section ───────────────────────────────────────────────────── */
.detail-stage-current {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: var(--text-base);
  flex-wrap: wrap;
}

.detail-stage-name {
  font-weight: 600;
}

.detail-stage-history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.detail-stage-item {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-border);
}

.detail-stage-item-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.detail-stage-item-meta {
  margin-left: auto;
}

.detail-stage-item-notes {
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

/* ── All imported fields — <details> collapse ───────────────────────────── */
.detail-all-fields {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.detail-all-fields-summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--aws-blue);
  padding: var(--space-sm) 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Hide the default browser triangle */
.detail-all-fields-summary::-webkit-details-marker { display: none; }
.detail-all-fields-summary::marker { display: none; }

/* Arrow prefix that flips open/closed */
.detail-all-fields-summary::before {
  content: '▶';
  font-size: 10px;
  transition: transform .15s;
  display: inline-block;
}

details[open] > .detail-all-fields-summary::before {
  transform: rotate(90deg);
}

.detail-all-fields-summary:hover {
  color: var(--aws-blue-dark);
}

.detail-all-fields-inner {
  margin-top: var(--space-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg) var(--space-xl);
}

.detail-subgroup-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
}

/* Compact variant inside collapsed section */
.detail-fields--compact {
  grid-template-columns: minmax(120px, 1fr) 1.5fr;
  gap: 2px var(--space-sm);
  font-size: var(--text-xs);
}

/* Activity placeholder */
.detail-activity-placeholder {
  font-style: italic;
}

/* ── 14. Responsive — tablet (768 px) ───────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 var(--space-md);
  }

  .app-title {
    font-size: var(--text-base);
  }

  .user-select {
    min-width: 120px;
  }

  .tab-list {
    padding: 0 var(--space-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tab-list::-webkit-scrollbar { display: none; }

  .tab-btn {
    padding: 0 var(--space-sm);
    font-size: var(--text-xs);
  }

  .main-content {
    padding: var(--space-md);
  }

  .modal-panel {
    padding: var(--space-md);
    max-height: calc(100vh - var(--space-md) * 2);
  }

  #toast-container {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }

  /* Phase 2 — table */
  .positions-table-wrapper {
    max-height: calc(100vh - 220px);
  }

  /* Phase 2 — detail modal */
  .detail-fields {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .detail-fields dt { padding: 2px 0; }
  .detail-fields dd { padding: 2px 0 6px; }

  .detail-all-fields-inner {
    grid-template-columns: 1fr;
  }

  .detail-fields--compact {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 3 — Import tab, Export buttons, Settings tab
══════════════════════════════════════════════════════════════════════════ */

/* ── Positions toolbar: export buttons on the right ─────────────────────── */
.positions-toolbar {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  flex-wrap:       wrap;
  gap:             var(--space-2);
  padding:         var(--space-2) var(--space-4);
  border-bottom:   1px solid var(--border-light);
  background:      var(--bg-primary);
}

.toolbar-actions {
  display:    flex;
  align-items: center;
  gap:        var(--space-2);
}

/* ── Button variants (Phase 3 section — all delegate to section 6 above) ─── */
/* These rules reinforce / override defaults for the Phase 3 import/export context */
.btn {
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  padding:         8px 16px;
  border:          none;
  border-radius:   4px;
  font-size:       14px;
  font-weight:     700;
  cursor:          pointer;
  text-decoration: none;
  line-height:     1.2;
  white-space:     nowrap;
  transition:      background 0.15s, border-color 0.15s, color 0.15s;
  position:        relative;
}

/* (duplicate .btn-* block from workflow section — follows main button rules in section 6) */
.btn-primary {
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
}
.btn-primary:hover:not(:disabled) { background: var(--ink-2); border-color: var(--ink-2); }

.btn-secondary {
  background: var(--surface);
  color: var(--indigo);
  border: 1px solid var(--indigo);
}
.btn-secondary:hover:not(:disabled) { background: var(--indigo-bg); }

.btn-danger {
  background: var(--rose);
  color: #ffffff;
  border: 1px solid var(--rose);
}
.btn-danger:hover:not(:disabled) { background: #991b1b; border-color: #991b1b; }

.btn:disabled,
.btn[disabled] {
  background:   var(--surface-2) !important;
  color:        var(--ink-4) !important;
  border:       1px solid var(--line) !important;
  cursor:       not-allowed !important;
  opacity:      0.65;
}

.btn-sm { padding: 4px 10px; font-size: 12px; font-weight: 600; }

.btn-icon {
  width:         16px;
  height:        16px;
  flex-shrink:   0;
}

/* ── Hidden attribute must always win over display:flex/grid ─────────────── */
[hidden] { display: none !important; }

/* ── Import tab body ─────────────────────────────────────────────────────── */

/* Generic card container used within the import tab */
.import-card {
  background:    var(--surface);
  border:        1px solid var(--line);
  border-radius: var(--card-radius);
  padding:       16px 20px;
  box-shadow:    var(--card-shadow);
}

.import-body {
  padding:        var(--space-6);
  max-width:      820px;
  display:        flex;
  flex-direction: column;
  gap:            var(--space-4);
}

/* ── Drop zone ───────────────────────────────────────────────────────────── */
.drop-zone {
  border:        2px dashed var(--border-mid);
  border-radius: 4px;
  background:    var(--bg-tertiary);
  cursor:        pointer;
  transition:    border-color 0.15s, background 0.15s;
  overflow:      hidden;
  text-align:    center;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drop-zone--active {
  border-color: var(--indigo);
  background:   var(--indigo-bg);
  outline:      none;
}

/* Idle inner state — contains icon, labels, button */
.drop-zone-idle {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             var(--space-3);
  padding:         56px var(--space-8);
  pointer-events:  none;
}

.drop-zone-icon {
  width:  52px;
  height: 52px;
  color:  #94a3b8;
}

.drop-zone:hover .drop-zone-icon,
.drop-zone--active .drop-zone-icon {
  color: var(--aws-blue);
}

.drop-zone-heading {
  font-size:   1.0625rem;
  font-weight: 600;
  color:       var(--color-text-primary);
  margin:      0;
}

.drop-zone-sub {
  font-size: 0.875rem;
  color:     var(--color-text-muted);
  margin:    0;
}

/* "Browse files" — styled like a primary button inside the drop zone */
.drop-zone-btn {
  display:         inline-flex;
  align-items:     center;
  margin-top:      var(--space-2);
  padding:         7px 14px;
  background:      var(--ink);
  color:           #ffffff;
  border-radius:   4px;
  font-size:       13px;
  font-weight:     600;
  cursor:          pointer;
  pointer-events:  all;
  transition:      background 0.15s;
  position:        relative;
}

.drop-zone-btn:hover { background: var(--ink-2); }

/* Loading state */
.drop-zone-loading {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             var(--space-3);
  padding:         56px var(--space-8);
  color:           var(--color-text-secondary);
  font-size:       0.9375rem;
}

.spinner {
  width:         36px;
  height:        36px;
  border:        3px solid var(--color-border);
  border-top:    3px solid var(--aws-blue);
  border-radius: 50%;
  animation:     spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Template strip ──────────────────────────────────────────────────────── */
.template-strip {
  display:     flex;
  align-items: center;
  gap:         var(--space-5);
  background:  var(--color-surface-1);
  border:      1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding:     var(--space-4) var(--space-5);
}

.template-strip-text {
  flex:        1;
  font-size:   0.875rem;
  color:       var(--color-text-secondary);
  line-height: 1.55;
}

.template-strip-text strong { color: var(--color-text-primary); }

/* ── Recent imports log ──────────────────────────────────────────────────── */
.recent-imports {
  background:    var(--color-surface-1);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding:       var(--space-4) var(--space-5);
}

.recent-imports-title {
  font-size:      0.6875rem;
  font-weight:    700;
  color:          var(--color-text-muted);
  margin:         0 0 var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.recent-imports-list {
  list-style: none;
  margin:     0;
  padding:    0;
}

.recent-import-item {
  display:       grid;
  grid-template-columns: 110px 1fr auto;
  gap:           var(--space-3);
  align-items:   center;
  padding:       var(--space-2) 0;
  border-bottom: 1px solid var(--color-surface-2);
}

.recent-import-item:last-child { border-bottom: none; }

.recent-import-ts     { font-size: 0.75rem; color: var(--color-text-muted); white-space: nowrap; }
.recent-import-name   { font-size: 0.875rem; color: var(--color-text-primary); font-weight: 500;
                        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-import-counts { font-size: 0.75rem; color: var(--color-text-secondary);
                        font-family: monospace; white-space: nowrap; }

/* ── Utility: .card ──────────────────────────────────────────────────────── */
/* Shared base for any bordered content card across all tabs. */
.card {
  background:    var(--bg-primary);
  border:        var(--card-border);
  border-radius: var(--card-radius);
  padding:       var(--card-padding);
  box-shadow:    var(--card-shadow);
}

/* ── Settings tab ────────────────────────────────────────────────────────── */
.settings-layout {
  display:               grid;
  grid-template-columns: 1fr;   /* single column — Backup and Danger Zone stacked */
  gap:                   var(--space-6);
  padding:               var(--space-6);
  max-width:             640px;
}

.settings-card {
  background:    var(--surface);
  border:        1px solid var(--line);
  border-radius: 4px;
  padding:       20px;
  box-shadow:    var(--card-shadow);
  display:       flex;
  flex-direction: column;
  gap:           var(--space-4);
}

.settings-card--danger {
  border: 1px solid var(--rose-line);
  border-left: 3px solid var(--rose);
  background: var(--rose-bg);
  box-shadow: none;
}

.settings-card-title {
  font-size:   14px;
  font-weight: 600;
  color:       var(--ink);
  margin:      0 0 var(--space-xs);
}

.settings-card--danger .settings-card-title {
  color: var(--rose);
}

.settings-card-desc {
  font-size:   13px;
  color:       var(--ink-3);
  margin:      0;
  line-height: 1.5;
  /* Gap on the flex parent provides the 16px separation before the actions row */
}

.settings-card-actions {
  display:    flex;
  flex-wrap:  wrap;
  gap:        var(--space-2);           /* 8px between sibling buttons */
  margin-top: var(--space-xs);          /* 4px extra push from desc — gap handles the bulk */
}

.settings-last-backup {
  font-size:  0.8rem;
  color:      var(--color-text-muted);
  margin:     0;
  font-style: italic;
}

/* ── Import analysis modal ───────────────────────────────────────────────── */
.import-analysis {
  font-size: 0.9rem;
  line-height: 1.6;
}

.import-analysis-summary {
  background:    var(--color-surface-0);
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  padding:       var(--space-4);
  margin-bottom: var(--space-4);
}

.import-analysis-summary p {
  margin: 0 0 var(--space-1);
  color:  var(--color-text-primary);
}

.import-analysis-summary p:last-child { margin-bottom: 0; }

.import-stat-add    { color: #16a34a; font-weight: 600; }
.import-stat-update { color: #d97706; font-weight: 600; }
.import-stat-skip   { color: var(--color-text-muted); font-weight: 600; }

.import-warnings-details {
  margin-bottom: var(--space-4);
}

.import-warnings-details summary {
  cursor:      pointer;
  font-weight: 500;
  color:       var(--color-text-secondary);
  padding:     var(--space-2) 0;
  user-select: none;
}

.import-warnings-list {
  list-style: disc;
  padding-left: 1.5rem;
  margin:      var(--space-2) 0 0;
  font-size:   0.8125rem;
  color:       var(--color-text-secondary);
  max-height:  180px;
  overflow-y:  auto;
}

.import-warnings-list li { margin-bottom: var(--space-1); }

/* ── Closed-position import warning ── */
.import-closed-warning {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 4px;
}
.import-closed-warning-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 12px;
  color: #92400e;
}
.import-closed-detail {
  margin: 0 0 4px;
  font-size: 12px;
  color: #78350f;
  display: flex;
  align-items: center;
  gap: 6px;
}
.import-closed-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.import-closed-badge--green { background: #d1fae5; color: #047857; }
.import-closed-badge--red { background: #fee2e2; color: #b91c1c; }
.import-closed-preview {
  margin-top: 10px;
}
.import-closed-preview summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: #92400e;
  text-decoration: underline;
}
.import-closed-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 11px;
  max-height: 180px;
  display: block;
  overflow-y: auto;
}
.import-closed-table thead { position: sticky; top: 0; }
.import-closed-table th {
  background: #fef3c7;
  text-align: left;
  padding: 5px 8px;
  font-weight: 600;
  color: #78350f;
  border-bottom: 1px solid #f59e0b;
}
.import-closed-table td {
  padding: 4px 8px;
  color: #451a03;
  border-bottom: 1px solid #fde68a;
}
.import-closed-table tr:last-child td { border-bottom: none; }
.import-closed-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: #78350f;
  cursor: pointer;
}
.import-closed-checkbox { cursor: pointer; }

.import-modal-actions {
  display:         flex;
  justify-content: flex-end;
  gap:             var(--space-2);
  margin-top:      var(--space-4);
  padding-top:     var(--space-4);
  border-top:      1px solid var(--color-border);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* .settings-layout is already 1fr — no override needed.
     .import-layout stays 2-col on wide viewports so keep this rule. */
  .import-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .toolbar-actions {
    flex-wrap: wrap;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 4 — Workflow progression forms & table action column
══════════════════════════════════════════════════════════════════════════ */

/* ── Checkbox / bulk-selection column ────────────────────────────────────── */
.col-checkbox-header {
  width:       36px;
  min-width:   36px;
  max-width:   36px;
  text-align:  center;
  padding:     10px var(--space-sm) !important;
  background:  var(--surface-2);
  cursor:      default;
}

.col-checkbox {
  width:       36px;
  min-width:   36px;
  max-width:   36px;
  text-align:  center;
  padding:     6px var(--space-sm) !important;
  vertical-align: middle;
}

/* Prevent the checkbox cell from triggering the row-open cursor */
.col-checkbox,
.col-checkbox-header {
  cursor: default !important;
}

.position-row-cb {
  width:   16px;
  height:  16px;
  cursor:  pointer;
  accent-color: var(--color-primary);
  vertical-align: middle;
}

#table-select-all {
  width:   16px;
  height:  16px;
  cursor:  pointer;
  accent-color: var(--color-primary);
  vertical-align: middle;
}

/* Highlight selected rows */
.positions-data-table tbody tr.row-selected td {
  background-color: var(--indigo-bg) !important;
  border-left: 3px solid var(--indigo);
}

/* ── Selection label + clear button in toolbar ────────────────────────────── */
.bulk-selection-label {
  font-size:   13px;
  font-weight: 600;
  color:       var(--indigo);
  white-space: nowrap;
  padding:     0 var(--space-xs);
}

.btn-link {
  background:  transparent;
  border:      none;
  color:       var(--indigo);
  cursor:      pointer;
  font-size:   13px;
  padding:     0 var(--space-xs);
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--aws-blue-dark);
  text-decoration: none;
}

/* ── Actions column in the positions table ───────────────────────────────── */
.col-actions-header {
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 9px 14px;
  text-align: left;
  white-space: nowrap;
  cursor: default;
  border-bottom: 1px solid var(--line-strong);
}

.cell-actions {
  white-space: nowrap;
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  padding: 6px var(--space-md) !important;
}

.workflow-table-btn {
  font-size: var(--text-xs) !important;
  padding: 3px 8px !important;
  white-space: nowrap;
}

/* ── Detail modal: workflow action buttons ───────────────────────────────── */
.detail-workflow-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

/* ── Workflow form modal ─────────────────────────────────────────────────── */
.workflow-form-content {
  padding-top: var(--space-xs);
}

/* Stage transition info row (pills + label) */
.wf-form-subinfo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.wf-arrow {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  font-weight: 300;
}

.wf-transition-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.wf-form-meta {
  margin-bottom: var(--space-lg);
}

/* ── Stage form ──────────────────────────────────────────────────────────── */
.wf-stage-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.wf-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.wf-form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
}

.wf-required {
  color: var(--color-overdue-badge);
  font-weight: 700;
}

/* Reuse existing form-input styles */
.wf-form-input,
.wf-form-select,
.wf-form-textarea {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.wf-form-input:focus,
.wf-form-select:focus,
.wf-form-textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-bg);
}

.wf-form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Radio group */
.wf-form-radio-group {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-sm) 0;
}

.wf-radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  cursor: pointer;
}

.wf-radio-input {
  width: 16px;
  height: 16px;
  accent-color: var(--aws-blue);
  cursor: pointer;
}

/* Per-field error */
.wf-field-error {
  font-size: var(--text-xs);
  color: var(--color-overdue-badge);
  font-weight: 500;
}

/* Form-level error summary */
.wf-form-error-summary {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-overdue-bg);
  border: 1px solid var(--color-overdue-border);
  border-radius: var(--radius-sm);
  color: var(--color-overdue-text);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* Action buttons row */
.wf-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-sm);
}

/* Rejection modal warning box */
.wf-reject-modal-title {
  color: var(--color-overdue-text);
}

.wf-reject-warning {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-upcoming-bg);
  border: 1px solid var(--color-upcoming-border);
  border-radius: var(--radius-sm);
  color: var(--color-upcoming-text);
  font-size: var(--text-sm);
  line-height: 1.55;
  margin-bottom: var(--space-sm);
}

/* ── Activity log ────────────────────────────────────────────────────────── */
.detail-activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.detail-activity-item {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-border);
}

.detail-activity-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.detail-activity-stage-meta {
  color: var(--color-text-secondary);
}

.detail-activity-time {
  margin-left: auto;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.detail-activity-notes {
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .cell-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .wf-form-actions {
    flex-direction: column-reverse;
  }

  .wf-form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .detail-workflow-actions {
    flex-direction: column;
  }

  .detail-workflow-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 4 additions — outcome banners, activity badges, first-run modal
══════════════════════════════════════════════════════════════════════════ */

/* ── Final outcome banners (shown at top of Workflow section) ────────────── */
.detail-outcome-banner {
  display:       flex;
  align-items:   center;
  gap:           var(--space-sm);
  padding:       var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size:     var(--text-sm);
  font-weight:   600;
  line-height:   1.4;
  margin-bottom: var(--space-md);
  border:        1px solid;
}

.detail-outcome-banner--handoff {
  background:   var(--color-ontrack-bg);
  border-color: var(--color-ontrack-border);
  color:        var(--color-ontrack-text);
}

.detail-outcome-banner--rejected {
  background:   var(--color-overdue-bg);
  border-color: var(--color-overdue-border);
  color:        var(--color-overdue-text);
}

/* ── Activity log: type-coloured badges ──────────────────────────────────── */
/* Re-uses the .badge base class from Phase 2 */

/* Activity log type badges — AWS colour palette */
.badge-activity-advance {
  background: var(--aws-blue);
  color:      #ffffff;
  border:     none;
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

.badge-activity-handoff {
  background: var(--status-green);
  color:      #ffffff;
  border:     none;
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

.badge-activity-rejection {
  background: var(--status-red);
  color:      #ffffff;
  border:     none;
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

.badge-activity-comment {
  background: var(--text-muted);
  color:      #ffffff;
  border:     none;
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

.badge-activity-default {
  background: var(--bg-tertiary);
  color:      var(--text-secondary);
  border:     1px solid var(--border-light);
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

.badge-activity-assignment {
  background: var(--status-green);
  color:      #ffffff;
  border:     none;
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

.badge-activity-revert {
  background: var(--status-amber);
  color:      #ffffff;
  border:     none;
  border-radius: 4px;
  padding:    2px 8px;
  font-size:  12px;
  display:    inline-block;
}

/* Activity item: left border matches badge type */
.detail-activity-item:has(.badge-activity-advance)    { border-left-color: var(--aws-blue); }
.detail-activity-item:has(.badge-activity-handoff)    { border-left-color: var(--status-green); }
.detail-activity-item:has(.badge-activity-rejection)  { border-left-color: var(--status-red); }
.detail-activity-item:has(.badge-activity-comment)    { border-left-color: var(--text-muted); }
.detail-activity-item:has(.badge-activity-assignment) { border-left-color: var(--status-green); }
.detail-activity-item:has(.badge-activity-revert)     { border-left-color: var(--status-amber); }
.detail-activity-item:has(.badge-activity-invoice)    { border-left-color: #0d9488; }

/* ── Invoice activity badge ──────────────────────────────────────────────── */
.badge-activity-invoice {
  background-color: #0d9488;
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius, 4px);
  white-space: nowrap;
}

/* ── Invoices sub-tab table ──────────────────────────────────────────────── */
.detail-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}
.detail-invoice-table th,
.detail-invoice-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.detail-invoice-table th {
  font-weight: 600;
  color: var(--color-muted, var(--text-muted));
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-subtle, var(--bg-secondary));
}
.detail-invoice-table td.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.detail-invoice-table tfoot tr.detail-invoice-totals td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: var(--bg-subtle, var(--bg-secondary));
}
.detail-invoice-total-label {
  color: var(--color-muted, var(--text-muted));
  font-size: var(--text-xs);
  text-transform: uppercase;
}

/* ── Relative timestamp — cursor shows full date on hover ────────────────── */
.detail-activity-time[title] {
  cursor: help;
  text-decoration-line:  underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 4 additions (round 2) — Reject-at-any-stage + Bulk Advance
══════════════════════════════════════════════════════════════════════════ */

/* ── Reject button: outlined red, white background ───────────────────────── */
.btn-reject-outline {
  background:   #ffffff;
  border:       1px solid var(--status-red);
  color:        var(--status-red);
}
.btn-reject-outline:hover {
  background:   #fdf2f0;
  border-color: #b02a0f;
  color:        #b02a0f;
}

/* Small reject icon button in table rows — compact, less visual weight */
.workflow-table-btn--reject {
  padding:   4px 7px;
  min-width: 28px;
}

/* ── Bulk advance modal — wide + scrollable ──────────────────────────────── */
.modal-panel--bulk {
  max-width:  960px;
  width:      95vw;
  max-height: 85vh;
  overflow-y: auto;
}

/* Top-level content wrapper inside the bulk modal */
.bulk-advance-content {
  /* inherits .detail-content base styles */
}

/* Container that holds all stage groups */
.bulk-groups-container {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-lg);
}

/* Each stage group */
.bulk-group {
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow:      hidden;
}

/* Sticky group header — stays visible while scrolling a long table */
.bulk-group-header {
  display:       flex;
  align-items:   center;
  gap:           var(--space-xs);
  flex-wrap:     wrap;
  padding:       var(--space-sm) var(--space-md);
  background:    var(--nav-bg);
  border-bottom: 1px solid var(--nav-line);
  color:         var(--nav-ink);
  font-weight:   600;
  font-size:     13px;
  position:      sticky;
  top:           0;
  z-index:       1;
}

.bulk-group-count {
  font-weight: 400;
}

/* Select-all / Deselect-all row above the checkbox table */
.bulk-toggle-row {
  display:     flex;
  align-items: center;
  gap:         var(--space-sm);
  padding:     var(--space-sm) var(--space-md);
  background:  var(--color-surface-1);
  border-bottom: 1px solid var(--color-border);
}

.bulk-selected-count {
  margin-left: auto;
}

/* Scrollable wrapper for the table */
.bulk-group-table-wrapper {
  overflow-x: auto;
}

/* Position checkbox table */
.bulk-group-table {
  width:      100%;
  font-size:  var(--text-sm);
}

.bulk-position-cb {
  width:         16px;
  height:        16px;
  cursor:        pointer;
  accent-color:  var(--aws-blue);
  vertical-align: middle;
}

/* Stage form section below the table */
.bulk-group-form {
  padding:    var(--space-md);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-1);
}

/* ── bulk_advance activity entry: expandable co-advanced IDs ─────────────── */
.detail-activity-bulk-details {
  margin-top:  var(--space-xs);
  padding-top: var(--space-xs);
  border-top:  1px solid var(--color-border);
}

.detail-activity-bulk-details summary {
  cursor: pointer;
  color:  var(--color-text-muted);
  user-select: none;
}

.detail-activity-bulk-list {
  list-style: none;
  padding:    var(--space-xs) 0 0 var(--space-md);
  margin:     0;
}

.detail-activity-bulk-list li {
  color:       var(--color-text-secondary);
  font-size:   var(--text-xs);
  font-family: var(--font-mono);
  line-height: 1.7;
}

/* detail.js: bulk_advance items get same blue left-border as stageAdvance */
.detail-activity-item:has(.badge-activity-advance) { border-left-color: #3b82f6; }

@media (max-width: 768px) {
  .modal-panel--bulk {
    max-height: calc(100vh - var(--space-md) * 2);
    width:      100%;
  }

  .bulk-group-header {
    position: static;  /* unstick on small screens to avoid layering issues */
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 5 — Filter toolbar, filter panel, multi-select dropdowns, presets
══════════════════════════════════════════════════════════════════════════ */

/* ── Filter toolbar ─────────────────────────────────────────────────────── */
.filter-toolbar {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  flex-wrap:       wrap;
  gap:             var(--space-sm);
  padding:         var(--space-sm) 0 var(--space-sm);
}

.filter-toolbar-left,
.filter-toolbar-right {
  display:     flex;
  align-items: center;
  gap:         var(--space-sm);
  flex-wrap:   wrap;
}

.filter-search-input {
  width:         220px;
  padding:       6px 11px;
  border:        1px solid var(--line-strong);
  border-radius: 4px;
  font-size:     13px;
  background:    var(--surface);
  color:         var(--ink);
  transition:    border-color .15s, box-shadow .15s;
  font-family:   var(--font-family);
}

.filter-search-input:focus {
  outline:    none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-bg);
}

.filter-toggle-btn {
  position: relative;
}

/* Active filter count bubble on the Filters button */
.filter-badge {
  display:        inline-flex;
  align-items:    center;
  justify-content: center;
  min-width:      18px;
  height:         18px;
  padding:        0 4px;
  border-radius:  4px;
  background:     var(--indigo);
  color:          #ffffff;
  font-size:      10px;
  font-weight:    700;
  line-height:    1;
  margin-left:    4px;
}

.filter-count-label {
  font-size:   var(--text-sm);
  font-weight: 600;
  color:       var(--color-text-secondary);
  white-space: nowrap;
}

/* ── Filter panel (collapsible) ─────────────────────────────────────────── */
.filter-panel {
  background:    var(--color-surface-1);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  box-shadow:    var(--shadow-sm);
}

.filter-panel-inner {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: flex-start;
}

.filter-row--dates {
  flex-wrap: wrap;
}

/* ── Multi-select dropdown ─────────────────────────────────────────────── */
.filter-ms {
  position: relative;
  min-width: 130px;
  flex: 1;
}

.filter-ms-trigger {
  display:       flex;
  align-items:   center;
  gap:           var(--space-xs);
  width:         100%;
  padding:       6px 11px;
  border:        1px solid var(--line-strong);
  border-radius: 4px;
  background:    var(--surface);
  font-size:     13px;
  color:         var(--ink);
  cursor:        pointer;
  text-align:    left;
  transition:    border-color .12s;
  white-space:   nowrap;
  font-family:   var(--font-family);
}

.filter-ms-trigger:hover,
.filter-ms-trigger--open {
  border-color: var(--indigo);
  background:   var(--indigo-bg);
}

.filter-ms-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-ms-count {
  font-weight:  700;
  color:        var(--indigo);
  font-size:    var(--text-xs);
  white-space:  nowrap;
}

.filter-ms-arrow {
  font-size:  11px;
  color:      var(--color-text-muted);
  flex-shrink: 0;
}

.filter-ms-panel {
  position:      absolute;
  top:           calc(100% + 2px);
  left:          0;
  z-index:       200;
  background:    var(--color-surface-1);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow:    var(--shadow-md);
  min-width:     180px;
  max-height:    260px;
  overflow-y:    auto;
}

.filter-ms-toprow {
  display:       flex;
  gap:           var(--space-xs);
  padding:       var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  background:    var(--color-surface-2);
  position:      sticky;
  top:           0;
  z-index:       1;
}

.filter-ms-selall {
  font-size:   var(--text-xs);
  color:       var(--indigo);
  cursor:      pointer;
  padding:     2px 4px;
  border-radius: var(--radius-sm);
  background:  none;
  border:      none;
}
.filter-ms-selall:hover { background: var(--indigo-bg); }

.filter-ms-list {
  list-style: none;
  padding:    0;
  margin:     0;
}

.filter-ms-option {
  padding: 0;
}

.filter-ms-optlabel {
  display:     flex;
  align-items: center;
  gap:         var(--space-xs);
  padding:     5px var(--space-sm);
  font-size:   var(--text-sm);
  cursor:      pointer;
  transition:  background .1s;
}

.filter-ms-optlabel:hover {
  background: var(--color-surface-2);
}

.filter-ms-optlabel input[type="checkbox"] {
  width:         14px;
  height:        14px;
  flex-shrink:   0;
  accent-color:  var(--indigo);
  cursor:        pointer;
}

.filter-ms-empty {
  padding:   var(--space-sm);
  font-size: var(--text-sm);
  color:     var(--color-text-muted);
  font-style: italic;
}

/* ── Single-select & date groups ────────────────────────────────────────── */
.filter-select-group,
.filter-date-group {
  display:        flex;
  flex-direction: column;
  gap:            3px;
  flex:           1;
  min-width:      130px;
}

.filter-label {
  font-size:   var(--text-xs);
  font-weight: 600;
  color:       var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.filter-select {
  padding:       6px var(--space-sm);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background:    var(--color-surface-1);
  font-size:     var(--text-sm);
  color:         var(--color-text-primary);
  cursor:        pointer;
  appearance:    none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6878'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.filter-select:focus {
  outline:      none;
  border-color: var(--color-border-focus);
  box-shadow:   0 0 0 3px rgba(59,130,246,.18);
}

.filter-date-input {
  padding:       6px var(--space-sm);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background:    var(--color-surface-1);
  font-size:     var(--text-sm);
  color:         var(--color-text-primary);
  appearance:    none;
}

.filter-date-input:focus {
  outline:      none;
  border-color: var(--color-border-focus);
  box-shadow:   0 0 0 3px rgba(59,130,246,.18);
}

/* ── Preset row ─────────────────────────────────────────────────────────── */
.filter-row--presets {
  border-top:  1px solid var(--color-border);
  padding-top: var(--space-sm);
  flex-wrap:   wrap;
  gap:         var(--space-sm);
}

.filter-preset-save {
  display:     flex;
  align-items: center;
  gap:         var(--space-xs);
}

.filter-preset-input {
  width:         180px;
  padding:       5px var(--space-sm);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size:     var(--text-sm);
  background:    var(--color-surface-1);
  color:         var(--color-text-primary);
}

.filter-preset-input:focus {
  outline:      none;
  border-color: var(--color-border-focus);
  box-shadow:   0 0 0 3px rgba(59,130,246,.18);
}

.filter-preset-input--error {
  border-color: var(--color-overdue-badge);
  animation:    shake .3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}

/* Preset chips container */
.filter-presets-chips {
  display:     flex;
  flex-wrap:   wrap;
  gap:         var(--space-xs);
  align-items: center;
}

.filter-preset-chip {
  display:       inline-flex;
  align-items:   center;
  gap:           4px;
  padding:       3px var(--space-sm) 3px 10px;
  background:    var(--indigo-bg);
  border:        1px solid var(--indigo-line);
  border-radius: 4px;
  font-size:     12px;
  white-space:   nowrap;
}

.filter-preset-chip-name {
  cursor:  pointer;
  color:   var(--aws-blue);
  font-weight: 600;
}
.filter-preset-chip-name:hover { text-decoration: underline; }

.filter-preset-chip-del {
  background: none;
  border:     none;
  color:      var(--color-text-muted);
  font-size:  14px;
  line-height: 1;
  cursor:     pointer;
  padding:    0 2px;
  border-radius: 50%;
}
.filter-preset-chip-del:hover { color: var(--color-overdue-badge); background: #fee2e2; }

/* ── Responsive: filters ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .filter-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-toolbar-left,
  .filter-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-search-input {
    flex: 1;
    width: auto;
  }

  .filter-ms {
    min-width: 110px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 5 — Dashboard: summary cards, chart grid, alerts
══════════════════════════════════════════════════════════════════════════ */

/* ── Panel header with action buttons ──────────────────────────────────── */
.panel-header--flex {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  gap:             var(--space-md);
  flex-wrap:       wrap;
}

.panel-header-actions {
  display:     flex;
  align-items: center;
  gap:         var(--space-sm);
  flex-shrink: 0;
  margin-top:  var(--space-xs);
}

/* ── Summary cards row ──────────────────────────────────────────────────── */
.dashboard-cards-row {
  display:   flex;
  flex-wrap: wrap;
  gap:       var(--space-md);
  margin-bottom: var(--space-xl);
}

.dashboard-card {
  background:    var(--surface);
  border:        1px solid var(--line);
  border-top:    3px solid var(--line-strong);
  border-radius: var(--card-radius);
  padding:       14px 16px;
  box-shadow:    var(--card-shadow);
  flex:          1;
  min-width:     140px;
}

.dashboard-card--clickable {
  cursor:     pointer;
  transition: box-shadow .15s, transform .1s;
}

.dashboard-card--clickable:hover {
  box-shadow: var(--shadow-md);
  transform:  translateY(-1px);
}

.dashboard-card--clickable:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* Prominent cards — KPI tone via border-top colour */
.dashboard-card.card--overdue {
  background:   var(--rose-bg);
  border-color: var(--rose-line);
  border-top-color: var(--rose);
}

.dashboard-card.card--upcoming {
  background:   var(--amber-bg);
  border-color: var(--amber-line);
  border-top-color: var(--amber);
}

.dashboard-card.card--handoff {
  background:   var(--emerald-bg);
  border-color: var(--emerald-line);
  border-top-color: var(--emerald);
}

.dashboard-card.card--rejected {
  background:   var(--rose-bg);
  border-color: var(--rose-line);
  border-top-color: var(--rose);
}

.dashboard-card-label {
  font-size:      11px;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color:          var(--ink-3);
  margin-bottom:  6px;
}

.card--overdue  .dashboard-card-label { color: var(--rose); }
.card--upcoming .dashboard-card-label { color: var(--amber); }
.card--handoff  .dashboard-card-label { color: var(--emerald); }
.card--rejected .dashboard-card-label { color: var(--rose); }

.dashboard-card-value {
  font-size:   32px;
  font-weight: 600;
  font-family: var(--font-mono);
  color:       var(--ink);
  line-height: 1.1;
}

.card--overdue  .dashboard-card-value { color: var(--rose); }
.card--upcoming .dashboard-card-value { color: var(--amber); }
.card--handoff  .dashboard-card-value { color: var(--emerald); }
.card--rejected .dashboard-card-value { color: var(--rose); }

.dashboard-card-sub {
  font-size:  11px;
  color:      var(--ink-3);
  margin-top: 4px;
  line-height: 1.4;
}

/* By Stage card — wider minimum so stage names never truncate */
.dashboard-card.card--stage-list {
  min-width: 260px;
  flex: 2;   /* allow it to grow a bit more than the numeric-only cards */
}

/* By Stage: stacked list layout */
.dashboard-stage-list {
  display:        flex;
  flex-direction: column;
  gap:            3px;
  margin-top:     var(--space-xs);
  width:          100%;
}

.dashboard-stage-row {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--space-sm);
  padding:         4px 8px 4px 10px;
  border-radius:   var(--radius-sm);
  border-left:     3px solid transparent;
  background:      var(--color-surface-2);
}

.dashboard-stage-row-label {
  font-size:   var(--text-sm);
  color:       var(--color-text-primary);
  line-height: 1.3;
  /* allow wrapping — never truncate full stage names */
  white-space: normal;
  flex:        1;
  min-width:   0;
}

.dashboard-stage-row-count {
  font-size:   var(--text-sm);
  font-weight: 700;
  color:       var(--color-text-primary);
  flex-shrink: 0;
}

/* KVA annotation on dashboard stage rows — sits after the count */
.dashboard-stage-row-kva {
  font-size:   var(--text-xs);
  margin-left: var(--space-2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Stage colours via left border — AWS-appropriate palette */
.dashboard-stage-row.stage-1 { border-left-color: var(--indigo); }
.dashboard-stage-row.stage-2 { border-left-color: #545b64; }
.dashboard-stage-row.stage-3 { border-left-color: #856404; }
.dashboard-stage-row.stage-4 { border-left-color: #a04000; }
.dashboard-stage-row.stage-5 { border-left-color: #1d6a2a; }
.dashboard-stage-row.stage-6 { border-left-color: #0056a3; }
.dashboard-stage-row.stage-7 { border-left-color: #1d8102; }

/* Rejected row — red accent, slight top separation */
.dashboard-stage-row--rejected {
  border-left-color: var(--color-danger, #dc2626);
  margin-top:        4px;
}

/* Divider between active WIP rows and the Rejected row */
.dashboard-stage-divider {
  border:     none;
  border-top: 1px dashed var(--color-border, #d1d5db);
  margin:     6px 0;
}

/* Muted scope label on metric cards ("Active positions", "All positions", etc.) */
.dashboard-card-scope {
  font-size:   var(--text-xs, 0.72rem);
  color:       var(--color-muted, #6b7280);
  margin-top:  var(--space-1, 4px);
  font-style:  italic;
}

/* Legacy pill/badge styles kept for any third-party reference — not used by the card */
.dashboard-card-stages {
  display:   flex;
  flex-wrap: wrap;
  gap:       3px;
  margin-top: var(--space-xs);
}

.dashboard-stage-badge {
  display:      inline-flex;
  align-items:  center;
  padding:      2px 8px;
  border-radius: var(--radius-full);
  font-size:    var(--text-xs);
  font-weight:  600;
  color:        #fff;
  white-space:  nowrap;
}

.dashboard-stage-badge.stage-1 { background: var(--color-stage-1); }
.dashboard-stage-badge.stage-2 { background: var(--color-stage-2); }
.dashboard-stage-badge.stage-3 { background: var(--color-stage-3); }
.dashboard-stage-badge.stage-4 { background: var(--color-stage-4); }
.dashboard-stage-badge.stage-5 { background: var(--color-stage-5); }
.dashboard-stage-badge.stage-6 { background: var(--color-stage-6); }
.dashboard-stage-badge.stage-7 { background: var(--color-stage-7); }

/* ── Charts grid ────────────────────────────────────────────────────────── */
.dashboard-charts-grid {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   var(--space-lg);
  margin-bottom:         var(--space-xl);
}

.dashboard-chart-cell {
  background:    var(--bg-primary);
  border:        var(--card-border);
  border-radius: var(--card-radius);
  box-shadow:    var(--card-shadow);
  overflow:      hidden;
}

.dashboard-chart-wide {
  grid-column: 1 / -1;  /* spans both columns */
}

.dashboard-chart-wrap {
  padding: var(--space-md) var(--space-lg);
}

.dashboard-chart-title {
  font-size:     var(--text-sm);
  font-weight:   600;
  color:         var(--color-text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.dashboard-chart-subtitle {
  font-size:      var(--text-xs);
  font-weight:    400;
  color:          var(--color-text-muted, var(--color-text-secondary));
  text-transform: none;
  letter-spacing: 0;
  opacity:        .75;
}

.dashboard-chart-wrap canvas {
  max-height: 280px;
}

/* No-data / no-chartjs messages */
.chart-empty,
.chart-no-chartjs {
  text-align:   center;
  padding:      var(--space-xl);
  color:        var(--color-text-muted);
  font-size:    var(--text-sm);
  font-style:   italic;
}

.chart-no-chartjs strong { color: var(--color-text-primary); }

/* ── Alerts panel ───────────────────────────────────────────────────────── */
.dashboard-alerts {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-sm);
  margin-bottom:  var(--space-xl);
}

.dashboard-alert-section {
  border:        var(--card-border);
  border-radius: var(--card-radius);
  overflow:      hidden;
  background:    var(--bg-primary);
  box-shadow:    var(--card-shadow);
}

.dashboard-alert-header {
  display:       flex;
  align-items:   center;
  gap:           var(--space-sm);
  width:         100%;
  padding:       var(--space-sm) var(--space-md);
  background:    var(--bg-tertiary);
  border:        none;
  text-align:    left;
  cursor:        pointer;
  font-size:     14px;
  font-weight:   700;
  color:         var(--text-primary);
  transition:    background .12s;
}
.dashboard-alert-header:hover { background: #e8ecec; }

.dashboard-alert-count {
  display:        inline-flex;
  align-items:    center;
  justify-content: center;
  min-width:      20px;
  height:         20px;
  padding:        0 5px;
  border-radius:  var(--radius-full);
  background:     var(--color-border);
  color:          var(--color-text-secondary);
  font-size:      var(--text-xs);
  font-weight:    700;
}

/* Alert-type-specific count badge colours */
.alert-overdue  .dashboard-alert-count { background: var(--color-overdue-badge);  color: #fff; }
.alert-upcoming .dashboard-alert-count { background: var(--color-upcoming-badge); color: #fff; }
.alert-stuck    .dashboard-alert-count { background: var(--color-stage-4);        color: #fff; }
.alert-rejected .dashboard-alert-count { background: var(--color-overdue-badge);  color: #fff; }
.alert-ready    .dashboard-alert-count { background: var(--aws-blue);         color: #fff; }

.dashboard-alert-arrow {
  margin-left: auto;
  font-size:   13px;
  color:       var(--color-text-muted);
}

.dashboard-alert-body {
  padding: var(--space-xs) 0 var(--space-sm);
}

.dashboard-alert-list {
  list-style: none;
  padding:    0;
  margin:     0;
}

.dashboard-alert-row {
  padding:    6px var(--space-md);
  font-size:  var(--text-sm);
  color:      var(--color-text-primary);
  cursor:     pointer;
  transition: background .1s;
  font-family: var(--font-mono);
}
.dashboard-alert-row:hover { background: var(--indigo-bg); }
.dashboard-alert-row:focus { outline: none; background: var(--indigo-bg); }

.dashboard-alert-more {
  padding:    4px var(--space-md);
  font-size:  var(--text-xs);
  color:      var(--color-text-muted);
  font-style: italic;
}

.dashboard-alert-empty {
  padding:    var(--space-sm) var(--space-md);
  font-size:  var(--text-sm);
  color:      var(--color-text-muted);
  font-style: italic;
}

.dashboard-alert-viewall {
  display:    block;
  margin:     var(--space-xs) var(--space-md) 0;
  font-size:  var(--text-xs);
  color:      var(--aws-blue);
  background: none;
  border:     none;
  cursor:     pointer;
  padding:    2px 0;
}
.dashboard-alert-viewall:hover { text-decoration: underline; }

/* ── Responsive: dashboard ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-wide {
    grid-column: 1;
  }

  .dashboard-cards-row {
    gap: var(--space-sm);
  }

  .dashboard-card {
    min-width: 120px;
    padding:   var(--space-sm) var(--space-md);
  }
}

@media (max-width: 600px) {
  .dashboard-cards-row {
    flex-direction: column;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Dashboard v2 — KPI strip + analytical grid
   ══════════════════════════════════════════════════════════════════════ */

/* ─── KPI strip ─────────────────────────────────────────────────────────── */
.dash-kpi-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.dash-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 8px;
  position: relative;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
  min-height: 96px;
}
.dash-kpi.dash-kpi-feature {
  display: grid; grid-template-columns: auto 1fr; gap: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fbfbf9 0%, #ffffff 100%);
}
.dash-kpi-main { display: flex; flex-direction: column; }
.dash-kpi-label {
  font-size: 10.5px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  display: flex; align-items: center; justify-content: space-between;
}
.dash-kpi-value {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em;
  color: var(--ink); margin-top: 2px;
}
.dash-kpi-feature .dash-kpi-value { font-size: 32px; }
.dash-kpi-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--ink-3);
  margin-top: auto;
}
.dash-delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 1px 5px; border-radius: 3px;
}
.dash-delta.up   { background: var(--emerald-bg); color: var(--emerald); }
.dash-delta.down { background: var(--rose-bg);    color: var(--rose); }
.dash-delta.flat { background: #f0f0ec;            color: var(--ink-3); }

.dash-kpi-spark-wrap { position: relative; height: 22px; margin: 2px -2px -2px; }
.dash-kpi-spark-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

.dash-kpi.tone-rose    { border-top: 2px solid var(--rose); }
.dash-kpi.tone-amber   { border-top: 2px solid var(--amber); }
.dash-kpi.tone-emerald { border-top: 2px solid var(--emerald); }
.dash-kpi.tone-indigo  { border-top: 2px solid var(--indigo); }

.dash-kpi-breakdown {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px;
  font-size: 11.5px; align-self: end; padding-bottom: 2px;
}
.dash-kpi-breakdown .b-label { color: var(--ink-3); }
.dash-kpi-breakdown .b-val {
  font-family: var(--font-mono); color: var(--ink); text-align: right;
}

/* ─── Analytical grid ───────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.dash-col-4  { grid-column: span 4; }
.dash-col-5  { grid-column: span 5; }
.dash-col-7  { grid-column: span 7; }
.dash-col-12 { grid-column: span 12; }
.dash-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2, #f0f0ec);
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.dash-col-8  { grid-column: span 8; }
.dash-col-12 { grid-column: span 12; }

.dash-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  min-height: 36px; flex-shrink: 0;
}
.dash-card-title {
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.07em;
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.dash-card-sub {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  font-size: 11px; color: var(--ink-3);
  white-space: nowrap;
}
.dash-card-count {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); font-weight: 400; letter-spacing: 0;
  padding: 1px 6px; background: #f0f0ec; border-radius: 999px;
  text-transform: none; white-space: nowrap;
}
.dash-card-tools { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.dash-card-body  { padding: 10px 12px; flex: 1; }

.dash-legend { display: flex; gap: 12px; align-items: center; }
.dash-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-3); font-weight: 400; text-transform: none; letter-spacing: 0; }
.dash-legend-sw { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.dash-viewall-btn {
  font-size: 11px; font-family: inherit;
  background: none; border: 1px solid var(--line);
  border-radius: 3px; padding: 3px 8px;
  color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.dash-viewall-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }

/* ─── Stage funnel ───────────────────────────────────────────────────────── */
.dash-funnel { display: flex; flex-direction: column; }
.dash-funnel-row {
  display: grid;
  grid-template-columns: 20px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.08s;
}
.dash-funnel-row:hover { background: var(--surface-2); }
.dash-funnel-row:last-child { border-bottom: none; }
.dash-stage-num {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4); text-align: right; flex-shrink: 0;
}
.dash-stage-name-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-stage-label { font-size: 12px; color: var(--ink-2); white-space: normal; }
.dash-stage-bar { height: 5px; background: #f0f0ec; border-radius: 2px; overflow: hidden; }
.dash-stage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink), #475569);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(.2,.7,.2,1);
}
.dash-stage-count {
  font-family: var(--font-mono); font-size: 13px;
  font-weight: 500; color: var(--ink); text-align: right;
  flex-shrink: 0;
}
.dash-stage-count.zero { color: var(--ink-4); }

.dash-funnel-row[data-stage="1"] .dash-stage-bar-fill { background: linear-gradient(90deg, #1e3a8a, #3b62d1); }
.dash-funnel-row[data-stage="2"] .dash-stage-bar-fill { background: linear-gradient(90deg, #5b21b6, #8b5cf6); }
.dash-funnel-row[data-stage="3"] .dash-stage-bar-fill { background: linear-gradient(90deg, #92400e, #f59e0b); }
.dash-funnel-row[data-stage="4"] .dash-stage-bar-fill { background: linear-gradient(90deg, #065f46, #10b981); }
.dash-funnel-row[data-stage="5"] .dash-stage-bar-fill { background: linear-gradient(90deg, #0e7490, #06b6d4); }
.dash-funnel-row[data-stage="6"] .dash-stage-bar-fill { background: linear-gradient(90deg, #1e293b, #64748b); }
.dash-funnel-row[data-stage="handoff"]  .dash-stage-bar-fill { background: linear-gradient(90deg, #065f46, #059669); }
.dash-funnel-row[data-stage="rejected"] .dash-stage-bar-fill { background: linear-gradient(90deg, #991b1b, #ef4444); }

.dash-funnel-divider {
  border: none; border-top: 1px dashed var(--line-strong); margin: 0;
}

/* ─── Worklist ───────────────────────────────────────────────────────────── */
.dash-worklist { display: flex; flex-direction: column; }
.dash-worklist-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px; align-items: center;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 12px; min-width: 0;
}
.dash-worklist-row:hover { background: var(--surface-2); }
.dash-worklist-row:last-child { border-bottom: none; }
.dash-wl-id-title { min-width: 0; overflow: hidden; }
.dash-wl-id {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-3); white-space: nowrap;
}
.dash-wl-title {
  color: var(--ink); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-wl-stage {
  font-size: 10.5px; padding: 1px 5px; border-radius: 3px;
  white-space: nowrap; flex-shrink: 0;
  background: #f0f0ec; color: var(--ink-3);
}
.dash-wl-due {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); white-space: nowrap; flex-shrink: 0;
}
.dash-wl-due.overdue  { color: var(--rose);  font-weight: 500; }
.dash-wl-due.upcoming { color: var(--amber); font-weight: 500; }

/* ─── Sites mini grid ───────────────────────────────────────────────────── */
.dash-site-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.dash-site-cell {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer;
}
.dash-site-cell:hover { background: var(--surface-2); }
.dash-site-cell:nth-child(2n)         { border-right: none; }
.dash-site-cell:nth-last-child(-n+2)  { border-bottom: none; }
/* single last item spanning both cols still needs no border-bottom */
.dash-site-cell:last-child             { border-bottom: none; }
.dash-site-name {
  font-size: 10.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.dash-site-val {
  font-family: var(--font-mono); font-size: 18px;
  font-weight: 500; color: var(--ink); line-height: 1.1;
}
.dash-site-sub { font-size: 10.5px; color: var(--ink-3); }
.dash-site-bar { height: 3px; background: #f0f0ec; border-radius: 1px; overflow: hidden; margin-top: 2px; }
.dash-site-bar-fill { height: 100%; background: var(--ink); border-radius: 1px; }

/* ─── Vendor / stat rows ────────────────────────────────────────────────── */
.dash-stat-row {
  display: flex; flex-direction: column;
  padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.dash-stat-row:last-child { border-bottom: none; }
.dash-stat-row-top { display: flex; justify-content: space-between; align-items: baseline; }
.dash-stat-label {
  font-size: 12px; color: var(--ink-2);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-stat-val {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink);
  margin-left: 10px; white-space: nowrap; flex-shrink: 0;
}
.dash-stat-bar { height: 3px; background: #f0f0ec; border-radius: 1px; margin-top: 5px; }
.dash-stat-bar-fill { height: 100%; background: var(--indigo); border-radius: 1px; }

/* ─── Compact alerts card ────────────────────────────────────────────────── */
.dash-alerts-body {
  overflow-y: auto; max-height: 280px;
  display: flex; flex-direction: column;
}
.dash-alert-row {
  display: grid; grid-template-columns: 7px 1fr auto;
  gap: 8px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  font-size: 12px; cursor: pointer; min-width: 0;
}
.dash-alert-row:hover { background: var(--surface-2); }
.dash-alert-row:last-child { border-bottom: none; }
.dash-alert-marker { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dash-alert-row.t-rose   .dash-alert-marker { background: var(--rose); }
.dash-alert-row.t-amber  .dash-alert-marker { background: var(--amber); }
.dash-alert-row.t-indigo .dash-alert-marker { background: var(--indigo); }
.dash-alert-msg {
  color: var(--ink-2); min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
}
.dash-alert-badge {
  font-size: 10px; font-weight: 500; padding: 1px 5px;
  border-radius: 3px; white-space: nowrap; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.dash-alert-badge.rose   { background: var(--rose-bg);   color: var(--rose);   border: 1px solid var(--rose-line); }
.dash-alert-badge.amber  { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-line); }
.dash-alert-badge.indigo { background: var(--indigo-bg); color: var(--indigo); border: 1px solid var(--indigo-line); }
.dash-alerts-empty { padding: 20px 12px; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dash-kpi-row { grid-template-columns: 1fr repeat(3, 1fr); }
  .dash-grid    { grid-template-columns: repeat(6, 1fr); }
  .dash-col-4, .dash-col-5 { grid-column: span 3; }
  .dash-col-7  { grid-column: span 6; }
}
@media (max-width: 700px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid    { grid-template-columns: 1fr; }
  .dash-col-4, .dash-col-5, .dash-col-7 { grid-column: span 1; }
}


/* ══════════════════════════════════════════════════════════════════════════
   Phase 6 — Users, Comments, Reports
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Assigned-user cell in the positions table ──────────────────────────── */
.cell-assign-user {
  cursor:      pointer;
  white-space: nowrap;
  user-select: none;
}
.cell-assign-user:hover .cell-assign-name {
  text-decoration: underline;
}
.cell-assign-arrow {
  color:     var(--color-muted);
  font-size: 0.75em;
  opacity:   0.7;
}
.cell-assign-inline-select {
  font-size:  0.875rem;
  padding:    2px 4px;
  border:     1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color:      var(--color-text);
  max-width:  160px;
}

/* ── "You" badge (used in user dropdown + Settings table) ───────────────── */
.user-you-badge {
  display:       inline-block;
  margin-left:   6px;
  padding:       1px 6px;
  font-size:     0.7rem;
  font-weight:   700;
  border-radius: 4px;
  background:    var(--aws-blue);
  color:         #fff;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

/* ── Settings → Users section ───────────────────────────────────────────── */
.settings-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top:  1px solid var(--color-border);
}
.settings-section-header {
  margin-bottom: var(--space-md);
}
.settings-section-title {
  font-size:   14px;
  font-weight: 600;
  color:       var(--ink);
  margin:      0 0 4px;
}
.settings-section-desc {
  font-size:  13px;
  color:      var(--ink-3);
  margin:     0;
  max-width:  520px;
  line-height: 1.5;
}
.settings-site-forecast-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.settings-site-forecast-row:last-child { border-bottom: none; }
.settings-site-forecast-name {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
}
.settings-site-forecast-input {
  width: 100px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  text-align: right;
}
.settings-site-forecast-unit {
  font-size: 13px;
  color: var(--ink-3);
  min-width: 24px;
}
.settings-site-forecast-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.settings-site-group-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.settings-site-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.settings-site-group-name-input {
  font-size: 14px;
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 160px;
}
.settings-site-group-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.settings-site-group-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-1, #f9fafb);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.settings-site-group-chip.active {
  background: var(--color-primary, #2563eb);
  color: #fff;
  border-color: var(--color-primary, #2563eb);
}
.settings-site-groups-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kwf-charts-row {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.kwf-chart-card {
  flex: 1;
  min-width: 280px;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.kwf-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}
.detail-edit-rejection-btn {
  margin-left: 12px;
  font-size: 11px;
  padding: 2px 8px;
  vertical-align: middle;
}
.detail-outcome-banner--rejected {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.kwf-matrix-section {
  margin-top: 24px;
  margin-bottom: 24px;
}
.kwf-matrix-table th {
  font-size: 11px;
  white-space: nowrap;
}
.kwf-matrix-table td {
  font-size: 13px;
}
.settings-add-user-form {
  display:     flex;
  gap:         var(--space-sm);
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.settings-users-table-wrap {
  overflow-x: auto;
}
.settings-users-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.875rem;
}
.settings-users-table th {
  text-align:    left;
  font-weight:   600;
  padding:       9px 12px;
  background:    var(--surface-2);
  color:         var(--ink-3);
  font-size:     11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line-strong);
}
.settings-users-table td {
  padding:       10px 12px;
  border-bottom: 1px solid var(--color-border-light, var(--color-border));
  vertical-align: middle;
}
.settings-users-table tbody tr:last-child td {
  border-bottom: none;
}
.settings-users-table tbody tr:hover td {
  background: var(--color-hover, rgba(0,0,0,0.03));
}
.settings-user-row--inactive td {
  opacity: 0.55;
}
.settings-user-row--inactive .settings-user-status--inactive {
  opacity: 1;
}
.settings-users-actions-col {
  white-space: nowrap;
  text-align:  right;
}
.settings-users-actions-col .btn + .btn {
  margin-left: 6px;
}
.settings-user-status--active   { color: var(--color-success, #2e7d32); }
.settings-user-status--inactive { color: var(--color-muted); }
.settings-users-empty {
  text-align: center;
  color:      var(--color-muted);
  font-style: italic;
  padding:    24px \!important;
}
.settings-user-name-input {
  font-size:    0.875rem;
  padding:      4px 8px;
  border:       1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background:   var(--color-surface);
  color:        var(--color-text);
}
.btn-xs {
  font-size:  0.78rem;
  padding:    3px 8px;
  min-height: 0;
  line-height: 1.4;
}

/* ── Comment thread ─────────────────────────────────────────────────────── */
.detail-subtab-strip {
  display:       flex;
  gap:           2px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-md);
}
.detail-subtab-btn {
  background:    none;
  border:        none;
  cursor:        pointer;
  padding:       8px 14px;
  font-size:     0.85rem;
  font-weight:   500;
  color:         var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition:    color 0.15s, border-color 0.15s;
  display:       flex;
  align-items:   center;
  gap:           6px;
}
.detail-subtab-btn:hover {
  color: var(--color-text-primary);
}
.detail-subtab-btn.active {
  color:         var(--aws-blue);
  border-bottom-color: var(--aws-blue);
  font-weight:   700;
}
.detail-subtab-badge {
  display:       inline-flex;
  align-items:   center;
  justify-content: center;
  min-width:     18px;
  height:        18px;
  padding:       0 5px;
  border-radius: 4px;
  background:    var(--aws-blue);
  color:         #fff;
  font-size:     0.7rem;
  font-weight:   700;
  line-height:   1;
}
.comment-compose {
  display:       flex;
  flex-direction: column;
  gap:           var(--space-sm);
  margin-bottom: var(--space-md);
  padding:       var(--space-md);
  background:    var(--color-surface-alt, var(--color-bg));
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.comment-compose-textarea {
  width:        100%;
  min-height:   72px;
  padding:      8px 10px;
  font-size:    0.875rem;
  font-family:  inherit;
  border:       1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background:   var(--color-surface);
  color:        var(--color-text);
  resize:       vertical;
  box-sizing:   border-box;
}
.comment-compose-textarea:focus {
  outline:      2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.comment-compose-actions {
  display:     flex;
  justify-content: flex-end;
}
.comment-thread {
  list-style: none;
  margin:     0;
  padding:    0;
  display:    flex;
  flex-direction: column;
  gap:        var(--space-sm);
}
.comment-item {
  display:        flex;
  gap:            var(--space-sm);
  align-items:    flex-start;
  padding:        var(--space-sm) var(--space-sm);
  border-radius:  var(--radius-md);
  transition:     background 0.1s;
}
.comment-item:hover {
  background: var(--color-surface-alt, rgba(0,0,0,0.025));
}
.comment-item--deleted {
  opacity: 0.5;
}
.comment-avatar {
  flex-shrink:   0;
  width:         32px;
  height:        32px;
  border-radius: 50%;
  background:    var(--aws-blue);
  color:         #fff;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     0.78rem;
  font-weight:   700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.comment-body {
  flex: 1;
  min-width: 0;
}
.comment-meta {
  display:     flex;
  align-items: baseline;
  gap:         8px;
  margin-bottom: 3px;
  flex-wrap:   wrap;
}
.comment-author {
  font-weight: 600;
  font-size:   0.85rem;
  color:       var(--color-text);
}
.comment-time {
  font-size: 0.75rem;
  color:     var(--color-muted);
}
.comment-edited-indicator {
  font-size:  0.72rem;
  color:      var(--color-muted);
  font-style: italic;
}
.comment-text {
  font-size:   0.875rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break:  break-word;
  color:       var(--color-text);
}
.comment-deleted-text {
  font-size:  0.875rem;
  color:      var(--color-muted);
  font-style: italic;
}
.comment-actions {
  display:     flex;
  gap:         6px;
  margin-top:  4px;
  opacity:     0;
  transition:  opacity 0.15s;
}
.comment-item:hover .comment-actions {
  opacity: 1;
}
.comment-action-btn {
  background:  none;
  border:      none;
  cursor:      pointer;
  padding:     2px 6px;
  font-size:   0.75rem;
  color:       var(--color-muted);
  border-radius: var(--radius-sm);
  transition:  color 0.1s, background 0.1s;
}
.comment-action-btn:hover {
  color:       var(--color-text);
  background:  var(--color-border);
}
.comment-action-btn--danger:hover {
  color:       var(--color-danger, #c62828);
  background:  rgba(198, 40, 40, 0.08);
}
.comment-edit-form {
  margin-top: var(--space-sm);
  display:    flex;
  flex-direction: column;
  gap:        var(--space-sm);
}
.comment-edit-textarea {
  width:       100%;
  min-height:  60px;
  padding:     6px 8px;
  font-size:   0.875rem;
  font-family: inherit;
  border:      1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background:  var(--color-surface);
  color:       var(--color-text);
  resize:      vertical;
  box-sizing:  border-box;
}
.comment-edit-actions {
  display: flex;
  gap:     6px;
}
.comment-empty-state {
  text-align: center;
  color:      var(--color-muted);
  font-style: italic;
  font-size:  0.875rem;
  padding:    var(--space-lg) 0;
}
.comment-loading {
  text-align: center;
  color:      var(--color-muted);
  font-size:  0.85rem;
  padding:    var(--space-md) 0;
}

/* ── Reports layout ─────────────────────────────────────────────────────── */
.reports-layout {
  display:   flex;
  gap:       0;
  min-height: 520px;
  border:    1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow:  hidden;
  margin-top: var(--space-md);
}
.reports-sidebar {
  width:        210px;
  flex-shrink:  0;
  background:   var(--surface-2);
  border-right: 1px solid var(--line);
  padding:      12px 0;
  overflow-y:   auto;
}
.reports-sidebar-group {
  margin-bottom: var(--space-xs);
}
.reports-sidebar-group + .reports-sidebar-group {
  border-top: 1px solid var(--line);
  padding-top: var(--space-xs);
  margin-top: var(--space-xs);
}
.reports-sidebar-group-title {
  font-size:   10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color:       var(--ink-4);
  padding:     6px 14px 4px;
  margin:      0;
}
.reports-sidebar-list {
  list-style: none;
  margin:     0;
  padding:    0;
}
.reports-sidebar-btn {
  display:    block;
  width:      100%;
  text-align: left;
  background: none;
  border:     none;
  cursor:     pointer;
  padding:    7px 14px;
  font-size:  12.5px;
  color:      var(--ink-2);
  transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
}
.reports-sidebar-btn:hover {
  background: var(--surface);
  color: var(--ink);
}
.reports-sidebar-btn.active {
  color:        var(--indigo);
  background:   var(--indigo-bg);
  border-left-color: var(--indigo);
  font-weight:  600;
}
.reports-main {
  flex:    1;
  padding: var(--space-lg);
  overflow: auto;
  min-width: 0;
}

/* Report controls (week-of date picker) */
.report-controls {
  display:     flex;
  align-items: flex-end;
  gap:         var(--space-md);
  margin-bottom: var(--space-md);
  padding:     12px 14px;
  background:  var(--surface-2);
  border:      1px solid var(--line);
  border-radius: 4px;
  flex-wrap:   wrap;
}
.report-control-group {
  display:        flex;
  flex-direction: column;
  gap:            4px;
}

/* Summary cards row */
.report-summary-cards {
  display:   flex;
  flex-wrap: wrap;
  gap:       var(--space-sm);
  margin-bottom: var(--space-md);
}
.report-summary-card {
  background:    var(--color-surface);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding:       var(--space-sm) var(--space-md);
  min-width:     110px;
  text-align:    center;
}
.report-summary-card-value {
  font-size:   28px;
  font-weight: 700;
  color:       var(--text-primary);
  line-height: 1.2;
}
.report-summary-card-label {
  font-size:  0.75rem;
  color:      var(--color-muted);
  margin-top: 2px;
}

/* Report table container */
.report-table-container {
  overflow-x: auto;
}
.report-empty-state {
  text-align: center;
  color:      var(--color-muted);
  font-style: italic;
  padding:    var(--space-xl) 0;
}

/* Report data table */
.report-data-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.875rem;
}
.report-data-table th {
  text-align:    left;
  padding:       9px 12px;
  background:    var(--surface-2);
  color:         var(--ink-3);
  font-weight:   600;
  font-size:     11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space:   nowrap;
  border-bottom: 1px solid var(--line-strong);
}
.report-data-table td {
  padding:        9px 12px;
  border-bottom:  1px solid var(--color-border-light, var(--color-border));
  vertical-align: middle;
  white-space:    nowrap;
}
.report-data-table tbody tr:last-child td {
  border-bottom: none;
}
.report-data-table tbody tr:hover td {
  background: var(--color-hover, rgba(0,0,0,0.03));
}

/* Grouped report sections */
.report-group {
  margin-bottom: var(--space-md);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow:      hidden;
}
.report-group-heading {
  cursor:     pointer;
  list-style: none;
  padding:    10px 16px;
  font-weight: 600;
  font-size:  0.9rem;
  background: var(--color-surface-alt, var(--color-bg));
  border-bottom: 1px solid var(--color-border);
  user-select: none;
}
.report-group-heading:hover {
  background: var(--color-hover, rgba(0,0,0,0.04));
}
.report-group[open] .report-group-heading {
  border-bottom: 1px solid var(--color-border);
}
.report-group:not([open]) .report-group-heading {
  border-bottom: none;
}
.report-group .report-data-table {
  margin: 0;
}
.report-group .report-empty-state {
  padding: var(--space-md);
}

/* ── Discrepancy group states ─────────────────────────────────────────────── */

/* Done groups are greyed out and collapsed */
.disc-group--done {
  opacity: 0.55;
  filter:  grayscale(0.4);
}
.disc-group--done .report-group-heading {
  background: var(--color-surface-alt, #f5f5f5);
}

/* Heading flex layout — label left, actions right */
.report-group-heading {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             12px;
}
.disc-group-label {
  flex: 1;
}
.disc-group-actions {
  flex-shrink: 0;
  display:     flex;
  align-items: center;
  gap:         8px;
}

/* Create Discrepancy button */
.disc-create-btn {
  font-size:     0.78rem;
  padding:       4px 10px;
  border-radius: 4px;
  white-space:   nowrap;
  /* Prevent the <summary> click-toggle from firing */
  pointer-events: auto;
}
.disc-create-btn:focus {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}

/* Done badge */
.disc-done-badge {
  font-size:   0.78rem;
  font-weight: 600;
  color:       #16a34a;
  padding:     3px 8px;
  background:  #dcfce7;
  border-radius: 12px;
  white-space: nowrap;
}

/* Re-run button (done groups) */
.disc-rerun-btn {
  font-size:    0.78rem;
  padding:      4px 10px;
  border-radius: 4px;
  white-space:  nowrap;
  color:        var(--color-primary, #2563eb);
  border-color: var(--color-primary, #2563eb);
}

/* Unmark button */
.disc-unmark-btn {
  font-size:    0.78rem;
  padding:      4px 10px;
  border-radius: 4px;
  white-space:  nowrap;
  color:        var(--color-muted, #6b7280);
  border:       1px solid currentColor;
  background:   transparent;
  cursor:       pointer;
}
.disc-unmark-btn:hover {
  color:       var(--color-danger, #dc2626);
  border-color: var(--color-danger, #dc2626);
  background:  #fef2f2;
}

/* ── Discrepancy modal ────────────────────────────────────────────────────── */
.disc-modal-inner {
  display:        flex;
  flex-direction: column;
  gap:            16px;
  padding:        4px 0;
}

/* Instruction banner */
.disc-modal-instruction {
  display:       flex;
  align-items:   flex-start;
  gap:           8px;
  background:    #eff6ff;
  border:        1px solid #bfdbfe;
  border-radius: 6px;
  padding:       10px 14px;
  font-size:     0.88rem;
  color:         #1e40af;
  font-weight:   500;
  line-height:   1.4;
}
.disc-modal-instruction-icon {
  font-size:   1.1rem;
  flex-shrink: 0;
  margin-top:  1px;
}

.disc-modal-copy-label {
  margin:    0;
  font-size: 0.85rem;
  color:     var(--color-muted, #6b7280);
}

/* Scrollable wrapper for wide tables */
.disc-modal-table-wrap {
  overflow-x: auto;
  border:     1px solid var(--color-border, #e5e7eb);
  border-radius: 6px;
}

/* The copy table */
.disc-copy-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.83rem;
  white-space:     nowrap;
}
.disc-copy-table th,
.disc-copy-table td {
  padding:       6px 12px;
  text-align:    left;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.disc-copy-table th {
  background:  var(--color-surface-alt, #f9fafb);
  font-weight: 600;
  font-size:   0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color:       var(--color-muted, #6b7280);
}
.disc-copy-table tbody tr:last-child td {
  border-bottom: none;
}
.disc-copy-table tbody tr:hover td {
  background: var(--color-hover, rgba(0,0,0,0.03));
}

/* Footer with action buttons */
.disc-modal-footer {
  display:     flex;
  gap:         8px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ── Expanded @media print rules (Phase 6) ──────────────────────────────── */
@media print {
  /* Hide all nav/actions — Reports panel is the print target */
  .app-header,
  .tab-nav,
  .panel-header-actions,
  .filter-toolbar,
  .reports-sidebar,
  #toast-container,
  #modal-root,
  .btn-report-export,
  .btn-report-print {
    display: none \!important;
  }

  /* Make reports fill the page */
  .reports-layout {
    border:  none;
    display: block;
  }
  .reports-main {
    padding: 0;
    width:   100%;
  }

  /* Expand all collapsed groups */
  .report-group {
    border:       none;
    margin-bottom: var(--space-lg);
    break-inside: avoid;
  }
  .report-group-heading {
    background:   none;
    border-bottom: 2px solid #000;
    font-size:    1rem;
    padding:      4px 0;
  }
  .report-data-table th,
  .report-data-table td {
    border-color: #aaa;
    font-size:    0.8rem;
    padding:      5px 8px;
  }
  .report-summary-cards {
    flex-wrap: wrap;
    gap:       8px;
    margin-bottom: 16px;
  }
  .report-summary-card {
    border:  1px solid #aaa;
    padding: 4px 12px;
  }
  .report-summary-card-value {
    font-size: 1.2rem;
    color:     #000;
  }

  /* Settings and other tabs: hide in print if not Reports */
  #tab-dashboard,
  #tab-positions,
  #tab-import,
  #tab-settings {
    display: none \!important;
  }
  #tab-reports {
    display: block \!important;
  }
  .tab-panel[hidden] { display: none \!important; }

  /* Weekly Digest print header — hidden on screen, shown when printing */
  .digest-print-header {
    display:       block !important;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #000;
  }
  .digest-print-title {
    font-size:   0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
  }
  .digest-print-subtitle {
    font-size:   1.25rem;
    font-weight: 700;
    color: #000;
    margin-top: 4px;
  }
  .digest-print-daterange {
    font-size:   0.9rem;
    color: #555;
    margin-top: 2px;
  }
  .digest-print-meta {
    font-size: 0.8rem;
    color: #555;
    margin-top: 2px;
  }
}

/* Weekly Digest print header — hidden on screen */
.digest-print-header { display: none; }

/* Weekly Digest — hint text beneath week picker */
.report-week-hint {
  font-size:   var(--text-xs, 0.75rem);
  color:       var(--text-muted, #687078);
  margin:      2px 0 0;
  font-style:  italic;
  line-height: 1.4;
}

/* Make the week select wide enough for the formatted option text */
.filter-select-week {
  min-width: 280px;
}

/* ════════════════════════════════════════════════════════════════════
   Phase 6.6 — Automation & Intelligence styles
════════════════════════════════════════════════════════════════════ */

/* Feature A — Import Diff Modal */
.diff-modal-tabs { display:flex; gap:4px; border-bottom:1px solid var(--color-border); margin-bottom:16px; }
.diff-tab-btn { background:none; border:none; padding:8px 16px; cursor:pointer; font-size:0.875rem; color:var(--color-text-muted); border-bottom:2px solid transparent; }
.diff-tab-btn.active { color:var(--aws-blue); border-bottom-color:var(--aws-blue); font-weight:700; }
.diff-tab-panel { display:none; }
.diff-tab-panel.active { display:block; }
.diff-stat-row { display:flex; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.diff-stat-box { background:var(--bg-tertiary); border:var(--card-border); border-radius:4px; padding:12px 20px; text-align:center; min-width:100px; box-shadow:var(--card-shadow); }
.diff-stat-box-value { font-size:1.75rem; font-weight:700; color:var(--aws-blue); }
.diff-stat-box-label { font-size:0.75rem; color:var(--color-text-muted); margin-top:2px; }
/* SubBuildId list beneath PFHO movement stat boxes */
.diff-stat-box-ids { list-style:none; padding:0; margin:6px 0 0; border-top:1px solid var(--color-border); padding-top:6px; text-align:left; max-height:120px; overflow-y:auto; }
.diff-stat-box-ids li { font-family:monospace; font-size:0.75rem; color:var(--color-text-secondary); padding:2px 0; white-space:nowrap; }
.diff-removed-note { font-size:0.8125rem; color:var(--color-text-muted); background:var(--color-surface-alt,#f8fafc); border:1px solid var(--color-border); border-radius:6px; padding:8px 12px; margin-bottom:12px; }
.diff-list { list-style: none; padding: 0; margin: 0; }
.diff-list li { padding: 6px 0; border-bottom: 1px solid var(--color-border-light, var(--color-border)); font-family: monospace; font-size: 0.85rem; }
.diff-list li:last-child { border-bottom: none; }
.diff-table { width: 100%; border-collapse: collapse; }
.diff-table th, .diff-table td { padding: 8px; text-align: left; border-bottom: 1px solid var(--color-border); }
.diff-table th { background: var(--color-surface-alt, #f8fafc); font-weight: 600; font-size: 0.8rem; }

/* Feature D — Vendor chips (visibility controlled by hidden attribute) */
.vendor-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; align-items:center; }
.vendor-chips-label { font-size:0.8125rem; color:var(--color-text-muted); }
.vendor-chip { background:var(--indigo-bg); border:1px solid var(--indigo-line); border-radius:4px; padding:4px 12px; font-size:12px; cursor:pointer; color:var(--indigo); font-weight:600; }
.vendor-chip:hover { background:#d0e8f5; }

/* Settings vendors list */
.settings-vendors-list { padding: 0; margin: 0; list-style: none; }
.settings-vendors-list li { font-size: 0.875rem; }
.settings-vendors-list li:last-child { margin-bottom: 0; }
.settings-vendors-list .btn-remove { padding: 2px 8px; font-size: 0.75rem; }

/* ── Per-vendor email management ─────────────────────────────────────────── */
.settings-vendor-item {
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius, 6px);
  padding: var(--space-3, 0.75rem);
  margin-bottom: var(--space-2, 0.5rem);
}
.settings-vendor-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  flex-wrap: wrap;
}
.settings-vendor-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
.settings-vendor-email-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #dbeafe;
  color: var(--color-primary, #2563eb);
  white-space: nowrap;
}
.settings-vendor-email-badge--empty {
  background: var(--color-bg-alt, #f8fafc);
  color: var(--color-muted, #64748b);
}
.settings-vendor-actions {
  display: flex;
  gap: var(--space-1, 0.25rem);
}
.settings-vendor-emails {
  margin-top: var(--space-3, 0.75rem);
  padding-top: var(--space-3, 0.75rem);
  border-top: 1px solid var(--color-border, #e2e8f0);
}
.settings-vendor-email-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-3, 0.75rem);
}
.settings-vendor-email-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  gap: var(--space-2, 0.5rem);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.settings-vendor-email-item:last-child { border-bottom: none; }
.settings-vendor-add-email-form {
  display: flex;
  gap: var(--space-2, 0.5rem);
  align-items: center;
  margin-top: var(--space-2, 0.5rem);
  flex-wrap: wrap;
}

/* ── Vendor rename inline form ───────────────────────────────────────────── */
.settings-vendor-rename-form {
  display: flex;
  gap: var(--space-2, 0.5rem);
  align-items: center;
  margin-top: var(--space-2, 0.5rem);
  flex-wrap: wrap;
}

/* ── Vendor reconciliation panel ─────────────────────────────────────────── */
.settings-vendor-recon-heading {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted, #64748b);
  margin: var(--space-4, 1rem) 0 var(--space-2, 0.5rem);
  padding-top: var(--space-4, 1rem);
  border-top: 1px solid var(--color-border, #e2e8f0);
}
.settings-vendor-recon-bucket {
  margin-bottom: var(--space-3, 0.75rem);
  padding: var(--space-3, 0.75rem);
  border-radius: var(--radius, 6px);
  border-left: 3px solid transparent;
}
.recon-bucket--missing  { background: #fef2f2; border-left-color: #ef4444; }
.recon-bucket--match    { background: #fffbeb; border-left-color: #f59e0b; }
.recon-bucket--orphan   { background: var(--color-bg-alt, #f8fafc); border-left-color: var(--color-border, #e2e8f0); }
.settings-vendor-recon-bucket-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted, #64748b);
  margin: 0 0 var(--space-2, 0.5rem);
}
.settings-vendor-recon-item {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  flex-wrap: wrap;
  padding: 5px 0;
  font-size: 0.875rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.settings-vendor-recon-item:first-of-type { border-top: none; }
.settings-vendor-recon-name { flex: 1; min-width: 0; }
.settings-vendor-recon-orphan-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--color-bg-alt, #f1f5f9);
  color: var(--color-muted, #64748b);
  white-space: nowrap;
}

/* ── vendor_rename activity badge ────────────────────────────────────────── */
.badge-activity-vendor-rename {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.detail-activity-item:has(.badge-activity-vendor-rename) {
  border-left: 3px solid #15803d;
}

/* ── Vendor Instruction Email modal (veim-*) ─────────────────────────────── */
@keyframes veim-step-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.veim-wrap { padding: 0 4px; }

.veim-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.veim-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.veim-title {
  margin: 0 !important;
}
.veim-meta {
  font-size: 0.9rem;
  color: var(--color-text, #1e293b);
  margin-bottom: 0;
}
.veim-meta-sep {
  margin: 0 6px;
  color: var(--color-muted, #64748b);
}
.veim-pos-names {
  color: var(--color-muted, #64748b);
  font-size: 0.85rem;
}
.veim-divider {
  border: none;
  border-top: 1px solid var(--color-border, #e2e8f0);
  margin: 14px 0;
}

/* Steps list */
.veim-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.veim-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--color-bg-alt, #f8fafc);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius, 6px);
  opacity: 0;
  animation: veim-step-in 0.28s ease forwards;
}
.veim-step-icon {
  font-size: 1.2rem;
  line-height: 1.3;
  flex-shrink: 0;
}
.veim-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.veim-step-action {
  flex-shrink: 0;
  margin-left: 8px;
}
.veim-step-btn {
  font-size: 0.8125rem;
  padding: 5px 12px;
  border-radius: var(--radius, 6px);
  border: 1px solid var(--color-primary, #2563eb);
  background: transparent;
  color: var(--color-primary, #2563eb);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.veim-step-btn:hover:not(:disabled) {
  background: var(--color-primary, #2563eb);
  color: #fff;
}
.veim-step-btn--done {
  border-color: #16a34a !important;
  color: #16a34a !important;
  background: #f0fdf4 !important;
  cursor: default;
}
.veim-step-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text, #1e293b);
}
.veim-step-note {
  font-size: 0.8125rem;
  color: var(--color-muted, #64748b);
  word-break: break-word;
}

/* Warning tip */
.veim-warn {
  font-size: 0.8125rem;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius, 6px);
  padding: 10px 14px;
  color: #92400e;
  margin-bottom: 16px;
}

.veim-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ── Responsive: Reports ─────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .reports-layout {
    flex-direction: column;
  }
  .reports-sidebar {
    width:        100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding:      var(--space-sm) 0;
  }
  .reports-sidebar-group {
    display: flex;
    flex-wrap: wrap;
    gap:       4px;
    padding:   4px 12px;
  }
  .reports-sidebar-group-title {
    display: none;
  }
  .reports-sidebar-btn {
    padding:       6px 10px;
    border-radius: var(--radius-sm);
    border-left:   none;
    border:        1px solid var(--color-border);
    width:         auto;
    font-size:     0.8rem;
  }
  .reports-sidebar-btn.active {
    border-color: var(--color-primary);
    background:   rgba(0, 85, 204, 0.1);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 7 — Storage Quota Banner
   ═══════════════════════════════════════════════════════════════════════ */

.storage-banner {
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
  gap:              12px;
  padding:          12px 16px;
  background:       var(--amber-bg);
  border-left:      3px solid var(--amber);
  border-bottom:    1px solid var(--line);
  color:            var(--amber);
  font-size:        14px;
  font-weight:      500;
  z-index:          200;
  flex-wrap:        wrap;
}

.storage-banner--critical {
  background:    #fdf2f0;
  border-color:  var(--status-red);
  color:         var(--status-red);
}

.storage-banner-msg {
  flex: 1;
  min-width: 0;
}

.storage-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.storage-banner-export-btn {
  background:   #f59e0b;
  color:        #fff;
  border-color: #d97706;
}
.storage-banner-export-btn:hover {
  background:   #d97706;
}

.storage-banner--critical .storage-banner-export-btn {
  background:   #dc2626;
  border-color: #b91c1c;
}
.storage-banner--critical .storage-banner-export-btn:hover {
  background:   #b91c1c;
}

.storage-banner-dismiss-btn {
  background:    transparent;
  border-color:  currentColor;
  color:         inherit;
  opacity:       0.75;
}
.storage-banner-dismiss-btn:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 7 — Help Tab
   ═══════════════════════════════════════════════════════════════════════ */

.help-search-wrap {
  padding:       var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  background:    var(--color-surface-1);
  position:      sticky;
  top:           0;
  z-index:       10;
}

.help-search-input {
  width:         100%;
  max-width:     480px;
  padding:       8px 14px;
  border:        1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size:     var(--text-base);
  background:    var(--color-surface-0);
  color:         var(--color-text-primary);
  transition:    border-color 0.15s;
}

.help-search-input:focus {
  outline:       none;
  border-color:  var(--color-border-focus);
  box-shadow:    0 0 0 3px rgba(59, 130, 246, 0.12);
}

.help-sections {
  padding: var(--space-md) var(--space-lg) var(--space-2xl);
  max-width: 860px;
}

.help-section {
  margin-bottom: var(--space-sm);
  border:        var(--card-border);
  border-radius: var(--card-radius);
  background:    var(--bg-primary);
  overflow:      hidden;
  transition:    box-shadow 0.15s;
  box-shadow:    var(--card-shadow);
}

.help-section:hover {
  box-shadow: var(--shadow-sm);
}

.help-section[open] {
  box-shadow: var(--shadow-sm);
}

.help-section-title {
  padding:     12px 18px;
  font-size:   var(--text-base);
  font-weight: 600;
  color:       var(--color-text-primary);
  cursor:      pointer;
  user-select: none;
  list-style:  none;  /* hide default marker */
  display:     flex;
  align-items: center;
  gap:         10px;
}

.help-section-title::-webkit-details-marker { display: none; }
.help-section-title::marker { display: none; }

.help-section-title::before {
  content:     '▶';
  font-size:   10px;
  color:       var(--color-text-muted);
  transition:  transform 0.2s;
  flex-shrink: 0;
}

.help-section[open] > .help-section-title::before {
  transform: rotate(90deg);
}

.help-section-body {
  padding:      0 20px 20px 20px;
  font-size:    var(--text-sm);
  line-height:  1.7;
  color:        var(--color-text-primary);
  border-top:   1px solid var(--color-border);
}

.help-section-body h4 {
  font-size:    var(--text-sm);
  font-weight:  600;
  margin:       16px 0 6px;
  color:        var(--color-text-primary);
}

.help-section-body p { margin-bottom: 10px; }
.help-section-body ul,
.help-section-body ol {
  padding-left: 20px;
  margin-bottom: 10px;
}
.help-section-body li { margin-bottom: 4px; }

.help-section-body code {
  background:    var(--color-surface-2);
  border:        1px solid var(--color-border);
  border-radius: 3px;
  padding:       1px 5px;
  font-family:   var(--font-mono);
  font-size:     0.85em;
}

.help-table {
  width:           100%;
  border-collapse: collapse;
  margin-bottom:   12px;
  font-size:       var(--text-sm);
}
.help-table th,
.help-table td {
  padding:       7px 10px;
  text-align:    left;
  border-bottom: 1px solid var(--color-border);
}
.help-table th {
  background:  var(--surface-2);
  color:       var(--ink-3);
  font-weight: 600;
  font-size:   11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line-strong);
}

.help-note {
  font-size:   var(--text-xs);
  color:       var(--color-text-muted);
  font-style:  italic;
  margin-top:  8px;
}

/* Section hidden by search */
.help-section--no-match {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 7 — Keyboard Shortcuts Modal
   ═══════════════════════════════════════════════════════════════════════ */

.shortcuts-modal {
  min-width: 400px;
}

.shortcuts-table {
  width:           100%;
  border-collapse: collapse;
  margin:          16px 0;
  font-size:       var(--text-sm);
}
.shortcuts-table th,
.shortcuts-table td {
  padding:       8px 12px;
  text-align:    left;
  border-bottom: 1px solid var(--color-border);
}
.shortcuts-table th {
  background:  var(--surface-2);
  color:       var(--ink-3);
  font-weight: 600;
  font-size:   11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line-strong);
}
.shortcuts-table td:first-child {
  white-space: nowrap;
  width:       120px;
}

kbd {
  display:        inline-block;
  padding:        2px 7px;
  background:     var(--color-surface-2);
  border:         1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius:  4px;
  font-family:    var(--font-mono);
  font-size:      0.82em;
  color:          var(--color-text-primary);
  white-space:    nowrap;
}

.shortcuts-note {
  font-size:   var(--text-xs);
  color:       var(--color-text-muted);
  font-style:  italic;
  margin-top:  8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 7 — Backup Reminder Toast
   ═══════════════════════════════════════════════════════════════════════ */

.toast-backup-reminder {
  display:        flex;
  flex-direction: column;
  gap:            10px;
  max-width:      340px;
}

.toast-backup-text {
  font-size:   var(--text-sm);
  line-height: 1.5;
}

.toast-backup-btns {
  display: flex;
  gap:     8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Hard Reset — Danger Zone section (Settings tab)
   ═══════════════════════════════════════════════════════════════════════ */

.settings-hard-reset-zone {
  margin:  var(--space-2xl) var(--space-lg) var(--space-xl);
  border:  2px solid var(--status-red);
  border-radius: 4px;
  background: var(--bg-primary);
  overflow: hidden;
}

.settings-hard-reset-header {
  padding:     var(--space-md) var(--space-lg);
  border-bottom: 1px solid #f5bcb0;
  background:  #fdf2f0;
}

.settings-hard-reset-title {
  font-size:   16px;
  font-weight: 700;
  color:       var(--status-red);
  margin:      0 0 2px;
}

.settings-hard-reset-desc {
  font-size:   14px;
  color:       var(--text-secondary);
  margin:      0;
}

.settings-hard-reset-card {
  display:        flex;
  align-items:    center;
  justify-content: space-between;
  gap:            var(--space-lg);
  padding:        var(--space-lg);
  flex-wrap:      wrap;
}

.settings-hard-reset-card-body {
  flex: 1;
  min-width: 0;
}

.settings-hard-reset-card-body strong {
  display:     block;
  font-size:   var(--text-base);
  font-weight: 600;
  color:       #7f1d1d;
  margin-bottom: 6px;
}

.settings-hard-reset-card-body p {
  font-size:   var(--text-sm);
  color:       var(--color-text-secondary);
  margin:      0;
  line-height: 1.6;
}

.settings-hard-reset-card-action {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Hard Reset — 3-step confirmation modal
   ═══════════════════════════════════════════════════════════════════════ */

.hard-reset-modal {
  max-width: 520px;
}

.hard-reset-step-indicator {
  font-size:   var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color:       var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.hard-reset-warning-list {
  margin:      var(--space-md) 0;
  padding:     var(--space-md) var(--space-md) var(--space-md) var(--space-xl);
  background:  #fdf2f0;
  border:      1px solid #f5bcb0;
  border-left: 4px solid var(--status-red);
  border-radius: 4px;
  list-style:  disc;
  font-size:   14px;
  color:       var(--text-primary);
  line-height: 1.7;
}

.hard-reset-warning-list li { margin-bottom: 2px; }

.hard-reset-backup-question {
  font-size:   var(--text-sm);
  font-weight: 600;
  color:       #991b1b;
  margin-top:  var(--space-md);
}

/* Step 2 — type DELETE */
.hard-reset-confirm-label {
  display:     block;
  font-size:   var(--text-sm);
  font-weight: 600;
  margin-bottom: 6px;
  color:       var(--color-text-primary);
}

.hard-reset-confirm-input {
  width:         100%;
  padding:       10px 14px;
  font-size:     var(--text-base);
  font-family:   var(--font-mono);
  font-weight:   700;
  letter-spacing: 0.1em;
  border:        2px solid var(--color-border);
  border-radius: var(--radius-md);
  background:    var(--color-surface-0);
  color:         var(--color-text-primary);
  transition:    border-color 0.15s;
  margin-bottom: 8px;
}

.hard-reset-confirm-input:focus {
  outline:      none;
  border-color: var(--color-border-focus);
}

.hard-reset-confirm-input.input-valid {
  border-color: #16a34a;
  background:   #f0fdf4;
}

.hard-reset-confirm-hint {
  font-size:  var(--text-xs);
  color:      var(--color-text-muted);
  margin-top: 4px;
}

/* Step 3 — count summary */
.hard-reset-count-summary {
  display:       flex;
  gap:           var(--space-md);
  flex-wrap:     wrap;
  margin:        var(--space-md) 0;
}

.hard-reset-count-box {
  flex:          1;
  min-width:     90px;
  text-align:    center;
  padding:       12px 8px;
  border:        1px solid #f5bcb0;
  border-radius: 4px;
  background:    #fdf2f0;
}

.hard-reset-count-value {
  display:     block;
  font-size:   20px;
  font-weight: 700;
  color:       var(--status-red);
  line-height: 1;
  margin-bottom: 4px;
}

.hard-reset-count-label {
  font-size:   var(--text-xs);
  color:       var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hard-reset-export-row {
  display:     flex;
  align-items: center;
  gap:         var(--space-sm);
  margin:      var(--space-md) 0 var(--space-sm);
}

.hard-reset-backup-done {
  font-size:   var(--text-sm);
  font-weight: 600;
  color:       #16a34a;
  display:     flex;
  align-items: center;
  gap:         6px;
}

/* Modal action row */
.hard-reset-actions {
  display:         flex;
  justify-content: flex-end;
  gap:             var(--space-sm);
  margin-top:      var(--space-lg);
  padding-top:     var(--space-md);
  border-top:      1px solid var(--color-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Hard Reset — Full-screen loading overlay
   ═══════════════════════════════════════════════════════════════════════ */

.hard-reset-overlay {
  position:        fixed;
  inset:           0;
  z-index:         9999;
  background:      rgba(10, 18, 30, 0.92);
  display:         flex;
  align-items:     center;
  justify-content: center;
}

.hard-reset-overlay[hidden] {
  display: none !important;
}

.hard-reset-overlay-inner {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            var(--space-lg);
  color:          #ffffff;
}

.hard-reset-overlay-spinner {
  width:  48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: hard-reset-spin 0.8s linear infinite;
}

@keyframes hard-reset-spin {
  to { transform: rotate(360deg); }
}

.hard-reset-overlay-msg {
  font-size:   var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align:  center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Financials Tab
   ═══════════════════════════════════════════════════════════════════════ */

/* Summary cards row */
.fin-summary-cards-row {
  display:               grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap:                   var(--space-4);
  margin-bottom:         var(--space-6);
}

.fin-summary-card {
  background:    var(--surface);
  border:        1px solid var(--line);
  border-top:    3px solid var(--line-strong);
  border-radius: var(--card-radius);
  padding:       14px 16px;
}

.fin-summary-card--warn {
  border-color: var(--amber-line);
  border-top-color: var(--amber);
  background:   var(--amber-bg);
}

.fin-summary-card-value {
  font-size:   1.5rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color:       var(--ink);
  line-height: 1.1;
}

.fin-summary-card-label {
  font-size:   11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color:       var(--ink-3);
  margin-top:  var(--space-1);
}

.fin-summary-card-sub {
  font-size:  var(--text-xs);
  color:      var(--color-muted);
  margin-top: var(--space-1);
}

/* Section wrappers */
.fin-section {
  margin-bottom: var(--space-8);
}

.fin-section-heading {
  font-size:     14px;
  font-weight:   600;
  color:         var(--ink);
  margin:        0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line-strong);
}

/* Toolbar (heading + Add button) */
.fin-toolbar {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-bottom:   var(--space-3);
}

.fin-toolbar .fin-section-heading {
  margin:  0;
  border:  none;
  padding: 0;
}

/* Generic fin table */
.fin-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       var(--text-sm);
}

.fin-table th {
  text-align:       left;
  padding:          var(--space-2) var(--space-3);
  border-bottom:    2px solid var(--color-border);
  color:            var(--color-muted);
  font-weight:      600;
  white-space:      nowrap;
}

.fin-table th.cell-num,
.fin-table td.cell-num {
  text-align: right;
}

.fin-table td {
  padding:       var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  color:         var(--color-text);
  vertical-align: middle;
}

.fin-table tbody tr:hover {
  background: var(--surface-2);
}

.fin-amount-cell {
  font-variant-numeric: tabular-nums;
  font-weight:          500;
}

/* Invoice list actions column */
.fin-actions-cell {
  white-space: nowrap;
  text-align:  right;
}

.fin-actions-cell .btn {
  margin-left: var(--space-1);
}

/* Empty state */
.fin-empty-state {
  color:       var(--color-muted);
  font-style:  italic;
  padding:     var(--space-4) 0;
}

/* Click hint */
.fin-click-hint {
  font-size:  var(--text-xs);
  margin-top: var(--space-2);
}

/* PO table expandable rows */
.fin-po-row {
  cursor: pointer;
}

.fin-po-row:hover td {
  background: var(--color-bg);
}

.fin-po-row--expanded td {
  background:  #f0f9ff;
  font-weight: 500;
}

.fin-po-sub-row td {
  background:  #f8fafc;
  font-size:   var(--text-xs);
  color:       var(--color-muted);
  border-bottom: 1px dashed var(--color-border);
}

.fin-po-sub-indent {
  width: 2rem;
}

.fin-po-sub-label {
  font-style: italic;
}

/* Position checklist in Add/Edit invoice modal */
.fin-pos-checklist-wrap {
  margin-top: var(--space-4);
}

.fin-checklist-heading {
  font-weight: 600;
  font-size:   var(--text-sm);
  color:       var(--color-text);
}

.fin-checklist-btn-row {
  display:     flex;
  align-items: center;
  gap:         var(--space-2);
  margin:      var(--space-2) 0;
}

.fin-pos-checklist {
  max-height:    260px;
  overflow-y:    auto;
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  padding:       var(--space-2);
  background:    var(--color-bg);
}

.fin-pos-row {
  display:     flex;
  align-items: flex-start;
  gap:         var(--space-2);
  padding:     var(--space-1) var(--space-2);
  cursor:      pointer;
  border-radius: 4px;
}

.fin-pos-row:hover {
  background: var(--color-surface);
}

.fin-pos-label {
  font-size:   var(--text-sm);
  color:       var(--color-text);
  line-height: 1.4;
}

.fin-checklist-empty {
  font-size:  var(--text-sm);
  color:      var(--color-muted);
  font-style: italic;
  margin:     0;
  padding:    var(--space-2);
}

/* Live summary shown below checklist */
.fin-live-summary {
  margin-top:    var(--space-2);
  padding:       var(--space-2) var(--space-3);
  background:    #f0fdf4;
  border:        1px solid #bbf7d0;
  border-radius: var(--radius);
  font-size:     var(--text-sm);
  color:         #166534;
}

.fin-live-line + .fin-live-line {
  margin-top: var(--space-1);
}

/* Form error display */
.fin-form-error {
  color:         var(--color-danger);
  font-size:     var(--text-sm);
  background:    #fef2f2;
  border:        1px solid #fecaca;
  border-radius: var(--radius);
  padding:       var(--space-2) var(--space-3);
  margin-top:    var(--space-3);
}

/* Detail modal invoices sub-tab table */
.fin-detail-invoice-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       var(--text-sm);
  margin-top:      var(--space-3);
}

.fin-detail-invoice-table th {
  text-align:    left;
  padding:       var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--color-border);
  color:         var(--color-muted);
  font-weight:   600;
}

.fin-detail-invoice-table td {
  padding:       var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.fin-detail-totals {
  margin-top:    var(--space-3);
  padding:       var(--space-3);
  background:    var(--color-bg);
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  font-size:     var(--text-sm);
  line-height:   1.6;
}

/* ── By Site table ─────────────────────────────────────────────────────── */

.fin-site-table tfoot tr.fin-site-totals-row td {
  border-top:    2px solid var(--color-border);
  border-bottom: none;
  background:    var(--color-bg);
  padding-top:   var(--space-3);
}

.fin-uninvoiced-warn {
  color:       #b45309;
  font-weight: 600;
}

/* ── Digest logging lag indicator ─────────────────────────────────────── */

.digest-logging-lag {
  font-size:     var(--text-sm);
  margin-top:    var(--space-3);
  padding:       var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border-left:   4px solid transparent;
}

.digest-logging-lag--ok {
  background:  #f0fdf4;
  border-color: #22c55e;
  color:        #166534;
}

.digest-logging-lag--warn {
  background:  #fffbeb;
  border-color: #f59e0b;
  color:        #92400e;
}

.digest-logging-lag--error {
  background:  #fef2f2;
  border-color: #ef4444;
  color:        #991b1b;
}

/* Badge — invoice activity entry in detail log */
.badge-activity-invoice {
  background:    #0d9488;
  color:         #ffffff;
  font-size:     0.65rem;
  font-weight:   700;
  padding:       2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  white-space:   nowrap;
}

.detail-activity-item:has(.badge-activity-invoice) {
  border-left: 3px solid #0d9488;
  padding-left: var(--space-3);
}

/* ── Vendor stacked-bar card ─────────────────────────────────────── */
.dash-vendor-row { margin-bottom: 10px; }
.dash-vendor-row:last-of-type { margin-bottom: 0; }
.dash-vendor-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}
.dash-vendor-name {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.dash-vendor-ratio {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  margin-left: 8px;
  flex-shrink: 0;
}
.dash-vendor-bar {
  display: flex;
  height: 8px;
  border-radius: 3px;
  overflow: hidden;
  background: #f0f0ec;
}
.dash-vendor-seg { height: 100%; }
.dash-vendor-seg--done     { background: #047857; }
.dash-vendor-seg--open     { background: #d1d0cb; }
.dash-vendor-seg--rejected { background: #b91c1c; }
.dash-vendor-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.dash-vendor-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-3);
}
.dash-vendor-legend-sw {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.dash-vendor-empty {
  font-size: 12px;
  color: var(--ink-3);
  padding: 8px 0;
}

/* ══════════════════════════════════════════════════════════════════════
   Reports v2 — sidebar nav + KPI strip + table header
══════════════════════════════════════════════════════════════════════ */

/* Page header */
.rpt-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
  flex-wrap: wrap;
}
.rpt-breadcrumb {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.rpt-title-row { display: flex; align-items: baseline; gap: 10px; }
.rpt-title     { font-size: 22px; font-weight: 700; color: var(--ink); margin: 0; }
.rpt-page-subtitle { font-size: 13px; color: var(--ink-3); }
.rpt-page-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Site pills */
.rpt-site-pills, .ds-site-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.rpt-site-pill, .ds-site-pill {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.rpt-site-pill:hover, .ds-site-pill:hover { background: var(--surface-2); }
.rpt-site-pill.active, .ds-site-pill.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.ds-site-pills { margin-bottom: 12px; }

/* Controls bar (week/site for digest) */
.rpt-controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

/* Two-column layout */
.rpt-layout {
  display: grid;
  grid-template-columns: 216px 1fr;
  min-height: calc(100vh - 170px);
}

/* Sidebar nav */
.rpt-nav {
  border-right: 1px solid var(--line);
  padding: 8px 0;
  overflow-y: auto;
}
.rpt-nav-group { margin-bottom: 2px; }
.rpt-nav-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 14px 16px 4px;
}
.rpt-nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 16px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 0;
  gap: 8px;
  transition: background 0.1s;
}
.rpt-nav-item:hover  { background: var(--surface-2); color: var(--ink); }
.rpt-nav-item.active { background: var(--ink); color: #fff; }
.rpt-nav-item.active .rpt-nav-meta { color: rgba(255,255,255,0.55); }
.rpt-nav-label { flex: 1; }
.rpt-nav-meta  {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  white-space: nowrap;
}
.rpt-nav-star  { color: var(--amber); font-size: 13px; }
.rpt-nav-item.active .rpt-nav-star { color: rgba(255,255,255,0.7); }

/* Main area */
.rpt-main { padding: 20px 24px; overflow-y: auto; }

/* KPI strip — 4 cards */
.rpt-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.rpt-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0; /* prevent flex item from expanding beyond its share */
}
.rpt-kpi-card:nth-child(1) { border-top: 3px solid #2563eb; }
.rpt-kpi-card:nth-child(2) { border-top: 3px solid #047857; }
.rpt-kpi-card:nth-child(3) { border-top: 3px solid #b91c1c; }
.rpt-kpi-card:nth-child(4) { border-top: 3px solid #d97706; }
.rpt-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.rpt-kpi-val {
  font-size: 34px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--ink);
  line-height: 1.1;
  overflow: hidden;
}
.rpt-kpi-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.rpt-kpi-sub .rpt-up   { color: #047857; }
.rpt-kpi-sub .rpt-down { color: #b91c1c; }

/* Table header bar */
.rpt-table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.rpt-table-head-left { display: flex; align-items: center; gap: 8px; }
.rpt-table-report-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
}
.rpt-table-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--ink-3);
}
.rpt-table-rowcount { font-size: 12px; color: var(--ink-3); }

/* Responsive */
@media (max-width: 900px) {
  .rpt-layout { grid-template-columns: 1fr; }
  .rpt-nav    { border-right: none; border-bottom: 1px solid var(--line); }
  .rpt-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ── Cycle Time report — SLA badges + distribution bars ─────────── */
.rpt-sla-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.rpt-sla-within {
  color: #047857;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}
.rpt-sla-over {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
}
.rpt-dist-cell { padding: 0 12px !important; vertical-align: middle; }
.rpt-dist-bar {
  width: 160px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.rpt-dist-fill {
  height: 100%;
  background: #047857;
  border-radius: 3px;
  transition: width 0.3s;
}
/* Over-target rows get an amber fill */
tr:has(.rpt-sla-over) .rpt-dist-fill { background: #b45309; }

/* ── Weekly Summary — status badges ─────────────────────────────── */
.rpt-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.rpt-status-open {
  color: #1d4ed8;
  background: transparent;
  border: 1.5px solid #93c5fd;
}
.rpt-status-closed {
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* Table header row-count pill (e.g. "6 weeks") */
.rpt-table-rowcount {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--ink-3);
}

/* ── Vendor Performance — health bar + sparkline ─────────────────── */
.rpt-health-bar {
  width: 120px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.rpt-health-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.rpt-sparkline-cell { padding: 4px 12px !important; vertical-align: middle; }
.rpt-sparkline-cell svg { display: block; }

/* Vendor count pill in table header (same style as week count) */
.rpt-table-head .rpt-table-tag + .rpt-table-rowcount {
  margin-left: 2px;
}

/* ── Dashboard PDF print ─────────────────────────────────────────── */
@media print {
  /* Only active when triggered by the dashboard PDF button */
  body[data-print-target="dashboard"] .app-header,
  body[data-print-target="dashboard"] .tab-nav,
  body[data-print-target="dashboard"] #tab-positions,
  body[data-print-target="dashboard"] #tab-reports,
  body[data-print-target="dashboard"] #tab-financials,
  body[data-print-target="dashboard"] #tab-import,
  body[data-print-target="dashboard"] #tab-settings,
  body[data-print-target="dashboard"] #tab-help,
  body[data-print-target="dashboard"] .ds-page-actions,
  body[data-print-target="dashboard"] #toast-container,
  body[data-print-target="dashboard"] #modal-root,
  body[data-print-target="dashboard"] #hard-reset-overlay,
  body[data-print-target="dashboard"] .filter-toolbar,
  body[data-print-target="dashboard"] .filter-panel,
  body[data-print-target="dashboard"] .storage-banner {
    display: none !important;
  }

  body[data-print-target="dashboard"] #tab-dashboard {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* KPI strip */
  body[data-print-target="dashboard"] .dash-kpi-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  body[data-print-target="dashboard"] .dash-kpi-card {
    flex: 1 1 120px;
    page-break-inside: avoid;
  }

  /* Dashboard card grid */
  body[data-print-target="dashboard"] .dash-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  body[data-print-target="dashboard"] .dash-card {
    page-break-inside: avoid;
    /* override fixed column widths for print */
    grid-column: span 1 !important;
  }

  /* Ensure canvas elements render at a readable size */
  body[data-print-target="dashboard"] canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  body[data-print-target="dashboard"] {
    background: #fff !important;
  }

  /* Print title */
  body[data-print-target="dashboard"] .ds-page-head {
    margin-bottom: 8px;
  }
}

/* ── Financials page header action bar ──────────────────────────────── */
.fin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.fin-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Financials PDF print ────────────────────────────────────────────── */
@media print {
  body[data-print-target="financials"] .app-header,
  body[data-print-target="financials"] .tab-nav,
  body[data-print-target="financials"] #tab-positions,
  body[data-print-target="financials"] #tab-reports,
  body[data-print-target="financials"] #tab-dashboard,
  body[data-print-target="financials"] #tab-import,
  body[data-print-target="financials"] #tab-settings,
  body[data-print-target="financials"] #tab-help,
  body[data-print-target="financials"] .fin-page-actions,
  body[data-print-target="financials"] .fin-toolbar .btn,
  body[data-print-target="financials"] .fin-actions-cell,
  body[data-print-target="financials"] #toast-container,
  body[data-print-target="financials"] #modal-root,
  body[data-print-target="financials"] #hard-reset-overlay,
  body[data-print-target="financials"] .storage-banner {
    display: none !important;
  }

  body[data-print-target="financials"] #tab-financials {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body[data-print-target="financials"] .fin-table {
    width: 100%;
    font-size: 10px;
    page-break-inside: auto;
  }

  body[data-print-target="financials"] .fin-table tr {
    page-break-inside: avoid;
  }

  body[data-print-target="financials"] .fin-section {
    page-break-before: always;
  }

  body[data-print-target="financials"] .fin-section:first-of-type {
    page-break-before: avoid;
  }

  body[data-print-target="financials"] .fin-summary-cards-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  body[data-print-target="financials"] .fin-summary-card {
    flex: 1 1 120px;
    page-break-inside: avoid;
  }

  /* Collapse PO sub-rows that are hidden on screen */
  body[data-print-target="financials"] .fin-po-sub-row[hidden] {
    display: none !important;
  }

  body[data-print-target="financials"] {
    background: #fff !important;
  }
}

/* ── Alerts & Activity feed ──────────────────────────────────────────── */
.dash-feed-live {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-left: 6px;
  vertical-align: middle;
  cursor: default;
  transition: background 0.3s, color 0.3s;
}

/* Green — fresh (changed within 3 days) */
.dash-feed-live--live {
  background: #dcfce7;
  color: #15803d;
}

/* Amber — ageing (3–6 days) */
.dash-feed-live--warn {
  background: #fef9c3;
  color: #92400e;
}

/* Red — stale (7+ days with no change) */
.dash-feed-live--stale {
  background: #b91c1c;
  color: #ffffff;
  font-size: 12px;
  padding: 3px 10px;
  animation: dash-stale-pulse 1.8s ease-in-out infinite;
}

@keyframes dash-stale-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.dash-alerts-count-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-alert-err-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
}

.dash-feed {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 340px;
}

.dash-feed-empty {
  padding: 20px 16px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

.dash-feed-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-1);
  transition: background 0.12s;
}

.dash-feed-row:last-child {
  border-bottom: none;
}

.dash-feed-row--link {
  cursor: pointer;
}

.dash-feed-row--link:hover {
  background: var(--surface-2);
}

.dash-feed-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}

.dash-feed-dot--red    { background: #ef4444; }
.dash-feed-dot--amber  { background: #f59e0b; }
.dash-feed-dot--blue   { background: #3b82f6; }

.dash-feed-msg {
  flex: 1;
  min-width: 0;
}

.dash-feed-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Report KPI strip — week card + single-row layout ───────────────── */
.rpt-kpi-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
}

.rpt-kpi-card--week {
  flex: 0 0 auto;
  min-width: 80px;
  border-top: 3px solid #2563eb;
}
