/* ═══════════════════════════════════════════════════════════════
   Contract Review System — UPS Lakshmi
   Brand: UPS Lakshmi Blue #09548d · Orange #f68d21 · Light Theme
   Font: Segoe UI Semibold (system font, no import required)
═══════════════════════════════════════════════════════════════ */

/* Segoe UI is a system font on Windows — no @import needed */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ─── Variables — UPS Lakshmi Brand ────────────────────────── */
:root {
  /* Page & panel backgrounds */
  --bg:           #eef2f7;
  --bg-2:         #ffffff;
  --bg-3:         #f4f7fb;
  /* Borders */
  --border:       #dde3ed;
  --border-h:     #c5cfe0;
  /* Text */
  --text:         #1a2640;
  --muted:        #6b7a99;
  /* UPS Lakshmi Blue — primary brand colour */
  --accent:       #09548d;
  --accent-dim:   rgba(9,84,141,0.09);
  --accent-glow:  rgba(9,84,141,0.22);
  /* UPS Lakshmi Orange — secondary highlight */
  --orange:       #f68d21;
  --orange-dim:   rgba(246,141,33,0.10);
  /* Semantic colours */
  --red:          #c0392b;
  --red-dim:      rgba(192,57,43,0.09);
  --yellow:       #d97706;
  --yellow-dim:   rgba(217,119,6,0.09);
  --green:        #16a34a;
  --green-dim:    rgba(22,163,74,0.09);
  --blue:         #1d6fa4;
  --blue-dim:     rgba(29,111,164,0.09);
  /* Sidebar */
  --sidebar-bg:   #09548d;
  --sidebar-w:    268px;
  /* Shape & motion */
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 16px rgba(9,84,141,0.10);
  /* Segoe UI Semibold — Windows system font, no import needed */
  --font-display: 'Segoe UI Semibold', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --font-body:    'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --transition:   0.18s cubic-bezier(0.4,0,0.2,1);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Segoe UI Semibold (weight 600) for headings, labels, buttons */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; }
.btn, thead th, .field > span, .panel-head h2, .eyebrow,
.badge, .topbar h1, .brand-tag, strong { font-weight: 600; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.muted { color: var(--muted); font-size: 0.875rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; }
pre { font-family: var(--font-mono); }

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: visible;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
  z-index: 30;
  box-shadow: 4px 0 20px rgba(9,84,141,0.18);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--orange);
  background: rgba(246,141,33,0.15);
  border: 1px solid rgba(246,141,33,0.35);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}

.sidebar-brand h2 {
  font-size: 1.05rem;
  color: #ffffff;
}

.sidebar-brand .muted {
  font-size: 0.78rem;
  margin-top: 4px;
  color: rgba(255,255,255,0.60);
}

.user-card {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-card .eyebrow { font-size: 0.65rem; margin-bottom: 2px; color: rgba(255,255,255,0.50); }
.user-card strong { font-size: 0.9rem; color: #ffffff; }

.role-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 1px 7px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 2px;
  width: fit-content;
  color: rgba(255,255,255,0.80);
}

.nav {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  gap: 2px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.68);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav a:hover {
  background: rgba(255,255,255,0.10);
  color: #ffffff;
  text-decoration: none;
}

.nav a.active {
  background: rgba(255,255,255,0.16);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.22);
}

.nav a.active .nav-icon { opacity: 1; }

.sidebar-section {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-section h3 {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
  margin-bottom: 12px;
}

/* Workflow steps */
.workflow { display: flex; flex-direction: column; gap: 8px; }

.step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.20);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.70);
}

.step-info { flex: 1; min-width: 0; }
.step-info strong { font-size: 0.78rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255,255,255,0.90); }
.step-info .muted { color: rgba(255,255,255,0.50); font-size: 0.72rem; }

.step-bar {
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.step-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* Email log in sidebar */
.email-log-summary .badge { margin-left: 6px; }

/* ─── Main Content ───────────────────────────────────────────── */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
  padding: 22px 32px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 var(--border);
}

.topbar h1 { margin-top: 4px; }
.topbar .muted { margin-top: 6px; }

.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
  margin-top: 6px;
}

.brand-logo {
  width: 95px; /* Appx 25mm */
  height: auto;
  object-fit: contain;
}

/* In dashboard where there's no toolbar, logo acts as its own right-aligned element */
.topbar > .brand-logo {
  margin-top: 6px;
  flex-shrink: 0;
}

/* Search */
.search {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.search input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  width: 260px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Panels ────────────────────────────────────────────────── */
.panel {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 0 32px 24px;
  transition: border-color var(--transition);
}

.panel:hover { border-color: var(--border-h); }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-head .muted { margin-top: 4px; }

/* ─── Layout: 12-Column Grid System ─────────────────────────── */
.col-12, .col-8, .col-6, .col-4, .col-3 { margin: 0; min-width: 0; }
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  margin: 0 32px 24px;
}

@media (max-width: 1100px) {
  .col-6 { grid-column: span 12; }
  .col-4 { grid-column: span 6; }
}

@media (max-width: 640px) {
  .col-4, .col-3 { grid-column: span 12; }
  .grid-12 { gap: 16px; margin: 0 16px 24px; }
}

/* ─── Metrics ───────────────────────────────────────────────── */
.metric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 32px 24px;
  padding: 0;
}

.metric {
  flex: 1 1 200px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  text-align: center;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), transform var(--transition);
}

/* animation: metric-in removed per user request */

.metric:hover { border-color: var(--border-h); transform: translateY(-2px); }

.metric-icon {
  font-size: 1.4rem;
  margin-bottom: 4px;
  opacity: 0.8;
}

.metric span {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 2px;
}

.metric::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.metric-blue::before  { background: var(--blue); }
.metric-yellow::before { background: var(--yellow); }
.metric-red::before   { background: var(--red); }
.metric-green::before { background: var(--green); }

.metric-blue  .metric-value { color: var(--blue); }
.metric-yellow .metric-value { color: var(--yellow); }
.metric-red   .metric-value { color: var(--red); }
.metric-green .metric-value { color: var(--green); }

.metric-blue  { background: linear-gradient(135deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 85%, var(--blue))); }
.metric-yellow { background: linear-gradient(135deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 85%, var(--yellow))); }
.metric-red   { background: linear-gradient(135deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 85%, var(--red))); }
.metric-green { background: linear-gradient(135deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 85%, var(--green))); }

/* Optimized Department Status Tables */
.dash-table {
  table-layout: fixed;
  width: 100%;
}

/* CR Status — 5 columns: Dept(30%) + 4×17.5% */
#crStatTable th:nth-child(1), #crStatTable td:nth-child(1) { width: 30%; }
#crStatTable th:nth-child(n+2), #crStatTable td:nth-child(n+2) { width: 17.5%; }

/* Query Status — 4 columns: Dept(34%) + 3×22% */
#queryStatTable th:nth-child(1), #queryStatTable td:nth-child(1) { width: 34%; }
#queryStatTable th:nth-child(n+2), #queryStatTable td:nth-child(n+2) { width: 22%; }

/* Optimized Users Table */
.users-table {
  table-layout: fixed;
  width: 100%;
  min-width: 560px;
}

