/* === VARIABLES === */
:root {
  --primary: #111827;
  --primary-light: #374151;
  --primary-dark: #000000;
  --adjective-color: #8B6914;
  --adjective-bg: #FFE9CF;
  --jameson-color: #2D7A2D;
  --jameson-bg: #CCFFCC;
  --waldo-color: #3D3DA0;
  --waldo-bg: #CCCCFF;
  --both-color: #6B21A8;
  --both-bg: #F3E8FF;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --yellow-500: #eab308;
  --orange-500: #f97316;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --bottom-nav-height: 64px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Roboto Mono', monospace;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }
table { border-collapse: collapse; width: 100%; }

/* === SIDEBAR === */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: white;
  z-index: 100;
  display: flex; flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-700);
}
.logo { font-size: 18px; font-weight: 700; }
.sidebar-nav { padding: 8px 0; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--gray-400);
  font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover { color: white; background: var(--gray-800); }
.nav-item.active { color: var(--gray-900); background: white; }
.nav-item svg { flex-shrink: 0; }
.nav-divider { border: none; border-top: 1px solid var(--gray-700); margin: 8px 0; }

/* === TOP BAR === */
.top-bar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
}
.hamburger {
  display: none;
  background: none; border: none; color: var(--gray-600);
  padding: 4px;
}
.page-title { font-size: 18px; font-weight: 600; flex: 1; }
.site-filter { flex-shrink: 0; }
.site-select {
  padding: 6px 12px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px;
  background: white; color: var(--gray-700);
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}
.page-content { padding: 24px; }

/* === BOTTOM NAV (mobile) === */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid var(--gray-200);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 11px; color: var(--gray-500);
  padding: 6px 8px; min-width: 56px;
}
.bottom-nav-item.active { color: var(--gray-900); }
.bottom-nav-item svg { width: 20px; height: 20px; }

/* === CARDS === */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* === SITE BADGES === */
.site-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.site-adjective { background: var(--adjective-bg); color: var(--adjective-color); }
.site-jameson { background: var(--jameson-bg); color: var(--jameson-color); }
.site-waldo { background: var(--waldo-bg); color: var(--waldo-color); }
.site-both { background: var(--both-bg); color: var(--both-color); }
select.site-select-adjective { background-color: var(--adjective-bg); color: var(--adjective-color); border-color: var(--adjective-color); font-weight: 500; }
select.site-select-jameson  { background-color: var(--jameson-bg);  color: var(--jameson-color);  border-color: var(--jameson-color);  font-weight: 500; }
select.site-select-waldo    { background-color: var(--waldo-bg);    color: var(--waldo-color);    border-color: var(--waldo-color);    font-weight: 500; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--red-500); color: white; }
.btn-danger:hover { background: var(--red-600); }
.btn-success { background: var(--green-500); color: white; }
.btn-success:hover { background: var(--green-600); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-icon { padding: 6px; border-radius: 6px; background: none; border: none; color: var(--gray-500); }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 14px; color: var(--gray-800);
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; }
.form-check label { font-size: 14px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* === TABLE === */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 12px;
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer; white-space: nowrap;
  user-select: none;
}
.data-table th:hover { color: var(--gray-700); }
.data-table th.sorted { color: var(--gray-900); }
.data-table td {
  padding: 10px 12px; font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-table tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--gray-50); }

.data-table .site-border-adjective { border-left: 3px solid var(--adjective-color); }
.data-table .site-border-jameson { border-left: 3px solid var(--jameson-color); }
.data-table .site-border-waldo { border-left: 3px solid var(--waldo-color); }

