/* ============================================================
   AI SDR OS — design system
   Dark, quiet, data-forward. Boldness spent in one place:
   the "engine active" hero. Everything else stays disciplined.
   ============================================================ */
:root {
  --bg:        #0a0b0f;
  --panel:     #131620;
  --elevated:  #1a1e2b;
  --line:      #20242f;     /* minimal, low-contrast borders */
  --text:      #e8eaf0;
  --muted:     #868fa3;
  --faint:     #5b6477;
  --accent:    #6d5efc;
  --accent-2:  #9d7bff;
  --grad:      linear-gradient(135deg, #6d5efc 0%, #9d7bff 100%);
  --ok:        #4ade80;
  --warn:      #fbbf24;
  --danger:    #f87171;
  --radius:    14px;
  --shadow:    0 1px 0 rgba(255,255,255,.02) inset, 0 8px 32px rgba(0,0,0,.35);
  --font:      "Inter", system-ui, -apple-system, sans-serif;
  --mono:      "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(109,94,252,.35); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, #0c0e14 0%, #0a0b0f 100%);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 0 24px rgba(109,94,252,.45);
}
.brand .name { font-weight: 650; letter-spacing: -.01em; }
.brand .name small { display: block; color: var(--faint); font-weight: 500; font-size: 11px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px; color: var(--muted);
  cursor: pointer; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--elevated); color: var(--text); }
.nav-item.active .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.nav-item .ico { width: 17px; text-align: center; opacity: .85; }
.nav-spacer { flex: 1; }
.nav-foot { color: var(--faint); font-size: 11px; padding: 10px; }

/* ---------- Main ---------- */
.main { padding: 34px 40px 80px; max-width: 1180px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 4px; }
.page-head p { color: var(--muted); margin: 0; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* metric tiles */
.metric { display: flex; flex-direction: column; gap: 6px; }
.metric .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.metric .value { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.metric .value.accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---------- Hero (the one bold moment) ---------- */
.hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 18px; padding: 30px 32px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(109,94,252,.18), transparent 55%),
    radial-gradient(120% 140% at 100% 0%, rgba(157,123,255,.12), transparent 50%),
    var(--panel);
  margin-bottom: 22px;
}
.hero h2 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0; max-width: 52ch; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ok);
  font-weight: 600; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .08em; }
.live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); }
  70% { box-shadow: 0 0 0 9px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.insight {
  margin-top: 18px; padding: 12px 16px; border-radius: 12px;
  background: rgba(109,94,252,.08); border: 1px solid rgba(109,94,252,.2);
  color: var(--text); font-size: 13px;
}
.insight b { color: var(--accent-2); }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--elevated); color: var(--text); font-weight: 550; font-size: 13px;
  cursor: pointer; transition: transform .08s, border-color .15s, background .15s;
}
.btn:hover { border-color: #2c3242; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 6px 20px rgba(109,94,252,.3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, textarea, select {
  width: 100%; background: #0c0e15; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font-size: 13px; font-family: var(--font);
  outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 92px; }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--faint); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; padding: 0 14px 12px; }
td { padding: 13px 14px; border-top: 1px solid var(--line); font-size: 13px; }
tr.row:hover td { background: rgba(255,255,255,.015); cursor: pointer; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--elevated); color: var(--muted); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.NEW       { color: var(--faint); }
.pill.CONTACTED { color: #7aa2ff; }
.pill.REPLIED   { color: #58c4dc; }
.pill.INTERESTED{ color: var(--accent-2); }
.pill.NURTURING { color: #f0a868; }
.pill.HOT       { color: var(--danger); background: rgba(248,113,113,.1); }
.pill.CLOSED    { color: var(--faint); }
.pill.interested,.pill.booking_intent { color: var(--ok); }
.pill.curious   { color: #58c4dc; }
.pill.objection { color: var(--warn); }
.pill.not_interested { color: var(--faint); }

/* status dot for connection states */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.status .d { width: 8px; height: 8px; border-radius: 50%; }
.status.on .d  { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status.off .d { background: var(--faint); }

/* ---------- Misc ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 14px; }
.card-title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; margin: 0 0 4px; }
.divide { height: 1px; background: var(--line); margin: 16px 0; }
.tag { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.empty .big { font-size: 15px; color: var(--text); margin-bottom: 4px; }

/* drawer for lead/inbox detail */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw;
  background: var(--panel); border-left: 1px solid var(--line); z-index: 41; padding: 26px;
  overflow-y: auto; box-shadow: -16px 0 40px rgba(0,0,0,.4); }
.thread-msg { background: var(--elevated); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; }
.thread-msg.out { background: rgba(109,94,252,.07); border-color: rgba(109,94,252,.2); }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--elevated); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 60; font-size: 13px; }
.toast.err { border-color: rgba(248,113,113,.4); }

/* login gate */
.gate { display: grid; place-items: center; height: 100vh; }
.gate .box { width: 360px; }

/* spinner */
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { padding: 22px 18px 70px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
