/* ===========================
   CSS Variables & Reset
=========================== */
:root {
  --bg: #0e0f11;
  --surface: #16181c;
  --surface2: #1e2026;
  --border: #2a2d35;
  --accent: #c8f05a;
  --accent-dim: rgba(200, 240, 90, 0.12);
  --text: #e8eaf0;
  --text-muted: #6b7080;
  --text-dim: #3d4152;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
  --radius: 4px;
  --transition: 0.2s ease;
}

/* Light mode overrides */
body[data-theme="light"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface2: #e8eaee;
  --border: #d0d4dc;
  --accent: #5a8c00;
  --accent-dim: rgba(90, 140, 0, 0.1);
  --text: #1c1e26;
  --text-muted: #5a6072;
  --text-dim: #b0b8c8;
}

body[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  opacity: 0.5;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===========================
   Background Grid
=========================== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.3;
  pointer-events: none;
}

/* ===========================
   Header & Navigation
=========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 64px;
  background: rgba(14, 15, 17, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-dealer {
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border);
  margin-left: 16px;
  padding-left: 16px;
}

.header-dealer.hidden { display: none; }

.header-dealer-name {
  font-size: 12px;
  color: var(--text-muted);
}

.header-dealer-select {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.header-dealer-select:hover, .header-dealer-select:focus {
  border-color: rgba(200, 240, 90, 0.4);
  outline: none;
}

.header-dealer-select option { background: var(--surface2); }

.dealer-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.dealer-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.dealer-check-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-bracket {
  color: var(--accent);
  font-style: italic;
  font-weight: 300;
}

.dispatch-mode-label {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

body.dispatch-mode .tab-nav       { display: none; }
body.dispatch-mode .logo          { pointer-events: none; cursor: default; }
body.dispatch-mode .dispatch-mode-label { display: block; }
body.dispatch-mode #header-dealer,
body.dispatch-mode #header-dealer-logo { display: none !important; }

/* ===========================
   Tab Navigation
=========================== */
.tab-nav {
  display: flex;
  gap: 2px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.tab-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(200, 240, 90, 0.3);
}

.tab-index {
  font-size: 10px;
  opacity: 0.5;
  color: var(--accent);
}

.tab-btn.active .tab-index {
  opacity: 1;
}

/* ===========================
   Content Area & Pages
=========================== */
.content-area {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 64px);
}

.tab-page {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}

.tab-page.active {
  display: block;
}

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

.page-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 20px;
}

/* ===========================
   Home / Hero
=========================== */
.hero {
  margin-bottom: 64px;
  border-left: 2px solid var(--accent);
  padding-left: 32px;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.7;
}

/* ===========================
   Feature Cards (Home)
=========================== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  border-color: rgba(200, 240, 90, 0.25);
  background: var(--surface2);
  transform: translateY(-2px);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.card-num {
  font-size: 11px;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.feature-card p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 24px;
}

.card-cta {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* ===========================
   Page Header (inner pages)
=========================== */
.page-header {
  margin-bottom: 20px;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.page-num {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.15em;
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ===========================
   Organize Page
=========================== */
.organize-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
}

.organize-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.collection-list {
  list-style: none;
  margin-bottom: 20px;
}

.collection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition);
  margin-bottom: 2px;
}

.collection-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.collection-item.active-item {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(200, 240, 90, 0.2);
}

.entry-table {
  margin-bottom: 20px;
}

.entry-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}

.header-row {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===========================
   Dashboard Page
=========================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: rgba(200, 240, 90, 0.25);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.activity-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.activity-item {
  display: flex;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

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

.act-time {
  min-width: 120px;
  color: var(--text-dim);
  font-size: 11px;
}

/* ===========================
   Reports Page
=========================== */
.reports-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all var(--transition);
}

.report-card:hover {
  border-color: rgba(200, 240, 90, 0.2);
  background: var(--surface2);
}

.report-icon {
  font-size: 1.5rem;
}

.report-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-info strong {
  color: var(--text);
  font-size: 14px;
}

.report-info span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   Buttons
=========================== */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.03em;
}

.action-btn:hover {
  background: var(--accent-dim);
  border-color: rgba(200, 240, 90, 0.4);
  color: var(--accent);
}

.action-btn.sm {
  padding: 6px 14px;
  font-size: 11px;
}

.action-btn.wide {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  color: var(--accent);
  border-color: rgba(200, 240, 90, 0.3);
  background: var(--accent-dim);
}

.action-btn.wide:hover {
  background: rgba(200, 240, 90, 0.2);
}

/* ===========================
   Header User Info
=========================== */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

#header-username {
  font-size: 12px;
  color: var(--accent);
}

/* User menu dropdown */
.user-menu { position: relative; }

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.user-menu-btn:hover,
.user-menu.open .user-menu-btn {
  border-color: var(--accent);
  color: var(--accent);
}

.user-menu-sep {
  color: var(--text-dim);
  font-size: 11px;
}

.user-menu-btn .role-badge[data-role] {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: normal;
}

.user-menu-arrow {
  font-size: 9px;
  color: var(--text-dim);
  transition: transform var(--transition);
}

.user-menu.open .user-menu-arrow { transform: rotate(180deg); }

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 140px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.user-menu.open .user-menu-dropdown { display: block; }

.user-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 7px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.user-menu-dropdown button:hover {
  background: var(--surface2);
  color: var(--text);
}

