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

:root {
  --bg: #020817;
  --bg-surface: #0a0f1e;
  --bg-raised: #0f1629;
  --border: #1e2d45;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-secondary: #8ba4c0;
  --text-label: #7a95b8;
  --brand: #0d9488;
  --brand-light: #2dd4bf;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #60a5fa;
  --purple: #c4b5fd;
  --green: #4ade80;
}

body { background: var(--bg); color: var(--text-muted); font-family: system-ui, -apple-system, sans-serif; font-size: 13px; }

/* ── Login ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 40px; width: 360px; }
.login-logo { font-size: 18px; font-weight: 700; color: var(--brand-light); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-label); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.field input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; color: var(--text); font-size: 13px; outline: none; }
.field input:focus { border-color: var(--brand); }
.error-msg { color: var(--red); font-size: 12px; margin-bottom: 12px; }
.btn { padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover:not(:disabled) { background: #0f766e; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-full { width: 100%; }
.btn-link { background: none; border: none; color: var(--text-label); font-size: 11px; cursor: pointer; padding: 0; }
.btn-link:hover { color: var(--text); }

/* ── Shell ── */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar { width: 200px; flex-shrink: 0; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 0; }
.sidebar-logo { padding: 0 16px 20px; font-size: 14px; font-weight: 700; color: var(--brand-light); letter-spacing: 0.05em; text-transform: uppercase; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.nav-section { padding: 8px 0; }
.nav-label { padding: 4px 16px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-label); margin-bottom: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--text-secondary); font-size: 12px; border-left: 2px solid transparent; text-decoration: none; }
.nav-item:hover { color: var(--text); background: #ffffff08; }
.nav-item.active { color: var(--text); background: #0f766e18; border-left-color: var(--brand-light); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--red); color: white; font-size: 9px; font-weight: 700; border-radius: 99px; padding: 1px 5px; }
.nav-badge-teal { background: var(--brand) !important; }
.sidebar-footer { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 11px; color: #4a6080; display: flex; flex-direction: column; gap: 4px; }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 52px; flex-shrink: 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.content { flex: 1; overflow-y: auto; padding: 24px; }
.loading { color: var(--text-label); padding: 40px; text-align: center; }

/* ── Stats bar ── */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.stat-card.alert { border-color: #ef444450; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-label); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.stat-value.red { color: var(--red); }
.stat-sub { font-size: 11px; color: #a0b8d0; }

/* ── Filters ── */
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn { padding: 5px 12px; border-radius: 99px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer; }
.filter-btn.active { background: var(--brand); color: white; border-color: var(--brand); }
.search-input { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; color: var(--text); font-size: 12px; width: 200px; outline: none; }
.search-input::placeholder { color: #4a6080; }

/* ── Table ── */
.table-wrap { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.table-header { padding: 10px 16px; background: #07091a; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-label); border-bottom: 1px solid var(--border); display: grid; }
.table-row { padding: 12px 16px; border-bottom: 1px solid #111827; display: grid; align-items: center; }
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: #0f1a2e; }
.biz-name { font-weight: 600; color: var(--text); font-size: 13px; }
.biz-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.due-overdue { color: var(--red); font-weight: 600; font-size: 12px; }
.due-today { color: var(--amber); font-weight: 600; font-size: 12px; }
.due-future { color: var(--text-secondary); font-size: 12px; }
.demo-yes { color: var(--brand-light); font-size: 11px; font-weight: 500; }
.demo-no { color: var(--red); font-size: 11px; font-weight: 500; }
.method-tag { font-size: 11px; color: var(--text-secondary); }
.row-actions { display: flex; align-items: center; gap: 6px; }
.action-btn { font-size: 10px; font-weight: 600; color: var(--brand-light); background: transparent; border: 1px solid #0d948850; border-radius: 4px; padding: 3px 8px; cursor: pointer; }
.action-btn:hover { background: #0d948820; }

/* ── Status pills ── */
.status-pill, .stage-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 10px; font-weight: 600; }
.pip { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.s-not-contacted { color: var(--text-secondary); background: #1e2d4560; }
.s-demo-built, .s-demo-sent { color: var(--blue); background: #3b82f620; }
.s-follow-up { color: var(--amber); background: #f59e0b20; }
.s-interested { color: var(--purple); background: #a78bfa20; }
.s-signed { color: var(--green); background: #22c55e20; }
.s-dead { color: #64748b; background: #1e2d4560; }
.st-intake, .st-build { color: var(--blue); background: #3b82f620; }
.st-review { color: var(--amber); background: #f59e0b20; }
.st-revision-1, .st-revision-2, .st-revision-3 { color: var(--purple); background: #a78bfa20; }
.st-delivered { color: var(--green); background: #22c55e20; }

/* ── Inline log row ── */
.log-row { grid-column: 1 / -1; background: var(--bg-raised); border-top: 1px solid var(--border); padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.log-row label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-label); margin-bottom: 5px; }
.log-row select, .log-row input, .log-row textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 7px 9px; color: var(--text); font-size: 12px; outline: none; }
.log-row textarea { resize: vertical; min-height: 60px; font-family: inherit; }

/* ── Slide panel ── */
#slide-panel { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
#slide-panel.open { pointer-events: all; }
.panel-backdrop { position: absolute; inset: 0; background: #00000060; opacity: 0; transition: opacity 0.2s; }
#slide-panel.open .panel-backdrop { opacity: 1; }
.panel-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 420px; background: var(--bg-surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.25s ease; }
#slide-panel.open .panel-drawer { transform: translateX(0); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 14px; font-weight: 600; color: var(--text); }
.panel-close { background: none; border: none; color: var(--text-secondary); font-size: 16px; cursor: pointer; line-height: 1; }
.panel-body { flex: 1; overflow-y: auto; padding: 20px; }
.panel-body .field { margin-bottom: 16px; }
.panel-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* Panel form inputs */
.panel-body .field input,
.panel-body .field select,
.panel-body .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 13px;
  outline: none; font-family: inherit;
}
.panel-body .field input:focus,
.panel-body .field select:focus,
.panel-body .field textarea:focus { border-color: var(--brand); }
.panel-body .field textarea { resize: vertical; min-height: 80px; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; font-size: 13px; color: var(--text); animation: toast-in 0.2s ease; }
.toast-success { border-color: #22c55e60; }
.toast-error { border-color: #ef444460; color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-label); }
.empty-state p { margin-top: 8px; font-size: 12px; }
