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

:root {
  --gold: #c9a84c;
  --gold-light: #deb65d;
  --gold-dim: #7a6b3d;
  
  /* Gold opacity levels */
  --gold-04: rgba(201, 168, 76, 0.04);
  --gold-06: rgba(201, 168, 76, 0.06);
  --gold-07: rgba(201, 168, 76, 0.07);
  --gold-08: rgba(201, 168, 76, 0.08);
  --gold-09: rgba(201, 168, 76, 0.09);
  --gold-10: rgba(201, 168, 76, 0.1);
  --gold-12: rgba(201, 168, 76, 0.12);
  --gold-17: rgba(201, 168, 76, 0.17);
  --gold-18: rgba(201, 168, 76, 0.18);
  --gold-22: rgba(201, 168, 76, 0.22);
  --gold-24: rgba(201, 168, 76, 0.24);
  --gold-26: rgba(201, 168, 76, 0.26);
  --gold-30: rgba(201, 168, 76, 0.3);
  --gold-38: rgba(201, 168, 76, 0.38);
  --gold-45: rgba(201, 168, 76, 0.45);
  --gold-70: rgba(201, 168, 76, 0.7);
  --gold-90: rgba(201, 168, 76, 0.9);
  
  /* Legacy aliases for compatibility */
  --gold-glow: rgba(201, 168, 76, 0.08);
  --gold-border: rgba(201, 168, 76, 0.2);

  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.04);

  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-tertiary: #999999;

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sidebar-width: 240px;
  --topbar-height: 56px;

  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  background:
    radial-gradient(circle at 100% 0%, rgba(201, 168, 76, 0.04), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(255, 255, 255, 0.02), transparent 42%),
    var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  display: flex;
  min-height: 100vh;
  line-height: 1.45;
  letter-spacing: -0.012em;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.logo {
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--gold-border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.logo-wordmark { font-size: 17px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.03em; }
.logo-sub { font-size: 10px; color: var(--text-tertiary); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.nav { padding: 8px 0; flex: 1; }

.nav-group-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 18px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  margin: 1px 8px;
  border-radius: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}

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

.nav-item.active {
  background: var(--gold-glow);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  box-shadow: inset 0 0 0 1px var(--gold-12), 0 10px 24px rgba(0, 0, 0, 0.22);
}

.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--gold-glow);
  color: var(--gold);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 20px;
  border: 1px solid var(--gold-border);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: default;
  transition: background var(--transition);
}

.user-row:hover { background: var(--bg-hover); }