.users-table th:nth-child(1) { width: 120px; } /* Username */
.users-table th:nth-child(2) { width: 180px; } /* Full Name */
.users-table th:nth-child(3) { width: auto; }  /* Email (Takes remaining space) */
.users-table th:nth-child(4) { width: 150px; } /* Role */
.users-table th:nth-child(5) { width: 100px; } /* Status */
.users-table th:nth-child(6) { width: 150px; } /* Actions */

.users-table th,
.users-table td {
  padding-left: 6px;
  padding-right: 6px;
}

/* Dashboard stat tables — allow header text to wrap, tighten columns */
.dash-table thead th {
  white-space: normal;
  word-break: break-word;
  text-align: center;
  cursor: default;
  padding: 5px 6px;
  vertical-align: bottom;
}
.dash-table thead th:first-child {
  text-align: left;
}
.dash-table tbody td {
  text-align: center;
  padding: 8px 6px;
}
.dash-table tbody td:first-child { text-align: left; }

/* ─── Table ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 0 -24px; 
  padding: 0 24px;
  min-height: 200px; 
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

thead th:hover { color: var(--text); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-3); }

.cr-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.cr-link:hover { text-decoration: underline; }

/* Table progress bar fix */
.table-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.table-progress-track {
  height: 6px;
  flex: 1;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}

.table-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Inline Popover Dropdowns — Refactored to Fixed "Overshow" style */
.inline-dropdown {
  position: fixed;
  z-index: 10000;
  display: none;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,0.8);
  width: auto;
  min-width: 300px;
  max-width: 90vw;
  overflow: hidden;
}

.inline-dropdown.show {
  display: block;
}

.inline-dropdown[data-pos="above"] {
  animation: popInFixedAbove 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.inline-dropdown[data-pos="below"] {
  animation: popInFixedBelow 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popInFixedAbove {
  from { opacity: 0; margin-top: 10px; transform: scale(0.96); }
  to { opacity: 1; margin-top: 0; transform: scale(1); }
}

@keyframes popInFixedBelow {
  from { opacity: 0; margin-top: -10px; transform: scale(0.96); }
  to { opacity: 1; margin-top: 0; transform: scale(1); }
}

.dropdown-head {
  padding: 10px 14px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dropdown-head strong { 
  font-family: var(--font-mono);
  font-size: 0.7rem; 
  text-transform: uppercase; 
  letter-spacing: 0.1em; 
  color: var(--accent);
}

.dropdown-body {
  padding: 4px;
  max-height: 400px;
  overflow-y: auto;
}

.popover-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}
.popover-table th {
  padding: 8px 12px;
  text-align: left;
  background: var(--bg-1);
  color: var(--muted);
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--border-h);
}
.popover-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-h);
}
.popover-table tr:last-child td { border-bottom: none; }
.popover-table tr:hover { background: var(--bg-3); }

.popover-table .delay-val {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--red);
}
.popover-table .target-text {
  font-size: 0.75rem;
  color: var(--muted);
}

.clickable-badge {
  cursor: pointer;
  transition: transform 0.1s ease;
}
.clickable-badge:active { transform: scale(0.95); }

/* Remove old expandable row styles */
.expand-detail-row { display: none !important; }


.delay-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Severity Colors */
.delay-low {
  background: color-mix(in srgb, var(--yellow) 15%, transparent);
  color: #a37b00;
  border: 1px solid var(--yellow);
}
.delay-high {
  background: color-mix(in srgb, var(--red) 15%, transparent);
  color: var(--red);
  border: 1px solid var(--red);
}

.delay-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 4px 0;
}

.delayed-depts-list {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dept-delay-tag {
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.popover-table .delay-val {
  font-weight: 800;
  color: var(--red);
}
.popover-table .target-text {
  font-size: 0.65rem;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}


.no-delay {
  color: var(--muted);
  font-size: 0.75rem;
}

.lot-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.lot-date-sub {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
  padding-left: 4px;
}

/* Notification Table Styles */
.notif-table {
  width: 100%;
  border-collapse: collapse;
}
.notif-table th {
  background: var(--bg-2);
  text-align: left;
  padding: 14px 16px;
  font-size: 0.75rem;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.notif-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.notif-row {
  transition: background var(--transition);
}
.notif-row.unread {
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}
.notif-row:hover {
  background: var(--bg-2);
}
.notif-row.read {
  opacity: 0.7;
}
.notif-body-text {
  font-size: 0.875rem;
  color: var(--text-h);
  margin: 0;
  max-width: 450px;
  white-space: normal;
  line-height: 1.5;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-h);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon-sm:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-icon-sm svg {
  width: 16px;
  height: 16px;
}

/* Approval pips */
.approval-pips { display: flex; gap: 4px; align-items: center; }

.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
}

.pip.done {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 6px var(--green-dim);
}

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-block;
}

.badge.red    { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(224,82,82,0.3); }
.badge.yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(232,200,64,0.3); }
.badge.green  { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(82,192,119,0.3); }
.badge.blue   { background: var(--blue-dim);   color: var(--blue);   border: 1px solid rgba(91,141,239,0.3); }
.badge.gray   { background: var(--bg-3);       color: var(--muted);  border: 1px solid var(--border); }
.badge.multiline {
  white-space: pre-line;
  line-height: 1.1;
  padding: 4px 8px;
  text-align: center;
}

/* Allow status column to wrap for multiline badges */
tbody td[data-label="Status"] {
  white-space: normal !important;
  min-width: 100px;
}

/* Inner Lot Table for Summary */
.inner-lot-wrap {
  min-width: 110px;
}
.inner-lot-table {
  width: 100%;
  font-size: 0.68rem;
  border-collapse: collapse;
  margin: 2px 0;
  border: 1px solid var(--border);
}
.inner-lot-table th {
  background: var(--bg-3);
  padding: 1px 3px;
  font-size: 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
}
.inner-lot-table td {
  padding: 1px 3px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  background: #fff;
}
.inner-lot-table tr:last-child td {
  border-bottom: none;
}

tbody td[data-label="Delivery"] {
  white-space: normal !important;
  padding: 6px 8px;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: 40px;
}

.btn:hover {
  background: var(--border);
  border-color: var(--border-h);
  text-decoration: none;
  color: var(--text);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.btn.primary:hover {
  background: #0a6aad;
  border-color: #0a6aad;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn.danger {
  background: var(--red-dim);
  border-color: rgba(224,82,82,0.3);
  color: var(--red);
}

.btn.danger:hover {
  background: var(--red);
  color: #fff;
}

.btn.saved {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}

/* ─── Forms ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-stack { display: flex; flex-direction: column; gap: 14px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: var(--font-mono);
}

.field.wide { grid-column: 1 / -1; }
.field.compact { min-width: 180px; }

.field input,
.field textarea,
.field select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ─── Custom Select ─────────────────────────────────────────── */
.native-select { display: none !important; }

.select-ui {
  position: relative;
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 40px;
}

.select-trigger i {
  border: solid var(--muted);
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-top: -3px;
}

.select-ui.open .select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.select-ui.open .select-trigger i { transform: rotate(-135deg); margin-top: 3px; }

.select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  z-index: 1000;
  display: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  max-height: 200px;
  overflow-y: auto;
  flex-direction: column;
}

/* Open upwards for fields at the bottom of the form */
.select-ui[data-for="newRole"] .select-menu {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -12px 40px rgba(0,0,0,0.6);
}

