/* ==========================================================================
   CHOBE TMS PHASE 2 - ADVANCED TASK HIERARCHY & TASK CREATION SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Color Palette - Premium Slate & Indigo Corporate Theme */
  --bg-main: #0b0f19;
  --bg-sidebar: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-header: #111827;
  --bg-input: #0f172a;
  
  --border-color: #1e293b;
  --border-light: #334155;
  --border-highlight: #475569;

  /* Primary & Accent Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --secondary: #0ea5e9;
  --accent: #8b5cf6;
  
  /* Status Colors */
  --status-not-started: #64748b;
  --status-in-progress: #3b82f6;
  --status-pending: #f59e0b;
  --status-completed: #10b981;
  --status-escalated: #ef4444;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  
  --glass-bg: rgba(30, 41, 59, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --sidebar-width: 260px;
  --header-height: 70px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset & Global Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', monospace;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--bg-main);
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Project Context Switcher */
.project-switcher {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.project-select-btn {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 600;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--transition-fast);
}

.project-select-btn:hover, .project-select-btn:focus {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

/* Navigation List */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
  padding: 0 12px 6px 12px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: var(--text-main);
  background: linear-gradient(90deg, var(--primary-light) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.nav-link-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.nav-item.active .nav-icon {
  color: var(--primary);
  opacity: 1;
}

.nav-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header Bar */
.top-header {
  height: var(--header-height);
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(10px);
}

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

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.search-bar {
  position: relative;
  width: 280px;
}

.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.action-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.action-btn.secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

.action-btn.secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.action-btn.success {
  background-color: var(--status-completed);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

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

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: var(--status-escalated);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* Form Groups for Modals */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 650px;
  max-width: 90vw;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

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

/* Page Views Container */
.content-body {
  padding: 28px;
  flex: 1;
}

.page-view {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

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

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

/* Report Selector */
.report-template-selector {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.report-tab-pill {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.report-tab-pill:hover {
  border-color: var(--border-highlight);
  color: var(--text-main);
}

.report-tab-pill.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.report-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.report-summary-card {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-summary-title { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.report-summary-value { font-size: 22px; font-weight: 800; color: var(--text-main); }

.chart-bar-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-input);
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.chart-bar-item { display: flex; align-items: center; gap: 14px; }
.chart-label { width: 180px; font-size: 12.5px; font-weight: 600; color: var(--text-main); }
.chart-track { flex: 1; height: 12px; background: var(--bg-card); border-radius: 6px; overflow: hidden; }
.chart-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%); border-radius: 6px; transition: width 0.5s ease-out; }

.report-export-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: var(--bg-header);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

/* Dynamic Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
}

.status-pill.not-started { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.3); }
.status-pill.in-progress { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.status-pill.pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-pill.completed { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-pill.escalated { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-pill.not-started .status-dot { background-color: #cbd5e1; }
.status-pill.in-progress .status-dot { background-color: #60a5fa; }
.status-pill.pending .status-dot { background-color: #fbbf24; }
.status-pill.completed .status-dot { background-color: #34d399; }
.status-pill.escalated .status-dot { background-color: #f87171; }

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover { transform: translateY(-2px); border-color: var(--border-highlight); }
.metric-header { display: flex; align-items: center; justify-content: space-between; }
.metric-title { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.metric-icon-box { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.metric-value { font-size: 26px; font-weight: 800; color: var(--text-main); letter-spacing: -0.5px; }
.metric-footer { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.trend-up { color: var(--status-completed); font-weight: 700; }
.trend-down { color: var(--status-escalated); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 28px; }
.panel-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; }
.panel-title-box { display: flex; flex-direction: column; }
.panel-title { font-size: 16px; font-weight: 700; color: var(--text-main); }
.panel-subtitle { font-size: 12px; color: var(--text-muted); }

.filter-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; background: var(--bg-card); padding: 14px 18px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-select, .filter-input { background-color: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-main); padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; outline: none; font-family: inherit; }
.filter-select:focus, .filter-input:focus { border-color: var(--primary); }

.view-toggle { display: flex; background: var(--bg-input); padding: 4px; border-radius: var(--radius-md); border: 1px solid var(--border-light); }
.toggle-btn { padding: 6px 14px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all var(--transition-fast); }
.toggle-btn.active { background-color: var(--primary); color: white; }

.table-responsive { width: 100%; overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-color); background: var(--bg-card); }
.custom-table { width: 100%; border-collapse: collapse; text-align: left; }
.custom-table th { background-color: rgba(15, 23, 42, 0.6); color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 14px 18px; border-bottom: 1px solid var(--border-color); }
.custom-table td { padding: 14px 18px; border-bottom: 1px solid var(--border-color); color: var(--text-main); font-size: 13.5px; vertical-align: middle; }
.custom-table tr:last-child td { border-bottom: none; }
.custom-table tr:hover td { background-color: rgba(255, 255, 255, 0.02); }

.kanban-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: start; overflow-x: auto; padding-bottom: 10px; }
.kanban-column { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: 75vh; }
.kanban-column-header { padding: 16px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.column-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.column-count { background: var(--bg-input); color: var(--text-muted); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.kanban-cards { padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.kanban-card { background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 14px; cursor: pointer; transition: all var(--transition-fast); }
.kanban-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-project-tag { font-size: 11px; font-weight: 700; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.card-title { font-weight: 600; font-size: 13.5px; color: var(--text-main); margin-bottom: 8px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.card-assignee { display: flex; align-items: center; gap: 6px; }
.avatar-mini { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: white; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.task-tabs { display: flex; gap: 12px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 16px; }
.task-tab-btn { background: transparent; border: none; color: var(--text-muted); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 12px; border-radius: var(--radius-sm); transition: all var(--transition-fast); }
.task-tab-btn.active { background: var(--primary-light); color: var(--text-main); border-bottom: 2px solid var(--primary); }
.subtask-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); font-size: 13px; cursor: pointer; }
.subtask-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.subtask-item.completed span { text-decoration: line-through; color: var(--text-dim); }

.builder-container { display: grid; grid-template-columns: 300px 1fr; gap: 24px; }
.master-list-sidebar { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.master-item-btn { padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-light); background: var(--bg-input); color: var(--text-muted); text-align: left; font-weight: 600; font-size: 13.5px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: all var(--transition-fast); }
.master-item-btn:hover { border-color: var(--border-highlight); color: var(--text-main); }
.master-item-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--text-main); }
.field-cards-grid { display: flex; flex-direction: column; gap: 12px; }
.field-row-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.field-info { display: flex; align-items: center; gap: 14px; }
.field-type-badge { background: rgba(14, 165, 233, 0.15); color: #38bdf8; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }

.hierarchy-canvas { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 32px; min-height: 380px; display: flex; align-items: center; justify-content: center; position: relative; }
.hierarchy-flow { display: flex; align-items: center; gap: 40px; }
.flow-node { background: var(--bg-input); border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: 20px; width: 200px; box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); text-align: center; cursor: pointer; transition: all var(--transition-fast); }
.flow-node:hover { transform: scale(1.03); border-color: var(--accent); }
.node-title { font-weight: 700; font-size: 15px; color: var(--text-main); margin-bottom: 4px; }
.node-sub { font-size: 11.5px; color: var(--text-muted); }
.flow-arrow { display: flex; align-items: center; color: var(--primary); font-size: 24px; position: relative; }
.flow-arrow::after { content: 'Per Project Binding'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-muted); white-space: nowrap; font-weight: 600; }

.drawer-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(5px); z-index: 200; display: none; opacity: 0; transition: opacity var(--transition-normal); }
.drawer-overlay.active { display: flex; align-items: center; justify-content: center; opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 620px; background: var(--bg-sidebar); border-left: 1px solid var(--border-color); z-index: 210; display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--transition-normal); box-shadow: var(--shadow-xl); }
.drawer-overlay.active .drawer { transform: translateX(0); }
.drawer-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { padding: 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 20px; }
.drawer-footer { padding: 20px 24px; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: flex-end; gap: 12px; }

.rule-sequence-box { background: var(--bg-input); border: 1px dashed var(--border-highlight); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.sequence-step { display: flex; align-items: center; gap: 16px; background: var(--bg-card); border: 1px solid var(--border-color); padding: 14px 18px; border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); }
.sequence-step:hover { border-color: var(--primary); transform: translateX(4px); }
.step-number { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: white; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-card); border: 1px solid var(--primary); border-radius: var(--radius-md); padding: 12px 18px; color: var(--text-main); font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: slideToast 0.3s ease-out; }
@keyframes slideToast { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .builder-container { grid-template-columns: 1fr; }
  .kanban-grid { grid-template-columns: repeat(2, 1fr); }
  .report-summary-bar { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Phase 2.0 mobile
   Off-canvas sidebar under 900px. layout/footer_link.php toggles ".show" on
   ".sidebar" via the ".toggle-sidebar" button and closes it on clicks inside
   ".main-content"; keep those three class names.
   ========================================================================== */
html, body { max-width: 100vw; overflow-x: hidden; }
.app-container { width: 100%; }
.main-wrapper, .content-body { min-width: 0; max-width: 100%; }
.toggle-sidebar { display: none; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 95; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: 280px; max-width: 86vw; box-shadow: var(--shadow-xl); }
  .sidebar.show { transform: translateX(0); }
  .sidebar.show ~ .sidebar-backdrop { display: block; }
  .main-wrapper { margin-left: 0; }
  .top-header { height: auto; min-height: var(--header-height); padding: 10px 16px; flex-wrap: wrap; gap: 8px 12px; }
  .toggle-sidebar { display: flex; flex-shrink: 0; }
  .header-left { flex: 1 1 auto; gap: 10px; min-width: 0; flex-wrap: wrap; }
  .header-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .page-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .search-bar { width: 100%; flex: 1 1 100%; order: 10; }
  .content-body { padding: 16px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric-value { font-size: 22px; }
  .dashboard-grid, .builder-container, .form-grid-2 { grid-template-columns: 1fr; }
  .kanban-grid { display: flex; overflow-x: auto; }
  .kanban-grid .kanban-column { min-width: 240px; flex: 0 0 240px; }
  .report-summary-bar { grid-template-columns: 1fr 1fr; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .custom-table th, .custom-table td { white-space: nowrap; padding: 10px 12px; }
  .drawer { width: 100vw; }
  .modal-dialog { max-width: 94vw; }
  .sidebar-footer { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .search-bar { display: none; }
  .metrics-grid { grid-template-columns: 1fr; }
  .report-summary-bar { grid-template-columns: 1fr; }
  .header-right .user-meta { display: none; }
  .content-body { padding: 16px 16px 24px; }
}

/* ==========================================================================
   Phase 2.0 legacy compatibility
   Phase 1 screens still use Bootstrap 5.3 and Tailwind utilities. The rules
   below map those classes onto the chobe-v2 tokens so they read as dark
   chobe-v2 until each screen is rebuilt. Tokens only; no new colours.
   ========================================================================== */
:root { color-scheme: dark; }

/* shell glue (the shell lives beside Bootstrap's reboot) */
.top-header .page-title { margin: 0; }
.sidebar .nav-item, .sidebar .nav-item:hover, .sidebar-logout, .notification-dropdown a { text-decoration: none; }
.project-switcher-label { display: block; font-size: 11px; text-transform: uppercase; color: var(--text-dim); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 6px; }
.sidebar-logout { margin-left: auto; width: 32px; height: 32px; flex-shrink: 0; font-size: 15px; }
.user-menu-btn { display: inline-flex; align-items: center; gap: 10px; background: transparent; border: 0; padding: 4px 6px 4px 4px; border-radius: var(--radius-md); color: var(--text-main); cursor: pointer; text-align: left; }
.user-menu-btn:hover, .user-menu-btn:focus-visible { background: var(--bg-card); outline: none; }
.user-menu-btn .user-avatar { width: 34px; height: 34px; font-size: 12px; }
.notification-count { display: none; align-items: center; justify-content: center; top: -5px; right: -5px; width: auto; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; font-weight: 700; line-height: 1; color: white; }
.notification-dropdown { width: 340px; max-width: 92vw; padding: 0; overflow: hidden; }
.notification-header, .notification-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 12.5px; font-weight: 600; }
.notification-header { border-bottom: 1px solid var(--border-color); }
.notification-footer { border-top: 1px solid var(--border-color); justify-content: center; }
.notification-header a, .notification-footer a { color: var(--primary); font-weight: 600; }
.notification-items { max-height: 320px; overflow-y: auto; }
.notification-items .dropdown-item { white-space: normal; padding: 10px 16px; border-bottom: 1px solid var(--border-color); cursor: pointer; }
.project-context { cursor: default; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.content-body .alert { margin-bottom: 20px; }
.content-body > .row:first-child .h3, .content-body h1.h3, .content-body h2.h3 { font-size: 18px; font-weight: 700; }

/* Bootstrap 5.3 components via their own variables */
.card { --bs-card-bg: var(--bg-card); --bs-card-color: var(--text-main); --bs-card-border-color: var(--border-color); --bs-card-cap-bg: rgba(15, 23, 42, 0.6); --bs-card-cap-color: var(--text-main); --bs-card-border-radius: var(--radius-lg); --bs-card-inner-border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header, .card-footer { border-color: var(--border-color); }
.card-title, .card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6 { color: var(--text-main); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text-main); --bs-table-border-color: var(--border-color); --bs-table-striped-bg: rgba(255, 255, 255, 0.02); --bs-table-striped-color: var(--text-main); --bs-table-hover-bg: rgba(255, 255, 255, 0.04); --bs-table-hover-color: var(--text-main); --bs-table-active-bg: var(--primary-light); --bs-table-active-color: var(--text-main); }
.table > :not(caption) > * > * { border-bottom-color: var(--border-color); background-color: transparent; color: var(--text-main); }
.table thead th, .table > thead > tr > th { background-color: rgba(15, 23, 42, 0.6); color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.table-light, .table-light > :not(caption) > * > * { --bs-table-bg: rgba(15, 23, 42, 0.6); --bs-table-color: var(--text-muted); background-color: rgba(15, 23, 42, 0.6); color: var(--text-muted); }
.table-responsive > .table { margin-bottom: 0; }
/* style.css paints every tbody row white/grey; chobe-v2 rows are transparent */
table tbody tr:nth-child(odd), table tbody tr:nth-child(even) { background-color: transparent; }
table tbody tr:hover { background-color: rgba(255, 255, 255, 0.02); }
.btn { --bs-btn-border-radius: var(--radius-md); --bs-btn-font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); --bs-btn-color: white; --bs-btn-hover-color: white; --bs-btn-active-color: white; --bs-btn-disabled-color: white; }
.btn-secondary, .btn-light, .btn-outline-secondary, .btn-outline-primary, .btn-outline-dark, .btn-outline-light { --bs-btn-bg: var(--bg-card); --bs-btn-border-color: var(--border-light); --bs-btn-color: var(--text-main); --bs-btn-hover-bg: var(--bg-card-hover); --bs-btn-hover-border-color: var(--border-highlight); --bs-btn-hover-color: var(--text-main); --bs-btn-active-bg: var(--bg-card-hover); --bs-btn-active-border-color: var(--border-highlight); --bs-btn-active-color: var(--text-main); --bs-btn-disabled-bg: var(--bg-card); --bs-btn-disabled-border-color: var(--border-light); --bs-btn-disabled-color: var(--text-dim); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-color: white; --bs-btn-active-bg: var(--primary); --bs-btn-active-color: white; }
.btn-success { --bs-btn-bg: var(--status-completed); --bs-btn-border-color: var(--status-completed); --bs-btn-hover-bg: var(--status-completed); --bs-btn-hover-border-color: var(--status-completed); --bs-btn-active-bg: var(--status-completed); --bs-btn-active-border-color: var(--status-completed); --bs-btn-color: white; --bs-btn-hover-color: white; --bs-btn-active-color: white; }
.btn-danger, .btn-outline-danger:hover { --bs-btn-bg: var(--status-escalated); --bs-btn-border-color: var(--status-escalated); --bs-btn-hover-bg: var(--status-escalated); --bs-btn-hover-border-color: var(--status-escalated); --bs-btn-active-bg: var(--status-escalated); --bs-btn-active-border-color: var(--status-escalated); --bs-btn-color: white; --bs-btn-hover-color: white; --bs-btn-active-color: white; }
.btn-outline-danger { --bs-btn-color: var(--status-escalated); --bs-btn-border-color: var(--status-escalated); --bs-btn-hover-bg: var(--status-escalated); --bs-btn-hover-color: white; }
.btn-warning { --bs-btn-bg: var(--status-pending); --bs-btn-border-color: var(--status-pending); --bs-btn-hover-bg: var(--status-pending); --bs-btn-hover-border-color: var(--status-pending); --bs-btn-active-bg: var(--status-pending); --bs-btn-active-border-color: var(--status-pending); --bs-btn-color: var(--bg-main); --bs-btn-hover-color: var(--bg-main); --bs-btn-active-color: var(--bg-main); }
.btn-info { --bs-btn-bg: var(--secondary); --bs-btn-border-color: var(--secondary); --bs-btn-hover-bg: var(--secondary); --bs-btn-hover-border-color: var(--secondary); --bs-btn-active-bg: var(--secondary); --bs-btn-active-border-color: var(--secondary); --bs-btn-color: white; --bs-btn-hover-color: white; --bs-btn-active-color: white; }
.btn-outline-success { --bs-btn-color: var(--status-completed); --bs-btn-border-color: var(--status-completed); --bs-btn-hover-bg: var(--status-completed); --bs-btn-hover-color: white; }
.btn-outline-warning { --bs-btn-color: var(--status-pending); --bs-btn-border-color: var(--status-pending); --bs-btn-hover-bg: var(--status-pending); --bs-btn-hover-color: var(--bg-main); }
.btn-outline-info { --bs-btn-color: var(--secondary); --bs-btn-border-color: var(--secondary); --bs-btn-hover-bg: var(--secondary); --bs-btn-hover-color: white; }
.btn-link { --bs-btn-color: var(--primary); --bs-btn-hover-color: var(--primary-hover); }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.form-control, .form-select, .input-group-text, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]), select, textarea { background-color: var(--bg-input); border-color: var(--border-light); color: var(--text-main); border-radius: var(--radius-md); font-family: inherit; }
.form-control:focus, .form-select:focus, input:focus, select:focus, textarea:focus { background-color: var(--bg-input); border-color: var(--primary); color: var(--text-main); box-shadow: 0 0 0 3px var(--primary-light); outline: none; }
.form-control::placeholder, input::placeholder, textarea::placeholder { color: var(--text-dim); }
.form-control:disabled, .form-select:disabled, input:disabled, select:disabled, textarea:disabled { background-color: var(--bg-card); color: var(--text-dim); }
.form-select, select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px; padding-right: 32px; -webkit-appearance: none; appearance: none; }
select[multiple], select[size]:not([size="1"]) { background-image: none; padding-right: 12px; }
/* Bootstrap's reboot underlines every link; the contract has none (buttons, cards and table links are plain) */
.content-body a { text-decoration: none; }
.form-check-input { background-color: var(--bg-input); border-color: var(--border-highlight); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--primary-light); border-color: var(--primary); }
.form-label, label, .col-form-label { color: var(--text-muted); }
.form-text { color: var(--text-dim); }
.input-group-text { color: var(--text-muted); }
.invalid-feedback, .text-danger, .is-invalid ~ .invalid-feedback { color: #f87171; }
.badge { --bs-badge-font-weight: 700; --bs-badge-border-radius: 10px; }
.badge.bg-primary, .badge.bg-info { background-color: rgba(59, 130, 246, 0.15) !important; color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.bg-secondary, .badge.bg-light, .badge.bg-dark { background-color: rgba(100, 116, 139, 0.2) !important; color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.3); }
.badge.bg-success { background-color: rgba(16, 185, 129, 0.15) !important; color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.bg-warning { background-color: rgba(245, 158, 11, 0.15) !important; color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.bg-danger { background-color: rgba(239, 68, 68, 0.15) !important; color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.modal-content { --bs-modal-bg: var(--bg-card); --bs-modal-color: var(--text-main); --bs-modal-border-color: var(--border-light); --bs-modal-border-radius: var(--radius-lg); --bs-modal-header-border-color: var(--border-color); --bs-modal-footer-border-color: var(--border-color); box-shadow: var(--shadow-xl); }
.modal-content .modal-header, .modal-content .modal-footer { border-color: var(--border-color); background: transparent; }
.modal-content .modal-body { padding: 24px; gap: 16px; max-height: none; }
.modal-title { color: var(--text-main); font-weight: 700; }
.modal-backdrop { --bs-backdrop-bg: rgba(0, 0, 0, 0.75); --bs-backdrop-opacity: 1; }
.dropdown-menu { --bs-dropdown-bg: var(--bg-card); --bs-dropdown-color: var(--text-main); --bs-dropdown-border-color: var(--border-light); --bs-dropdown-border-radius: var(--radius-md); --bs-dropdown-link-color: var(--text-main); --bs-dropdown-link-hover-color: var(--text-main); --bs-dropdown-link-hover-bg: var(--bg-card-hover); --bs-dropdown-link-active-bg: var(--primary); --bs-dropdown-link-active-color: white; --bs-dropdown-divider-bg: var(--border-color); --bs-dropdown-header-color: var(--text-muted); box-shadow: var(--shadow-lg); }
.dropdown-item { color: var(--text-main); }
.dropdown-item small, .dropdown-item .small { color: var(--text-muted); }
.nav-tabs { --bs-nav-tabs-border-color: var(--border-color); --bs-nav-tabs-link-active-bg: var(--bg-card); --bs-nav-tabs-link-active-color: var(--text-main); --bs-nav-tabs-link-active-border-color: var(--border-light) var(--border-light) var(--bg-card); --bs-nav-tabs-link-hover-border-color: var(--border-light) var(--border-light) var(--border-color); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--primary); --bs-nav-pills-link-active-color: white; --bs-nav-pills-border-radius: var(--radius-md); }
.nav-link { --bs-nav-link-color: var(--text-muted); --bs-nav-link-hover-color: var(--text-main); color: var(--text-muted); }
.nav-link:hover, .nav-link:focus { color: var(--text-main); }
.alert { --bs-alert-border-radius: var(--radius-md); }
.alert-success { --bs-alert-bg: rgba(16, 185, 129, 0.15); --bs-alert-color: #34d399; --bs-alert-border-color: rgba(16, 185, 129, 0.3); }
.alert-danger { --bs-alert-bg: rgba(239, 68, 68, 0.15); --bs-alert-color: #f87171; --bs-alert-border-color: rgba(239, 68, 68, 0.3); }
.alert-warning { --bs-alert-bg: rgba(245, 158, 11, 0.15); --bs-alert-color: #fbbf24; --bs-alert-border-color: rgba(245, 158, 11, 0.3); }
.alert-info, .alert-primary { --bs-alert-bg: rgba(59, 130, 246, 0.15); --bs-alert-color: #60a5fa; --bs-alert-border-color: rgba(59, 130, 246, 0.3); }
.alert-secondary, .alert-light, .alert-dark { --bs-alert-bg: var(--bg-card); --bs-alert-color: var(--text-main); --bs-alert-border-color: var(--border-light); }
.list-group { --bs-list-group-bg: var(--bg-card); --bs-list-group-color: var(--text-main); --bs-list-group-border-color: var(--border-color); --bs-list-group-action-hover-bg: var(--bg-card-hover); --bs-list-group-action-hover-color: var(--text-main); --bs-list-group-action-active-bg: var(--primary-light); --bs-list-group-active-bg: var(--primary); --bs-list-group-active-border-color: var(--primary); --bs-list-group-border-radius: var(--radius-md); }
.list-group-item { background-color: var(--bg-card); color: var(--text-main); border-color: var(--border-color); }
.pagination { --bs-pagination-bg: var(--bg-card); --bs-pagination-color: var(--text-muted); --bs-pagination-border-color: var(--border-light); --bs-pagination-hover-bg: var(--bg-card-hover); --bs-pagination-hover-color: var(--text-main); --bs-pagination-hover-border-color: var(--border-highlight); --bs-pagination-focus-bg: var(--bg-card-hover); --bs-pagination-focus-color: var(--text-main); --bs-pagination-focus-box-shadow: 0 0 0 3px var(--primary-light); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-active-color: white; --bs-pagination-disabled-bg: var(--bg-card); --bs-pagination-disabled-color: var(--text-dim); --bs-pagination-disabled-border-color: var(--border-color); --bs-pagination-border-radius: var(--radius-sm); }
.breadcrumb { --bs-breadcrumb-divider-color: var(--text-dim); --bs-breadcrumb-item-active-color: var(--text-main); }
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.spinner-border.text-primary { color: var(--primary) !important; }
.text-muted, .text-secondary, .text-body-secondary { color: var(--text-muted) !important; }
.text-dark, .text-body, .text-black { color: var(--text-main) !important; }
.text-primary { color: #818cf8 !important; }
.text-success { color: #34d399 !important; }
.text-warning { color: #fbbf24 !important; }
.text-info { color: #38bdf8 !important; }
.bg-light, .bg-body, .bg-body-tertiary { background-color: var(--bg-card) !important; color: var(--text-main); }
.border, .border-top, .border-bottom, .border-start, .border-end, .border-light, .border-secondary { border-color: var(--border-light) !important; }
hr { border-color: var(--border-light); opacity: 1; }
a { color: #818cf8; }
a:hover { color: var(--primary); }
.btn, .nav-item, .dropdown-item, .page-link, .breadcrumb-item, .list-group-item, .nav-link, .badge { text-decoration: none; }

/* Tailwind utilities used by the Phase 1 and Sept screens */
.bg-white, .bg-gray-50, .bg-gray-100 { background-color: var(--bg-card) !important; color: var(--text-main); }
.bg-gray-200, .bg-gray-300 { background-color: var(--bg-card-hover); color: var(--text-main); }
.bg-blue-50, .bg-indigo-50, .bg-blue-100 { background-color: var(--primary-light); }
.bg-green-50, .bg-green-100 { background-color: rgba(16, 185, 129, 0.15); }
.bg-red-50, .bg-red-100 { background-color: rgba(239, 68, 68, 0.15); }
.bg-yellow-50, .bg-yellow-100, .bg-amber-50, .bg-amber-100 { background-color: rgba(245, 158, 11, 0.15); }
.bg-blue-600, .bg-blue-500, .bg-indigo-600, .bg-primary-600 { background-color: var(--primary); color: white; }
.hover\:bg-blue-700:hover, .hover\:bg-indigo-700:hover, .hover\:bg-primary-700:hover, .hover\:bg-blue-600:hover { background-color: var(--primary-hover); }
.text-gray-900, .text-gray-800, .text-gray-700, .text-black, .text-slate-900, .text-slate-800, .text-slate-700 { color: var(--text-main); }
.text-gray-600, .text-gray-500, .text-slate-600, .text-slate-500 { color: var(--text-muted); }
.text-gray-400, .text-gray-300, .text-slate-400 { color: var(--text-dim); }
.text-blue-600, .text-blue-700, .text-blue-500, .text-indigo-600 { color: #818cf8; }
.hover\:text-blue-800:hover, .hover\:text-blue-700:hover, .hover\:text-indigo-800:hover { color: var(--primary); }
.text-green-600, .text-green-500, .text-green-700 { color: #34d399; }
.text-red-600, .text-red-500, .text-red-700 { color: #f87171; }
.text-yellow-600, .text-amber-600, .text-yellow-700, .text-amber-700 { color: #fbbf24; }
.hover\:text-gray-600:hover, .hover\:text-gray-700:hover, .hover\:text-gray-900:hover { color: var(--text-main); }
.border-gray-100, .border-gray-200, .border-gray-300, .border-slate-200, .border-slate-300, .border-b, .border-t, .border-l, .border-r { border-color: var(--border-light); }
.divide-gray-100 > :not(:last-child), .divide-gray-200 > :not(:last-child), .divide-gray-300 > :not(:last-child), .divide-y > :not(:last-child) { border-color: var(--border-color); }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow, .shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl, .shadow-2xl { box-shadow: var(--shadow-xl) !important; }
.hover\:shadow-md:hover, .hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }
.hover\:bg-gray-50:hover, .hover\:bg-gray-100:hover, .hover\:bg-gray-200:hover, .hover\:bg-slate-50:hover { background-color: var(--bg-card-hover); }
.rounded-lg { border-radius: var(--radius-md); }
.rounded-xl, .rounded-2xl { border-radius: var(--radius-lg); }
.ring-1, .ring-gray-200, .ring-gray-300 { --tw-ring-color: var(--border-light); }
.focus\:ring-blue-500:focus { --tw-ring-color: var(--primary); }
.focus\:border-blue-500:focus { border-color: var(--primary); }
.bg-black.bg-opacity-50, .bg-black\/50 { background-color: rgba(0, 0, 0, 0.75); }
.stat-badge { background: var(--primary-light); color: #818cf8; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--text-main); }
strong, b { color: inherit; }

/* select2 */
.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple { background-color: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); min-height: 38px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text-main); line-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: var(--text-muted) transparent transparent transparent; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--text-dim); }
.select2-container--default.select2-container--focus .select2-selection--single, .select2-container--default.select2-container--focus .select2-selection--multiple, .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--primary); }
.select2-container--default .select2-selection--multiple .select2-selection__choice { background-color: var(--bg-card-hover); border: 1px solid var(--border-highlight); color: var(--text-main); border-radius: var(--radius-sm); }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--text-muted); }
.select2-dropdown { background-color: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); color: var(--text-main); }
.select2-container--default .select2-search--dropdown .select2-search__field, .select2-container--default .select2-search--inline .select2-search__field { background-color: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-main); border-radius: var(--radius-sm); }
.select2-container--default .select2-results__option { color: var(--text-main); }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable, .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--primary); color: white; }
.select2-container--default .select2-results__option--selected, .select2-container--default .select2-results__option[aria-selected="true"] { background-color: var(--bg-card-hover); color: var(--text-main); }
.select2-container--default .select2-results__group { color: var(--text-muted); }

/* toastr */
#toast-container > div { background-color: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-light); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); opacity: 1; }
#toast-container > .toast-success { border-color: var(--status-completed); }
#toast-container > .toast-error { border-color: var(--status-escalated); }
#toast-container > .toast-warning { border-color: var(--status-pending); }
#toast-container > .toast-info { border-color: var(--secondary); }
#toast-container .toast-title { color: var(--text-main); }
#toast-container .toast-message { color: var(--text-muted); }

/* ApexCharts */
.apexcharts-canvas .apexcharts-text, .apexcharts-canvas .apexcharts-title-text, .apexcharts-canvas .apexcharts-subtitle-text, .apexcharts-canvas .apexcharts-datalabel-label, .apexcharts-canvas .apexcharts-datalabel-value { fill: var(--text-muted) !important; }
.apexcharts-legend-text { color: var(--text-muted) !important; }
.apexcharts-gridline, .apexcharts-xaxis-tick, .apexcharts-xaxis line, .apexcharts-yaxis line { stroke: var(--border-light); }
.apexcharts-tooltip.apexcharts-theme-light, .apexcharts-tooltip.apexcharts-theme-dark { background: var(--bg-card); border: 1px solid var(--border-light); color: var(--text-main); box-shadow: var(--shadow-lg); }
.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title, .apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title { background: var(--bg-input); border-bottom: 1px solid var(--border-light); color: var(--text-main); }
.apexcharts-tooltip-text, .apexcharts-tooltip-text-y-value, .apexcharts-tooltip-text-y-label { color: var(--text-main); }
.apexcharts-xaxistooltip, .apexcharts-yaxistooltip { background: var(--bg-card); border: 1px solid var(--border-light); color: var(--text-main); }
.apexcharts-xaxistooltip-bottom:before, .apexcharts-xaxistooltip-bottom:after { border-bottom-color: var(--border-light); }
.apexcharts-menu { background: var(--bg-card); border: 1px solid var(--border-light); color: var(--text-main); }
.apexcharts-menu-item:hover { background: var(--bg-card-hover); }
.apexcharts-toolbar svg { fill: var(--text-muted); }

/* FullCalendar v6 (legacy calendar views) */
.fc { --fc-border-color: var(--border-color); --fc-page-bg-color: var(--bg-card); --fc-neutral-bg-color: var(--bg-input); --fc-neutral-text-color: var(--text-muted); --fc-today-bg-color: var(--primary-light); --fc-button-bg-color: var(--bg-card); --fc-button-border-color: var(--border-light); --fc-button-text-color: var(--text-main); --fc-button-hover-bg-color: var(--bg-card-hover); --fc-button-hover-border-color: var(--border-highlight); --fc-button-active-bg-color: var(--primary); --fc-button-active-border-color: var(--primary); --fc-event-bg-color: var(--primary); --fc-event-border-color: var(--primary); color: var(--text-main); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc .fc-toolbar-title { color: var(--text-main); }

/* ==========================================================================
   Phase 2.0 legacy compatibility - D1 (work screens: dashboard, tasks, my
   work, activities, daily lock). Tokens only. The classes below are used by
   the restyled views and by the row templates in tasklist.js, mytask.js,
   teamh.js, myactivities.js and taskactivity.js.
   ========================================================================== */
/* Tasks by Priority rows (dashboard) */
.priority-breakdown .pb-label, .priority-breakdown .pb-value { color: var(--text-main); }
.priority-breakdown .pb-pct, .priority-breakdown .pb-total { color: var(--text-muted); }
.priority-breakdown .pb-track { background: var(--bg-input); }
.priority-breakdown .pb-total { border-top-color: var(--border-color); }
.priority-breakdown .pb-dot-high, .priority-breakdown .pb-fill-high { background: var(--status-escalated); }
.priority-breakdown .pb-dot-medium, .priority-breakdown .pb-fill-medium { background: var(--status-pending); }
.priority-breakdown .pb-dot-low, .priority-breakdown .pb-fill-low { background: var(--status-completed); }
/* metric cards that are links */
a.metric-card { color: inherit; text-decoration: none; }
/* work cards (kanban-card) rendered by the task list scripts */
.kanban-grid.two-columns { grid-template-columns: repeat(2, 1fr); }
.kanban-column.hidden { display: none; }
/* three header actions must not wrap the page title; the search bar gives way instead */
.top-header .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.header-left { min-width: 0; flex: 1 1 auto; }
.header-left .search-bar { flex: 0 1 280px; min-width: 120px; }
.header-right { flex: 0 0 auto; max-width: 100%; }
.header-right .action-btn { white-space: nowrap; }
.kanban-card .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kanban-card .card-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card .card-sub { font-size: 11.5px; color: var(--text-dim); margin-bottom: 8px; }
.kanban-card .card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kanban-card .card-meta.no-border { border-top: 0; padding-top: 0; margin-top: 6px; }
.kanban-cards:empty::after { content: 'No tasks'; display: block; text-align: center; font-size: 12px; color: var(--text-dim); padding: 12px; }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.progress-track { flex: 1; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--status-completed); border-radius: 3px; transition: width 0.3s; }
.progress-fill.low, .progress-fill.bg-red-500 { background: var(--status-escalated); }
.progress-fill.mid, .progress-fill.bg-yellow-500 { background: var(--status-pending); }
.progress-fill.bg-green-500 { background: var(--status-completed); }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar-mini { margin-left: -6px; border: 2px solid var(--bg-card); width: 26px; height: 26px; overflow: hidden; }
.avatar-stack .avatar-mini:first-child { margin-left: 0; }
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.action-btn.sm { padding: 6px 12px; font-size: 12px; }
.action-btn, .action-btn:hover, a.action-btn { text-decoration: none; color: white; }
.action-btn.secondary, .action-btn.secondary:hover { color: var(--text-main); }
.icon-btn.sm { width: 32px; height: 32px; font-size: 14px; }
.icon-btn.danger:hover { color: #f87171; border-color: var(--status-escalated); }
.icon-btn.active { background: var(--primary-light); color: var(--text-main); border-color: var(--primary); }
button.icon-btn, button.action-btn { font-family: inherit; }
/* legacy custom (Tailwind) modals opened with classList 'hidden': the contract overlay/dialog */
.modal-overlay.hidden { display: none; }
.modal-overlay:not(.hidden) { display: flex; opacity: 1; }
.modal-overlay .modal-dialog { pointer-events: auto; margin: 0; max-height: 92vh; }
.modal-overlay .modal-dialog.wide { width: 900px; }
.modal-overlay .modal-dialog.narrow { width: 460px; }
.modal-overlay .modal-header .modal-title { font-size: 16px; font-weight: 700; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.modal-overlay .modal-header .modal-tools { display: flex; gap: 8px; flex-shrink: 0; }
.modal-overlay .modal-body { max-height: none; }
.modal-overlay .modal-footer > * { margin: 0; }
.modal-overlay .step1, .modal-overlay .step2, .modal-overlay .step3, .modal-overlay .step4 { padding: 24px; display: none; flex-direction: column; gap: 16px; }
.modal-overlay .step-active { display: flex; }
.detail-list { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.detail-list .detail-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 2px; }
.modal-profiles, #modal-profiles, #participants, #participantsactivityTasks, #activities.unit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.modal-profiles > div, #modal-profiles > div, #participants > *, #participantsactivityTasks > *, .staff-wrapper, .activity-wrapper, .staff-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); font-size: 13px; color: var(--text-main); }
.modal-profiles .avatar-mini, #modal-profiles .avatar-mini, .staff-row .avatar-mini { flex-shrink: 0; }
.staff-row { cursor: pointer; margin: 0; }
.staff-row .staff-name { flex: 1; }
.staff-row .form-check-input { margin: 0; flex-shrink: 0; }
/* priority buttons toggled by tasklist.js (bg-orange-100 = selected) */
.priority-btn { background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-muted); border-radius: var(--radius-md); padding: 8px 14px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }
.priority-btn.bg-orange-100 { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
#priorityButtons { display: flex; gap: 8px; flex-wrap: wrap; }
/* chat-style reply history (mytask.js, tasklist.js, teamh.js, myactivities.js) */
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.chat-date { display: flex; justify-content: center; }
.chat-date span { font-size: 11px; color: var(--text-muted); background: var(--bg-input); border: 1px solid var(--border-light); padding: 2px 10px; border-radius: 10px; }
.chat-row { display: flex; justify-content: flex-start; }
.chat-row.me { justify-content: flex-end; }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 80%; }
.chat-row.me .chat-msg { flex-direction: row-reverse; }
.chat-bubble { background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-main); padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; }
.chat-row.me .chat-bubble { background: var(--primary-light); border-color: rgba(99, 102, 241, 0.3); }
.chat-bubble p { margin: 0; }
.chat-time { font-size: 10.5px; color: var(--text-dim); text-align: right; margin-top: 4px; }
.chat-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 24px 0; }
.reply-form { display: flex; flex-direction: column; gap: 10px; }
.reply-form .form-textarea { min-height: 90px; width: 100%; resize: vertical; }
.reply-form .reply-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* activity rows (myactivities.js / taskactivity.js) */
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-row { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--bg-input); border: 1px solid var(--border-light); border-left: 3px solid var(--status-pending); border-radius: var(--radius-md); }
.activity-row.completed { border-left-color: var(--status-completed); }
.activity-row .activity-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.activity-row .activity-title { font-weight: 600; font-size: 13.5px; color: var(--text-main); }
.activity-row .activity-desc { font-size: 12.5px; color: var(--text-muted); }
.activity-row .activity-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.activity-row .activity-meta .ml-auto { margin-left: auto; }
.comment-form { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.comment-form .comment-text { flex: 1; min-height: 38px; resize: vertical; }
.comment-form .comment-text:disabled { background: var(--bg-card); color: var(--text-muted); cursor: not-allowed; }
.comment-form .hidden, .activity-row .hidden, .activity-meta .hidden { display: none; }
/* tables rendered by inline scripts (daily lock, activities list, dashboard recent tasks) */
.table-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border-color); font-size: 12.5px; color: var(--text-muted); }
.table-pager .pager-nav { display: flex; align-items: center; gap: 8px; }
.table-pager .action-btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.table-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 32px 16px; }
.custom-table input[type="checkbox"], .filter-toolbar input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: middle; }
.custom-table .id-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 16px; background: var(--primary-light); color: #818cf8; font-weight: 700; font-size: 12px; cursor: pointer; margin-right: 8px; }
.custom-table .row-actions { display: flex; gap: 6px; }
.filter-toolbar .filter-input, .filter-toolbar .filter-select { min-width: 160px; }
.filter-toolbar .filter-input.grow { flex: 1 1 220px; }
.panel-card > .filter-toolbar { margin-bottom: 0; }
.panel-card .panel-body { display: flex; flex-direction: column; gap: 16px; }
.form-grid-2 .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.form-input[type="file"] { padding: 8px 12px; }
.form-input[type="file"]::file-selector-button { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 4px 10px; margin-right: 10px; font-family: inherit; }
.unit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.unit-grid:empty { display: none; }
/* auto-assign option cards (style.css .assign-card) */
.assign-card .card-inner { border-color: var(--border-light); background: var(--bg-input); color: var(--text-main); }
.assign-card .card-inner h4 { font-size: 14px; font-weight: 600; margin: 0; }
.assign-card .card-inner p { color: var(--text-muted); }
.assign-card input:checked + .card-inner { border-color: var(--primary); background: var(--primary-light); }
.assign-card input:checked + .card-inner .radio-dot { border-color: var(--primary); }
.assign-card .radio-dot { border-color: var(--border-highlight); }
.assign-card .radio-dot::after { background: var(--primary); }
.assign-options { display: flex; flex-direction: column; gap: 12px; }
#assignProgressWrapper { background: var(--bg-input); border-radius: var(--radius-md); }
#assignProgressBar { background-color: var(--primary); }
.doc-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #818cf8; }
@media (max-width: 900px) {
  .task-tabs { flex-wrap: wrap; gap: 8px; }
  .kanban-grid.two-columns { display: flex; }
  .kanban-grid.two-columns .kanban-column { min-width: 280px; flex: 0 0 85%; }
  .modal-profiles, #modal-profiles, #participants, #participantsactivityTasks, .unit-grid { grid-template-columns: 1fr; }
  .filter-toolbar .filter-input, .filter-toolbar .filter-select { min-width: 0; flex: 1 1 140px; }
  .filter-toolbar .filter-group { width: 100%; }
  .header-right .action-btn { padding: 8px 12px; }
  .comment-form { flex-wrap: wrap; }
}
/* ==========================================================================
   Phase 2.0 legacy compatibility - D2 (people and data screens: users & roles,
   clients, branches, projects, project units, task templates, settings)
   Tokens only. Small helpers shared by the restyled row templates.
   ========================================================================== */
/* a chobe-v2 .modal-dialog sits beside Bootstrap's reset of the same class (pointer-events: none, margin) */
.modal-overlay .modal-dialog { pointer-events: auto; margin: 0; }
/* action buttons used as links in the shell header (Bootstrap's reboot underlines them) */
a.action-btn, a.action-btn:hover, a.icon-btn, a.icon-btn:hover { text-decoration: none; }
a.action-btn { color: white; }
a.action-btn.secondary { color: var(--text-main); }
/* form grids: a wide intrinsic input (date, file, select) must not stretch the column past the card */
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-2 > * { min-width: 0; }
.form-group .form-input, .form-group .form-select, .form-group .form-textarea { width: 100%; min-width: 0; }
@media (max-width: 900px) { .form-grid-2 { grid-template-columns: minmax(0, 1fr); } }
/* table cells: person (avatar + name + sub line), badges, right-aligned actions */
.custom-table .cell-person { display: flex; align-items: center; gap: 10px; }
.custom-table .cell-main { font-weight: 600; }
.custom-table .cell-sub { font-size: 12px; color: var(--text-muted); }
.custom-table .cell-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.custom-table .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.custom-table .action-btn { padding: 5px 12px; font-size: 12px; }
.custom-table .icon-btn { width: 32px; height: 32px; display: inline-flex; font-size: 14px; }
.custom-table td.text-right, .custom-table th.text-right { text-align: right; }
.custom-table .status-pill { cursor: default; }
/* empty list message inside a panel or table wrapper */
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 13px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
/* the compat chevron sits in the right padding; the contract's own 12px padding hid the text under it */
.filter-select, .form-select { padding-right: 32px; }
/* Tailwind's .hidden loads before the contract: these contract components set display themselves */
.filter-toolbar.hidden, .filter-group.hidden, .form-group.hidden, .filter-select.hidden, .filter-input.hidden, .panel-card.hidden { display: none; }
.custom-table .cell-person, .custom-table .cell-main { white-space: nowrap; }
/* search box grows, selects keep their size; everything stacks on a phone */
.filter-toolbar .filter-input { flex: 1 1 240px; min-width: 200px; }
.filter-toolbar .filter-group { flex: 1 1 auto; }
.form-input[type="file"] { padding: 8px 12px; }
.form-group .invalid-feedback { font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-grid-2 .form-span-2 { grid-column: 1 / -1; }
.form-row { display: flex; align-items: center; gap: 8px; }
.form-row .form-input, .form-row .form-select { flex: 1; min-width: 0; }
.chip-remove { background: transparent; border: 0; color: inherit; cursor: pointer; padding: 0; margin-left: 2px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; }
.chip-remove:hover { background: rgba(255, 255, 255, 0.12); }
.page-actions-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .filter-toolbar .filter-group { width: 100%; }
  .filter-toolbar .filter-input, .filter-toolbar .filter-select { width: 100%; flex: 1 1 100%; min-width: 0; }
  .header-right .action-btn { padding: 8px 12px; font-size: 12px; }
  .form-actions { justify-content: stretch; }
  .form-actions .action-btn { flex: 1 1 auto; justify-content: center; }
}
/* ==========================================================================
   Phase 2.0 legacy compatibility - D4 (Sept screens: Masters, Configurator,
   Board, Report Builder, Notification Rules). Tokens only.
   ========================================================================== */
/* Tailwind's .hidden (display:none) loses to the contract's display rules on buttons, pills,
   form groups and panels that are toggled by the Sept pages' own scripts; no view uses "hidden md:block" */
.hidden { display: none !important; }
/* a chobe-v2 overlay holds a .modal-dialog that Bootstrap's own .modal-dialog rule makes unclickable */
.modal-overlay .modal-dialog { pointer-events: auto; margin: 0; }
/* the legacy "select { padding-right: 32px }" rule above loses to .filter-select's own padding, so the chevron overlapped the text */
.filter-select { padding-right: 32px; }

/* ==========================================================================
   Phase 2.1 - A (Master Configurator: Masters tab, Versions drawer, Audit tab)
   Tokens only. The page-local helpers live in the views; these are the few
   shell-level rules the pages share.
   ========================================================================== */
/* a chobe-v2 .drawer-overlay sits above the shell header and below the page's modals */
.drawer-overlay { z-index: 1090; }
.drawer-overlay.active { display: block; }
/* the versions drawer must scroll on its own on a phone */
.drawer { max-width: 100vw; }
.drawer .drawer-body { -webkit-overflow-scrolling: touch; }
/* a table cell that holds a wrapped rule or change text keeps the row readable */
.custom-table td.cfg-rule, .custom-table td.au-change { white-space: normal; }
@media (max-width: 1024px) {
  /* the configurator rail stacks above the fields panel (contract: one column) with a 16px gutter */
  .builder-container { gap: 16px; }
}

/* Phase 2.1 - C */
/* Masters data entry (screens/masters.php + masters/records.php): the rail, the generated table, the record and import modals. Tokens only. */
.master-list-sidebar a.master-item-btn { text-decoration: none; gap: 10px; }
.builder-container > .master-records { min-width: 0; }
.mrc-rail-title { padding: 0 0 2px; }
.mrc-rail-title + .mrc-rail-title, .master-item-btn + .mrc-rail-title { padding-top: 10px; }
.mrc-rail-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mrc-rail-name { font-weight: 700; color: inherit; }
.mrc-rail-meta { font-size: 11px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.field-type-badge.mrc-badge-config { background: var(--primary-light); color: var(--accent); }
.field-type-badge.mrc-badge-muted { background: var(--bg-card-hover); color: var(--text-muted); }
.mrc-panel { min-width: 0; }
.mrc-head { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.mrc-head .panel-title-box { gap: 4px; min-width: 0; }
.mrc-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mrc-toolbar { justify-content: flex-end; }
.mrc-toolbar .filter-input { min-width: 220px; }
.mrc-unique { color: var(--primary); font-size: 10px; vertical-align: middle; }
.mrc-required { color: var(--status-escalated); }
.mrc-phase1 { font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; }
.mrc-phase1:hover { color: var(--primary); text-decoration: underline; }
a.mrc-project { text-decoration: none; cursor: pointer; }
.mrc-note { color: var(--text-muted); font-size: 12.5px; }
.mrc-help { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.mrc-muted-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); background: var(--bg-card-hover); border-radius: 6px; padding: 2px 6px; margin-left: 4px; vertical-align: middle; }
.mrc-table th .mrc-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.mrc-table th .mrc-sort:hover, .mrc-table th .mrc-sort.active { color: var(--text-main); }
.mrc-table th .mrc-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.mrc-sort-dir { font-size: 9px; color: var(--primary); min-width: 9px; }
.mrc-table td.mrc-num { font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.mrc-table td.mrc-multi { white-space: normal; min-width: 12rem; max-width: 22rem; }
.mrc-table .mrc-inactive-col { color: var(--text-muted); }
.mrc-table tr.mrc-row-inactive td { color: var(--text-muted); }
.mrc-ref { color: var(--primary); font-weight: 600; text-decoration: none; }
.mrc-ref:hover { color: var(--primary); text-decoration: underline; }
.mrc-row-actions { display: flex; justify-content: flex-end; gap: 14px; white-space: nowrap; }
.mrc-row-actions .ma-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer; color: var(--primary); }
.mrc-row-actions .ma-link:hover { color: var(--primary); }
.mrc-row-actions .ma-link.ma-muted { color: var(--text-muted); }
.mrc-row-actions .ma-link.ma-muted:hover { color: var(--text-main); }
.mrc-row-actions .ma-link.ma-danger { color: var(--status-escalated); }
.mrc-row-actions .ma-link.ma-danger:hover { color: var(--status-escalated); }
.mrc-row-actions .ma-link.ma-success { color: var(--status-completed); }
.mrc-row-actions .ma-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.mrc-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mrc-pager-btns { display: flex; align-items: center; gap: 12px; }
.action-btn.mrc-small { padding: 6px 12px; font-size: 12px; }
.action-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.modal-overlay.mrc-modal { z-index: 1100; }
.modal-overlay.wrapModal.mrc-modal:not(.hidden) { display: flex; opacity: 1; }
.mrc-dialog { max-height: 92vh; }
.mrc-dialog.mrc-wide { width: 980px; }
.mrc-dialog .modal-header .panel-title-box { min-width: 0; }
.mrc-body { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; }
.mrc-body .form-input.is-invalid, .mrc-body .form-select.is-invalid, .mrc-body .mrc-checklist.is-invalid { border-color: var(--status-escalated); }
.mrc-body .is-invalid ~ .invalid-feedback { display: block; font-size: 12px; }
.mrc-checklist { border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 8px 12px; background: var(--bg-input); }
.mrc-check-options { max-height: 12rem; overflow-y: auto; overscroll-behavior: contain; }
.mrc-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-main); padding: 4px 0; margin: 0; cursor: pointer; overflow-wrap: anywhere; }
.mrc-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.mrc-check-filter { width: 100%; padding: 6px 10px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13px; background: var(--bg-card); color: var(--text-main); }
.mrc-relations { border-top: 1px solid var(--border-color); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.mrc-import-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.mrc-import-row .mrc-grow { flex: 1 1 320px; }
.mrc-ok { color: var(--status-completed); font-weight: 600; }
.mrc-upd { color: var(--status-pending); font-weight: 600; }
.mrc-err { color: var(--status-escalated); font-weight: 600; }
.mrc-table td.mrc-cell-err { color: var(--status-escalated); }
.mrc-table td.mrc-errors { white-space: normal; max-width: 22rem; color: var(--status-escalated); font-size: 12.5px; }
@media (max-width: 900px) {
  .mrc-head, .mrc-head .panel-title-box, .mrc-toolbar { width: 100%; }
  .mrc-toolbar { justify-content: flex-start; }
  .mrc-toolbar .filter-input, .mrc-toolbar .filter-select { flex: 1 1 100%; min-width: 0; width: 100%; }
  .mrc-pager { justify-content: center; }
}

/* Phase 2.1 - D */
/* Projects screen (Master Document screen 5): list rows, project page header, statuses editor, inline notices. Tokens only. */
.p2-note { font-size: 12.5px; color: var(--text-muted); margin: -8px 0 16px; }
.p2-notice { display: block; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); font-size: 13px; margin-bottom: 16px; }
.p2-notice.is-error { border-color: var(--status-escalated); color: var(--status-escalated); }
.p2-notice.is-success { border-color: var(--status-completed); color: var(--status-completed); }
.p2-notice[hidden] { display: none; }
.projects-table .project-row { cursor: pointer; }
.projects-table .project-name { font-weight: 700; font-size: 14px; color: var(--text-main); text-decoration: none; }
.projects-table .project-name:hover { color: var(--primary); }
.projects-table .project-code { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.projects-table .project-lifecycle { font-size: 12px; color: var(--text-muted); }
.projects-table .project-open { padding: 4px 10px; font-size: 12px; }
.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.project-head .project-back { color: var(--text-muted); font-size: 12px; text-decoration: none; }
.project-head .project-back:hover { color: var(--text-main); }
.project-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; color: var(--text-main); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 0; }
.project-head p { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.project-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.project-head .ctx-pill { font-size: 11px; font-weight: 600; letter-spacing: 0.3px; padding: 3px 8px; border-radius: 6px; background: var(--primary-light); color: var(--text-main); border: 1px solid var(--border-highlight); }
.project-tabs a.task-tab-btn { text-decoration: none; display: inline-block; }
.project-tabs { flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--text-main); }
.status-editor .field-row-card { flex-wrap: wrap; }
.status-editor .field-info { flex-wrap: wrap; }
.status-editor .status-name { padding: 6px 10px; width: 220px; }
.status-editor .status-colour { padding: 4px 8px; font-size: 12px; }
.status-editor .status-flags { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.status-editor .status-flags input { accent-color: var(--primary); }
.status-editor .status-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status-editor .status-actions .action-btn { padding: 4px 10px; }
.status-editor .field-row-card.is-inactive { opacity: 0.55; }
.status-editor .step-number { width: 24px; height: 24px; font-size: 11px; flex: none; }
.hierarchy-canvas.project-chain { min-height: 220px; }
.hierarchy-canvas.project-chain .hierarchy-flow { flex-wrap: wrap; justify-content: center; row-gap: 24px; }
.hierarchy-canvas.project-chain .flow-arrow::after { content: 'then'; }
.hierarchy-canvas.project-chain .flow-node .nav-badge { margin-top: 8px; display: inline-block; }
.hierarchy-canvas.project-chain .flow-node.is-unit { border-color: var(--accent); }
.team-table .field-type-badge.is-client { background: var(--bg-card-hover); color: var(--secondary); }
@media (max-width: 900px) {
  .kv { grid-template-columns: 110px 1fr; }
  .project-head h2 { font-size: 18px; }
  .status-editor .status-name { width: 100%; }
  .hierarchy-canvas.project-chain { padding: 20px; }
  .hierarchy-canvas.project-chain .hierarchy-flow { flex-direction: column; gap: 16px; }
}

/* ==========================================================================
   Phase 2.2 - B (Tasks & Activities screen: toolbar, list, pager, selection,
   boards per project, calendar month grid, task panel, modals). Tokens only;
   page-local rules live in app/Views/work/tasks/index.php.
   ========================================================================== */
.wt-muted { color: var(--text-muted); }
.wt-dim { color: var(--text-dim); }
.wt-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wt-title { font-weight: 600; color: var(--text-main); overflow-wrap: anywhere; }
.wt-hint { font-size: 12px; color: var(--text-muted); margin: 0; }
.wt-project { font-weight: 700; font-size: 12px; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.wt-who { display: inline-flex; align-items: center; gap: 8px; }
.wt-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.wt-avatar.wt-none { background: var(--bg-card-hover); color: var(--text-dim); }
.wt-overdue { color: var(--status-escalated); font-weight: 700; }
.wt-overdue-tag { font-size: 11px; font-weight: 600; text-transform: lowercase; }
.status-pill.wt-pill-sm { padding: 1px 8px; font-size: 11px; }
.wt-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 13.5px; }
.wt-empty h3 { font-size: 15px; font-weight: 600; color: var(--text-main); margin: 0 0 4px; }
.wt-empty p { margin: 0; }
.wt-progress { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.wt-progress .progress-track { flex: 1; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.wt-progress .progress-fill { height: 100%; background: var(--status-completed); border-radius: 3px; transition: width 0.3s; }
.wt-progress .progress-fill.low { background: var(--status-escalated); }
.wt-progress .progress-fill.mid { background: var(--status-pending); }
.wt-selection { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 12px; border: 1px solid var(--border-highlight); border-radius: var(--radius-md); background: var(--primary-light); color: var(--text-main); font-size: 13px; font-weight: 600; }
.wt-selection.hidden { display: none; }
.wt-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; color: var(--text-muted); }
.wt-pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wt-pager .action-btn.sm { padding: 5px 10px; font-size: 12px; }
.wt-pager .action-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.action-btn.success { background: var(--status-completed); color: white; }
.action-btn.success:hover { background: var(--status-completed); filter: brightness(1.1); }
.form-input.is-invalid, .form-select.is-invalid, .form-textarea.is-invalid { border-color: var(--status-escalated); }
.wt-modal-body .is-invalid ~ .invalid-feedback, .wt-panel-body .is-invalid ~ .invalid-feedback { display: block; font-size: 12px; }
.modal-overlay.wt-modal { z-index: 1200; }
.modal-overlay.wt-modal:not(.hidden) { display: flex; opacity: 1; }
.wt-dialog { max-height: 92vh; display: flex; flex-direction: column; }
.wt-dialog form { display: flex; flex-direction: column; min-height: 0; }
.wt-modal-body { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 640px) {
  .wt-pager { justify-content: center; }
  .wt-table th, .wt-table td { padding: 10px 12px; }
}
/* Phase 2.2 - B: boards per project */
.wt-board { margin-bottom: 26px; }
.wt-board-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.wt-board-note { font-size: 11.5px; color: var(--text-dim); }
.kanban-grid.wt-kanban { display: grid; gap: 18px; align-items: start; overflow-x: auto; padding-bottom: 10px; }
.kanban-column.wt-col { min-width: 230px; max-height: 75vh; }
.wt-col .kanban-cards { min-height: 60px; }
.wt-col.wt-drop-over { outline: 2px dashed var(--primary); outline-offset: -2px; background: var(--primary-light); }
.wt-col.wt-drop-no { outline: 2px dashed var(--status-escalated); outline-offset: -2px; }
.wt-col.wt-col-nodrop .kanban-cards { opacity: .6; cursor: not-allowed; } /* a Cashing-Up board's Pending column takes no drop (R1-8) */
.wt-card[draggable="true"] { cursor: grab; }
.wt-card.wt-dragging { opacity: 0.5; user-select: none; }
.wt-card.is-locked { opacity: 0.75; }
.wt-card .card-title { overflow-wrap: anywhere; }
.wt-card .card-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.wt-card .card-meta { gap: 8px; flex-wrap: wrap; }
.wt-card .card-assignee { min-width: 0; }
.wt-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wt-more { display: block; width: 100%; font-size: 12px; color: var(--text-muted); text-align: center; padding: 8px; border: 1px dashed var(--border-highlight); border-radius: var(--radius-md); background: transparent; cursor: pointer; font-family: inherit; }
.wt-more:hover { color: var(--text-main); border-color: var(--primary); }
/* Phase 2.2 - B: calendar month grid (Monday first) */
.wt-cal .wt-cal-head { flex-wrap: wrap; gap: 12px; }
.wt-cal-nav .toggle-btn { min-width: 36px; justify-content: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 6px 4px; text-align: center; }
.cal-cell { min-height: 96px; min-width: 0; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.other { opacity: 0.45; }
.cal-cell.today { border-color: var(--primary); }
.cal-cell .d { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-cell.today .d { color: var(--primary); }
.status-pill.cal-chip { display: flex; width: 100%; min-width: 0; padding: 2px 6px; border-radius: var(--radius-sm); font-size: 11px; text-transform: none; text-align: left; font-family: inherit; }
.status-pill.cal-chip .status-dot { flex: none; }
.status-pill.cal-chip.is-overdue { box-shadow: inset 0 0 0 1px var(--status-escalated); }
.cal-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-more { font-size: 11px; font-weight: 600; color: var(--text-muted); background: none; border: 0; text-align: left; padding: 0 4px; cursor: pointer; font-family: inherit; }
.cal-more:hover { color: var(--text-main); }
.cal-grid > .wt-empty { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .cal-grid { gap: 3px; }
  .cal-dow { font-size: 10px; padding: 4px 0; }
  .cal-cell { min-height: 64px; padding: 4px; gap: 2px; border-radius: var(--radius-sm); }
  .cal-cell .d { font-size: 11px; }
  .status-pill.cal-chip { font-size: 10px; padding: 1px 4px; gap: 3px; }
  .status-pill.cal-chip .status-dot { width: 4px; height: 4px; }
  .cal-more { font-size: 10px; }
}
/* Phase 2.2 - B: the task panel (the Sept board's drawer pattern) */
.drawer-overlay.wt-panel-wrap { z-index: 1100; }
.drawer-overlay.wt-panel-wrap:not(.hidden) { display: flex; opacity: 1; }
.drawer-overlay.wt-panel-wrap:not(.hidden) .drawer { transform: translateX(0); }
.wt-backdrop { position: absolute; inset: 0; }
.drawer.wt-panel { z-index: 1110; overscroll-behavior: contain; }
.drawer-header.wt-panel-head { align-items: flex-start; gap: 12px; }
.wt-panel-title { font-size: 17px; font-weight: 700; color: var(--text-main); margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.wt-panel-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.wt-panel-body { gap: 16px; }
.wt-panel-box { background: var(--bg-input); padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 12px; }
.wt-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wt-status-pick { display: flex; align-items: center; gap: 8px; }
.wt-status-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.wt-status-select { padding: 4px 28px 4px 8px; font-size: 12px; background-color: var(--bg-card); }
.wt-kv { grid-template-columns: 120px 1fr; }
.wt-kv dd { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.wt-kv dd.wt-desc { display: block; white-space: pre-wrap; }
.wt-inline-input { width: auto; padding: 4px 8px; font-size: 12px; background-color: var(--bg-card); }
.wt-inline-btn { padding: 4px 10px; font-size: 12px; }
.wt-progress-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.wt-progress-pct { font-weight: 700; color: var(--primary); }
.wt-progress-wide .progress-track { background: var(--bg-card); }
.task-tabs.wt-panel-tabs { margin: 0; padding-bottom: 8px; gap: 4px; overflow-x: auto; flex-shrink: 0; }
.task-tabs.wt-panel-tabs .wt-ptab { white-space: nowrap; }
.wt-acts { display: flex; flex-direction: column; gap: 10px; }
.wt-act { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: var(--radius-md); background: var(--bg-input); }
.wt-act.is-done { border-color: var(--status-completed); }
.wt-act-main { min-width: 0; flex: 1; }
.wt-act-name { font-weight: 600; font-size: 13.5px; color: var(--text-main); display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.wt-act.is-done .wt-act-name { color: var(--text-muted); }
.wt-act-no { width: 20px; height: 20px; border-radius: 50%; background: var(--primary-light); color: var(--text-main); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.wt-act-tick { width: 20px; height: 20px; border-radius: 50%; background: var(--status-completed); color: white; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.wt-act-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.wt-chip { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-light); color: var(--text-muted); }
.wt-required { color: var(--status-escalated); }
.wt-form-box { background: var(--bg-input); border: 1px dashed var(--border-highlight); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.wt-form-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.wt-comment { background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 8px; }
.wt-comment.is-query { border-color: var(--status-pending); }
.wt-comment-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; flex-wrap: wrap; }
.wt-comment-head strong { color: var(--text-main); font-weight: 600; }
.wt-comment-body { font-size: 13.5px; color: var(--text-main); white-space: pre-wrap; overflow-wrap: anywhere; }
.wt-att { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-color); font-size: 13.5px; }
.wt-att-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--primary-light); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.wt-att-main { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.wt-att a { color: var(--text-main); font-weight: 600; }
.wt-att a:hover { color: var(--primary); }
.wt-timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.wt-timeline li { position: relative; padding: 0 0 16px 18px; border-left: 2px solid var(--border-light); }
.wt-timeline li:last-child { border-left-color: transparent; }
.wt-timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.wt-timeline li.wt-ev-commented::before, .wt-timeline li.wt-ev-query_raised::before { background: var(--status-pending); }
.wt-timeline li.wt-ev-attached::before, .wt-timeline li.wt-ev-updated::before { background: var(--status-not-started); }
.wt-timeline li.wt-ev-created::before, .wt-timeline li.wt-ev-activity_completed::before, .wt-timeline li.wt-ev-completed::before { background: var(--status-completed); }
.wt-timeline li.wt-ev-locked::before, .wt-timeline li.wt-ev-deleted::before { background: var(--status-escalated); }
.wt-ev-text { font-size: 13.5px; color: var(--text-main); }
.wt-ev-note { font-size: 13px; color: var(--text-muted); background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 6px 10px; margin-top: 6px; white-space: pre-wrap; }
.wt-ev-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.wt-panel-foot { flex-wrap: wrap; justify-content: flex-start; }
.wt-panel-foot .action-btn.success { margin-left: auto; }
.action-btn.wt-danger { color: var(--status-escalated); }
.wt-ref { display: flex; flex-direction: column; gap: 6px; }
.wt-ref .wt-ref-search { font-size: 12.5px; }
#wtActivityFields.hidden { display: none; }
@media (max-width: 640px) {
  .wt-kv { grid-template-columns: 96px 1fr; }
  .wt-act { flex-direction: column; }
  .wt-act-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .wt-panel-foot .action-btn { flex: 1 1 auto; justify-content: center; }
  .wt-panel-foot .action-btn.success { margin-left: 0; flex-basis: 100%; }
}