.user-menu-dropdown button.danger { color: #e05252; }
.user-menu-dropdown button.danger:hover { background: rgba(224, 82, 82, 0.1); color: #e05252; }

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.role-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.role-badge[data-role="enterprise_admin"] { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(200,240,90,0.3); }
.role-badge[data-role="dealer_admin"]     { background: rgba(100,160,255,0.1); color: #7ab0ff; border: 1px solid rgba(100,160,255,0.3); }
.role-badge[data-role="user"]             { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

.action-btn--sm {
  padding: 6px 14px;
  font-size: 11px;
}

.hidden { display: none !important; }

/* ===========================
   Login Overlay
=========================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.login-overlay.hidden { display: none; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-logo .logo-bracket { color: var(--accent); font-style: italic; font-weight: 300; }

.login-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===========================
   Form Fields (shared)
=========================== */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1.1rem;
}

.field-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.field-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.field-input:focus { border-color: var(--accent); }
.field-input[readonly] { opacity: 0.5; cursor: not-allowed; }
select.field-input { cursor: pointer; }
select.field-input option { background: var(--surface2); }

.field-error {
  color: #ff6b6b;
  font-size: 11px;
  min-height: 1.2em;
  margin-bottom: 4px;
}

.field-hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.locked-badge {
  display: inline-block;
  background: rgba(255, 80, 80, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255, 80, 80, 0.3);
  border-radius: 4px;
  font-size: 10px;
  padding: 1px 5px;
  vertical-align: middle;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ===========================
   Modals
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}

.modal-overlay.hidden { display: none; }

.modal-box,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-box--sm { max-width: 420px; }
.modal-box--md { max-width: 560px; }

/* Help / Feedback modal */
.help-choice-prompt { font-size: 14px; color: var(--text-dim); margin-bottom: 14px; text-align: center; }
.help-choice-btns { display: flex; flex-direction: column; gap: 10px; }
.help-choice-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.help-choice-btn:hover { border-color: var(--accent); background: var(--surface3, rgba(255,255,255,0.05)); }
.help-choice-icon { font-size: 18px; flex-shrink: 0; }
.help-back-btn { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; padding: 0 0 12px 0; display: inline-flex; align-items: center; gap: 4px; }
.help-back-btn:hover { color: var(--text); }
.help-form { display: flex; flex-direction: column; gap: 14px; }
.help-field { display: flex; flex-direction: column; gap: 5px; }
.help-label { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.help-select { font-size: 13px; }
.help-textarea { width: 100%; min-height: 80px; padding: 8px 10px; font-size: 13px; font-family: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); resize: vertical; box-sizing: border-box; }
.help-textarea:focus { outline: none; border-color: var(--accent); }
.help-char-count { font-size: 11px; color: var(--text-dim); text-align: right; }
.help-error { font-size: 12px; color: var(--danger, #e05); margin: 0; }
.help-submit-btn { align-self: flex-end; }
.help-thanks { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; padding: 8px 0; }
.help-thanks p { font-size: 14px; color: var(--text); line-height: 1.6; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-toolbar { margin-bottom: 0.5rem; }

.modal-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-sizing: border-box;
  margin-bottom: 10px;
}
.modal-search:focus { outline: none; border-color: var(--accent); }
.modal-search::placeholder { color: var(--text-dim); }

/* ===========================
   Dealer Picker (header)
=========================== */
.dealer-picker { position: relative; }

.dealer-picker-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.dealer-picker-btn:hover { border-color: rgba(200,240,90,0.4); }

.dealer-picker-arrow { font-size: 10px; opacity: 0.6; }

.dealer-picker-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 200px;
  z-index: 200;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.dealer-picker-search {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-sizing: border-box;
  margin-bottom: 4px;
}
.dealer-picker-search:focus { outline: none; border-color: var(--accent); }
.dealer-picker-search::placeholder { color: var(--text-dim); }

.dealer-picker-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
}

.dealer-picker-item {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
}
.dealer-picker-item:hover { background: var(--surface); }
.dealer-picker-item.active { color: var(--accent); font-weight: 600; }
.dealer-picker-item.hidden { display: none; }
.dealer-picker-code { color: var(--text-dim); font-size: 11px; }

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: color var(--transition), border-color var(--transition);
}

.icon-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* ===========================
   User Table
=========================== */
.user-table-wrap { overflow-x: auto; }

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.user-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}

.user-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface2);
  color: var(--text);
}

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

.row-actions { display: flex; gap: 6px; }

.action-btn--danger {
  border-color: rgba(255, 107, 107, 0.35);
  color: #ff6b6b;
}

.action-btn--danger:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.action-btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

.action-btn--ghost:hover {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ===========================
   Collaborate Tool
=========================== */
.modal-box--lg { max-width: 860px; }

.collab-empty-msg {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}

.collab-footer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}


.collection-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.collection-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.collection-item:hover .collection-item-actions { opacity: 1; }

.tbl-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 5px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1;
  font-family: var(--font-mono);
  transition: color var(--transition), background var(--transition);
}

.tbl-icon-btn:hover { color: var(--accent); background: var(--accent-dim); }
.tbl-icon-btn.danger:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }

.data-table tr:hover .item-menu-btn { opacity: 1; }

/* Row truncation warning */
.row-truncation-warning {
  font-size: 12px;
  color: #f59e0b;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 4px;
  padding: 6px 12px;
  margin-bottom: 8px;
}

/* Dynamic data table */
.data-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface2);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table .row-actions { display: flex; gap: 6px; }

.data-table tr.inline-edit-row td {
  padding: 4px 6px;
  background: rgba(200, 240, 90, 0.04);
  border-bottom: 1px solid rgba(200, 240, 90, 0.2);
}

.inline-input {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-width: 60px;
}

.dropdown-cell {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 3px 6px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  min-width: 70px;
  max-width: 180px;
}

.dropdown-cell:hover, .dropdown-cell:focus {
  border-color: var(--border);
  background: var(--surface2);
  outline: none;
}

.dropdown-cell option { background: var(--surface2); }

/* Group-by section headers */
.data-table tr.group-header td {
  background: var(--surface2);
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-top: 2px solid var(--border);
  font-weight: 500;
}

.data-table tr.group-header:first-child td { border-top: none; }

.group-empty {
  color: var(--text-dim) !important;
  font-size: 12px !important;
  padding: 6px 12px !important;
}

/* Group-by checkbox in table builder */
.groupby-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

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

/* Table builder */
.builder-cols-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.col-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.col-card-row {
  display: grid;
  grid-template-columns: auto 1fr 155px auto;
  gap: 8px;
  align-items: center;
}