.user-logo-wrap {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.user-logo {
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.user-info-name { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.user-info-email { font-size: 10px; color: var(--text-tertiary); margin-top: 1px; }

.btn-logout-icon {
  margin-left: auto;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-logout-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.btn-logout-icon svg {
  width: 14px;
  height: 14px;
}

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  flex-shrink: 0;
  gap: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-left { display: flex; flex-direction: column; }
.page-title { font-size: 17px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.03em; }
.page-breadcrumb { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.todo-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.todo-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }

.todo-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: 0.3; pointer-events: none; color: var(--text-tertiary); }

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 12px 7px 32px;
  font-size: 12.5px;
  color: var(--text-primary);
  width: 220px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  font-family: inherit;
  letter-spacing: -0.01em;
}

.search-input:focus { border-color: var(--gold-border); box-shadow: 0 0 0 3px var(--gold-10); background: rgba(255, 255, 255, 0.07); }
.search-input::placeholder { color: var(--text-tertiary); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  color: #000;
  border-color: var(--gold-border);
  box-shadow: 0 8px 20px var(--gold-22);
}
.btn-primary:hover { filter: brightness(1.02); transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Content ── */
.content { padding: 24px; overflow-y: auto; flex: 1; }

/* ── KPI Grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pipeline-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.pipeline-card-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.pipeline-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.pipeline-card-note {
  font-size: 12px;
  color: var(--text-tertiary);
  max-width: 280px;
  text-align: right;
  line-height: 1.5;
}

.pipeline-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pipeline-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}

.pipeline-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.pipeline-stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.pipeline-stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 16px;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-2px); background: rgba(255, 255, 255, 0.06); }

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 60%);
  opacity: 0.28;
}

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--gold-light); }
.trend-warn { color: var(--text-secondary); }
.trend-down { color: var(--text-tertiary); }

/* ── AI Banner ── */
.ai-banner {
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.ai-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--gold-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: ai-pulse 2s ease-in-out infinite;
}

@keyframes ai-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.ai-message { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.ai-message strong { color: var(--text-primary); font-weight: 500; }

.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid;
}

.chip-gold { background: var(--gold-glow); color: var(--gold-light); border-color: var(--gold-border); box-shadow: inset 0 0 0 1px var(--gold-08); }
.chip-green { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border-color: var(--border); }
.chip-amber { background: rgba(201, 168, 76, 0.12); color: var(--gold-light); border-color: var(--gold-border); }
.chip-red { background: rgba(255, 255, 255, 0.04); color: var(--text-tertiary); border-color: var(--border); }
.chip-blue { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); border-color: var(--border); }

/* ── Two-Col Layout ── */
.grid-2col { display: grid; grid-template-columns: 1fr 300px; gap: 16px; margin-bottom: 20px; }

/* ── Card / Panel ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.card-action { font-size: 12px; color: var(--gold-dim); cursor: pointer; transition: color var(--transition); font-weight: 500; }
.card-action:hover { color: var(--gold); }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; }

.table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  transition: background var(--transition);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.05); }
.table tbody tr { cursor: pointer; }

.cell-primary { color: var(--text-primary); font-weight: 500; font-size: 13px; }
.cell-sub { color: var(--text-tertiary); font-size: 11px; margin-top: 1px; }

/* ── Status ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
}

.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.s-active { background: rgba(201, 168, 76, 0.12); color: var(--gold); border-color: var(--gold-border); }
.s-lead { background: rgba(201, 168, 76, 0.1); color: var(--gold); border-color: var(--gold-border); }
.s-pending { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border); }
.s-inactive { background: rgba(255, 255, 255, 0.04); color: var(--text-tertiary); border-color: var(--border); }

/* ── Package Badge ── */
.pkg {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ── Activity Feed ── */
.feed { padding: 4px 0; }

.feed-item {
  display: flex;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), transform var(--transition);
}

.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--bg-hover); transform: translateX(2px); }

.feed-dot-wrap { padding-top: 5px; flex-shrink: 0; }

.feed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
}

.feed-dot.ai { background: var(--gold-glow); border-color: var(--gold); }

.feed-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.feed-text strong { color: var(--text-primary); font-weight: 500; }
.feed-time { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  width: 460px;
  max-width: 92vw;
  transform: scale(0.97) translateY(8px);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

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

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

.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }

.modal-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.modal-body { padding: 20px; }

/* ── In-app document viewer (renders files inside the CRM, no raw URL) ── */
.doc-viewer-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.80);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center;
  padding: 3vh 3vw;
}
.doc-viewer-overlay.open { display: flex; }
.doc-viewer {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  width: 1000px; max-width: 94vw; height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}
.doc-viewer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.doc-viewer-name {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-viewer-close {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text-secondary); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all var(--transition);
}
.doc-viewer-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.doc-viewer-body { flex: 1; position: relative; min-height: 0; background: #111; }
.doc-viewer-body iframe, .doc-viewer-body img { width: 100%; height: 100%; border: 0; display: block; }
.doc-viewer-body img { object-fit: contain; }
.doc-viewer-msg {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
  color: var(--text-tertiary); font-size: 13px;
}
.doc-viewer-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: dvspin 0.8s linear infinite;
}
@keyframes dvspin { to { transform: rotate(360deg); } }
@media (max-width: 768px) {
  .doc-viewer-overlay { padding: 1vh 1vw; }
  .doc-viewer { height: 96vh; max-width: 98vw; }
}

