/* ══════════════════════════════════════════════
   CMZ CLIENT MANAGER — DESIGN SYSTEM
   Palette: Deep Space Dark + Electric Cyan
   ══════════════════════════════════════════════ */

:root {
  --bg-base:      #0a0d14;
  --bg-surface:   #0f1320;
  --bg-card:      #141929;
  --bg-elevated:  #1a2035;
  --bg-hover:     #1f2740;

  --accent:       #e6e205;
  --accent-dim:   rgba(0, 212, 255, 0.12);
  --accent-glow:  rgba(0, 212, 255, 0.25);
  --accent-2:     #7c6dff;
  --accent-2-dim: rgba(124, 109, 255, 0.12);

  --danger:       #ff4757;
  --danger-dim:   rgba(255, 71, 87, 0.15);
  --success:      #2ed573;
  --success-dim:  rgba(46, 213, 115, 0.15);
  --warning:      #ffa502;
  --warning-dim:  rgba(255, 165, 2, 0.15);

  --text-primary:   #e8eaf6;
  --text-secondary: #7e8bb5;
  --text-muted:     #4a5478;

  --border:       rgba(255,255,255,0.07);
  --border-focus: rgba(0, 212, 255, 0.5);

  --sidebar-w: 240px;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ══════════════════════════════
   SIDEBAR
══════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-icon {
  font-size: 1.75rem;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
  animation: pulse-icon 3s ease-in-out infinite;
}
@keyframes pulse-icon {
  0%,100% { filter: drop-shadow(0 0 6px var(--accent-glow)); }
  50%      { filter: drop-shadow(0 0 14px var(--accent)); }
}
.brand-name { font-size: 1.1rem; font-weight: 800; letter-spacing: 0.08em; color: var(--accent); }
.brand-sub  { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,212,255,0.2);
}
.nav-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  display: none;
}
.nav-badge.visible { display: inline-block; }

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar-version {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ══════════════════════════════
   BUTTONS
══════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.btn-primary:hover {
  background: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
  text-align: center;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-ghost.small { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  transition: all 0.2s;
}
.btn-danger:hover { opacity: 0.85; }

/* ══════════════════════════════
   MOBILE HEADER
══════════════════════════════ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  z-index: 200;
}
.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  padding: 0.25rem;
}
.mobile-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.mobile-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  display: none;
}
.mobile-badge.visible { display: inline-block; }

/* ══════════════════════════════
   MAIN CONTENT
══════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem;
  max-width: 100%;
}

/* ══════════════════════════════
   PAGES
══════════════════════════════ */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}
.page-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--success);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--success-dim);
  border: 1px solid rgba(46,213,115,0.2);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.2; }
}

/* ══════════════════════════════
   DASHBOARD STATS
══════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-total::before   { background: var(--accent); }
.stat-active::before  { background: var(--success); }
.stat-today::before   { background: var(--warning); }
.stat-tomorrow::before{ background: var(--accent-2); }
.stat-ending::before  { background: var(--danger); }
.stat-expired::before { background: var(--text-muted); }

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.75rem;
}
.stat-total .stat-value   { color: var(--accent); }
.stat-active .stat-value  { color: var(--success); }
.stat-today .stat-value   { color: var(--warning); }
.stat-tomorrow .stat-value{ color: var(--accent-2); }
.stat-ending .stat-value  { color: var(--danger); }

.stat-bar {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.stat-total .stat-fill   { background: var(--accent); }
.stat-active .stat-fill  { background: var(--success); }
.stat-today .stat-fill   { background: var(--warning); }
.stat-tomorrow .stat-fill{ background: var(--accent-2); }
.stat-ending .stat-fill  { background: var(--danger); }
.stat-expired .stat-fill { background: var(--text-muted); }

/* ══════════════════════════════
   DASHBOARD BOTTOM
══════════════════════════════ */
.dashboard-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}
.panel-link {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  transition: opacity 0.2s;
}
.panel-link:hover { opacity: 0.7; }

.dash-list { display: flex; flex-direction: column; gap: 0.5rem; }
.dash-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  transition: all 0.2s;
}
.dash-item:hover { border-color: var(--accent); }
.dash-item-name { font-weight: 600; color: var(--text-primary); flex: 1; }
.dash-item-info { color: var(--text-secondary); font-size: 0.72rem; }
.dash-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ══════════════════════════════
   CLIENTS PAGE
══════════════════════════════ */
.clients-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem 0.65rem 2.25rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}
.search-input:focus { outline: none; border-color: var(--border-focus); }
.search-input::placeholder { color: var(--text-muted); }

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.select-filter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.select-filter:focus { outline: none; border-color: var(--border-focus); }
.select-filter option { background: var(--bg-card); }

.clients-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
}

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

