/* Sales Team HQ — dark operations UI. Mobile-first: setters work from phones. */
:root {
  --bg: #0b0e13;
  --panel: #131822;
  --panel-2: #1a2130;
  --line: #232c3d;
  --text: #e8ecf3;
  --muted: #8b96a8;
  --accent: #ff3b4e;
  --accent-soft: rgba(255, 59, 78, 0.12);
  --green: #2fd07c;
  --yellow: #f5c451;
  --blue: #4da3ff;
  --red: #ff5a5a;
  --gray: #6b7686;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ── shell ── */
header.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(11, 14, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: 0.4px; font-size: 16px; }
.brand em { color: var(--accent); font-style: normal; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar .signout { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 12px; }

nav.tabs {
  position: sticky; top: 53px; z-index: 39;
  display: flex; gap: 4px; padding: 8px 12px;
  background: var(--bg); border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
nav.tabs button {
  background: none; border: none; color: var(--muted);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; white-space: nowrap;
}
nav.tabs button.active { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 16px 14px 90px; }

/* ── cards, grids ── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card h2 .tag { font-size: 11px; font-weight: 600; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.muted { color: var(--muted); font-size: 13px; }
.done { color: var(--green); }

/* ── forms ── */
label.f { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"],
input[type="email"], input[type="password"], input[type="url"], textarea, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 9px 11px; font: inherit;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.formrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.btn {
  background: var(--accent); border: none; color: #fff; font-weight: 700;
  border-radius: 9px; padding: 10px 18px; margin-top: 12px;
}
.btn.secondary { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn.small { padding: 5px 10px; font-size: 12px; margin-top: 0; }
.btn:disabled { opacity: 0.5; cursor: default; }
.section-label { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }

/* ── chips, badges ── */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.chip.red { background: rgba(255,90,90,.15); color: var(--red); }
.chip.yellow { background: rgba(245,196,81,.15); color: var(--yellow); }
.chip.blue { background: rgba(77,163,255,.15); color: var(--blue); }
.chip.green { background: rgba(47,208,124,.15); color: var(--green); }
.chip.gray { background: rgba(107,118,134,.18); color: var(--gray); }
.pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: 12px; color: var(--muted); }
.pill b { color: var(--text); }

/* ── stats ── */
.statrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat .v { font-size: 24px; font-weight: 800; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .t { font-size: 11px; margin-top: 4px; }
.stat .t.ok { color: var(--green); }
.stat .t.behind { color: var(--yellow); }

/* ── tables ── */
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; position: sticky; top: 0; background: var(--panel); }
table.data tr:hover td { background: rgba(255,255,255,0.02); }
td.num, th.num { text-align: right; }
td.bad { color: var(--red); font-weight: 700; }
td.good { color: var(--green); }

/* ── leads board ── */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; }
.col { min-width: 240px; max-width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; }
.leadcard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 8px; cursor: pointer; }
.leadcard:hover { border-color: var(--accent); }
.leadcard .n { font-weight: 700; font-size: 13px; }
.leadcard .m { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ── drawer ── */
.drawer-back { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw);
  background: var(--panel); border-left: 1px solid var(--line); z-index: 61;
  overflow-y: auto; padding: 18px;
}
.drawer h2 { display: flex; align-items: center; gap: 10px; }
.drawer .close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 22px; }
.quicklog { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.quicklog button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.quicklog button:hover { border-color: var(--accent); }
.timeline { margin-top: 10px; }
.timeline .titem { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline .titem .when { color: var(--muted); font-size: 11px; white-space: nowrap; padding-top: 2px; }

/* ── leaderboard ── */
.lb { counter-reset: rank; }
.lbrow { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-bottom: 1px solid var(--line); }
.lbrow .rank { width: 30px; font-weight: 800; color: var(--muted); font-size: 16px; }
.lbrow:nth-child(1) .rank { color: #ffd700; }
.lbrow:nth-child(2) .rank { color: #c0c8d8; }
.lbrow:nth-child(3) .rank { color: #cd8b48; }
.lbrow .who { flex: 1; }
.lbrow .who .nm { font-weight: 700; }
.lbrow .who .rl { font-size: 11px; color: var(--muted); }
.lbrow .pts { font-size: 20px; font-weight: 800; color: var(--accent); }
.lbrow .sub { font-size: 11px; color: var(--muted); text-align: right; }

/* ── auth screens ── */
.authwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.authcard { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.authcard h1 { font-size: 22px; margin-bottom: 4px; }
.authcard h1 em { color: var(--accent); font-style: normal; }
.authcard .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.authcard .switch { margin-top: 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* ── objectives ── */
.obj { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.obj input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--accent); }
.obj .cat { margin-left: auto; }
.obj.donerow .ttl { text-decoration: line-through; color: var(--muted); }

/* ── toast ── */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 24px);
  background: #1e2735; color: var(--text); border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 10px; font-size: 14px; opacity: 0;
  transition: all 0.22s ease; z-index: 99; pointer-events: none; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: var(--red); color: var(--red); }

.searchbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.searchbar input[type="text"] { max-width: 240px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { background: none; border: none; color: var(--muted); padding: 7px 13px; font-weight: 600; font-size: 13px; }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 26px 0; font-size: 14px; }