/* Force specific dropdowns to open upwards */
.select-ui[data-for="operationalRisk"] .select-menu {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -12px 40px rgba(0,0,0,0.6);
}

.select-ui.open .select-menu { display: flex; }

.select-option {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.select-option:hover { background: var(--bg-3); }
.select-option.selected { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

/* ─── Password toggle ───────────────────────────────────────── */
.password-control {
  position: relative;
  display: flex;
  align-items: center;
}

.password-control input { padding-right: 44px; }

.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.password-toggle:hover { color: var(--accent); }

.password-toggle svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Record Strip ──────────────────────────────────────────── */
.record-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 32px;
}

.info-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  flex: 0 1 auto;
}

.info-card span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.info-card strong {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Progress bars (Review) ────────────────────────────────── */
#overallProgress {
  padding: 0 32px 0;
  margin-bottom: 0;
}

.progress-wrap {
  margin-bottom: 14px;
  padding: 0 0 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.progress-label strong { color: var(--text); font-family: var(--font-mono); }

.progress-track {
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.dept-progress-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dept-prog {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 140px;
}

.dept-prog span { width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dept-prog small { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }

.mini-track {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}

.mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ─── Checklist ─────────────────────────────────────────────── */
.checklist { display: flex; flex-direction: column; gap: 0; }

.check-section {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  margin: 14px 0 4px;
}

.check-section:first-child { margin-top: 0; }

.check-row {
  display: grid;
  grid-template-columns: 48px 1fr auto 200px 200px;
  gap: 12px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: row-in 0.3s ease both;
}

@keyframes row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

.check-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  padding-top: 2px;
}

.check-content { min-width: 0; }
.question { font-size: 0.9rem; line-height: 1.5; }

.responsibility-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  margin-top: 4px;
}

.status-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.status-buttons button {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  background: var(--bg-3);
  color: var(--muted);
  min-width: 48px;
}

.status-buttons button.red    { border-color: rgba(224,82,82,0.2); color: var(--red); background: var(--red-dim); }
.status-buttons button.yellow { border-color: rgba(232,200,64,0.2); color: var(--yellow); background: var(--yellow-dim); }
.status-buttons button.green  { border-color: rgba(82,192,119,0.2); color: var(--green); background: var(--green-dim); }

.status-buttons button.red.active    { background: var(--red);    color: #fff; border-color: var(--red);    box-shadow: 0 0 12px rgba(224,82,82,0.5); }
.status-buttons button.yellow.active { background: var(--yellow); color: #000; border-color: var(--yellow); box-shadow: 0 0 12px rgba(232,200,64,0.5); }
.status-buttons button.green.active  { background: var(--green);  color: #000; border-color: var(--green);  box-shadow: 0 0 12px rgba(82,192,119,0.5); }

.check-row textarea {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  resize: vertical;
  min-height: 72px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.check-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Approvals ─────────────────────────────────────────────── */
.approval-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.approval-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition);
}

.approval-card.approved {
  border-color: rgba(82,192,119,0.35);
  background: color-mix(in srgb, var(--bg-3) 80%, var(--green));
}

.approval-card.approval-summary {
  grid-column: 1 / -1;
  background: var(--bg-2);
}

.approval-summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.approval-summary-row:last-child { border-bottom: none; }
.approval-summary-row strong { font-size: 0.875rem; min-width: 120px; }
.approval-summary-row small { color: var(--muted); font-size: 0.82rem; margin-left: auto; }

/* ─── Timeline ──────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; margin-top: 16px; }

.timeline-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 148px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item small {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  grid-row: 1; grid-column: 1;
}

.timeline-item strong {
  font-size: 0.875rem;
  grid-row: 1; grid-column: 2;
}

.timeline-item p {
  grid-row: 2; grid-column: 2;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

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

/* ─── Message / Alerts ──────────────────────────────────────── */
.message {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-top: 8px;
  display: none;
}

.message:not(:empty) { display: block; }

.message.error   { background: var(--red-dim);   border: 1px solid rgba(224,82,82,0.25);   color: var(--red); }
.message.success { background: var(--green-dim); border: 1px solid rgba(82,192,119,0.25); color: var(--green); }

/* ─── Modals ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  width: 100%;
  max-width: 760px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  animation: modal-in 0.2s cubic-bezier(0.4,0,0.2,1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.modal-head h2 { font-size: 1.1rem; }
.modal-head .muted { margin-top: 4px; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Email entries */
.email-entry {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.email-entry-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.email-entry-head strong { flex: 1; font-size: 0.875rem; min-width: 0; }
.email-entry-head small { color: var(--muted); font-size: 0.75rem; font-family: var(--font-mono); white-space: nowrap; }

.email-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── Email Toast ───────────────────────────────────────────── */
.email-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  max-width: 360px;
  display: none;            /* hidden until .show is added */
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow);
  z-index: 999;
  transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1);
}

.email-toast.show { display: flex; }

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.email-toast strong { font-size: 0.85rem; display: block; margin-bottom: 2px; }
.email-toast span { color: var(--muted); font-size: 0.8rem; display: block; }
.toast-subject { font-style: italic; margin-top: 2px; }

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
}

.toast-close:hover { color: var(--text); }

/* ─── Login ─────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 25% 60%, rgba(9,84,141,0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 20%, rgba(246,141,33,0.07) 0%, transparent 50%),
    var(--bg);
  padding: 24px;
}

.login-panel {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 8px 40px rgba(9,84,141,0.14);
  animation: modal-in 0.35s cubic-bezier(0.4,0,0.2,1);
}

.login-panel h1 { margin-top: 6px; }

.login-help {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.82rem;
}

.login-help strong { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--font-mono); margin-bottom: 6px; }
.login-help span { color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; }

/* ─── Users split layout ────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  margin: 0 32px 24px;
}

.split .panel { margin: 0; }

/* ─── Misc spacers ──────────────────────────────────────────── */
.panel + .panel { }
section.panel:first-of-type, section.metric-grid + .panel { margin-top: 0; }

/* Top padding for page content below topbar */
.content > .topbar + * { margin-top: 12px; }
.content > .panel { }
.content > section.record-strip + .panel,
.content > form.panel,
.content > section.split { }

/* ─── Scrollbar global ──────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-h); }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .check-row { grid-template-columns: 40px 1fr auto 160px 160px; }
  .approval-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }

  .check-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .check-num { display: none; }

  .status-buttons {
    flex-direction: row;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 12px;
  }

  .toolbar { flex-wrap: wrap; width: 100%; }

  .panel, .record-strip { margin-left: 16px; margin-right: 16px; }

  .split {
    grid-template-columns: 1fr;
    margin-left: 16px;
    margin-right: 16px;
  }

  .dept-progress-row { flex-direction: column; gap: 8px; }
  .dept-prog { min-width: 100%; }
}

@media (max-width: 640px) {
  .metric-grid { grid-template-columns: 1fr; padding: 16px 16px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .approval-grid { grid-template-columns: 1fr; }
  table thead { display: none; }
  tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 10px;
  }
  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    font-size: 0.82rem;
  }
  tbody td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    flex-shrink: 0;
    margin-right: 8px;
  }
  .topbar h1 { font-size: 1.3rem; }
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ═══════════════════════════════════════════════════════════════
   Date Picker — Calendar Popup + Date Wrap
═══════════════════════════════════════════════════════════════ */