/* === FILTERS BAR === */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 16px;
}
.pagination-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; margin-top: 8px;
  border-top: 1px solid var(--gray-200);
}
.inline-select {
  border: 1px solid transparent; border-radius: 4px; padding: 2px 6px;
  font-size: inherit; font-family: inherit; background: transparent;
  cursor: pointer; color: inherit; max-width: 100%;
}
.inline-select:hover { border-color: var(--gray-300); background: var(--gray-50); }
.inline-select:focus { border-color: var(--primary); outline: none; background: white; }
.filters-bar .form-input, .filters-bar .form-select {
  width: auto; min-width: 150px;
}
.search-input {
  flex: 1; min-width: 200px; max-width: 400px;
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* === STATS CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: white; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.stat-card .stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* === KANBAN === */
.kanban-wrapper { overflow-x: auto; padding-bottom: 16px; }
.kanban-board {
  display: flex; gap: 12px;
}
.kanban-column {
  flex: 1 1 260px; min-width: 260px;
  background: var(--gray-100);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 200px);
}
.kanban-column-header {
  padding: 12px; font-size: 13px; font-weight: 600;
  color: var(--gray-600); text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-300);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--gray-100);
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 1;
}
.kanban-column-header .count {
  background: var(--gray-300); color: var(--gray-600);
  font-size: 12px; padding: 1px 6px; border-radius: 10px;
}
.kanban-column-header .value { font-size: 12px; color: var(--gray-500); font-weight: 400; }
.kanban-cards {
  padding: 8px; flex: 1; overflow-y: auto;
  min-height: 60px;
}
.kanban-card {
  background: white; border-radius: 6px;
  padding: 12px; margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: grab;
  border-left: 4px solid var(--gray-300);
  transition: box-shadow 0.15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card.site-adjective-border { border-left-color: var(--adjective-color); }
.kanban-card.site-jameson-border { border-left-color: var(--jameson-color); }
.kanban-card.site-waldo-border { border-left-color: var(--waldo-color); }
.kanban-card .card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.kanban-card .card-account { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.kanban-card .card-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--gray-500);
}
.kanban-card .card-value { font-weight: 600; color: var(--gray-700); }
.kanban-card .card-days { color: var(--orange-500); }
.kanban-card .card-days.overdue { color: var(--red-500); font-weight: 600; }
.kanban-card .card-badges {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px;
}
.job-type-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--gray-100); color: var(--gray-600);
  font-weight: 500;
}
.status-select {
  font-size: 12px; font-weight: 500; padding: 2px 6px;
  border-radius: 4px; border: 1px solid transparent;
  cursor: pointer; font-family: inherit; outline: none;
  -webkit-appearance: none; appearance: none;
}
.status-select.status-active  { background: #dcfce7; color: #166534; border-color: #86efac; }
.status-select.status-prospect { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.status-select.status-lead     { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.status-select.status-inactive { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-300); }
.kanban-column.drag-over { background: var(--gray-200); }
.kanban-column.drag-over .kanban-cards { background: rgba(0,0,0,0.03); }

/* === PIPELINE OVERVIEW === */
.pipeline-section { margin-bottom: 24px; }
.pipeline-section h4 {
  font-size: 14px; font-weight: 600; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.pipeline-bar {
  display: flex; gap: 2px; height: 32px; border-radius: 4px; overflow: hidden; margin-bottom: 4px;
}
.pipeline-segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: white;
  min-width: 40px; padding: 0 6px;
  white-space: nowrap; overflow: hidden;
}
.pipeline-legend {
  display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px;
  color: var(--gray-500); margin-top: 4px;
}
.pipeline-legend-item { display: flex; align-items: center; gap: 4px; }
.pipeline-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* === TABS === */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--gray-200); margin-bottom: 16px; }
.tab-btn {
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  color: var(--gray-500); background: none; border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--gray-900); border-bottom-color: var(--gray-900); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === ACTIVITY TIMELINE === */
.timeline { padding: 0; }
.timeline-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.timeline-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.timeline-icon.call { background: var(--gray-200); color: var(--gray-700); }
.timeline-icon.meeting { background: #fef3c7; color: #d97706; }
.timeline-icon.email { background: #d1fae5; color: #059669; }
.timeline-icon.sms { background: #ede9fe; color: #7c3aed; }
.timeline-icon.note { background: var(--gray-100); color: var(--gray-500); }
.timeline-icon.other { background: var(--gray-100); color: var(--gray-500); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 2px; gap: 8px;
}
.timeline-subject { font-size: 14px; font-weight: 500; }
.timeline-date { font-size: 12px; color: var(--gray-400); white-space: nowrap; }
.timeline-details { font-size: 13px; color: var(--gray-600); }
.timeline-meta { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* === FOLLOW-UP ITEMS === */
.followup-list { max-height: 400px; overflow-y: auto; }
.followup-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
.followup-item:hover { background: var(--gray-50); cursor: pointer; }
.followup-info { flex: 1; min-width: 0; }
.followup-name { font-size: 14px; font-weight: 500; }
.followup-detail { font-size: 12px; color: var(--gray-500); }
.followup-days {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 4px 8px; border-radius: 4px;
}
.followup-days.urgent { background: #fef2f2; color: var(--red-500); }
.followup-days.warning { background: #fffbeb; color: var(--orange-500); }
.followup-days.info { background: var(--gray-100); color: var(--gray-700); }

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  justify-content: center; align-items: flex-start;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
}
.modal.modal-wide {
  max-width: 900px;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 24px;
  color: var(--gray-400); line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--gray-600); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* === TOAST === */
.toast-container {
  position: fixed; bottom: 80px; right: 16px;
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  color: white; min-width: 250px;
  animation: slideIn 0.3s ease;
}
.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-600); }
.toast.info { background: var(--gray-800); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* === DETAIL VIEW === */
.detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.detail-title { font-size: 24px; font-weight: 700; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.detail-field .field-label { font-size: 12px; color: var(--gray-500); margin-bottom: 2px; }
.detail-field .field-value { font-size: 14px; font-weight: 500; }
.detail-field .field-value a { color: var(--gray-900); text-decoration: underline; }
.detail-field .field-value a:hover { text-decoration: underline; }

/* === BACK LINK === */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; color: var(--gray-500);
  margin-bottom: 12px;
}
.back-link:hover { color: var(--gray-900); }

/* === VIEW TOGGLE === */
.view-toggle {
  display: inline-flex; border: 1px solid var(--gray-300); border-radius: var(--radius);
  overflow: hidden;
}
.view-toggle-btn {
  padding: 6px 12px; font-size: 13px; font-weight: 500;
  background: white; border: none; color: var(--gray-500);
  border-right: 1px solid var(--gray-300);
}
.view-toggle-btn:last-child { border-right: none; }
.view-toggle-btn.active { background: var(--gray-900); color: white; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--gray-400);
}
.empty-state svg { margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-bottom: var(--bottom-nav-height); }
  .bottom-nav { display: flex; }
  .hamburger { display: block; }
  .page-content { padding: 16px; }
  .top-bar { padding: 0 12px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar .form-input, .filters-bar .form-select { width: 100%; min-width: auto; }
  .search-input { max-width: 100%; }
  .detail-info-grid { grid-template-columns: 1fr; }
  .kanban-column { min-width: 200px; }
  .modal { max-width: calc(100% - 32px); }
  .data-table td, .data-table th { padding: 8px; font-size: 13px; }
  .site-select { font-size: 13px; max-width: 160px; }
  .detail-header { flex-direction: column; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1; justify-content: center; }
  .followup-grid { grid-template-columns: 1fr !important; }
  .dashboard-bottom-grid { grid-template-columns: 1fr !important; }
  .tabs { overflow-x: auto; }
  .tab-btn { white-space: nowrap; font-size: 13px; padding: 8px 12px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-column { min-width: 220px; }
}

@media (min-width: 1025px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* === UTILITY === */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.currency::before { content: '$'; }

/* === FILTER PANEL === */
.filter-panel {
  position: fixed; top: 0; right: -440px; width: 420px; height: 100vh;
  background: white; border-left: 2px solid var(--gray-200);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12); z-index: 1000;
  transition: right 0.25s ease; display: flex; flex-direction: column; overflow: hidden;
}
.filter-panel.open { right: 0; }
.filter-panel-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 999;
}
.filter-panel-overlay.open { display: block; }
.filter-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.filter-panel-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.filter-panel-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}
.filter-section { margin-bottom: 20px; }
.filter-section-title {
  font-weight: 600; font-size: 0.75em; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 8px;
}
.filter-row { display: flex; gap: 8px; }
.filter-row .form-select, .filter-row .form-input { flex: 1; min-width: 0; width: auto; }
.filter-radius-row {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
  flex-wrap: wrap;
}
.filter-radius-row .form-select,
.filter-radius-row .form-input { width: auto; min-width: 0; }
.inv-condition-row {
  display: flex; gap: 6px; align-items: center; margin-bottom: 6px;
}
.inv-condition-row .form-select,
.inv-condition-row .form-input { flex: 1; min-width: 0; width: auto; }
.inv-condition-row .btn-icon { flex-shrink: 0; }
.filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 700; min-width: 18px; height: 18px;
  padding: 0 5px; margin-left: 4px; vertical-align: middle;
}
.btn-active { background: var(--gray-100) !important; border-color: var(--gray-600) !important; font-weight: 600; }

/* === INLINE TITLE === */
.task-title-inline {
  width: 100%; box-sizing: border-box;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; padding: 2px 6px; margin: -2px -6px;
  font-size: 1.25rem; font-weight: 600; line-height: 1.4;
  color: var(--gray-900); font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.task-title-inline:hover { border-color: var(--gray-300); background: var(--gray-50); }
.task-title-inline:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px rgba(99,102,241,0.1); }

/* Compact form controls for sidebar */
.form-select-sm, .form-input-sm {
  padding: 4px 8px; font-size: 0.8125rem; height: auto;
}

/* === INLINE DESCRIPTION === */
.task-desc-inline {
  width: 100%; box-sizing: border-box;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; resize: none; overflow: hidden;
  font-family: inherit; font-size: 0.875rem; line-height: 1.6;
  color: var(--gray-700); padding: 4px 6px;
  transition: border-color 0.15s, background 0.15s;
  min-height: 60px;
}
.task-desc-inline:hover { border-color: var(--gray-300); background: var(--gray-50); }
.task-desc-inline:focus {
  outline: none; border-color: var(--primary);
  background: #fff; box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.task-desc-inline::placeholder { color: var(--gray-400); font-style: italic; }

/* === NAV BADGE === */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; border-radius: 10px;
  font-size: 10px; font-weight: 700; min-width: 17px; height: 17px;
  padding: 0 4px; margin-left: auto; line-height: 1;
}
.bottom-nav-item .nav-badge {
  position: absolute; top: 4px; right: 12px;
  margin-left: 0;
}

/* === TASK MANAGEMENT === */

.tasks-page-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.tasks-filters-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.tasks-actions-bar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-filter-check { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; }

.task-board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start;
}
.task-column { background: var(--gray-100); border-radius: var(--radius); min-height: 300px; transition: background 0.15s; }
.task-column.drag-over { background: #dbeafe; }
.task-column-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px; border-radius: var(--radius) var(--radius) 0 0;
  background: white; border-bottom: 1px solid var(--gray-200);
}
.task-column-title { font-weight: 600; font-size: 13px; }
.task-column-count { background: var(--gray-200); color: var(--gray-600); border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.task-column-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.task-card {
  background: white; border-radius: 6px; padding: 10px 12px;
  box-shadow: var(--shadow); cursor: pointer; border: 1px solid var(--gray-200);
  transition: box-shadow 0.15s, transform 0.1s;
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card.dragging { opacity: 0.4; transform: rotate(2deg); }
.task-card-header { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.task-card-title { font-size: 13px; font-weight: 500; line-height: 1.4; margin-bottom: 4px; }
.task-card-due, .task-card-related, .task-card-subtasks { margin-bottom: 4px; }
.task-card-footer { display: flex; align-items: center; justify-content: flex-end; margin-top: 6px; }
.task-add-btn {
  width: 100%; background: none; border: 1px dashed var(--gray-300);
  border-radius: 6px; padding: 8px; color: var(--gray-500); font-size: 12px;
  cursor: pointer; text-align: left; margin-top: 4px; transition: all 0.15s;
}
.task-add-btn:hover { background: var(--gray-200); color: var(--gray-700); }

.priority-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.priority-low { background: var(--gray-200); color: var(--gray-600); }
.priority-medium { background: #dbeafe; color: #1d4ed8; }
.priority-high { background: #ffedd5; color: #c2410c; }
.priority-urgent { background: #fee2e2; color: var(--red-600); }

.task-status-badge {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
}
.status-not-started { background: var(--gray-200); color: var(--gray-700); }
.status-in-progress { background: #dbeafe; color: #1d4ed8; }
.status-on-hold { background: #fef9c3; color: #854d0e; }
.status-completed { background: #dcfce7; color: #15803d; }
.status-archived { background: var(--gray-300); color: var(--gray-600); }

.due-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 2px 6px; border-radius: 4px; }
.due-overdue { background: #fee2e2; color: var(--red-600); font-weight: 700; }
.due-today { background: #fef9c3; color: #854d0e; font-weight: 700; }
.due-soon { background: #dcfce7; color: #15803d; }
.due-future { background: var(--gray-100); color: var(--gray-600); }

.recurring-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #7c3aed; background: #ede9fe; border-radius: 4px; padding: 2px 5px;
}
.series-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 600;
  color: var(--gray-600); background: var(--gray-200); border-radius: 4px; padding: 2px 5px;
}

.related-badge {
  display: inline-flex; align-items: center; font-size: 11px; padding: 2px 6px;
  border-radius: 4px; background: #f0fdf4; color: #166534; cursor: pointer; border: 1px solid #bbf7d0;
}
.related-link { color: var(--primary); text-decoration: underline; cursor: pointer; font-size: 14px; }

.tag-badge {
  display: inline-flex; align-items: center; font-size: 11px; padding: 2px 6px;
  border-radius: 4px; background: var(--gray-200); color: var(--gray-700); margin: 1px;
}

.staff-avatars { display: flex; gap: 2px; align-items: center; }
.staff-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--primary); color: white; font-weight: 700; flex-shrink: 0;
}
.staff-avatar-extra {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--gray-400); color: white; font-weight: 700; flex-shrink: 0;
}

.subtask-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.subtask-item:last-child { border-bottom: none; }
.subtask-check { flex-shrink: 0; }
.subtask-title { font-size: 13px; }
.subtask-done { text-decoration: line-through; color: var(--gray-500); }

.subtask-progress { display: flex; align-items: center; gap: 4px; }
.subtask-progress-bar { flex: 1; height: 4px; background: var(--gray-200); border-radius: 2px; overflow: hidden; }
.subtask-progress-bar div { height: 100%; border-radius: 2px; transition: width 0.3s; }
.subtask-progress span { font-size: 10px; color: var(--gray-500); white-space: nowrap; }

.subtask-progress-bar-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.subtask-progress-bar-track { flex: 1; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.subtask-progress-bar-fill { height: 100%; background: var(--green-500); border-radius: 3px; transition: width 0.3s; }

.task-detail-header {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.task-detail-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.task-detail-title { font-size: 20px; font-weight: 700; flex: 1; }
.task-detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.task-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.task-detail-body { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.task-detail-main { min-width: 0; }
.task-detail-section { margin-bottom: 12px; }
.task-detail-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 3px;
}

.task-dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.task-dash-stat { text-align: center; padding: 8px; border-radius: 6px; background: var(--gray-100); }
.task-dash-stat-primary { background: #dbeafe; }
.task-dash-stat-danger { background: #fee2e2; }
.task-dash-stat-val { font-size: 22px; font-weight: 700; line-height: 1; }
.task-dash-stat-lbl { font-size: 10px; color: var(--gray-500); margin-top: 2px; text-transform: uppercase; }
.task-dash-stat-danger .task-dash-stat-val { color: var(--red-600); }

.task-row-overdue td { background: #fff5f5; }
.view-toggle { display: flex; gap: 2px; }

@media (max-width: 768px) {
  .task-board { grid-template-columns: 1fr; }
  .task-detail-body { grid-template-columns: 1fr; }
  .task-detail-sidebar { order: -1; }
  .task-dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .tasks-page-header { flex-direction: column; align-items: stretch; }
}