/* ── Sales activity: call tracking, weekly KPIs, commission, reactivation ── */
.track-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.track-datewrap { display: flex; flex-direction: column; gap: 4px; }
.track-datelabel { font-size: 11px; color: var(--text-tertiary); }
.track-date { width: 180px; }
.track-summary { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.track-sum-item { flex: 1; min-width: 90px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.track-sum-val { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.track-sum-lbl { font-size: 11px; color: var(--text-secondary); }

.kpiw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kpiw-card { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--r-md); padding: 14px 16px; }
.kpiw-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpiw-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.kpiw-scope { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.kpiw-valrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 8px 0; }
.kpiw-val { font-size: 24px; font-weight: 700; line-height: 1; }
.kpiw-status { font-size: 11px; font-weight: 600; flex-shrink: 0; }
.kpiw-bar { height: 6px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.kpiw-bar-fill { height: 100%; border-radius: 999px; max-width: 100%; transition: width 0.3s ease; }
.kpiw-band { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; }
.kpiw-note { font-size: 11px; color: var(--text-tertiary); margin-top: 14px; line-height: 1.5; }

.lf-commission { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 14px; background: var(--gold-glow); border: 1px solid var(--gold-border); border-radius: var(--r-sm); }
.lf-commission-label { font-size: 12px; color: var(--text-secondary); }
.lf-commission-val { font-size: 16px; font-weight: 700; color: var(--gold-light); }

.react-bar { background: var(--gold-glow); border: 1px solid var(--gold-border); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 14px; }
.react-bar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.react-bar-icon { color: var(--gold-light); font-size: 14px; line-height: 1; }
.react-bar-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.react-bar-list { display: flex; flex-wrap: wrap; gap: 8px; }
.react-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--text-primary); cursor: pointer; transition: all var(--transition); }
.react-chip:hover { border-color: var(--gold-border); background: var(--bg-hover); }
.react-chip-date { font-size: 10px; color: var(--text-tertiary); }
@media (max-width: 768px) { .kpiw-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Form ── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  letter-spacing: -0.01em;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px var(--gold-09);
  background: rgba(255, 255, 255, 0.07);
}

.form-input::placeholder { color: var(--text-tertiary); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23b9af99' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.form-select option { background: var(--bg-card); }

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ── Settings Page ── */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }

.settings-nav { display: flex; flex-direction: column; gap: 2px; }

.settings-nav-item {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-nav-item.active { background: var(--gold-glow); color: var(--gold); border: 1px solid var(--gold-border); }

.settings-section { display: none; }
.settings-section.active { display: block; }

.settings-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.settings-block-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-block-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.settings-block-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.settings-block-body { padding: 20px; }

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

.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-row:first-child { padding-top: 0; }

.settings-row-label { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.settings-row-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* Toggle */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle input:checked + .toggle-track {
  background: var(--gold);
  border-color: var(--gold);
}

.toggle-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
  pointer-events: none;
}

.toggle input:checked ~ .toggle-thumb {
  background: #000;
  transform: translateX(18px);
}

/* Color Picker Row */
.color-options { display: flex; gap: 8px; }
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.color-swatch.selected { border-color: var(--text-primary); transform: scale(1.1); }

/* ── Full Table Page ── */
.page-table-wrap { flex: 1; overflow-y: auto; }

.full-table { width: 100%; border-collapse: collapse; }
.full-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 18, 20, 0.92);
  position: sticky;
  top: 0;
  z-index: 1;
}

.full-table td {
  padding: 12px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.full-table tbody tr:hover td { background: var(--bg-hover); cursor: pointer; }

/* ── Detail Drawer ── */
.detail-drawer {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-elevated);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.detail-drawer.open { display: flex; }

.drawer-header { padding: 20px; border-bottom: 1px solid var(--border); }

.drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.drawer-name { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; }
.drawer-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.drawer-section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-section:last-child { border-bottom: none; }
.drawer-section-label { font-size: 10px; font-weight: 600; color: var(--text-tertiary); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }

.drawer-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 5px 0; }
.drawer-key { font-size: 12px; color: var(--text-tertiary); }
.drawer-val { font-size: 12px; color: var(--text-secondary); text-align: right; max-width: 180px; }
.drawer-val-link { color: var(--gold-dim); }