.options-editor {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.options-editor-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.option-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

.option-reorder {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.option-reorder .tbl-icon-btn {
  padding: 1px 4px;
  font-size: 10px;
  line-height: 1.2;
}

.option-reorder .tbl-icon-btn:disabled {
  opacity: 0.2;
  cursor: default;
}

/* ===========================
   Item menu (⋯ dropdown on tool list items)
=========================== */
.item-menu {
  position: relative;
  flex-shrink: 0;
}

.item-menu-btn {
  opacity: 0;
  transition: opacity var(--transition);
}

.collection-item:hover .item-menu-btn,
.item-menu.open .item-menu-btn {
  opacity: 1;
}

.item-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 20;
  min-width: 110px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.item-menu.open .item-menu-dropdown {
  display: block;
}

.item-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.item-menu-dropdown button:hover {
  color: var(--text);
  background: var(--surface);
}

.item-menu-dropdown button.danger { color: #ff6b6b; }
.item-menu-dropdown button.danger:hover { background: rgba(255, 107, 107, 0.1); }

/* ===========================
   Collaborate — Tools sidebar sections
=========================== */
.tools-section-header {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.tools-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.tools-section-separator {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}


/* ===========================
   File Tiles (Boxes)
=========================== */
.file-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 4px 0 8px;
}

.file-tile {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.file-tile:hover {
  border-color: rgba(200, 240, 90, 0.3);
  background: var(--surface);
}

.file-tile-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
}

.file-tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-type-icon {
  font-size: 2rem;
  line-height: 1;
}

.file-tile-footer {
  padding: 5px 7px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.file-tile-name {
  flex: 1;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.file-tile-actions {
  display: flex;
  gap: 1px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.file-tile:hover .file-tile-actions { opacity: 1; }

/* ===========================
   File Viewer Modal
=========================== */
.modal-box--viewer {
  max-width: 90vw;
  width: 90vw;
  max-height: 90vh;
  height: 90vh;
}

.modal-body--viewer {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-body--viewer iframe,
.modal-body--viewer video {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.modal-body--viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-body--viewer audio {
  padding: 32px;
  width: 80%;
}

/* ===========================
   Searchable Select (title field)
=========================== */
.searchable-select { position: relative; }

.searchable-select-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.searchable-option {
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.searchable-option:hover { background: var(--surface2); color: var(--text); }

/* Admin access checkbox */
.admin-access-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.admin-access-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Access modal section label */
.access-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ===========================
   Checklist
=========================== */
.checklist-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 2px;
  transition: background var(--transition);
}

.checklist-item:hover { background: var(--surface2); }

.checklist-item.checked .checklist-item-text {
  text-decoration: line-through;
  color: var(--text-dim);
  opacity: 0.55;
}

.checklist-checkbox {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  word-break: break-word;
  line-height: 1.4;
}

.checklist-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.checklist-header-spacer {
  width: 14px;
  flex-shrink: 0;
}

.checklist-sort-btn {
  font-size: 11px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.checklist-sort-btn:hover { background: var(--surface2); color: var(--text); }
.checklist-sort-btn.active { color: var(--accent); font-weight: 600; }

.checklist-item-delete {
  opacity: 0;
  transition: opacity var(--transition);
}

.checklist-item:hover .checklist-item-delete { opacity: 1; }

.checklist-priority-select {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  width: 62px;
  flex-shrink: 0;
}

.checklist-priority-select.priority-low  { border-color: #4a9c59; color: #4a9c59; }
.checklist-priority-select.priority-medium { border-color: #e09524; color: #e09524; }
.checklist-priority-select.priority-high { border-color: #c94040; color: #c94040; }

.checklist-date-input {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  width: 120px;
  flex-shrink: 0;
}

.checklist-date-input::-webkit-calendar-picker-indicator { opacity: 0.5; cursor: pointer; }

.checklist-item.checked .checklist-priority-select,
.checklist-item.checked .checklist-date-input {
  opacity: 0.45;
}

.checklist-item--add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
}

.checklist-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}

/* ===========================
   Manage Tab Dashboard
=========================== */
.manage-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.manage-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

.manage-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manage-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.manage-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.manage-card-type-badge {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.manage-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.manage-card-autogen-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #dc3232;
  background: rgba(220, 50, 50, 0.12);
  padding: 2px 7px;
  border-radius: 3px;
  align-self: center;
}

.manage-card-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manage-card-no-users {
  font-size: 12px;
  color: var(--text-dim);
}

.manage-card-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manage-card-username {
  font-size: 12px;
  min-width: 0;
  flex: 0 0 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-card-username-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  min-width: 0;
  flex: 0 0 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.manage-card-username-btn:hover { color: var(--accent); }

.manage-completion-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f0a050;
  flex-shrink: 0;
}

.manage-view-checklist-item { align-items: flex-start; }

.manage-view-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.manage-view-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.manage-view-item-body .checklist-item-text { flex: none; }

.manage-view-notes {
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  font-style: italic;
}

.manage-view-completed-at {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

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

.manage-progress-fill {
  height: 100%;
  background: var(--text-dim);
  border-radius: 3px;
  transition: width 0.3s;
}

.manage-progress-fill.done {
  background: var(--accent);
}

.manage-progress-label {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.manage-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.manage-card-count {
  font-size: 11px;
  color: var(--text-dim);
}

.manage-card-due {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--surface);
  color: var(--text-muted);
}

.manage-card-due.past-due { background: rgba(220, 50, 50, 0.15); color: #dc3232; }
.manage-card-due.due-today { background: rgba(240, 160, 80, 0.15); color: #f0a050; }
.manage-card-due.complete  { background: rgba(80, 200, 80, 0.12); color: #5bc85b; }

.manage-tl-due-auto {
  background: var(--bg-secondary);
  cursor: default;
  color: var(--text-muted);
  font-size: 13px;
}

.manage-request-btn { margin: 0; }

.manage-card-recurrence {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 1px 5px;
  border: 1px solid var(--accent);
  border-radius: 2px;
}
.manage-card-title-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* Assignee mode toggle (User / Title) */
.assignee-mode-switch {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  width: fit-content;
}
.assignee-mode-btn {
  padding: 3px 10px;
  font-size: 11px;
  border: none;
  background: none;
  color: var(--text-dim);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.assignee-mode-btn.active {
  background: var(--accent);
  color: #000;
}
.assignee-mode-btn:not(.active):hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* Assignee search dropdown */
.assignee-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  z-index: 200;
  max-height: 180px;
  overflow-y: auto;
}
.assignee-option {
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.assignee-option:hover {
  background: rgba(255,255,255,0.06);
}
.assignee-option-sub {
  color: var(--text-dim);
  font-size: 11px;
}
.assignee-option-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Assignee chips */
.assignee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 4px;
}
.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(180,220,100,0.1);
  border: 1px solid rgba(180,220,100,0.25);
  color: var(--text);
  font-size: 11px;
  padding: 3px 6px 3px 9px;
  border-radius: 12px;
}
.assignee-chip--title {
  background: rgba(100,160,230,0.1);
  border-color: rgba(100,160,230,0.25);
}
.chip-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.chip-remove:hover {
  color: var(--text);
}

/* Manage modal item rows */
.manage-modal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.manage-modal-item-text { flex: 1; font-size: 13px; }
.manage-modal-item-due  { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  pointer-events: all;
  animation: toast-in 0.2s ease;
}
.toast--success { background: #1a7f4b; }
.toast--error   { background: #c0392b; }
.toast--info    { background: #2563eb; }
.toast-msg      { flex: 1; }
.toast-close    { background: none; border: none; color: #fff; opacity: 0.7; cursor: pointer; font-size: 15px; padding: 0; line-height: 1; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }
.toast.toast--out   { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(24px); } }

/* Temp password modal */
.temp-pw-instructions {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 16px;
  line-height: 1.5;
}
.temp-pw-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-alt, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
}
.temp-pw-value {
  flex: 1;
  font-family: monospace;
  font-size: 18px;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text);
  user-select: all;
}

/* ===========================
   Notification Highlights
=========================== */
.tab-btn.tab-notify-orange {
  position: relative;
}
.tab-btn.tab-notify-orange::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f0a050;
  box-shadow: 0 0 4px #f0a050;
}
.tab-btn.tab-notify-red {
  position: relative;
}
.tab-btn.tab-notify-red::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dc3232;
  box-shadow: 0 0 4px #dc3232;
}

/* ===========================
   Managed Tasklist (Organize tab user view)
=========================== */
.managed-task-due {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--surface2);
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

.managed-task-due.due-today { background: rgba(240, 160, 80, 0.15); color: #f0a050; }
.managed-task-due.past-due  { background: rgba(220, 50, 50, 0.15);  color: #dc3232; }

.managed-item-text { flex: 1; }

.managed-notes-btn {
  flex-shrink: 0;
  font-size: 11px;
}

.managed-notes-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.managed-notes-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font-size: 12px;
  padding: 6px 8px;
  line-height: 1.5;
}

.managed-notes-editor-actions {
  display: flex;
  gap: 6px;
}

.managed-notes-preview {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* Orange left border on unviewed tasklist sidebar items */
.collection-item.notify-orange {
  border-left: 3px solid #f0a050;
  padding-left: 9px;
}

/* Red left border on due-today / overdue tasklist sidebar items */
.collection-item.notify-red {
  border-left: 3px solid #dc3232;
  padding-left: 9px;
}

/* ===========================
   Report Tab
=========================== */
.report-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.report-subtab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 18px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}
.report-subtab-btn:hover  { color: var(--text); }
.report-subtab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.report-panel { width: 100%; }
.report-empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
}

/* Step indicator */
.report-create-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}
.report-step {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.report-step.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.report-step.done {
  color: var(--text-muted);
  border-color: var(--border);
}
.report-step-sep { color: var(--text-dim); font-size: 12px; }

/* Setup step */
.rpt-setup { display: flex; flex-direction: column; gap: 20px; max-width: 820px; }
.rpt-setup-field { display: flex; flex-direction: column; gap: 6px; }
.rpt-setup-row { display: flex; gap: 32px; flex-wrap: wrap; }
.rpt-multidealer-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rpt-multidealer-label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); }
.rpt-multidealer-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.rpt-multidealer-hint { font-size: 11px; color: var(--text-dim); }
.rpt-user-dealer-badge { display: inline-block; margin-left: 5px; padding: 0 5px; font-size: 10px; font-weight: 600; line-height: 16px; border-radius: 3px; background: var(--surface3, rgba(255,255,255,0.12)); color: var(--text-muted, #8a8a8a); vertical-align: middle; letter-spacing: 0.03em; }
.rpt-positions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.rpt-position-col { display: flex; flex-direction: column; gap: 8px; }
.rpt-position-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rpt-position-sub {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
}
.rpt-pos-error-msg {
  font-size: 11px;
  color: #e05c5c;
  padding: 3px 0;
}
.rpt-add-row-btn {
  align-self: flex-start;
  margin-top: 8px;
}
.rpt-position-search-wrap { position: relative; }
.rpt-pos-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 50;
  max-height: 180px;
  overflow-y: auto;
}
.rpt-pos-results-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  padding: 6px 10px 3px;
  pointer-events: none;
}
.rpt-pos-result-item {
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}
.rpt-pos-result-item:hover { background: var(--surface); }
.rpt-pos-result-title { background: rgba(200,240,90,0.04); }
.rpt-pos-result-title:hover { background: rgba(200,240,90,0.09); }
.rpt-pos-title-name { color: var(--accent); font-size: 12px; }
.rpt-position-list { display: flex; flex-direction: column; gap: 4px; min-height: 32px; }
.rpt-position-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
}
.rpt-pos-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 11px; padding: 0 2px;
  line-height: 1;
}
.rpt-pos-remove:hover { color: #e05c5c; }

/* Type buttons */
.rpt-type-btns { display: flex; gap: 8px; }
.rpt-type-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.rpt-type-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Step nav */
.rpt-step-nav { display: flex; gap: 10px; margin-top: 20px; }

/* Define step — table */
.rpt-define { display: flex; flex-direction: column; gap: 12px; }
.rpt-define-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rpt-spinner {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rpt-spin-btn {
  background: var(--surface2);
  border: none;
  color: var(--text);
  font-size: 14px;
  width: 28px; height: 28px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background var(--transition);
}
.rpt-spin-btn:hover { background: var(--surface); }
.rpt-spinner span {
  padding: 0 12px;
  font-size: 13px;
  min-width: 36px;
  text-align: center;
  background: var(--surface);
}
.rpt-define-hint { font-size: 11px; color: var(--text-dim); margin-left: 8px; }

.rpt-table-wrap { overflow-x: auto; }

.rpt-define-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 300px;
}
.rpt-define-table td, .rpt-define-table th {
  border: 1px solid var(--border);
  padding: 0;
  min-width: 80px;
  max-width: 180px;
}
.rpt-cell { vertical-align: middle; }
.rpt-cell-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  min-width: 60px;
}
.rpt-cell-input:focus { background: rgba(200,240,90,0.04); }

.rpt-corner { background: var(--surface2); }
.rpt-col-header {
  background: var(--surface2);
  font-weight: 600;
  color: var(--text-muted);
}
.rpt-col-header th { text-align: left; padding: 6px 8px; }
.rpt-row-label { background: var(--surface2); }
.rpt-header-row-label { font-weight: 600; }
.rpt-header-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.8;
}
.rpt-data-placeholder { background: var(--bg); }
.rpt-placeholder { color: var(--text-dim); padding: 6px 8px; display: block; }
.rpt-header-cell { background: rgba(200,240,90,0.04); }
.rpt-ro { padding: 6px 8px; color: var(--text); }
.rpt-header-row { background: rgba(200,240,90,0.04); }

/* Block-off phase */
.rpt-blockoff-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  max-width: 600px;
}
.rpt-blockoff-table .rpt-blockoff-cell {
  cursor: pointer;
  min-height: 32px;
  height: 32px;
  transition: background var(--transition);
}
.rpt-blockoff-cell.available {
  background: var(--bg);
}
.rpt-blockoff-cell.available:hover { background: rgba(200,240,90,0.06); }
.rpt-blockoff-cell.blocked {
  background: rgba(80,80,100,0.45);
  background-image: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,0.15) 4px,
    rgba(0,0,0,0.15) 5px
  );
}

/* Serif span inside B/I/U buttons — Georgia guarantees distinct bold + italic rendering */
.rpt-fmt-serif { font-family: Georgia, 'Times New Roman', serif; font-size: 15px; line-height: 1; }
.rpt-fmt-u     { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
/* CSS-only alignment icons */
.rpt-align-icon { display: flex; flex-direction: column; gap: 2px; width: 16px; pointer-events: none; }
.rpt-align-icon > span { height: 2px; background: currentColor; border-radius: 1px; display: block; }
.rpt-align-left > span:nth-child(1)   { width: 100%; }
.rpt-align-left > span:nth-child(2)   { width: 55%; }
.rpt-align-left > span:nth-child(3)   { width: 75%; }
.rpt-align-center > span:nth-child(1) { width: 100%; }
.rpt-align-center > span:nth-child(2) { width: 55%; margin: 0 auto; }
.rpt-align-center > span:nth-child(3) { width: 75%; margin: 0 auto; }
.rpt-align-right > span:nth-child(1)  { width: 100%; }
.rpt-align-right > span:nth-child(2)  { width: 55%; margin-left: auto; }
.rpt-align-right > span:nth-child(3)  { width: 75%; margin-left: auto; }

/* Implement step */
.rpt-implement { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.rpt-implement-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}
.rpt-implement-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
.rpt-implement-meta-row { display: flex; gap: 12px; }
.rpt-implement-meta-label {
  width: 90px;
  color: var(--text-muted);
  flex-shrink: 0;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  padding-top: 2px;
}
.rpt-blocked-preview {
  background: rgba(80,80,100,0.45);
  background-image: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,0.15) 4px,
    rgba(0,0,0,0.15) 5px
  );
  min-height: 32px; height: 32px;
}
.rpt-open-preview { background: var(--bg); min-height: 32px; height: 32px; }

/* Merged multi-submitter list table */
.rpt-merged-list-table .rpt-merged-col { white-space: normal; word-break: break-word; min-width: 90px; max-width: 180px; }
.rpt-merged-list-table .rpt-row-label  { white-space: nowrap; }

/* List table */
.rpt-list-table .rpt-list-label-cell { background: var(--surface2); }
.rpt-list-table .rpt-list-blank-cell { background: var(--bg); }
.rpt-list-table .rpt-list-del-cell { background: var(--surface2); width: 36px; text-align: center; }
.rpt-list-del-btn {
  background: none; border: none;
  cursor: pointer; color: var(--text-dim);
  font-size: 11px; padding: 4px;
}
.rpt-list-del-btn:hover { color: #e05c5c; }

/* ===========================
   Feedback Tab
=========================== */
.fb-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.fb-search  { flex: 1 1 180px; min-width: 140px; }
.fb-filter  { flex: 0 1 160px; min-width: 120px; font-size: 13px; }
.fb-list    { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fb-empty   { color: var(--text-dim); font-size: 13px; padding: 10px 0; }

.fb-ticket-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: var(--radius);
  border: 2px solid transparent; background: var(--surface2);
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.fb-ticket-card:hover { background: var(--surface3, rgba(255,255,255,0.06)); }
.fb-ticket--new      { border-color: var(--red, #dc3232); }
.fb-ticket--accepted { border-color: #c8a000; }
.fb-ticket--closed   { border-color: var(--border); opacity: 0.7; }

.fb-ticket-left  { display: flex; align-items: center; gap: 12px; }
.fb-ticket-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.fb-ticket-meta  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.fb-ticket-user  { font-weight: 600; color: var(--text); }
.fb-ticket-dealer, .fb-ticket-tab { color: var(--text-dim); font-size: 12px; }
.fb-ticket-sep   { color: var(--border); }
.fb-ticket-date  { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

.fb-type-badge  { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; flex-shrink: 0; }
.fb-type-bug     { background: rgba(220,50,50,0.15); color: #e05c5c; }
.fb-type-feature { background: rgba(100,180,100,0.15); color: #5cb85c; }

.fb-status-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fb-status-new      .fb-status-dot, .fb-status-dot.fb-status-new      { background: var(--red, #dc3232); }
.fb-status-accepted .fb-status-dot, .fb-status-dot.fb-status-accepted { background: #c8a000; }
.fb-status-closed   .fb-status-dot, .fb-status-dot.fb-status-closed   { background: var(--border); }

.fb-resolved-section { margin-top: 20px; }
.fb-resolved-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 13px; font-family: var(--font-mono);
  padding: 4px 0; display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
}
.fb-resolved-toggle:hover { color: var(--text); }

/* Ticket modal */
.fb-ticket-modal-title-wrap { display: flex; align-items: center; gap: 10px; }
.fb-ticket-type-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 3px; }
.fb-modal-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.fb-modal-meta-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fb-modal-meta-label { width: 100px; flex-shrink: 0; color: var(--text-dim); font-size: 12px; }
.fb-contact-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-family: var(--font-mono); font-size: 13px; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.fb-contact-btn:hover { opacity: 0.8; }
.fb-status-pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.fb-status-pill.fb-status-new      { background: rgba(220,50,50,0.15); color: #e05c5c; }
.fb-status-pill.fb-status-accepted { background: rgba(200,160,0,0.15); color: #c8a000; }
.fb-status-pill.fb-status-closed   { background: var(--surface3, rgba(255,255,255,0.08)); color: var(--text-dim); }
.fb-modal-section { margin-bottom: 16px; }
.fb-modal-field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 6px; }
.fb-modal-field-body  { font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-wrap; background: var(--surface2); border-radius: var(--radius); padding: 10px 12px; }
.fb-notes-list   { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.fb-no-notes     { font-size: 12px; color: var(--text-dim); margin: 0 0 10px; }
.fb-note         { background: var(--surface2); border-radius: var(--radius); padding: 8px 12px; }
.fb-note-meta    { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.fb-note-text    { font-size: 13px; color: var(--text); white-space: pre-wrap; }
.fb-note-input-wrap { display: flex; gap: 8px; align-items: flex-start; }
.fb-note-input   { flex: 1; min-height: 56px; padding: 8px 10px; font-size: 13px; font-family: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); resize: vertical; }
.fb-note-input:focus { outline: none; border-color: var(--accent); }
.fb-modal-actions { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }

#fb-ticket-modal-body { position: relative; }

.fb-contact-popup {
  position: absolute; bottom: 56px; left: 16px; right: 16px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 10;
}
.fb-contact-popup-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim);
}
.fb-contact-popup-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.fb-contact-row  { display: flex; gap: 10px; font-size: 13px; }
.fb-contact-label { width: 64px; flex-shrink: 0; color: var(--text-dim); font-size: 12px; }
.fb-contact-value { color: var(--text); word-break: break-all; }
.fb-contact-value a { color: var(--accent); text-underline-offset: 2px; }

/* Right-click context menu */
.report-ctx-menu {
  position: fixed;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 200;
  min-width: 160px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.report-ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 14px;
  cursor: pointer;
}
.report-ctx-menu button:hover { background: var(--surface); }

/* ===========================
   Access modal — dual columns
=========================== */

.acc-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 8px;
}

.acc-col { display: flex; flex-direction: column; gap: 8px; }

.acc-col-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.acc-col-sub {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-weight: 400;
}

.acc-search-wrap { position: relative; }

.acc-results {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  z-index: 300;
  max-height: 180px;
  overflow-y: auto;
}
.acc-results-section {
  padding: 5px 10px 3px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.acc-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.acc-result-item:hover { background: rgba(255,255,255,0.05); }

.acc-chip-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 32px;
}
.acc-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text);
  gap: 8px;
}
.acc-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}
.acc-chip-remove:hover { color: #e05c5c; }

/* ===========================
   Report — Submit subtab
=========================== */

.rpt-submit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.rpt-submit-count { font-size: 12px; color: var(--text-muted); }
.rpt-sort-bar { display: flex; align-items: center; gap: 6px; }
.rpt-sort-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rpt-sort-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
}
.rpt-sort-btn.active,
.rpt-sort-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.rpt-submit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.rpt-submit-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.rpt-submit-tile:hover { border-color: var(--accent); transform: translateY(-1px); }

.rpt-tile-thumb {
  height: 100px;
  overflow: hidden;
  background: var(--surface);
  padding: 6px;
  border-bottom: 1px solid var(--border);
}

/* Thumbnail mini-table */
.rpt-thumb-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}
.rpt-thumb-cell {
  border: 1px solid var(--border);
  height: 13px;
  padding: 1px 3px;
  font-size: 7px;
  font-family: var(--font-mono);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-muted);
}
.rpt-thumb-corner, .rpt-thumb-head { background: var(--surface-3); color: var(--text-dim); }
.rpt-thumb-blocked { background: var(--border); }
.rpt-thumb-open    { background: var(--surface); }
.rpt-thumb-hrow    { background: var(--surface-3); border-top: 2px solid var(--accent-dim); }

.rpt-tile-info { padding: 8px 10px; }
.rpt-tile-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rpt-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.rpt-tile-freq {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rpt-tile-badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* Status badges */
.rpt-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.rpt-badge--submitted { background: rgba(100,200,100,0.15); color: #6bc96b; }
.rpt-badge--draft     { background: rgba(200,200,80,0.15);  color: #c0b560; }
.rpt-badge--due       { background: rgba(224,92,92,0.15);   color: #e05c5c; }

/* Fill form */
.rpt-fill-wrap { display: flex; flex-direction: column; gap: 16px; }
.rpt-fill-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.rpt-fill-title-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}
.rpt-fill-form { overflow-x: auto; }
.rpt-fill-table .rpt-fill-cell { padding: 0; }
.rpt-fill-input {
  width: 100%;
  min-height: 32px;
  background: none;
  border: none;
  outline: none;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  box-sizing: border-box;
  display: block;
}
.rpt-fill-input:focus { background: var(--accent-dim); }

/* Review screen */
.rpt-review-hint { font-size: 12px; color: var(--text-muted); margin: 0; }
.rpt-review-filled {
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  padding: 6px 8px;
  min-height: 32px;
}

.rpt-empty-state { color: var(--text-dim); font-size: 13px; padding: 24px 0; }

/* ===========================
   Settings Modal
=========================== */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-row-label {
  font-size: 13px;
  color: var(--text);
}
.settings-row-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.theme-toggle:hover { color: var(--text); }

.theme-toggle-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.theme-toggle-track {
  width: 36px;
  height: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}

body[data-theme="light"] .theme-toggle-track {
  background: var(--accent-dim);
  border-color: var(--accent);
}
body[data-theme="light"] .theme-toggle-thumb {
  background: var(--accent);
  transform: translateX(16px);
}

.theme-toggle-label { user-select: none; }

/* Settings logo */
.settings-logo-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.settings-logo-preview {
  width: 80px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-secondary);
}
.settings-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.settings-logo-placeholder {
  font-size: 10px;
  color: var(--text-muted);
}

/* Header dealer logo */
.header-dealer-logo {
  display: flex;
  align-items: center;
  margin-left: 10px;
}
.header-dealer-logo.hidden { display: none; }
.header-dealer-logo-img {
  height: 28px;
  max-width: 80px;
  object-fit: contain;
}

/* ===========================
   Scorecard
=========================== */
.sc-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* Toolbar */
.sc-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sc-tool-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  transition: background var(--transition), border-color var(--transition);
}
.sc-tool-btn:hover { background: var(--surface); border-color: var(--border); }
.sc-tool-btn.sc-tool-active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.sc-tool-btn.hidden { display: none; }

.sc-tool-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* Color pickers */
.sc-color-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
}
.sc-color-wrap:hover { background: var(--surface); border-color: var(--border); }
.sc-color-label { font-size: 12px; color: var(--text); line-height: 1; }
.sc-color-swatch {
  width: 14px;
  height: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  flex-shrink: 0;
}
.sc-color-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
}

/* Mode bar */
.sc-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(200, 240, 90, 0.06);
  border-bottom: 1px solid rgba(200, 240, 90, 0.2);
  flex-shrink: 0;
}
.sc-mode-bar--view {
  background: none;
  border-bottom: 1px solid var(--border);
}
.sc-mode-label {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.sc-updated-date {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}
@keyframes sc-updated-pulse {
  0%   { color: #22c55e; }
  60%  { color: #22c55e; }
  100% { color: var(--text-muted); }
}
.sc-updated-date--pulse {
  animation: sc-updated-pulse 1.2s ease forwards;
}
.collab-admin-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 5px;
  vertical-align: middle;
  opacity: 0.7;
}

/* Grid wrapper */
.sc-grid-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

/* Grid table */
.sc-grid {
  border-collapse: collapse;
  table-layout: fixed;
  user-select: none;
  background: var(--surface);
}

/* Control row (layout mode col headers) */
.sc-ctrl-col { width: 28px; }
.sc-ctrl-row th { background: var(--surface2); border: 1px solid var(--border); padding: 0; }
.sc-corner { width: 28px; }
.sc-col-ctrl {
  position: relative;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}
.sc-del-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 10px;
  padding: 3px 6px;
  line-height: 1;
}
.sc-del-btn:hover { color: #ff6b6b; }

/* Column resize handle */
.sc-col-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}
.sc-col-resize:hover { background: var(--accent); opacity: 0.4; }

/* Row ctrl cell */
.sc-row-ctrl {
  background: var(--surface2);
  border: 1px solid var(--border);
  text-align: center;
  padding: 0;
  position: relative;
  width: 28px;
}
.sc-row-resize {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  cursor: row-resize;
  background: transparent;
}
.sc-row-resize:hover { background: var(--accent); opacity: 0.4; }

/* Data cells */
.sc-cell {
  border: 1px solid var(--border);
  padding: 0;
  position: relative;
  vertical-align: middle;
  cursor: default;
  overflow: hidden;
  min-width: 40px;
}
.sc-cell.sc-sel {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(200, 240, 90, 0.1) !important;
}
.sc-cell.sc-merged-owner { background: rgba(200, 240, 90, 0.03); }

.sc-disp {
  padding: 4px 8px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 100%;
}
.sc-edit {
  display: block;
  padding: 4px 8px;
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  caret-color: var(--accent);
  min-height: 100%;
}

/* Add row / col bar */
.sc-add-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sc-add-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 12px;
  transition: border-color var(--transition), color var(--transition);
}
.sc-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===========================
   Report Tab — Created subtab
=========================== */
.rptc-list { display: flex; flex-direction: column; gap: 8px; }

.rptc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color var(--transition);
}
.rptc-row:hover { border-color: var(--accent); }

.rptc-row-info { flex: 1; min-width: 0; }
.rptc-row-title {
  display: block;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.rptc-row-meta { font-size: 11px; color: var(--text-muted); }
.rptc-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===========================
   Report Tab — View subtab
=========================== */
.rptv-section { margin-bottom: 32px; }

.rptv-section-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.rptv-section-hdr--red    { border-bottom-color: rgba(229,57,53,.35); }
.rptv-section-hdr--yellow { border-bottom-color: rgba(245,158,11,.35); }
.rptv-section-hdr--orange { border-bottom-color: rgba(249,115,22,.35); }

.rptv-section-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.rptv-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.rptv-badge--red    { background: #e53935; }
.rptv-badge--yellow { background: #f59e0b; }
.rptv-badge--orange { background: #f97316; }

.rptv-sort-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.rptv-sort-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 8px;
  transition: border-color var(--transition), color var(--transition);
}
.rptv-sort-btn.active,
.rptv-sort-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Review / New tile accents */
.rptv-tile--review { border-color: #e53935 !important; }
.rptv-tile--new    { border-color: #f59e0b !important; }

.rptv-tile-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.rptv-tile-badge--red    { background: #e53935; }
.rptv-tile-badge--yellow { background: #f59e0b; }
.rptv-tile-badge--orange { background: #f97316; }
.rptv-tile--pending { opacity: 0.75; cursor: default; }

.rptv-tile-date {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* History folder grid */
.rptv-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}
.rptv-folder {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color var(--transition), transform var(--transition);
}
.rptv-folder:hover { border-color: var(--accent); transform: translateY(-1px); }

.rptv-folder-thumb {
  height: 100px;
  overflow: hidden;
  background: var(--surface);
  padding: 6px;
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}
.rptv-folder-info { padding: 8px 10px; }
.rptv-folder-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.rptv-folder-count { font-size: 10px; color: var(--text-dim); }

.rptv-empty { color: var(--text-muted); font-style: italic; font-size: 13px; }

/* Folder popup */
.rptv-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rptv-popup {
  background: var(--card, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.rptv-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.rptv-popup-title { font-weight: 600; font-size: 15px; color: var(--text); }
.rptv-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius);
  line-height: 1;
}
.rptv-popup-close:hover { color: var(--text); }
.rptv-popup-body { overflow-y: auto; flex: 1; padding: 16px 20px; }

.rptv-popup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color var(--transition), background var(--transition);
}
.rptv-popup-item:hover { border-color: var(--accent); background: var(--surface); }
.rptv-popup-item-primary { font-weight: 500; font-size: 14px; color: var(--text); }
.rptv-popup-item-secondary { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.rptv-popup-arrow { color: var(--text-muted); font-size: 20px; }

.rptv-popup-back { margin-bottom: 12px; }
.rptv-popup-sub-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

/* Receiver review in-panel layout */
.rptv-review-wrap { display: flex; flex-direction: column; gap: 0; }

.rptv-review-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rptv-review-report-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  flex: 1;
}
.rptv-review-actions { display: flex; gap: 8px; }
.rptv-review-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Fill form footer row (Publish button) */
.rpt-fill-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Multi-page batch view */
.rptv-batch-page {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.rptv-batch-page:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.rptv-submitter-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
  padding: 4px 8px;
  background: var(--surface);
  border-radius: var(--radius);
  display: inline-block;
}

.rptv-page-count {
  font-size: 9px;
  background: var(--surface-3, var(--surface-2));
  color: var(--text-dim);
  border-radius: 8px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Blocked submit tile */
.rpt-submit-tile--blocked {
  opacity: 0.6;
  cursor: not-allowed;
}
.rpt-submit-tile--blocked:hover {
  border-color: var(--border) !important;
  transform: none !important;
}
.rpt-tile-blocked-msg {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ===========================
   Responsive
=========================== */
@media (max-width: 900px) {
  .site-header { padding: 0 12px; }
  .tab-btn .tab-label { display: none; }
  .tab-btn { padding: 8px 14px; }
  .page-inner { padding: 40px 12px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .organize-layout { grid-template-columns: 1fr; }
  #header-username, #header-role { display: none; }
}

/* ===========================
   Dispatch Tab
   =========================== */

.dsp-page-inner {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  overflow: hidden;
}

/* Subtab nav */
.dsp-subtab-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.dsp-subtab-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 4px 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dsp-subtab-btn:hover { background: var(--hover); color: var(--text); }
.dsp-subtab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.dsp-subtab-sw-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.dsp-subtab-actions { margin-left: auto; display: flex; gap: 6px; }
.dsp-action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 3px 10px;
  transition: background 0.15s;
}
.dsp-action-btn:hover { background: var(--hover); }
.dsp-action-btn.danger { color: var(--danger, #e55); border-color: var(--danger, #e55); }
.dsp-action-btn.danger:hover { background: var(--danger, #e55); color: #fff; }

/* Panels */
.dsp-panel { display: none; flex: 1; overflow: auto; padding: 12px 0; }
.dsp-panel.active { display: flex; flex-direction: column; }
.dsp-empty { color: var(--text-muted); font-size: 0.85rem; padding: 16px; text-align: center; }
.dsp-section-title { font-weight: 600; font-size: 0.88rem; font-family: var(--font-mono); }

/* Board layout */
.dsp-board-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}
.dsp-board-section {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.dsp-board-section:last-child { border-bottom: none; }
.dsp-board-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dsp-hotbox-section {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  flex-shrink: 0;
}
.dsp-hotbox-content { min-height: 48px; }
.dsp-tech-section { flex-shrink: 0; }
.dsp-tech-list { width: 100%; }
.dsp-rfd-section { }
.dsp-rfd-section .dsp-ro-list { }

/* RFD view toggle buttons */
.dsp-rfd-view-btns { display: flex; gap: 3px; margin-left: auto; }
.dsp-view-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px 6px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.dsp-view-btn:hover { background: var(--hover); color: var(--text); }
.dsp-view-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* List view wrapper (replaces dsp-ro-list in list mode) */
.dsp-rfd-list-wrap { display: block; width: 100%; overflow: auto; }
.dsp-rfd-list-row--clickable { cursor: pointer; }
.dsp-tech-table { width: 100%; }
.dsp-tech-row { transition: background 0.12s; }
.dsp-tech-row:hover td { background: var(--hover); }
.dsp-tech-name-cell { font-weight: 600; font-size: 0.85rem; white-space: nowrap; padding-right: 16px !important; }

/* Inline controls */
.dsp-inline-select,
.dsp-inline-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  padding: 3px 6px;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.dsp-inline-select:hover:not(:disabled),
.dsp-inline-input:hover:not(:disabled) { border-color: var(--border); background: var(--surface); }
.dsp-inline-select:focus,
.dsp-inline-input:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.dsp-inline-select:disabled,
.dsp-inline-input:disabled { opacity: 0.6; cursor: default; }

/* Status row color accent */
.dsp-tech-status--working        td:first-child { border-left: 3px solid #22c55e; }
.dsp-tech-status--needs-dispatch td:first-child { border-left: 3px solid #f97316; }
.dsp-tech-status--off-not-in     td:first-child { border-left: 3px solid #6b7280; }
.dsp-tech-status--road-test      td:first-child { border-left: 3px solid #3b82f6; }
.dsp-tech-status--waiting-on-parts   td:first-child { border-left: 3px solid #a855f7; }
.dsp-tech-status--waiting-on-advisor td:first-child { border-left: 3px solid #eab308; }

/* Status select color tinting */
.dsp-status-select.dsp-tech-status--working        { color: #22c55e; }
.dsp-status-select.dsp-tech-status--needs-dispatch { color: #f97316; }
.dsp-status-select.dsp-tech-status--off-not-in     { color: #6b7280; }
.dsp-status-select.dsp-tech-status--road-test      { color: #3b82f6; }
.dsp-status-select.dsp-tech-status--waiting-on-parts   { color: #a855f7; }
.dsp-status-select.dsp-tech-status--waiting-on-advisor { color: #eab308; }

/* Tech status colors */
.dsp-tech-status--working        { border-left: 3px solid #22c55e; }
.dsp-tech-status--needs-dispatch { border-left: 3px solid #f97316; }
.dsp-tech-status--off-not-in     { border-left: 3px solid #6b7280; }
.dsp-tech-status--road-test      { border-left: 3px solid #3b82f6; }
.dsp-tech-status--waiting-on-parts   { border-left: 3px solid #a855f7; }
.dsp-tech-status--waiting-on-advisor { border-left: 3px solid #eab308; }

/* Board RO list */
.dsp-ro-list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  align-content: start;
}
.dsp-board-ro-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dsp-board-ro-card:hover { background: var(--hover); }
.dsp-ro-card-top { display: flex; gap: 6px; align-items: center; }
.dsp-card-edit-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.68rem;
  margin-left: auto;
  padding: 1px 7px;
}
.dsp-card-edit-btn:hover { background: var(--hover); color: var(--text); }
.dsp-ro-cust { font-weight: 600; font-size: 0.85rem; }
.dsp-ro-vehicle { font-size: 0.78rem; color: var(--text-muted); }
.dsp-ro-num, .dsp-ro-skill { font-size: 0.75rem; color: var(--text-muted); }

/* Priority badges */
.dsp-priority-badge {
  display: inline-block;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  text-transform: uppercase;
}
.dsp-priority--low      { background: #d1fae5; color: #065f46; }
.dsp-priority--medium   { background: #fef9c3; color: #713f12; }
.dsp-priority--high     { background: #ffedd5; color: #7c2d12; }
.dsp-priority--critical { background: #fee2e2; color: #7f1d1d; }

/* Priority row highlight */
.dsp-priority-row--critical { background: rgba(254,226,226,0.18); }
.dsp-priority-row--high     { background: rgba(255,237,213,0.15); }

/* RO status badges */
.dsp-ro-status-badge {
  display: inline-block;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  text-transform: uppercase;
}
.dsp-ro-status--awaiting-service      { background: #dbeafe; color: #1e3a8a; }
.dsp-ro-status--awaiting-customer     { background: #f3e8ff; color: #581c87; }
.dsp-ro-status--in-shop               { background: #dcfce7; color: #14532d; }
.dsp-ro-status--parts-ordered         { background: #fef9c3; color: #713f12; }
.dsp-ro-status--parts-in              { background: #ffedd5; color: #7c2d12; }
.dsp-ro-status--awaiting-soa          { background: #fce7f3; color: #831843; }
.dsp-ro-status--dispatch-not-accepted { background: #fee2e2; color: #7f1d1d; }

.dsp-assign-btn {
  margin-top: 6px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 10px;
  align-self: flex-start;
}
.dsp-assign-btn:hover { opacity: 0.85; }

/* Queue / SW table */
.dsp-queue-toolbar, .dsp-sw-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-shrink: 0;
}
/* Sortable column headers */
.dsp-q-sort-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.dsp-q-sort-th:hover { color: var(--accent); }
.dsp-sort-ind { font-size: 0.65rem; margin-left: 3px; color: var(--accent); }

/* Filter row */
.dsp-q-filter-th {
  padding: 3px 4px !important;
  position: relative;
}
.dsp-filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.68rem;
  padding: 1px 5px;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
.dsp-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.dsp-filter-btn--active { border-color: var(--accent); color: var(--accent); background: var(--hover); }

/* Filter dropdown panel */
.dsp-filter-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  left: 0;
  max-height: 220px;
  min-width: 140px;
  overflow-y: auto;
  padding: 4px 0;
  position: absolute;
  top: 100%;
  z-index: 100;
}
.dsp-filter-panel.hidden { display: none; }
.dsp-filter-controls {
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
  padding: 3px 6px 5px;
}
.dsp-filter-ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.68rem;
  padding: 1px 7px;
}
.dsp-filter-ctrl-btn:hover { background: var(--hover); color: var(--text); }
.dsp-filter-option {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 0.78rem;
  gap: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}
.dsp-filter-option:hover { background: var(--hover); }
.dsp-sw-actions { display: flex; gap: 6px; margin-left: auto; }
.dsp-queue-table-wrap, .dsp-sw-table-wrap { flex: 1; overflow: auto; }
.dsp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.dsp-table th {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}
.dsp-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: middle;
}
.dsp-table tr:hover td { background: var(--hover); }
.dsp-empty-row { color: var(--text-muted); text-align: center; padding: 20px; }
.dsp-row-actions { display: flex; gap: 4px; white-space: nowrap; }
.dsp-row-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 7px;
}
.dsp-row-btn:hover { background: var(--hover); }

/* RO Modal grid */
.dsp-ro-modal-card { max-width: 680px; width: 96vw; }
.dsp-ro-modal-body { max-height: 60vh; overflow-y: auto; }
.dsp-ro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
@media (max-width: 560px) { .dsp-ro-grid { grid-template-columns: 1fr; } }

/* Assign modal */
.dsp-assign-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; }

/* Dispatch user settings in user form */
.dispatch-settings-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dsp-timer-cell { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; cursor: default; }
.dsp-timer-cell[data-tech-id] { cursor: pointer; }
.dsp-timer-cell.dsp-timer--up .dsp-timer-display { color: #e55; font-weight: 600; }
.dsp-timer-input { width: 52px; font-size: 0.8rem; padding: 1px 4px; border: 1px solid var(--border); border-radius: 3px; background: var(--bg); color: var(--text); }

/* ===========================
   Dispatch Hot Box
   =========================== */
.dsp-hotbox-content { display: flex; flex-direction: column; gap: 10px; }

/* Dispatcher box */
.dsp-hb-dispatcher { padding: 6px 0; }
.dsp-hb-assign-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dsp-hb-label { font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.dsp-hb-ro-input {
  width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 4px 8px;
}
.dsp-hb-tech-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 4px 8px;
  min-width: 140px;
}
.dsp-hb-dispatch-btn {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 14px;
  transition: background 0.15s;
}
.dsp-hb-dispatch-btn:hover { opacity: 0.88; }
.dsp-hb-dispatch-btn--success { background: #22c55e !important; }
.dsp-hb-error { color: #e55; font-size: 0.78rem; }

/* Tech box */
.dsp-hb-tech { display: flex; flex-direction: column; gap: 8px; }
.dsp-hb-pending {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(234,179,8,0.12);
  border: 1px solid #eab308;
  border-radius: 6px;
  padding: 8px 12px;
}
.dsp-hb-pending-label { font-weight: 700; font-size: 0.78rem; color: #eab308; white-space: nowrap; }
.dsp-hb-pending-details { display: flex; gap: 10px; font-size: 0.82rem; flex: 1; flex-wrap: wrap; }
.dsp-hb-pending-ro { font-weight: 600; }
.dsp-hb-accept-btn {
  background: #22c55e;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  white-space: nowrap;
}
.dsp-hb-accept-btn:hover { opacity: 0.88; }
.dsp-hb-no-pending { font-size: 0.8rem; color: var(--text-muted); }
.dsp-hb-queue { overflow-x: auto; }

/* SW quick-add */
.dsp-hb-sw { display: flex; flex-direction: column; gap: 8px; }
.dsp-hb-sw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
}
.dsp-hb-field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  padding: 4px 8px;
  box-sizing: border-box;
}
.dsp-hb-field:focus { border-color: var(--accent); outline: none; }
.dsp-hb-sw-footer { display: flex; align-items: center; gap: 10px; }
.dsp-hb-sw-error { font-size: 0.78rem; color: #e55; margin: 0; }

/* Required asterisk */
.req { color: #e55; font-size: 0.8rem; }

/* Ready for Dispatch read-only cards */
.dsp-board-ro-card--readonly { cursor: default; }
.dsp-board-ro-card--readonly:hover { background: var(--surface); }
[title="Click to fill RO # in dispatcher"].dsp-board-ro-card--readonly { cursor: pointer; }
[title="Click to fill RO # in dispatcher"].dsp-board-ro-card--readonly:hover { background: var(--hover); }