/* Date input wrapper with calendar icon button */
.date-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.date-wrap input {
  flex: 1;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
  border-right: none !important;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.date-wrap input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  z-index: 1;
  position: relative;
}

.cal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  padding: 0;
}

.cal-btn:hover {
  background: var(--border);
  color: var(--accent);
}

.cal-btn svg {
  width: 17px;
  height: 17px;
  display: block;
}

/* Calendar popup */
.date-cal {
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
  width: 284px;
  user-select: none;
  overflow: visible; /* must be visible — overflow:hidden clips the native select dropdown */
  animation: cal-in 0.15s cubic-bezier(0.4,0,0.2,1);
}

/* Native select inside the calendar header */
.cal-select {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-body);
  width: 100%;
  cursor: pointer;
  outline: none;
  appearance: auto;
  transition: border-color var(--transition);
}
.cal-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.cal-select option { background: var(--bg-2); color: var(--text); }

@keyframes cal-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Calendar header */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.cal-ctrl {
  flex: 1;
  min-width: 0;
}

.cal-ctrl .select-trigger {
  padding: 6px 10px;
  min-height: 32px;
  font-size: 0.8rem;
  font-weight: 700;
}

.cal-ctrl .select-menu {
  max-height: 160px;
}

.cal-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.cal-month-btn,
.cal-year-btn {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.cal-month-btn:hover,
.cal-year-btn:hover {
  background: var(--border);
  color: var(--accent);
}

.cal-nav {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  padding: 0;
  line-height: 1;
}

.cal-nav:hover {
  background: var(--border);
  color: var(--text);
}

/* Lot date wrap specific styles */
.lot-date-wrap {
  width: 100%;
}
.lot-date-wrap .cal-btn {
  width: 30px;
  height: 32px;
}
.lot-date-wrap input {
  height: 32px;
  padding: 0 8px;
  font-size: 0.8rem;
}

/* Day name headers */
.cal-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 8px 2px;
  gap: 2px;
}

.cal-days-header span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
}

/* Day grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 2px 8px 8px;
}

.cal-empty { /* placeholder */ }

.cal-day {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  margin: 0 auto;
}

.cal-day:hover {
  background: var(--bg-3);
  color: var(--text);
}

.cal-today {
  color: var(--accent);
  font-weight: 700;
  border: 1px solid var(--accent-glow);
}

.cal-selected {
  background: var(--accent) !important;
  color: #0c0d10 !important;
  font-weight: 800;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Month selector grid */
.cal-grid-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px;
}

.cal-month-item {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 6px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  text-align: center;
}

.cal-month-item:hover {
  background: var(--border);
  border-color: var(--border-h);
}

.cal-month-item.cal-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c0d10;
  font-weight: 800;
}

/* Year selector grid */
.cal-grid-years {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px;
}

.cal-year-item {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 4px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  text-align: center;
}

.cal-year-item:hover {
  background: var(--border);
  border-color: var(--border-h);
}

.cal-year-item.cal-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c0d10;
  font-weight: 800;
}

/* Footer */
.cal-footer {
  padding: 6px 10px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.cal-today-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 18px;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition);
}

.cal-today-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar Collapse + User Table Actions
═══════════════════════════════════════════════════════════════ */

/* ─── Sidebar Inner Scroll Container ────────────────────────── */
.sidebar-inner {
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 22px;
  z-index: 50;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border-h);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.sidebar-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent-glow);
  color: var(--accent);
}

.toggle-icon {
  display: inline-block;
  transition: transform var(--transition);
  font-size: 1.1rem;
  line-height: 1;
}

/* ─── Collapsed State ────────────────────────────────────────── */
.sidebar.collapsed {
  width: 60px !important;
  min-width: 60px;
}

.sidebar.collapsed .toggle-icon {
  transform: rotate(180deg);
}

/* Hide all text/content in collapsed mode */
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .user-card,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .nav-label {
  display: none;
}

/* Collapsed nav icons only */
.sidebar.collapsed .nav {
  padding: 10px 8px;
  gap: 4px;
}

.sidebar.collapsed .nav a {
  justify-content: center;
  padding: 10px;
  border-radius: var(--radius-sm);
}

.sidebar.collapsed .nav-icon {
  width: 100%;
}

/* Adjust app-shell when sidebar collapsed */
.app-shell.sidebar-collapsed .sidebar {
  width: 60px;
  min-width: 60px;
}

/* ─── Users page — using grid-12 ───────────────────────────────── */

.user-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-xs {
  padding: 4px 10px !important;
  font-size: 0.75rem !important;
  min-height: 28px !important;
  gap: 4px !important;
}

.row-inactive td {
  opacity: 0.55;
}

.row-inactive td:last-child,
.row-inactive td:nth-last-child(2) {
  opacity: 1;
}

.mono-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

/* Status toggle pill button */
.status-toggle-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.status-toggle-btn.active {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(82,192,119,0.3);
}

.status-toggle-btn.active:hover {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(224,82,82,0.3);
}

.status-toggle-btn.inactive {
  background: var(--bg-3);
  color: var(--muted);
  border-color: var(--border);
}

.status-toggle-btn.inactive:hover {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(82,192,119,0.3);
}

/* ═══════════════════════════════════════════════════════════════
   New additions: sidebar tooltip, nav-btn, checklist layout,
   query system, dept-progress boxes, info-card-wide
═══════════════════════════════════════════════════════════════ */

/* ─── Sidebar: nav-btn (for Raise Query) ────────────────────── */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all var(--transition);
}
.nav-btn:hover {
  background: var(--bg-3);
  color: var(--text);
}

/* Query count badge inside nav label */
.query-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Step badges: CR count + query count side by side */
.step-badges {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ─── Sidebar tooltip on hover (collapsed mode) ─────────────── */
.sidebar.collapsed .nav a,
.sidebar.collapsed .nav-btn {
  position: relative;
}

/* Scale icon on hover in collapsed mode */
.sidebar.collapsed .nav a:hover .nav-icon,
.sidebar.collapsed .nav-btn:hover .nav-icon {
  transform: scale(1.2);
  color: var(--text);
  opacity: 1;
}

.sidebar.collapsed .nav a::after,
.sidebar.collapsed .nav-btn::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 24px);
  top: 50%;
  transform: translateY(-50%) translateX(-12px);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  border: 3px solid var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 12px 28px;
  border-radius: 12px;
  box-shadow: 0 0 30px var(--accent-glow), 0 20px 80px rgba(0,0,0,1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9999;
}

/* Large arrow for tooltip */
.sidebar.collapsed .nav a::before,
.sidebar.collapsed .nav-btn::before {
  content: "";
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-12px);
  border-width: 12px 14px 12px 0;
  border-style: solid;
  border-color: transparent var(--accent) transparent transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9999;
}

.sidebar.collapsed .nav a:hover::after,
.sidebar.collapsed .nav-btn:hover::after,
.sidebar.collapsed .nav a:hover::before,
.sidebar.collapsed .nav-btn:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ─── Checklist: new two-column textarea layout ─────────────── */
.check-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto;
  grid-template-areas: "num content status textareas";
  gap: 14px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  animation: row-in 0.3s ease both;
}
.check-row:last-child { border-bottom: none; }