.drawer-actions { padding: 16px 20px; display: flex; gap: 8px; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.filter-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-pill:hover { border-color: var(--border-strong); color: var(--text-primary); }
.filter-pill.active { background: var(--gold-glow); color: var(--gold); border-color: var(--gold-border); }

/* ── AI Summaries ── */
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.summary-card:hover { border-color: var(--border-strong); }

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

.summary-body { padding: 16px 18px; }
.summary-text { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--text-primary);
  z-index: 2000;
  transform: translateY(60px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 280px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast-label { font-size: 10px; font-weight: 600; color: var(--gold); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 3px; }

.todo-form-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 130px 140px 120px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.todo-form-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  min-width: 0;
  box-sizing: border-box;
}

.todo-form-stack > .form-input:first-child {
  padding: 12px 12px;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  border-radius: 8px;
}

.todo-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.todo-form-row .form-input {
  flex: 1;
  min-width: 0;
}

.todo-form-row .btn {
  flex-shrink: 0;
}

.todo-form-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 16px;
  min-width: 0;
}

.todo-form-meta-row {
  display: grid;
  grid-template-columns: 130px 1fr 120px 1fr;
  gap: 8px;
  align-items: center;
}

.todo-list-wrap {
  margin: 0 16px 16px 16px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.005));
}

.todo-item {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.todo-item:hover {
  background: rgba(255, 255, 255, 0.035);
  border-bottom-color: var(--border);
}

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

.todo-item.done {
  background: rgba(255, 255, 255, 0.015);
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.todo-item.done .todo-item-sub {
  color: rgba(153, 153, 153, 0.6);
}

.todo-item-checkbox-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.todo-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: transparent;
  transition: all 0.2s ease;
  position: relative;
}

.todo-item input[type="checkbox"]:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.04);
}

.todo-item input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.todo-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  color: #000;
  font-weight: bold;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.todo-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.todo-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.todo-item-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  gap: 6px;
  align-items: center;
}

.todo-priority {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.todo-priority.high {
  background: rgba(255, 59, 48, 0.12);
  color: #ff3b30;
}

.todo-priority.medium {
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
}

.todo-priority.low {
  background: rgba(52, 199, 89, 0.12);
  color: #34c759;
}

.todo-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s ease;
}

.todo-item:hover .todo-meta {
  background: rgba(255, 255, 255, 0.06);
}

.todo-empty {
  padding: 24px 14px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.report-kpi-item {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
}

.report-kpi-item span {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.report-kpi-item strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.audit-list {
  max-height: 320px;
  overflow-y: auto;
}

.audit-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

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

.audit-main {
  font-size: 12px;
  color: var(--text-primary);
}

.audit-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.audit-empty {
  padding: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.report-grid {
  gap: 16px;
  margin-top: 0;
}

/* ── AI Chatbot FAB ── */
.ai-chatbot-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1100;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(125deg, rgba(12, 17, 22, 0.95), rgba(28, 24, 14, 0.95));
  color: #f8f8fb;
  border-radius: 999px;
  min-height: 50px;
  padding: 10px 15px 10px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38), 0 0 0 1px var(--gold-24) inset;
  backdrop-filter: blur(12px) saturate(1.25);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
  overflow: hidden;
}

.ai-chatbot-fab:hover {
  border-color: var(--gold-70);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42), 0 0 0 1px var(--gold-38) inset;
}

.ai-chatbot-fab:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.82);
  outline-offset: 2px;
}

.ai-chatbot-fab__logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 3px;
}

.ai-chatbot-fab__text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ai-chatbot-answer {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}

.ai-chatbot-panel {
  position: fixed;
  right: 22px;
  bottom: 84px;
  width: min(380px, calc(100vw - 28px));
  max-height: 68vh;
  display: none;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid var(--gold-30);
  background:
    radial-gradient(circle at 0% 0%, var(--gold-18), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(120, 188, 255, 0.12), transparent 44%),
    rgba(10, 12, 15, 0.9);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  z-index: 1099;
}

.ai-chatbot-panel.open {
  display: flex;
}

.ai-chatbot-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}

.ai-chatbot-panel__head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chatbot-panel__logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 3px;
}

.ai-chatbot-panel__title {
  color: #f6f5f2;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-chatbot-panel__meta {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-90);
}

.ai-chatbot-panel__close {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-radius: 10px;
  width: 28px;
  height: 28px;
}

.ai-chatbot-panel__messages {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  max-height: 48vh;
}

.ai-chat-msg {
  display: flex;
}

