/* ═══════════════════════════════════════════════════════════
   CLIENT WORK TRACKER — Design System
   ═══════════════════════════════════════════════════════════ */

/* ─── Custom Properties ─── */
:root {
  /* Surfaces */
  --bg-body: #07070d;
  --bg-sidebar: #0c0c16;
  --bg-card: rgba(18, 18, 32, 0.85);
  --bg-card-hover: rgba(26, 26, 48, 0.95);
  --bg-input: rgba(22, 22, 40, 0.7);
  --bg-modal: rgba(14, 14, 26, 0.97);
  --bg-glass: rgba(255, 255, 255, 0.03);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(139, 92, 246, 0.5);

  /* Text */
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-muted: #555570;
  --text-inverse: #07070d;

  /* Accent */
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.25);

  /* Status Colors */
  --status-not-started: #6b7280;
  --status-not-started-bg: rgba(107, 114, 128, 0.15);
  --status-in-progress: #3b82f6;
  --status-in-progress-bg: rgba(59, 130, 246, 0.15);
  --status-review: #f59e0b;
  --status-review-bg: rgba(245, 158, 11, 0.15);
  --status-completed: #10b981;
  --status-completed-bg: rgba(16, 185, 129, 0.15);
  --status-urgent: #ef4444;
  --status-urgent-bg: rgba(239, 68, 68, 0.15);
  --status-halted: #a855f7;
  --status-halted-bg: rgba(168, 85, 247, 0.15);

  /* Layout */
  --sidebar-w: 240px;
  --header-h: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ═══════════════════ SIDEBAR ═══════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--duration) var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.brand-icon {
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 28px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}

.nav-btn:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.nav-btn.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.2);
  color: var(--accent-hover);
}

.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }

/* Filters */
.sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 28px;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}

.filter-chip:hover { background: var(--bg-glass); color: var(--text-primary); }
.filter-chip.active { background: rgba(139,92,246,0.08); color: var(--accent-hover); border-color: rgba(139,92,246,0.15); }

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-all { background: var(--accent); }
.dot-urgent { background: var(--status-urgent); }
.dot-week { background: var(--status-in-progress); }
.dot-overdue { background: #f97316; }

/* Sidebar Stats */
.sidebar-stats {
  margin-top: auto;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
}

.stat-row .stat-label { color: var(--text-muted); }
.stat-row .stat-value { color: var(--text-primary); font-weight: 600; }

/* ═══════════════════ MAIN ═══════════════════ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* Prevent flex stretching past screen width */
}

/* ─── Header ─── */
.header {
  height: var(--header-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(7, 7, 13, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--duration) var(--ease);
}

.search-box:focus-within { border-color: var(--border-focus); }

.search-icon { color: var(--text-muted); font-size: 1.1rem; margin-right: 8px; }

.search-input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 9px 0;
  width: 200px;
  min-width: 0;
  flex: 1;
  outline: none;
}

.search-input::placeholder { color: var(--text-muted); }

/* Primary Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #8b5cf6);
  transform: translateY(-1px);
  box-shadow: 0 0 40px var(--accent-glow);
}

/* ─── Content ─── */
.content {
  flex: 1;
  padding: 24px 32px 40px;
  min-width: 0; /* Prevent flex stretching */
}

/* Views */
.view { display: none; animation: fadeIn 0.35s var(--ease); }
.view.active { display: block; }

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

/* ═══════════════════ TABLE VIEW ═══════════════════ */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 720px; /* Ensure table doesn't squish on mobile */
  border-collapse: collapse;
}

.data-table thead { background: rgba(255,255,255,0.02); }