/* ── Client Card ── */
.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  transition: all 0.2s;
  cursor: default;
}
.client-card:hover {
  border-color: rgba(0,212,255,0.3);
  box-shadow: 0 4px 20px rgba(0,212,255,0.05);
  transform: translateY(-1px);
}
.client-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}
.client-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dim), var(--accent-2-dim));
  border: 1px solid rgba(0,212,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.client-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.client-card-country {
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.client-status-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.status-active  { background: var(--success-dim); color: var(--success); border: 1px solid rgba(46,213,115,0.2); }
.status-ending  { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,165,2,0.2); }
.status-expired { background: var(--danger-dim);  color: var(--danger);  border: 1px solid rgba(255,71,87,0.2); }

.client-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}
.meta-key { color: var(--text-muted); width: 60px; flex-shrink: 0; }
.meta-val { color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }

.client-days-bar {
  margin-bottom: 1rem;
}
.days-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-family: 'JetBrains Mono', monospace;
}
.progress-track {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease;
}

.client-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.action-btn {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  padding: 0.4rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.action-btn.wa:hover { border-color: var(--success); color: var(--success); background: var(--success-dim); }
.action-btn.del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.action-btn.view:hover { border-color: var(--accent-2); color: var(--accent-2); background: var(--accent-2-dim); }

/* ══════════════════════════════
   ADD/EDIT FORM
══════════════════════════════ */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 760px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.field-group { display: flex; flex-direction: column; gap: 0.4rem; }
.field-group.full-width { grid-column: 1 / -1; }
.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.req { color: var(--accent); }
.computed { color: var(--text-muted); font-weight: 400; }
.field-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.875rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
}
.field-input::placeholder { color: var(--text-muted); }
.field-input[readonly] { color: var(--text-muted); cursor: default; }
.field-textarea {
  resize: vertical;
  min-height: 100px;
}
.field-input option { background: var(--bg-card); }

.followup-preview {
  background: var(--bg-elevated);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.preview-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.preview-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.preview-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}
.preview-chip .chip-label { color: var(--text-muted); margin-right: 0.3rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ══════════════════════════════
   FOLLOW-UP CENTER
══════════════════════════════ */
.date-badge {
  background: var(--accent-dim);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}
.followup-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem;
  width: fit-content;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tab.active { background: var(--accent-dim); color: var(--accent); }
.tab:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }
.tab-count {
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
}
.tab.active .tab-count { background: rgba(0,212,255,0.15); color: var(--accent); }

.followup-list { display: flex; flex-direction: column; gap: 0.75rem; }
.followup-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
}
.followup-item:hover { border-color: rgba(0,212,255,0.2); }
.followup-item.done {
  opacity: 0.4;
  border-color: var(--border);
}
.followup-item.done .fu-name { text-decoration: line-through; }
.fu-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fu-info { flex: 1; }
.fu-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.fu-meta { font-size: 0.72rem; color: var(--text-secondary); display: flex; gap: 0.75rem; flex-wrap: wrap; }
.fu-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.fu-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn-mark-done {
  background: var(--success-dim);
  border: 1px solid rgba(46,213,115,0.2);
  color: var(--success);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-mark-done:hover { background: var(--success); color: #000; }
.btn-mark-done.undo {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-wa-small {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-wa-small:hover { border-color: var(--success); color: var(--success); }

.fu-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.fu-empty-icon { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.4; }
.fu-empty-text { font-size: 0.9rem; }

/* ══════════════════════════════
   REPORTS
══════════════════════════════ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.report-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.report-chart { min-height: 120px; }

.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: flex; align-items: center; gap: 0.75rem; }
.bar-label { font-size: 0.72rem; color: var(--text-secondary); width: 80px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.8s ease; }
.bar-count { font-size: 0.72rem; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); width: 24px; text-align: right; }

.pie-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.pie-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; }
.pie-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pie-name { color: var(--text-secondary); flex: 1; }
.pie-val { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.report-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
th {
  text-align: left;
  padding: 0.6rem 0.875rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.65rem 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-elevated); }
.td-name { color: var(--text-primary); font-weight: 600; }

/* ══════════════════════════════
   MODAL
══════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}
.modal.small-modal { max-width: 400px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.25rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.5rem; }

/* ── Modal detail rows ── */
.detail-section { margin-bottom: 1.25rem; }
.detail-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.detail-item {}
.detail-key {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}
.detail-val {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}
.followup-schedule {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.schedule-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
}
.schedule-item.fu-done { opacity: 0.45; }
.schedule-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.schedule-label { color: var(--text-secondary); flex: 1; }
.schedule-date { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.schedule-status {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* ══════════════════════════════
   TOAST
══════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-size: 0.825rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ══════════════════════════════
   SCROLLBAR
══════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════
   OVERLAY for mobile sidebar
══════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ══════════════════════════════
   RESPONSIVE
══════════════════════════════ */
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    z-index: 150;
    top: 0;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 4.5rem;
  }
  .dashboard-bottom { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .followup-tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 1.35rem; }
}

/* ══════════════════════════════
   UTILITY
══════════════════════════════ */
.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-muted    { color: var(--text-muted); }
.mono          { font-family: 'JetBrains Mono', monospace; }

/* Print */
@media print {
  .sidebar, .mobile-header, .clients-toolbar, .client-card-actions,
  .form-actions, .followup-tabs, .fu-actions, .page-header button { display: none !important; }
  .main-content { margin-left: 0; }
  body { background: #fff; color: #000; }
}