.ai-chat-msg--user {
  justify-content: flex-end;
}

.ai-chat-msg--assistant {
  justify-content: flex-start;
}

.ai-chat-msg__bubble {
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #dddddf;
}

.ai-chat-msg--user .ai-chat-msg__bubble {
  background: linear-gradient(160deg, var(--gold-26), var(--gold-10));
  border-color: var(--gold-45);
  color: #f4f2ec;
}

.ai-chat-msg--typing .ai-chat-msg__bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-90);
  animation: ai-chat-typing 1s infinite ease-in-out;
}

.ai-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-chat-typing {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-2px); opacity: 1; }
}

.ai-chatbot-panel__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.ai-chatbot-panel__input {
  width: 100%;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-primary);
  padding: 9px 10px;
  font-size: 16px;
  outline: none;
}

.ai-chatbot-panel__input:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px var(--gold-08);
}

.ai-chatbot-panel__send {
  min-width: 78px;
  justify-content: center;
}

.ai-chatbot-panel__send:disabled,
.ai-chatbot-panel__input:disabled {
  opacity: 0.65;
}

body.contact-drawer-open .ai-chatbot-fab,
body.contact-drawer-open .ai-chatbot-panel {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ── Performance Mode: No Animations ── */
*, *::before, *::after {
  animation: none !important;
  transition: none !important;
}

.sidebar,
.topbar,
.btn-secondary,
.pipeline-card,
.kpi-card,
.ai-banner,
.card,
.modal,
.settings-block,
.detail-drawer,
.summary-card,
.toast {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.btn-primary:hover,
.kpi-card:hover,
.feed-item:hover,
.color-swatch.selected,
.modal,
.modal-overlay.open .modal,
.toast,
.toast.show {
  transform: none !important;
}

.ai-chatbot-fab,
.ai-chatbot-panel,
.ai-chatbot-panel__input,
.ai-chat-msg__bubble,
.ai-dot {
  transition: all 0.18s ease !important;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2col { grid-template-columns: 1fr; }
  .pipeline-stats { grid-template-columns: 1fr; }
  .pipeline-card-head {
    flex-direction: column;
  }
  .todo-form-row { grid-template-columns: 1fr 1fr; }
  .todo-form-meta-row { grid-template-columns: 1fr 1fr; }
  .report-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar {
    padding: 0 16px;
    gap: 12px;
  }
  
  .page-title {
    font-size: 15px;
  }
  
  .topbar-actions {
    gap: 6px;
  }
  
  .search-wrap {
    display: none;
  }
  
  .kpi-grid { gap: 10px; }
  
  .pipeline-card {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  
  .sidebar {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    max-width: 280px;
    z-index: 999;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
  }
  
  .sidebar.mobile-open {
    display: flex;
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
  }
  
  .sidebar-overlay.mobile-open {
    display: block;
  }
  
  .menu-toggle {
    display: flex;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    order: -1;
  }
  
  .menu-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
  }
  
  .content { padding: 12px; }
  
  .topbar {
    padding: 0 12px;
    gap: 8px;
    height: 52px;
  }
  
  .page-title {
    font-size: 14px;
  }
  
  .page-breadcrumb {
    display: none;
  }
  
  .topbar-left {
    gap: 2px;
  }
  
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    font-size: 12px;
  }
  
  .table th,
  .table td {
    padding: 10px 12px;
    white-space: nowrap;
  }
  
  .page-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .full-table {
    font-size: 11px;
  }
  
  .full-table th,
  .full-table td {
    padding: 8px 10px;
  }
  
  /* Keep the 4 KPI cards 2-up on phones — their content is just a number +
     short label, so a single full-width column made them tall and stretched. */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-card { padding: 12px 14px; }
  .kpi-label { font-size: 11px; }
  .kpi-value { font-size: 24px; }
  .kpi-trend { font-size: 11px; }
  
  .pipeline-card {
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  
  .pipeline-card-head {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }
  
  .pipeline-card-label {
    font-size: 9px;
  }
  
  .pipeline-card-title {
    font-size: 16px;
  }
  
  .pipeline-card-note {
    text-align: left;
    max-width: none;
    font-size: 11px;
  }
  
  .pipeline-stats { grid-template-columns: 1fr; gap: 8px; }
  .pipeline-stat { padding: 12px; }
  .pipeline-stat-label { font-size: 9px; }
  .pipeline-stat-value {
    font-size: 20px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .pipeline-stat-sub { font-size: 11px; }
  
  .ai-banner {
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  
  .ai-banner > div:first-child {
    width: 100%;
  }
  
  .ai-banner .btn {
    width: 100%;
  }
  
  .ai-indicator {
    margin-bottom: 6px;
  }
  
  .ai-message {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 6px;
  }
  
  .todo-btn {
    width: 32px;
    height: 32px;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .todo-form-row { grid-template-columns: 1fr 1fr; }
  .todo-form-main { grid-template-columns: 1fr; }
  .todo-form-meta-row { grid-template-columns: 1fr; }
  .report-kpi-row { grid-template-columns: 1fr; }

  .ai-chatbot-fab {
    right: 14px;
    bottom: 14px;
    min-height: 46px;
    padding: 8px 12px 8px 8px;
  }

  .ai-chatbot-panel {
    right: 8px;
    bottom: 68px;
    width: calc(100vw - 16px);
    max-height: 72vh;
  }

  .ai-chatbot-fab__text {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .content { padding: 10px; }
  
  .topbar {
    padding: 0 10px;
    height: 48px;
  }
  
  .page-title {
    font-size: 13px;
  }
  
  .kpi-grid { gap: 6px; }
  .kpi-card { padding: 10px 12px; }
  .kpi-label { font-size: 10px; }
  .kpi-value { font-size: 20px; }
  
  .pipeline-card {
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  
  .pipeline-card-title {
    font-size: 14px;
  }
  
  .pipeline-stat {
    padding: 10px;
  }

  .pipeline-stat-value {
    font-size: 18px;
    line-height: 1.15;
  }
  
  .ai-banner {
    padding: 8px 10px;
    margin-bottom: 10px;
    gap: 8px;
  }
  
  .btn {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .todo-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}

/* ── AI Sales Agent — Today (Close-style action center) ── */
.agent-card {
  background: linear-gradient(180deg, var(--gold-glow), var(--bg-card));
  border: 1px solid var(--gold-border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.agent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.agent-head-left { display: flex; align-items: center; gap: 12px; }
.agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.agent-name { font-weight: 600; color: var(--text-primary); font-size: 15px; }
.agent-brief { color: var(--text-tertiary); font-size: 13px; margin-top: 2px; }
.agent-head-action { flex-shrink: 0; }
.agent-actions { display: flex; flex-direction: column; gap: 8px; }
.agent-action {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  transition: border-color var(--transition), background var(--transition);
}
.agent-action:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.agent-action-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}
.agent-action--overdue .agent-action-icon { color: #ff3b30; background: rgba(255, 59, 48, 0.1); }
.agent-action--today   .agent-action-icon { color: var(--gold-light); background: var(--gold-glow); }
.agent-action--lead    .agent-action-icon { color: var(--gold); background: var(--gold-glow); }
.agent-action--pending .agent-action-icon { color: var(--text-tertiary); }
.agent-action-body { flex: 1; min-width: 0; }
.agent-action-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-action-sub { color: var(--text-tertiary); font-size: 12px; margin-top: 1px; }
.agent-action-btn { flex-shrink: 0; font-size: 12px; }
.agent-empty { color: var(--text-tertiary); font-size: 13px; padding: 10px 4px; }
.agent-ask { display: flex; gap: 8px; margin-top: 14px; }
.agent-ask-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
}
.agent-ask-input:focus { outline: none; border-color: var(--gold-border); }
.agent-ask-input::placeholder { color: var(--text-tertiary); }

/* ── 7-stage lead board (moved from pipeline.html for the SPA shell) ── */
.lead-pipeline-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-tertiary); background: var(--gold-glow); border: 1px solid var(--gold-border); border-radius: var(--r-sm); padding: 8px 12px; margin: 0 0 14px; }
.lead-board { display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
/* All 7 stages share the width so the whole funnel is visible at once instead
   of a fixed-246px horizontal scroll that hid stages 1–4. Columns shrink to
   fit; the board only scrolls if the viewport is too narrow for the min-width. */
.lead-col { flex: 1 1 0; min-width: 132px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; transition: border-color var(--transition), background var(--transition); }
.lead-col--over { border-color: var(--gold-border); background: var(--gold-glow); }
.lead-col-bar { height: 3px; border-radius: 2px; margin-bottom: 9px; }
.lead-col[data-stage="1"] .lead-col-bar { background: #6b7280; }
.lead-col[data-stage="2"] .lead-col-bar { background: #3b82f6; }
.lead-col[data-stage="3"] .lead-col-bar { background: #22c55e; }
.lead-col[data-stage="4"] .lead-col-bar { background: #f59e0b; }
.lead-col[data-stage="5"] .lead-col-bar { background: #d6409f; }
.lead-col[data-stage="6"] .lead-col-bar { background: var(--gold); }
.lead-col[data-stage="7"] .lead-col-bar { background: #4b5563; }
.lead-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 2px; }
.lead-col-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); line-height: 1.25; }
.lead-col-status { font-size: 10px; color: var(--text-tertiary); }
.lead-col-count { font-size: 11px; min-width: 20px; text-align: center; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,0.05); color: var(--text-tertiary); flex-shrink: 0; }
.lead-col-body { display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.lead-col-empty { color: var(--text-tertiary); font-size: 12px; padding: 12px 4px; text-align: center; }
.lead-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 12px; cursor: grab; transition: border-color var(--transition); }
.lead-card:hover { border-color: var(--border-strong); }
.lead-card--dragging { opacity: 0.5; cursor: grabbing; }
.lead-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.lead-card-row { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }
.lead-card-row a { color: var(--gold); text-decoration: none; }
.lead-card-foot { margin-top: 10px; }
.lead-card-stage { width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 5px 8px; color: var(--text-secondary); font-size: 11px; }
.lead-card-stage:focus { outline: none; border-color: var(--gold-border); }
.lead-card-titlerow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lead-card-badge { font-size: 10px; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,0.06); color: var(--text-tertiary); flex-shrink: 0; }
.lead-card-badge.done { background: var(--gold-glow); color: var(--gold-light); border: 1px solid var(--gold-border); }
/* Phone: stack the 7 stages vertically (scrub top↕bottom) instead of the
   fixed-width left↔right scroll. Each stage becomes a full-width row; the
   per-card stage dropdown handles moving leads (drag is unreliable on touch). */
@media (max-width: 768px) {
  .lead-board { flex-direction: column; overflow-x: visible; gap: 14px; }
  .lead-col { flex: 1 1 auto; max-width: none; width: 100%; }
}

/* per-stage field form (modal) */
.lf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.lf-stagebadge { font-size: 12px; font-weight: 600; color: var(--text-primary); padding: 3px 10px; border-radius: 8px; background: var(--gold-glow); border: 1px solid var(--gold-border); }
.lf-meta { font-size: 12px; color: var(--text-tertiary); }
.lf-comp { margin-left: auto; font-size: 12px; color: var(--gold-light); font-weight: 600; }
.lf-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.lf-row { display: flex; flex-direction: column; gap: 4px; }
.lf-row.lf-wide { grid-column: 1 / -1; }
.lf-label { font-size: 11px; color: var(--text-tertiary); }
.lf-req { color: var(--gold); }
.lf-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
@media (max-width: 600px) { .lf-fields { grid-template-columns: 1fr; } }

/* pipeline conversion-target stats */
.pl-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pl-stat { flex: 1; min-width: 130px; background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--r-sm); padding: 10px 12px; }
/* Reserve 2 lines for the label so cards align whether the name wraps or not. */
.pl-stat-label { font-size: 11px; line-height: 1.3; min-height: 2.6em; color: var(--text-secondary); font-weight: 500; }
/* meter row — gauge bar + % value on one line to keep cards compact */
.pl-stat-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pl-stat-val { font-size: 15px; font-weight: 700; flex-shrink: 0; min-width: 40px; text-align: right; }
.pl-stat-target { font-size: 10px; color: var(--gold-light); margin-top: 5px; letter-spacing: .02em; }
.pl-gauge { flex: 1; height: 6px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.pl-gauge-fill { height: 100%; max-width: 100%; background: var(--gold); border-radius: 999px; transition: width .3s ease; }

/* ── SPA shell ── */
#app-view:empty::after { content: ""; }
.spa-interim { color: var(--text-tertiary); font-size: 14px; padding: 40px; text-align: center; }

@media (max-width: 768px) {
  .agent-card-head { flex-wrap: wrap; }
  .agent-action-title { white-space: normal; }
}

/* ── Lead workspace — conversation/activity timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-empty { color: var(--text-tertiary); font-size: 12px; padding: 8px 2px; }
.timeline-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-icon {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: rgba(255, 255, 255, 0.04); color: var(--text-secondary);
}
.timeline-item--conversation .timeline-icon { color: var(--gold); background: var(--gold-glow); }
.timeline-item--milestone .timeline-icon { color: var(--gold-light); background: var(--gold-glow); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.timeline-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.timeline-date { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }
.timeline-text { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.45; }
.timeline-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.timeline-tag {
  font-size: 10px; padding: 2px 7px; border-radius: 6px;
  background: var(--gold-glow); border: 1px solid var(--gold-border); color: var(--gold-light);
}

/* ── Pipeline board (kanban) ── */
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.pl-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  transition: border-color var(--transition), background var(--transition);
}
.pl-col--over { border-color: var(--gold-border); background: var(--gold-glow); }
.pl-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.pl-col-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.pl-col-count {
  font-size: 11px; min-width: 20px; text-align: center;
  padding: 1px 7px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); color: var(--text-tertiary);
}
.pl-col-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.pl-col-empty { color: var(--text-tertiary); font-size: 12px; padding: 12px 4px; text-align: center; }
.pl-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  cursor: grab;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.pl-card:hover { border-color: var(--border-strong); }
.pl-card--dragging { opacity: 0.5; cursor: grabbing; }
.pl-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.pl-card-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.pl-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.pl-card-progress { font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.pl-card-bar { height: 3px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.pl-card-bar-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.3s; }
.pl-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.pl-card-stage {
  flex: 1; min-width: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 5px 8px;
  color: var(--text-secondary); font-size: 11px;
}
.pl-card-stage:focus { outline: none; border-color: var(--gold-border); }
.pl-card-edit { font-size: 11px; padding: 4px 10px; flex-shrink: 0; }
@media (max-width: 900px) {
  .pipeline-board { grid-template-columns: 1fr; }
}

/* ── Settings (preferences editor) ── */
.set-wrap { max-width: 860px; padding-bottom: 80px; }
.set-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 20px 22px; margin-bottom: 18px;
}
.set-card-title {
  font-size: 14px; font-weight: 600; color: var(--gold);
  margin: 0 0 4px; letter-spacing: .01em;
}
.set-note { font-size: 12px; color: var(--text-tertiary); margin-bottom: 14px; }
.set-rows { display: flex; flex-direction: column; gap: 14px; }
.set-row {
  display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start;
}
.set-label {
  font-size: 13px; color: var(--text-secondary); padding-top: 8px;
  word-break: break-word;
}
.set-control { min-width: 0; }
.set-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 8px 11px;
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.set-input:focus { outline: none; border-color: var(--gold-border); }
.set-input--mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
textarea.set-input { resize: vertical; line-height: 1.5; }
.set-color { display: flex; gap: 10px; align-items: center; }
.set-swatch {
  width: 42px; height: 36px; padding: 0; border: 1px solid var(--border);
  border-radius: var(--r-xs); background: transparent; cursor: pointer; flex-shrink: 0;
}
.set-color .set-input { flex: 1; }
.set-savebar {
  position: fixed; left: var(--sidebar-width); right: 0; bottom: 0;
  display: none; align-items: center; justify-content: flex-end; gap: 16px;
  padding: 12px 28px; background: var(--bg-elevated);
  border-top: 1px solid var(--border-strong); z-index: 40;
}
.set-savebar--show { display: flex; }
.set-savebar-msg { font-size: 12px; color: var(--gold-light); }
@media (max-width: 768px) {
  .set-row { grid-template-columns: 1fr; gap: 5px; }
  .set-label { padding-top: 0; }
  .set-savebar { left: 0; }
}