/* ── Checklist responsive: stack at narrow widths ── */
@media (max-width: 860px) {
  .check-row {
    grid-template-columns: 36px 1fr;
    grid-template-areas:
      "num content"
      ".   status"
      ".   textareas";
    gap: 10px;
  }
  .check-textareas {
    grid-template-columns: 1fr;
  }
}

.check-num  { grid-area: num; }
.check-content { grid-area: content; }
.status-buttons { grid-area: status; }
.check-textareas {
  grid-area: textareas;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.textarea-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.textarea-heading {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent-glow);
  margin-bottom: 2px;
}

.check-row textarea {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  resize: vertical;
  min-height: 72px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.check-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.check-row textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Read-only row */
.check-readonly { opacity: 0.8; }
.check-readonly .status-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ─── Responsibility tag hidden in non-View All mode (handled in JS) */
.responsibility-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  margin-top: 4px;
}

/* ─── Info cards: all fields, including wide description card ── */
.record-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 32px;
}

.info-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 130px;
  flex: 0 1 auto;
}

.info-card span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.info-card strong {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.info-card-wide {
  flex: 1 1 100%;
  min-width: 100%;
}

/* ─── Dept progress boxes ────────────────────────────────────── */
.dept-progress-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 4px;
}

.dept-prog {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--muted);
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 260px;
}

.dept-prog span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-prog small {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-track {
  flex: 1;
  height: 5px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ─── Raise Query Modal ──────────────────────────────────────── */
.modal-wide { max-width: 960px !important; }

.modal-two-col {
  display: grid !important;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  padding: 20px 24px !important;
}

.query-form-col h3,
.query-list-col h3 {
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--text);
}

.query-form-col form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.query-list-col {
  border-left: 1px solid var(--border);
  padding-left: 24px;
  overflow: hidden;
}

.query-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.query-list::-webkit-scrollbar { width: 4px; }
.query-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.query-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--transition);
}
.query-card.open { border-left: 3px solid var(--yellow); }
.query-card.resolved { border-left: 3px solid var(--green); opacity: 0.8; }

.query-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.query-card-head small {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.query-section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

.query-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
}

.query-reply {
  background: var(--green-dim);
  border: 1px solid rgba(82,192,119,0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--green);
}

.reply-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition);
  flex: 1;
}
.reply-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Responsive overrides for new checklist layout ─────────── */
@media (max-width: 1100px) {
  .check-row {
    grid-template-columns: 40px minmax(0,1fr) auto;
    grid-template-areas:
      "num content status"
      "num textareas textareas";
  }
  .check-textareas {
    grid-column: 2 / -1;
  }
}

@media (max-width: 900px) {
  .check-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "content"
      "status"
      "textareas";
    gap: 10px;
  }
  .check-num { display: none; }
  .status-buttons { flex-direction: row; }
  .check-textareas { grid-template-columns: 1fr; }
  .modal-two-col { grid-template-columns: 1fr !important; }
  .query-list-col { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .dept-prog { flex: 1 1 100%; max-width: 100%; }
}

@media (max-width: 640px) {
  .record-strip { padding: 12px 16px; }
  .info-card { min-width: calc(50% - 5px); }
}

/* ═══════════════════════════════════════════════════════════════
   Targeted UI fixes — v5
═══════════════════════════════════════════════════════════════ */

/* ─── Sidebar: remove tagline, tighten brand ─────────────────── */
.sidebar-brand { padding: 16px 20px 12px; }
.sidebar-brand h2 { font-size: 0.95rem; margin-top: 4px; }
.sidebar-brand .muted { display: none; } /* tagline removed */

/* ─── Topbar: reduce height ──────────────────────────────────── */
.topbar { padding: 16px 28px 14px; }
.topbar h1 { font-size: 1.45rem; margin-top: 2px; }
.topbar .muted { margin-top: 3px; font-size: 0.8rem; }
.eyebrow { font-size: 0.68rem; margin-bottom: 2px; }

/* ─── Sidebar step: name + badges in one row ─────────────────── */
.step { align-items: flex-start; gap: 8px; }
.step-info { flex: 1; min-width: 0; }