.data-table th {
  padding: 14px 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 16px 20px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.th-date { width: 12%; }
.th-client { width: 14%; }
.th-title { width: 16%; }
.th-content { width: 26%; }
.th-status { width: 12%; }
.th-deadline { width: 12%; }
.th-actions { width: 8%; text-align: center; }

.td-date {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.table-spacer {
  height: 18px;
  background: transparent;
  pointer-events: none;
}

.table-spacer td {
  height: 18px;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}

.td-client {
  font-weight: 600;
  color: var(--text-primary);
}

.td-client-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.td-title {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-content {
  color: var(--text-secondary);
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-deadline {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.td-deadline.overdue { color: var(--status-urgent); font-weight: 600; }

.td-actions { text-align: center; }

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--duration) var(--ease);
}

.action-btn:hover { background: var(--bg-glass); color: var(--text-primary); }

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.status-badge[data-status="Not Started"] {
  background: var(--status-not-started-bg);
  color: var(--status-not-started);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.status-badge[data-status="In Progress"] {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge[data-status="Review"] {
  background: var(--status-review-bg);
  color: var(--status-review);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge[data-status="Completed"] {
  background: var(--status-completed-bg);
  color: var(--status-completed);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge[data-status="Halted"] {
  background: var(--status-halted-bg);
  color: var(--status-halted);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.status-badge[data-status="Urgent"] {
  background: var(--status-urgent-bg);
  color: var(--status-urgent);
  border: 1px solid rgba(239, 68, 68, 0.2);
  animation: urgentPulse 2s infinite;
}

@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p { font-size: 0.85rem; color: var(--text-muted); }

/* ═══════════════════ KANBAN VIEW ═══════════════════ */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - var(--header-h) - 80px);
}

.kanban-col {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.kanban-col-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-glass);
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 600;
}

.kanban-col-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 80px;
}

.kanban-col-body.drag-over {
  background: rgba(139, 92, 246, 0.05);
  border: 2px dashed rgba(139, 92, 246, 0.3);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.kanban-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.kanban-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-card-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.kanban-card-client {
  font-size: 0.75rem;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.kanban-card-content {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.kanban-card-date.overdue { color: var(--status-urgent); font-weight: 600; }

.kanban-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.kanban-card-avatar .client-logo--sm {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ═══════════════════ CALENDAR VIEW ═══════════════════ */
.calendar-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.cal-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 200px;
}

.cal-nav {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}

.cal-nav:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.cal-today-btn {
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.cal-today-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-day-header {
  padding: 12px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
}

.cal-day {
  min-height: 110px;
  padding: 8px;
  background: var(--bg-card);
  transition: background var(--duration) var(--ease);
  display: flex;
  flex-direction: column;
}

.cal-day:hover { background: var(--bg-card-hover); }

.cal-day.other-month { opacity: 0.35; }

.cal-day.today {
  background: rgba(139, 92, 246, 0.06);
}

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.cal-day.today .cal-day-num {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.cal-event {
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 3px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-event:hover { filter: brightness(1.2); transform: scale(1.02); }

.cal-event[data-status="Not Started"] { background: var(--status-not-started-bg); color: var(--status-not-started); border-left: 3px solid var(--status-not-started); }
.cal-event[data-status="In Progress"] { background: var(--status-in-progress-bg); color: var(--status-in-progress); border-left: 3px solid var(--status-in-progress); }
.cal-event[data-status="Review"] { background: var(--status-review-bg); color: var(--status-review); border-left: 3px solid var(--status-review); }
.cal-event[data-status="Completed"] { background: var(--status-completed-bg); color: var(--status-completed); border-left: 3px solid var(--status-completed); }
.cal-event[data-status="Halted"] { background: var(--status-halted-bg); color: var(--status-halted); border-left: 3px solid var(--status-halted); }
.cal-event[data-status="Urgent"] { background: var(--status-urgent-bg); color: var(--status-urgent); border-left: 3px solid var(--status-urgent); }

.cal-more {
  font-size: 0.66rem;
  color: var(--text-muted);
  padding: 2px 6px;
  cursor: pointer;
}

/* ═══════════════════ CLIENTS VIEW ═══════════════════ */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.client-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.client-avatar-large,
.client-avatar-profile {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}

.client-avatar-large {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.client-avatar-profile {
  width: 88px;
  height: 88px;
  font-size: 1.75rem;
}

.client-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.client-card-projects {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-glass);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.client-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ═══════════════════ CLIENT DETAIL VIEW ═══════════════════ */
.client-detail-header {
  margin-bottom: 32px;
}

.client-profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.client-logo-area {
  flex-shrink: 0;
}

.client-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.client-logo {
  display: block;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-medium);
  background: var(--bg-glass);
}

.client-logo--profile {
  width: 88px;
  height: 88px;
  border-radius: 50%;
}

.client-logo--large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 16px;
}

.client-logo--xs {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.client-logo--sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.client-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.client-logo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-logo-upload,
.btn-logo-remove {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-logo-upload {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-hover);
}

.btn-logo-upload:hover {
  background: rgba(139, 92, 246, 0.25);
}

.btn-logo-remove {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-logo-remove:hover {
  color: var(--status-urgent);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: color var(--duration) var(--ease);
}

.btn-back:hover { color: var(--text-primary); }

.client-page-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.client-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.client-projects-panel,
.client-files-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.client-projects-panel h3,
.client-files-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.client-projects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-project-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.client-project-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.client-project-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.client-project-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ═══════════════════ MODALS ═══════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s var(--ease);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* Detail Modal Header */
.detail-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-status-badge { margin-bottom: 12px; }

.detail-title-display {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.detail-client {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-hover);
  margin-bottom: 6px;
}

/* Tabs */
.detail-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-glass);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.tab-btn {
  flex: 1;
  padding: 9px 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-hover);
}

.tab-panel { display: none; animation: fadeIn 0.25s var(--ease); }
.tab-panel.active { display: block; }

/* Form Fields */
.detail-field {
  margin-bottom: 18px;
}

.detail-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--duration) var(--ease);
}

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

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

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field-select option { background: var(--bg-body); color: var(--text-primary); }

.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Action Buttons */
.detail-actions-bar {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.btn-save {
  flex: 1;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-save:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }

.btn-delete {
  padding: 11px 16px;
  background: var(--status-urgent-bg);
  color: var(--status-urgent);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-delete:hover { background: rgba(239,68,68,0.25); }

/* Notes */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 260px;
  overflow-y: auto;
}

.note-item {
  padding: 12px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  position: relative;
}

.note-item-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

.note-item-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.note-item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.note-item:hover .note-item-delete { opacity: 1; }
.note-item-delete:hover { color: var(--status-urgent); }

.note-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.note-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  resize: none;
  transition: border-color var(--duration) var(--ease);
}

.note-input:focus { border-color: var(--border-focus); }

.btn-add-note {
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.btn-add-note:hover { background: var(--bg-card-hover); }

/* Files — bento + masonry grid */
.attachments-list {
  margin-bottom: 16px;
}

.files-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.files-bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 108px;
  grid-auto-flow: dense;
  gap: 10px;
}

.modal .files-bento-grid,
.client-detail-layout .files-bento-grid {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

@media (min-width: 640px) {
  .files-bento-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 112px;
    gap: 12px;
  }
}

@media (min-width: 1024px) {
  .client-files-panel .files-bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal .files-bento-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.file-tile {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  overflow: hidden;
  min-height: 0;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.file-tile:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.file-tile--loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Bento spans */
.file-tile--bento-sm {
  grid-column: span 1;
  grid-row: span 1;
}

.file-tile--bento-wide {
  grid-column: span 2;
  grid-row: span 1;
}

.file-tile--bento-lg {
  grid-column: span 2;
  grid-row: span 2;
}

@media (max-width: 480px) {
  .file-tile--bento-wide,
  .file-tile--bento-lg {
    grid-column: span 2;
  }

  .file-tile--bento-lg {
    grid-row: span 2;
  }
}

/* Image tiles */
.file-tile--image .file-tile-media {
  display: block;
  position: absolute;
  inset: 0;
  line-height: 0;
}

.file-tile--image .file-tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--ease);
}

.file-tile--image:hover .file-tile-media img {
  transform: scale(1.04);
}

.file-tile-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  z-index: 1;
}

.file-tile-overlay .file-tile-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Document tiles */
.file-tile--doc {
  display: flex;
  flex-direction: column;
  padding: 12px;
  min-height: 108px;
}

.file-tile-doc {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.file-tile-doc:hover .file-tile-name {
  color: var(--accent-hover);
}

.file-tile-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.file-tile--doc .file-tile-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.file-tile-size {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: auto;
}

.file-tile-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration) var(--ease), background var(--duration) var(--ease);
  z-index: 2;
}

.file-tile--doc .file-tile-remove {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.file-tile:hover .file-tile-remove,
.file-tile--doc .file-tile-remove {
  opacity: 1;
}

.file-tile-remove:hover {
  background: var(--status-urgent-bg);
  color: var(--status-urgent);
  border-color: rgba(239, 68, 68, 0.35);
}

.attachment-drop {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  transition: all var(--duration) var(--ease);
  cursor: pointer;
}

.attachment-drop:hover,
.attachment-drop.drag-hover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.05);
}

.drop-icon { font-size: 2rem; margin-bottom: 8px; display: block; }

.drop-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* ═══════════════════ TOAST ═══════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.35s var(--ease), toastOut 0.35s var(--ease) 2.4s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-icon { font-size: 1.1rem; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .kanban-col { flex: 0 0 260px; }
}

@media (max-width: 1024px) {
  .client-detail-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .clients-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-left { flex: 1; min-width: 0; }

  .header-right {
    width: 100%;
    gap: 8px;
    order: 3;
  }

  .search-box {
    display: flex;
    flex: 1;
    min-width: 0;
  }

  .search-input { width: 100%; }

  .content { padding: 16px; }
  .detail-row { grid-template-columns: 1fr; }
  .modal { padding: 24px; width: 95%; }
  .cal-day { min-height: 80px; padding: 4px; }
  .cal-event { font-size: 0.6rem; padding: 2px 4px; }
  .header-title { font-size: 1.1rem; }
  .btn-primary { padding: 8px 12px; font-size: 0.8rem; }
  .kanban-board { padding-bottom: 24px; }
  
  /* Make toast stack nicely */
  .toast-container { right: 16px; bottom: 16px; left: 16px; }
  .toast { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .sidebar { width: 85%; max-width: 300px; }
  .header-subtitle { display: none; }
  .detail-actions-bar { flex-direction: column; }
  .btn-save, .btn-delete { width: 100%; }
  .cal-nav { width: 28px; height: 28px; font-size: 1rem; }
  .cal-title { min-width: 140px; font-size: 1rem; text-align: center; }
  .calendar-header { gap: 8px; }

  .client-page-title { font-size: 1.35rem; }
  .client-card { padding: 18px; }
  .client-avatar-large { width: 52px; height: 52px; font-size: 1.2rem; }
  .client-project-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .note-input-row { flex-direction: column; align-items: stretch; }
  .btn-add-note { width: 100%; }
  .files-bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 96px;
  }
}