.step-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.step-name-row strong {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.step-inline-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.step-inline-badges .badge {
  font-size: 0.62rem;
  padding: 1px 5px;
}

/* Remove old step-badges column layout */
.step-badges { display: none; }

/* ─── CR Card Grid (record strip) ────────────────────────────── */
.record-strip { padding: 12px 28px; }

.cr-card-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.cr-card-row {
  display: flex;
  gap: 4px;
  width: 100%;
}

.cr-card {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cr-card-full { flex: 1 1 100%; }

.cr-card-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.cr-card-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Checklist: new flat layout with section-level col headers ─ */
.check-section-block { margin-top: 14px; }
.check-section-block:first-child { margin-top: 0; }

/* Override old check-section margin */
.check-section {
  margin: 0 0 0 0 !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* Column headers row — appears once per section */
.check-col-headers {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) 58px minmax(0,1fr) minmax(0,1fr);
  gap: 14px;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  padding: 5px 10px;
  border-radius: 0;
}

.check-col-headers > div {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Updated check-row to match the column header grid */
.check-row {
  display: grid !important;
  grid-template-columns: 48px minmax(0,1fr) 58px minmax(0,1fr) minmax(0,1fr) !important;
  grid-template-areas: none !important;
  gap: 14px !important;
  align-items: start;
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: relative;
  z-index: 1;
}
.check-row:focus-within { z-index: 10; }

/* Remove old named grid areas */
.check-num  { grid-area: unset !important; align-self: start; padding-top: 6px; }
.check-content { grid-area: unset !important; }
.status-buttons { grid-area: unset !important; align-self: start; }

/* Textareas are now direct children, not wrapped */
.check-row > textarea {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  resize: vertical;
  min-height: 68px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.check-row > textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.check-row > textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Remove old check-textareas wrapper style */
.check-textareas { display: contents !important; }
.textarea-col, .textarea-heading { display: none !important; }

/* Readonly row tint */
.check-readonly { background: color-mix(in srgb, var(--bg-2) 92%, var(--muted)) !important; }
.check-readonly .check-num { opacity: 0.5; }

/* Status buttons — vertical stack tighter */
.status-buttons {
  display: flex !important;
  flex-direction: column;
  gap: 4px;
}

.status-buttons button {
  min-width: 42px;
  padding: 5px 8px;
}

/* ─── Responsive for new col-header grid ────────────────────── */
@media (max-width: 960px) {
  .check-col-headers,
  .check-row {
    grid-template-columns: 36px minmax(0,1fr) 48px minmax(0,1fr) !important;
  }
  /* Stack second textarea below */
  .check-row {
    grid-template-columns: 36px minmax(0,1fr) 48px 1fr !important;
  }
  .check-col-headers > .chdr-action { display: none; }
  .check-row > textarea:last-child { grid-column: 2 / -1; }
}

@media (max-width: 700px) {
  .check-col-headers { display: none; }
  .check-row {
    grid-template-columns: 1fr !important;
    padding: 12px;
  }
  .check-num { display: none; }
  .status-buttons { flex-direction: row !important; }
  .check-row > textarea { min-height: 56px; }
  .cr-card-row { flex-wrap: wrap; }
  .cr-card { min-width: calc(50% - 2px); flex: 0 1 calc(50% - 2px); }
}

/* ═══════════════════════════════════════════════════════════════
   v5 UI fixes — Image 1/2/3 corrections
═══════════════════════════════════════════════════════════════ */

/* ─── Fix 1: dept-prog boxes — proper layout, no overlap ──────── */
.dept-progress-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  margin-top: 8px;
}

.dept-prog {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 6px 8px !important;
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  grid-template-rows: auto auto !important;
  gap: 0 6px !important;
  align-items: center;
}

.dept-prog span {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.72rem !important;
  font-weight: 700;
  min-width: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.dept-prog .mini-track {
  grid-column: 2;
  grid-row: 1;
}

.dept-prog small {
  grid-column: 3;
  grid-row: 1;
  font-size: 0.65rem !important;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Query badge inside dept-prog small — keep inline */
.dept-prog small .badge {
  font-size: 0.58rem;
  padding: 1px 4px;
  line-height: 1.3;
}

/* ─── Fix 2: Section header — labels inside same row ──────────── */

/* The section block now uses a 2-row structure:
   Row 1: amber section title bar (left) + col labels (right)
   Row 2: actual checklist rows */
.check-section-block { margin-top: 16px; margin-bottom: 0; }
.check-section-block:first-child { margin-top: 0; }

/* Override old check-section to be a flex row */
.check-section {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin: 0 !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
  padding: 7px 12px !important;
}

/* The section title text (left side) */
.check-section-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

/* Col labels on the right side of section header */
.check-section-labels {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) minmax(0,1fr);
  gap: 14px;
  flex: 1;
  margin-left: 48px; /* align with question column start */
}

.check-section-labels span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.75;
}

/* Hide old separate col-headers row entirely */
.check-col-headers { display: none !important; }

/* ─── Fix 3: Read-only rows — fully visible, no blur/dim ─────── */
.check-readonly {
  opacity: 1 !important;
  background: var(--bg-2) !important;
}

/* Disabled R/Y/G buttons: visible but clearly inactive */
.check-readonly .status-buttons button:disabled,
.status-buttons button:disabled {
  opacity: 1 !important;
  cursor: default !important;
  filter: none !important;
}

/* Buttons that are disabled but NOT selected — subtle muted look */
.status-buttons button:disabled:not(.active) {
  background: var(--bg-3) !important;
  color: var(--border-h) !important;
  border-color: var(--border) !important;
}

/* Disabled selected buttons stay vivid */
.status-buttons button.red.active:disabled   { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; box-shadow: 0 0 8px rgba(224,82,82,0.4) !important; }
.status-buttons button.yellow.active:disabled { background: var(--yellow) !important; color: #000 !important; border-color: var(--yellow) !important; }
.status-buttons button.green.active:disabled  { background: var(--green) !important; color: #000 !important; border-color: var(--green) !important; }

/* Disabled textareas — fully visible, just not editable */
.check-row > textarea:disabled,
.check-row textarea:disabled {
  opacity: 1 !important;
  cursor: default !important;
  background: var(--bg-3) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Placeholder in disabled textarea — slightly muted is fine */
.check-row > textarea:disabled::placeholder { color: var(--border-h); }

/* ═══════════════════════════════════════════════════════════════
   v5.1 — Section header title-only + aligned col-headers below
═══════════════════════════════════════════════════════════════ */

/* Section title bar: amber strip, title only, no labels */
.check-section {
  display: block !important;
  padding: 7px 12px !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
  margin: 0 !important;
}

.check-section-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Hide the old flex labels that were inside the section bar */
.check-section-labels { display: none !important; }

/* Col-headers row: sits between section bar and first checklist row */
/* Must match the check-row grid exactly:
   48px (num) | 1fr (question) | 58px (status) | 1fr (comment) | 1fr (action) */
.check-col-headers {
  display: grid !important;
  grid-template-columns: 48px minmax(0,1fr) 58px minmax(0,1fr) minmax(0,1fr) !important;
  gap: 14px !important;
  padding: 5px 10px !important;
  background: var(--bg-3) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
}

.check-col-headers > div {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
}

/* Empty cells (num + question) — no label */
.chdr-num, .chdr-question { opacity: 0 !important; }

/* ═══════════════════════════════════════════════════════════════
   Dashboard Refactored
   ═══════════════════════════════════════════════════════════════ */
/* Stat number styles */
.stat-num {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 800;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  min-width: 32px;
  text-align: center;
}

.stat-num.open {
  background: var(--yellow-dim);
  border-color: rgba(232,200,64,0.3);
  color: var(--yellow);
}

.stat-num.closed {
  background: var(--green-dim);
  border-color: rgba(82,192,119,0.3);
  color: var(--green);
}

.stat-num.pending {
  background: var(--blue-dim);
  border-color: rgba(91,141,239,0.3);
  color: var(--blue);
}

.stat-zero {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--border-h);
  padding: 2px 10px;
  display: inline-block;
}

/* Table tweaks inside summary panels removed to use global standardized padding */

/* Responsive */
@media (max-width: 900px) {
  .dash-summary-row {
    grid-template-columns: 1fr;
    margin: 0 16px 24px;
  }
}

/* ─── Inline search beside Reset Demo Data ───────────────────── */
.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.search-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.search-inline input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  width: 240px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-inline input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Form submit row — bottom of create/edit forms ─────────── */
.form-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ─── Lock notice & locked button ────────────────────────────── */
.lock-notice {
  background: var(--yellow-dim);
  border: 1px solid rgba(232,200,64,0.35);
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius-sm);
  color: var(--yellow);
  font-size: 0.875rem;
  padding: 12px 16px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.btn-locked {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

/* ═══════════════════════════════════════════════════════════════
   Dashboard v6 — KPI cards + dept progress circles
═══════════════════════════════════════════════════════════════ */

/* KPI sub-label */
.metric-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Gray KPI card (Void) */
.metric-gray { background: var(--bg-2); }
.metric-gray::before { background: var(--border-h); }
.metric-gray .metric-value { color: var(--muted); }

/* ─── Dept progress circles in table ───────────────────────── */
.dept-circles {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.dept-circle-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
}

.dept-circle-name {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.dept-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 800;
  color: #000;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dept-circle:hover { transform: scale(1.15); }

.dept-circle-tick {
  font-size: 0.9rem;
  font-weight: 900;
  color: #000;
}

.dept-circle-pct {
  font-size: 0.52rem;
  font-weight: 800;
  color: #000;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   v6.1 — 5 KPI cards + SVG ring dept circles
═══════════════════════════════════════════════════════════════ */

/* 5-column KPI grid */
.metric-grid {
  grid-template-columns: repeat(5, 1fr) !important;
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 700px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ─── SVG ring dept circles ──────────────────────────────────── */
.dept-circles {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dept-circle-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
}

.dept-circle-name {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.dept-ring {
  display: block;
  overflow: visible;
}

.dept-ring circle {
  transition: stroke-dasharray 0.5s ease;
}

.dept-circle-svg-wrap {
  transition: transform 0.15s ease;
}

.dept-circle-col:hover .dept-circle-svg-wrap {
  transform: scale(1.15);
}

/* Override old filled-circle styles */
.dept-circle { display: none !important; }
.dept-circle-tick, .dept-circle-pct { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   Create/Edit form improvements — v6.2
═══════════════════════════════════════════════════════════════ */

/* Read-only auto date display in form */
.readonly-date-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
  cursor: not-allowed;
  min-height: 42px;
}

.readonly-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Auto date info row in edit form */
.auto-date-info {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  grid-column: 1 / -1;
}

.auto-date-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auto-date-card span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.auto-date-card strong {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}

.auto-date-card em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.75;
}

/* New Part RM sync note */
.np-sync-note {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 4px;
  font-style: italic;
}

/* New Part RM question rows — highlighted */
.np-rm-row {
  background: color-mix(in srgb, var(--bg-2) 85%, var(--accent)) !important;
  border-left: 2px solid var(--accent) !important;
}

/* ─── CR card grid — balanced rows ──────────────────────────── */
.cr-card-grid { gap: 6px !important; }

.cr-card-row {
  display: grid !important;
  gap: 6px !important;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
}

.cr-card-wide {
  grid-column: span 2;
}

/* Card min sizing */
.cr-card { min-width: 0; }

.cr-card-val {
  white-space: normal !important;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* RM row (Row 3) — visually separate */
.cr-card-row:nth-child(3) {
  padding-top: 2px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

/* Responsive */
@media (max-width: 1200px) {
  .cr-card-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
}

@media (max-width: 800px) {
  .cr-card-row { grid-template-columns: repeat(2, 1fr) !important; }
  .cr-card-wide { grid-column: span 2 !important; }
}

@media (max-width: 500px) {
  .cr-card-row { grid-template-columns: 1fr !important; }
  .cr-card-wide { grid-column: span 1 !important; }
}

/* ═══════════════════════════════════════════════════════════════
   Question 6.9 widget + textarea auto-expand fixes
═══════════════════════════════════════════════════════════════ */

/* ─── Textarea: no resize handle, auto-height ─────────────────── */
.check-row > textarea {
  resize: none !important;
  overflow: hidden !important;
  min-height: 68px;
  transition: height 0.1s ease;
}

/* ─── Check-row-69 special layout ────────────────────────────── */
.check-row-69 {
  /* Use standard columns */
}

.check-content-wide {
  grid-column: 2 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Yes/No buttons */
.row69-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.row69-yesno { display: flex; gap: 8px; }

.ryg-yesno {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 7px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--muted);
  transition: all var(--transition);
}

.ryg-yesno:hover:not(.disabled) { border-color: var(--border-h); color: var(--text); }

.ryg-yesno.active.green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 0 12px rgba(82,192,119,0.4);
}

.ryg-yesno.active.red {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(224,82,82,0.4);
}

.ryg-yesno.disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.row69-qty-info {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.stat-zero {
  color: var(--border-h);
  font-family: var(--font-mono);
  display: block;
  text-align: center;
  width: 100%;
}

/* Ensure dashboard table cells for data are mostly centered */
section.panel .table-wrap table tbody td {
  text-align: center;
}
section.panel .table-wrap table thead th {
  text-align: center;
}

/* Keep identifying columns left-aligned */
section.panel .table-wrap table tbody td:nth-child(1),
section.panel .table-wrap table thead th:nth-child(1),
section.panel .table-wrap table tbody td:nth-child(2),
section.panel .table-wrap table thead th:nth-child(2),
section.panel .table-wrap table tbody td:nth-child(3),
section.panel .table-wrap table thead th:nth-child(3),
section.panel .table-wrap table tbody td:nth-child(4),
section.panel .table-wrap table thead th:nth-child(4) {
  text-align: left;
}

/* Lot table */
.row69-table-wrap { overflow-x: auto; }

.lot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 4px;
}

.lot-table th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.lot-table th:first-child { text-align: left; }

.lot-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.lot-hdr {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  padding-right: 12px;
}

.lot-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  width: 100%;
  min-width: 90px;
  outline: none;
  transition: border-color var(--transition);
  text-align: center;
}

.lot-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.lot-input:disabled { opacity: 0.5; cursor: default; }

.lot-date { font-size: 0.75rem; }

.lot-validation-msg {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.lot-error {
  background: var(--red-dim);
  border: 1px solid rgba(224,82,82,0.3);
  color: var(--red);
}

.lot-ok {
  background: var(--green-dim);
  border: 1px solid rgba(82,192,119,0.3);
  color: var(--green);
}

/* ─── Progress bar hint & label ─────────────────────────── */
.progress-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.progress-hint {
  font-size: 0.70rem;
  color: var(--muted);
  font-family: var(--font-mono);
  opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════
   UPS Lakshmi Brand Overrides — Blue Sidebar Adaptations
═══════════════════════════════════════════════════════════════ */

/* Sidebar scrollbar — white-toned on blue background */
.sidebar-inner {
  scrollbar-color: rgba(255,255,255,0.20) transparent;
}
.sidebar-inner::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.20);
}

/* Sidebar toggle button — orange for brand visibility on blue sidebar */
.sidebar-toggle {
  background: var(--orange);
  border-color: rgba(246,141,33,0.45);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(9,84,141,0.30);
}
.sidebar-toggle:hover {
  background: #e07d10;
  border-color: rgba(246,141,33,0.6);
  color: #ffffff;
}

/* nav-btn (logout / query sidebar buttons) — white text on blue */
.nav-btn {
  color: rgba(255,255,255,0.68) !important;
  border-color: transparent !important;
}
.nav-btn:hover {
  background: rgba(255,255,255,0.10) !important;
  color: #ffffff !important;
}

/* Sidebar query/notification count badges */
.notif-count,
.query-count {
  background: var(--orange) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

/* Workflow step text in sidebar */
.step { color: rgba(255,255,255,0.85); }

/* Sidebar tooltip text (collapsed mode) */
.sidebar.collapsed .nav a::after,
.sidebar.collapsed .nav-btn::after {
  background: #09548d;
  color: #ffffff;
  border-color: rgba(255,255,255,0.15);
}

/* KPI metric card — brand blue top accent */
.metric-blue::before  { background: var(--accent); }
.metric-blue .metric-value { color: var(--accent); }

/* Orange action highlights */
.metric-yellow::before { background: var(--orange); }
.metric-yellow .metric-value { color: var(--orange); }

/* Progress fill uses brand blue */
.progress-fill,
.mini-fill,
.table-progress-fill { background: var(--accent); }

/* dept-prog text readable on light bg */
.dept-prog span { color: var(--text); font-size: 0.75rem; }
.dept-prog small { color: var(--muted); }

/* Approval card — brand blue ready badge */
.approval-card.approved {
  border-color: var(--green);
  background: linear-gradient(135deg, #ffffff, #f0faf4);
}

/* Table header — subtle brand tint */
thead th {
  background: var(--bg-3);
}

/* Badge — update border colors for light bg */
.badge.red    { border-color: rgba(192,57,43,0.25); }
.badge.yellow { border-color: rgba(217,119,6,0.25); }
.badge.green  { border-color: rgba(22,163,74,0.25); }
.badge.blue   { border-color: rgba(29,111,164,0.25); }

/* Login panel — brand blue accent on submit */
.login-panel .btn.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
}

/* Checklist R/Y/G — lighter palette for light theme */
button.red    { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(192,57,43,0.25); }
button.yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(217,119,6,0.25); }
button.green  { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(22,163,74,0.25); }
button.red.active    { background: var(--red);    color: #fff; border-color: var(--red); }
button.yellow.active { background: var(--yellow); color: #fff; border-color: var(--yellow); }
button.green.active  { background: var(--green);  color: #fff; border-color: var(--green); }

/* Modal overlay — lighter scrim on light theme */
.modal-overlay {
  background: rgba(26,38,64,0.45) !important;
  backdrop-filter: blur(6px) !important;
}

/* Input focus — brand blue ring */
.field input:focus,
.field textarea:focus,
.field select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  outline: none;
}

/* Panel hover — subtle blue lift */
.panel:hover { border-color: var(--accent-glow); }

/* Eyebrow text — brand blue */
.eyebrow { color: var(--accent); }

/* --- Premium Filter Modal -------------------------------------- */
.filter-modal-content { max-width: 720px; padding: 0; overflow: hidden; border-radius: 12px; }
.filter-layout { display: flex; height: 480px; }
.filter-sidebar { width: 220px; background: #f8fafd; border-right: 1px solid var(--border); padding: 12px 0; }
.filter-cat { padding: 14px 24px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: var(--transition); border-left: 3px solid transparent; }
.filter-cat:hover { background: #eff4fb; }
.filter-cat.active { background: #e6effc; border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.filter-cat .icon { font-size: 18px; opacity: 0.7; }
.filter-cat.active .icon { opacity: 1; }
.filter-options { flex: 1; display: flex; flex-direction: column; background: #fff; }
.filter-options-head { padding: 16px 24px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.filter-options-head span { font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.filter-options-body { flex: 1; overflow-y: auto; padding: 12px 24px; }
.filter-option-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; transition: 0.1s; }
.filter-option-item:hover { color: var(--accent); }
.filter-option-item input { width: 16px; height: 16px; cursor: pointer; }
.filter-option-item span { font-size: 14px; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }



/* --- Compact Filter Dropdown ---------------------------------- */
.filter-dropdown { position: absolute; top: 60px; right: 20px; width: 480px; background: #fff; border: 1px solid var(--border-h); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.12); z-index: 1000; display: none; flex-direction: column; overflow: hidden; animation: filterFadeIn 0.15s ease-out; }
.filter-dropdown.show { display: flex; }
@keyframes filterFadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.filter-layout { display: flex; height: 320px; }
.filter-sidebar { width: 160px; background: #f9fafc; border-right: 1px solid var(--border); }
.filter-cat { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; transition: 0.1s; border-left: 3px solid transparent; }
.filter-cat:hover { background: #f0f4f9; }
.filter-cat.active { background: #e8f0fe; border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.filter-cat .icon { font-size: 16px; }
.filter-options { flex: 1; display: flex; flex-direction: column; }
.filter-options-head { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; background: #fff; }
.filter-options-head span { font-weight: 700; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.filter-options-body { flex: 1; overflow-y: auto; padding: 8px 16px; }
.filter-option-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 13px; }
.filter-option-item input { width: 14px; height: 14px; }
.filter-footer { padding: 10px 16px; background: #f9fafc; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }


/* --- Lot Popover Table Enhancements ------------------------- */
.inner-lot-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.inner-lot-table th { background: #f0f4f9; color: var(--text); padding: 6px 10px; text-align: left; border-bottom: 2px solid var(--border); }
.inner-lot-table td { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; }
.inner-lot-table tr:last-child td { border-bottom: none; }
.inner-lot-table tr:hover { background: #fafbfc; }
.clickable-badge { cursor: pointer; transition: 0.2s; }
.clickable-badge:hover { opacity: 0.8; transform: scale(1.05); }


/* ─── Task 2: Horizontal Checklist Widgets ─────────────────── */
.widget-row-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.horizontal-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px;
  border-radius: var(--radius-sm);
  width: 100%;
}

.toggle-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toggle-btn:hover:not(.active):not(.disabled) {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(9,84,141,0.3);
}

.toggle-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.widget-sub-input {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  animation: fadeInDown 0.2s ease-out;
}

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

.widget-sub-input select,
.widget-sub-input input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}

.widget-sub-input label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.date-picker-wrap {
  position: relative;
  width: 100%;
}

.date-picker-wrap input {
  width: 100%;
  padding-right: 36px;
}

.date-picker-wrap .cal-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

/* Master Summary Table Styling */
/* ─── Premium Sticky Table Logic ───────────────────────── */
.master-table th {
  background: var(--bg-3) !important;
  position: sticky;
  top: 0;
  z-index: 25; /* Above everything */
  padding: 12px 10px !important;
  border-bottom: 2px solid var(--border) !important;
}

.master-table td {
  padding: 10px !important;
  border-bottom: 1px solid var(--border);
  background: #fff; /* Solid background for sticky visibility */
}

/* Fix for the first column (CR No.) */
.master-table th:first-child,
.master-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 20; /* Below top header, above other cells */
  background: #fff !important;
  border-right: 2px solid var(--border) !important;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.master-table th:first-child {
  z-index: 30; /* Corner cell needs highest z-index */
  background: var(--bg-3) !important;
}

.master-table tr:hover td {
  background: #f8fbff;
}

.master-table tr:hover td:first-child {
  background: #f0f7ff !important;
}





/* --- Premium Date Picker Group Overrides ------------------ */
.date-picker-wrap {
  position: relative;
  width: 100%;
  max-width: 200px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.date-picker-wrap input {
  width: 100%;
  background: transparent !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 40px 10px 14px !important;
  font-family: var(--font-mono);
  font-size: 0.85rem !important;
  color: var(--text);
  letter-spacing: 0.05em;
  outline: none;
  transition: all var(--transition);
}

.date-picker-wrap input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  background: #fff !important;
}

.date-picker-wrap .cal-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all var(--transition);
}

.date-picker-wrap .cal-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
  color: var(--accent-glow);
}

.date-picker-wrap .cal-btn svg {
  width: 18px;
  height: 18px;
}

.date-picker-wrap input:disabled {
  background: var(--bg-2) !important;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.date-picker-wrap input:disabled + .cal-btn {
  display: none;
}


.master-table th, .master-table td {
  white-space: nowrap;
}


/* Sticky first column for Master Table */
.master-table th:first-child,
.master-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 12;
  background: #fff;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}
.master-table th:first-child {
  z-index: 13;
  background: var(--bg-3) !important;
}


/* Force solid background for sticky cells to prevent bleed-through */
.master-table th:first-child {
  z-index: 30 !important; /* Top left corner needs highest z-index */
  background: var(--bg-3) !important;
}
.master-table td:first-child {
  z-index: 15 !important;
  background: #fff !important;
}


.master-table {
  font-size: 0.75rem !important;
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}


/* Aggressive fix for sticky column transparency and alignment */
.master-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.master-table th:first-child,
.master-table td:first-child {
  position: sticky !important;
  left: 0 !important;
  background-color: #ffffff !important; /* Force solid white */
  z-index: 50 !important;
  border-right: 2px solid var(--border) !important;
}

.master-table th:first-child {
  background-color: var(--bg-3) !important; /* Header background */
  z-index: 60 !important;
}

.table-wrap {
  padding: 0 !important;
  margin: 0 !important;
}

/* test deployment auto-update */
