/* PowerhouseTech Sales & CRM — dark isolated portal */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --accent: #424fd1;
  --accent-hover: #3340b8;
  --accent-soft: rgba(66, 79, 209, 0.18);
  --bg: #0a0a0f;
  --bg-elev: #111118;
  --panel: #15151e;
  --panel-2: #1a1a24;
  --line: #2a2a38;
  --line-soft: #22222e;
  --text: #f2f2f7;
  --muted: #8b8b9a;
  --muted-2: #6a6a7a;
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.15);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --cyan: #22d3ee;
  --purple: #8b5cf6;
  --sidebar-w: 248px;
  --radius: 10px;
  --font: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ── Hub ─────────────────────────────────────────── */
.hub-shell {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(66, 79, 209, 0.22), transparent),
    var(--bg);
  padding: 40px 24px 64px;
}
.hub-inner { max-width: 920px; margin: 0 auto; }
.hub-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
}
.hub-brand svg { width: 36px; height: 36px; }
.hub-brand .name { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.hub-brand .sub {
  font-size: 0.7rem; color: var(--muted); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.hub-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px;
}
.hub-hero p { color: var(--muted); max-width: 520px; margin-bottom: 20px; }
.review-banner {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(66, 79, 209, 0.22), rgba(16, 185, 129, 0.1));
  border: 1px solid rgba(66, 79, 209, 0.45);
  border-radius: 16px; padding: 22px 24px; margin-bottom: 28px;
}
.review-kicker {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: #a5b4fc; margin-bottom: 6px;
}
.review-banner h2 {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px;
}
.review-lead {
  color: var(--muted); font-size: 0.92rem; line-height: 1.5;
  max-width: 520px; margin-bottom: 8px;
}
.review-creds {
  font-size: 0.84rem; color: var(--text);
}
.review-creds code {
  font-family: var(--mono); background: var(--panel); padding: 2px 6px; border-radius: 6px;
}
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hub-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-bottom: 28px;
}
.biz-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.biz-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.biz-card h3 { font-size: 1.05rem; font-weight: 700; }
.biz-card .meta { color: var(--muted); font-size: 0.82rem; }
.biz-card .actions { display: flex; gap: 8px; margin-top: 4px; }
.create-card {
  border-style: dashed; background: transparent; cursor: pointer;
  align-items: center; justify-content: center; min-height: 140px;
  color: var(--muted); text-align: center;
}
.create-card:hover { color: var(--text); border-color: var(--accent); }
.create-card .plus { font-size: 1.6rem; font-weight: 700; color: var(--accent); }

.hub-gate, .modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.gate-card, .modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px;
  width: min(400px, 100%);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.gate-card h1, .modal-card h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: 6px; }
.gate-card .lead, .modal-card .lead { color: var(--muted); margin-bottom: 18px; font-size: 0.9rem; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-field label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-field input, .form-field select, .form-field textarea,
.crm-input, .crm-select {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
.form-field input:focus, .crm-input:focus, .crm-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.form-error { color: var(--red); font-size: 0.85rem; margin-bottom: 8px; }
.sample-creds {
  margin-top: 14px; font-size: 0.8rem; color: var(--muted);
  background: var(--bg-elev); border-radius: 8px; padding: 10px 12px;
}
.sample-creds code { font-family: var(--mono); color: var(--text); font-size: 0.78rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: 0.15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #22222e; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--red-soft); border-color: transparent; color: #fca5a5; }

/* ── App shell ───────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.side {
  background: #0d0d14;
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; padding: 14px 12px 12px;
  z-index: 20;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
}
.side-brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.side-brand .name { font-weight: 800; font-size: 0.98rem; }
.side-brand .sub { font-size: 0.65rem; color: var(--muted-2); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.org-switch {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; margin: 0 4px 12px;
  font-size: 0.8rem; cursor: pointer;
}
.org-switch .label { color: var(--muted-2); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.org-switch .val { font-weight: 600; }

.jump {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; margin: 0 4px 14px;
  color: var(--muted); font-size: 0.82rem;
}
.jump kbd {
  margin-left: auto; font-family: var(--mono); font-size: 0.68rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

.nav-sec {
  font-size: 0.65rem; font-weight: 700; color: var(--muted-2);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 8px;
  border: 0; background: transparent; color: #b4b4c4;
  font-size: 0.88rem; font-weight: 500; cursor: pointer;
  transition: 0.12s;
}
.nav-item:hover { background: #1a1a24; color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; opacity: 0.9; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--purple); color: #fff;
  font-size: 0.65rem; font-weight: 700; border-radius: 999px;
  padding: 1px 7px; min-width: 18px; text-align: center;
}

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 4px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  background: var(--accent); flex-shrink: 0;
}
.user-row .u-name { font-weight: 600; font-size: 0.85rem; }
.user-row .u-role { font-size: 0.72rem; color: var(--muted); }

/* Main */
.main-wrap {
  display: flex; flex-direction: column; min-width: 0; min-height: 100vh;
  background: var(--bg);
  position: relative;
}
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 15;
}
.top-search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; color: var(--muted); font-size: 0.85rem;
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); cursor: pointer; position: relative;
  display: grid; place-items: center;
}
.icon-btn:hover { color: var(--text); border-color: #3a3a4a; }
.icon-btn .dot {
  position: absolute; top: 4px; right: 4px;
  background: var(--red); color: #fff; font-size: 0.58rem; font-weight: 700;
  border-radius: 999px; min-width: 14px; height: 14px;
  display: grid; place-items: center; padding: 0 3px;
}
.font-scale {
  display: flex; align-items: center; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px;
}
.font-scale button {
  border: 0; background: transparent; color: var(--muted);
  padding: 4px 7px; cursor: pointer; border-radius: 6px; font-weight: 600;
}
.font-scale button.active, .font-scale button:hover { background: var(--panel-2); color: var(--text); }

.content {
  flex: 1; padding: 22px 24px 72px; min-width: 0;
}
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Feature hub cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.feature-card .fico {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; font-size: 1.1rem; font-weight: 700;
}
.feature-card h3 { font-size: 1.02rem; font-weight: 700; }
.feature-card .tagline { color: var(--muted); font-size: 0.88rem; }
.feature-card ul { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.feature-card li {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 0.84rem; color: #c8c8d4;
}
.feature-card li::before {
  content: '✓'; flex-shrink: 0;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--green-soft); color: var(--green);
  font-size: 0.65rem; font-weight: 800;
  display: grid; place-items: center; margin-top: 2px;
}
.feature-card .explore {
  margin-top: auto; color: #818cf8; font-weight: 600; font-size: 0.88rem;
  background: none; border: 0; cursor: pointer; padding: 0; text-align: left;
}
.feature-card .explore:hover { text-decoration: underline; }
.hub-badge {
  display: inline-flex; align-items: center;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-size: 0.78rem; color: var(--muted); font-weight: 600;
}

/* Toolbar / filters */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 14px;
}
.toolbar .search-box {
  flex: 1; min-width: 200px; max-width: 360px;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px;
}
.toolbar .search-box input {
  border: 0; background: transparent; outline: none; width: 100%; color: var(--text);
}
.status-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px;
}
.status-tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
  font-size: 0.8rem; font-weight: 600;
}
.status-tabs button.active { background: var(--accent); color: #fff; }
.status-tabs button:hover:not(.active) { color: var(--text); background: var(--panel-2); }

.smart-lists { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.smart-chip {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 5px 12px; font-size: 0.78rem;
  color: var(--muted); cursor: pointer; font-weight: 600;
}
.smart-chip.active, .smart-chip:hover { border-color: var(--accent); color: var(--text); }

/* Table */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}
table.crm-table {
  width: 100%; border-collapse: collapse; min-width: 900px;
}
.crm-table th {
  text-align: left; padding: 10px 14px;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line); background: var(--bg-elev);
  white-space: nowrap; position: sticky; top: 0;
}
.crm-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; font-size: 0.88rem;
}
.crm-table tr:last-child td { border-bottom: 0; }
.crm-table tr:hover td { background: rgba(255,255,255,0.02); }
.crm-table tr.row-hover-actions:hover .qa { opacity: 1; }
.name-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.name-cell .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #3b82f6; flex-shrink: 0;
}
.muted { color: var(--muted); }
.qa {
  display: flex; gap: 4px; opacity: 0; transition: 0.15s;
}
.qa button {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); cursor: pointer; font-size: 0.75rem;
}
.qa button:hover { color: var(--text); border-color: var(--accent); }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 0.75rem; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; background: var(--panel-2); color: var(--text);
}
.pill select {
  border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600;
  outline: none; cursor: pointer; appearance: none; padding-right: 12px;
}
.st-new { background: #1e1e28; color: #c8c8d4; }
.st-contacted { background: #1e2433; color: #93c5fd; }
.st-qualified { background: #172554; color: #60a5fa; }
.st-proposal { background: #2e1065; color: #c4b5fd; }
.st-negotiation { background: #422006; color: #fcd34d; }
.st-won { background: #052e1a; color: #6ee7b7; }
.st-lost { background: #1f1f1f; color: #9ca3af; }
.st-converted { background: #0c4a6e; color: #7dd3fc; }
.pri-high { background: var(--red-soft); color: #fca5a5; }
.pri-med { background: var(--amber-soft); color: #fcd34d; }
.pri-low { background: var(--panel-2); color: var(--muted); }

/* Automation */
.funnel-bar {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; margin-bottom: 18px;
}
.funnel-step {
  padding: 14px 16px; border-right: 1px solid var(--line);
  cursor: pointer; transition: 0.12s;
}
.funnel-step:last-child { border-right: 0; }
.funnel-step:hover, .funnel-step.active { background: var(--accent-soft); }
.funnel-step .flabel {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 4px;
}
.funnel-step .fdetail { font-size: 0.82rem; font-weight: 600; }
.auto-layout {
  display: grid; grid-template-columns: 1fr 280px; gap: 16px;
}
@media (max-width: 1000px) {
  .auto-layout { grid-template-columns: 1fr; }
  .funnel-bar { grid-template-columns: 1fr 1fr; }
}
.rule-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
}
.rule-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.rule-head h4 { font-size: 0.95rem; font-weight: 700; }
.rule-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  background: var(--accent-soft); color: #a5b4fc;
  border-radius: 999px; padding: 2px 8px; margin-left: 8px;
}
.rule-logic {
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
  background: var(--bg-elev); border-radius: 8px; padding: 8px 10px; margin: 8px 0;
}
.rule-stats { font-size: 0.78rem; color: var(--muted-2); }
.rule-actions { display: flex; gap: 6px; align-items: center; }
.toggle {
  width: 36px; height: 20px; border-radius: 999px; border: 0;
  background: #333; position: relative; cursor: pointer;
}
.toggle.on { background: var(--green); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: 0.15s;
}
.toggle.on::after { left: 18px; }
.widget {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; margin-bottom: 12px;
}
.widget h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; }
.rot-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem;
}
.rot-row:last-child { border-bottom: 0; }
.rot-row .count { margin-left: auto; font-weight: 700; color: var(--muted); }

/* Deals kanban */
.pipeline-summary {
  display: flex; gap: 10px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px;
}
.pipe-card {
  flex: 0 0 140px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; border-top: 3px solid var(--cyan);
}
.pipe-card .pname { font-size: 0.75rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.pipe-card .pval { font-weight: 800; font-size: 0.9rem; }
.pipe-card .pmeta { font-size: 0.72rem; color: var(--muted-2); margin-top: 2px; }
.forecast-bar {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.forecast-bar .fl { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; color: var(--muted); }
.forecast-bar .fv { font-size: 1.15rem; font-weight: 800; }
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 8px;
}
.kanban-col {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; min-height: 320px; display: flex; flex-direction: column;
}
.kanban-col-head {
  padding: 12px 12px 8px; border-bottom: 1px solid var(--line-soft);
  border-top: 3px solid var(--accent); border-radius: 12px 12px 0 0;
}
.kanban-col-head h4 { font-size: 0.88rem; font-weight: 700; }
.kanban-col-head .meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.kanban-body { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.deal-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; cursor: grab;
}
.deal-card h5 { font-size: 0.84rem; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.deal-card .dval { font-weight: 800; font-size: 0.92rem; }
.deal-card .dw { font-size: 0.72rem; color: var(--muted); margin: 2px 0 8px; }
.prob-bar { height: 4px; background: #2a2a38; border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.prob-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.deal-foot { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.deal-foot .days {
  margin-left: auto; background: var(--panel-2); border-radius: 999px; padding: 2px 7px;
}

/* Calendar */
.cal-controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.cal-dow {
  background: var(--bg-elev); padding: 8px; text-align: center;
  font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
}
.cal-cell {
  background: var(--panel); min-height: 96px; padding: 8px;
}
.cal-cell.out { background: var(--bg-elev); opacity: 0.55; }
.cal-cell .daynum {
  font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px;
  width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%;
}
.cal-cell.today .daynum { background: var(--accent); color: #fff; }
.cal-event {
  background: rgba(59, 130, 246, 0.2); color: #93c5fd;
  border-radius: 4px; padding: 2px 5px; font-size: 0.68rem;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: default;
}

/* Targets */
.target-list {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 0;
}
.target-row {
  display: grid; grid-template-columns: 200px 1fr 120px;
  gap: 16px; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
}
.target-row:last-child { border-bottom: 0; }
@media (max-width: 700px) {
  .target-row { grid-template-columns: 1fr; gap: 8px; }
}
.progress {
  height: 10px; background: #1e1e28; border-radius: 999px; overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--green); transition: width 0.4s ease;
}
.progress.empty > span { background: #333; }
.pct { font-weight: 800; text-align: right; }

/* Footer target */
.target-footer {
  position: sticky; bottom: 0;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 8px 20px;
  display: flex; align-items: center; gap: 14px;
  z-index: 14; font-size: 0.82rem;
}
.target-footer .tl { font-weight: 700; color: var(--muted); white-space: nowrap; }
.target-footer .tbar { flex: 1; height: 8px; background: #1e1e28; border-radius: 999px; overflow: hidden; }
.target-footer .tbar > span { display: block; height: 100%; width: 0%; background: var(--green); }
.target-footer .tmeta { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Toast */
.crm-toast {
  position: fixed; bottom: 56px; right: 20px;
  background: #1e1e2a; border: 1px solid var(--line);
  color: var(--text); padding: 10px 16px; border-radius: 10px;
  z-index: 200; opacity: 0; transform: translateY(8px);
  transition: 0.2s; pointer-events: none; font-weight: 600; font-size: 0.88rem;
  max-width: 320px;
}
.crm-toast.show { opacity: 1; transform: translateY(0); }
.crm-toast.error { border-color: var(--red); color: #fca5a5; }

/* Gate overlay inside app */
.app-gate {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(66, 79, 209, 0.2), transparent),
    var(--bg);
  padding: 24px;
}

/* Mobile */
.menu-btn { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform 0.2s;
    width: min(280px, 86vw); z-index: 40;
  }
  .side.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .side-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35;
  }
  .side-backdrop.show { display: block; }
  .content { padding: 16px 14px 72px; }
  .cal-grid { font-size: 0.75rem; }
  .cal-cell { min-height: 72px; }
  .bill-kpi { grid-template-columns: 1fr 1fr; }
}

/* ── Billing & Quotes ───────────────────────────── */
.bill-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.bill-kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.kpi-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.95rem; flex-shrink: 0;
}
.kpi-ico.amber { background: var(--amber-soft); color: #fbbf24; }
.kpi-ico.green { background: var(--green-soft); color: #34d399; }
.kpi-ico.red { background: var(--red-soft); color: #f87171; }
.kpi-ico.muted { background: var(--panel-2); color: var(--muted); }
.kpi-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.kpi-val { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.amt-due { color: #fbbf24; font-weight: 700; }

.bill-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.bill-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px;
}
.bill-tab {
  border: 0; background: transparent; color: var(--muted);
  font-weight: 600; font-size: 0.8rem;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.bill-tab:hover { color: var(--text); }
.bill-tab.active { background: var(--accent-soft); color: #c7cbff; }

.bill-pill {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 3px 10px;
  font-size: 0.72rem; font-weight: 700;
}
.bill-draft { background: #1e1e28; color: #c8c8d4; }
.bill-sent { background: #172554; color: #60a5fa; }
.bill-viewed { background: #1e3a5f; color: #7dd3fc; }
.bill-accepted, .bill-paid { background: #052e1a; color: #6ee7b7; }
.bill-declined, .bill-overdue { background: var(--red-soft); color: #fca5a5; }
.bill-partial { background: var(--amber-soft); color: #fcd34d; }
.bill-recurring { background: #2e1065; color: #c4b5fd; }

.linkish {
  background: none; border: 0; color: #60a5fa;
  font: inherit; font-weight: 700; cursor: pointer; padding: 0;
}
.linkish:hover { text-decoration: underline; }

.bill-totals {
  margin-top: 14px; max-width: 280px; margin-left: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.bill-totals > div {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 0.88rem; color: var(--muted);
}
.bill-totals .grand {
  margin-top: 4px; padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--text); font-size: 1rem;
}
.bill-lines .num { width: 88px; }
.bill-lines td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bill-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 8px 0 4px;
}
.bill-flag {
  display: inline-block;
  font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: #c4b5fd;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 999px; padding: 2px 8px; margin-right: 6px;
}
.help-dot {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 0.7rem; font-weight: 700;
  background: var(--panel-2); color: var(--muted);
  vertical-align: middle; margin-left: 6px;
}

.doc-preview-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; color: var(--muted); font-size: 0.85rem;
}
.doc-sheet {
  background: #fff; color: #111;
  border-radius: 12px; padding: 28px 32px;
  max-width: 800px; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.doc-sheet-head {
  display: flex; justify-content: space-between; gap: 20px;
  border-bottom: 2px solid #e5e5ea; padding-bottom: 16px; margin-bottom: 16px;
}
.doc-brand { font-weight: 800; font-size: 1.1rem; color: #424fd1; }
.doc-org { font-weight: 700; font-size: 1rem; margin-top: 2px; }
.doc-title { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; color: #666; }
.doc-meta { text-align: right; font-size: 0.85rem; }
.doc-party { margin-bottom: 18px; font-size: 0.9rem; }
.doc-party .label { font-size: 0.7rem; font-weight: 700; color: #888; text-transform: uppercase; margin-bottom: 4px; }
.doc-lines { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-bottom: 16px; }
.doc-lines th {
  text-align: left; padding: 8px 6px; border-bottom: 1px solid #ddd;
  font-size: 0.7rem; text-transform: uppercase; color: #666;
}
.doc-lines td { padding: 8px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.doc-lines .num { text-align: right; }
.doc-totals { max-width: 260px; margin-left: auto; font-size: 0.88rem; }
.doc-totals > div { display: flex; justify-content: space-between; padding: 4px 0; }
.doc-totals .grand { font-weight: 800; border-top: 2px solid #111; margin-top: 6px; padding-top: 8px; }
.doc-notes { margin-top: 16px; font-size: 0.85rem; color: #444; }
.doc-foot { margin-top: 20px; font-size: 0.72rem; }
.doc-sheet .muted { color: #777; }

/* —— My Work home —— */
.mw-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.mw-kpi {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.mw-kpi:hover { border-color: var(--accent); transform: translateY(-1px); }
.mw-kpi .k { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.mw-kpi .v { font-size: 1.55rem; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.mw-kpi.warn .v { color: #fbbf24; }
.mw-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .mw-grid { grid-template-columns: 1fr; } }
.mw-list { display: flex; flex-direction: column; gap: 4px; }
.mw-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 8px;
  padding: 10px 8px; cursor: pointer; color: inherit; font: inherit;
}
.mw-row:hover { background: var(--panel-2); }
.mw-row strong { font-size: 0.92rem; }
.mw-row .muted { font-size: 0.78rem; margin-top: 2px; }

/* —— Lead drawer / timeline —— */
.lead-drawer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: flex; justify-content: flex-end;
  animation: mw-fade 0.18s ease;
}
.lead-drawer.hidden { display: none; }
.drawer-panel {
  width: min(520px, 100%);
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--line);
  padding: 20px 22px;
  overflow-y: auto;
  animation: mw-slide 0.22s ease;
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 16px;
}
.drawer-head h3 { font-size: 1.15rem; font-weight: 800; }
.drawer-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 560px) { .drawer-grid { grid-template-columns: 1fr; } }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item {
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tl-kind {
  display: inline-block;
  font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 4px;
}
@keyframes mw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mw-slide { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }

@media print {
  .side, .topbar, .target-footer, .page-head, .doc-preview-bar, .side-backdrop, .lead-drawer { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .doc-sheet { box-shadow: none; max-width: none; }
}

/* ── Ops Dashboard & jump palette ───────────────── */
.ops-kpi-btn {
  border: 1px solid var(--line);
  cursor: pointer; text-align: left; width: 100%;
  font: inherit; color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.ops-kpi-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 1000px) {
  .ops-grid { grid-template-columns: 1fr; }
}
.ops-sec-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 10px;
}
.ops-sec-head h4 { margin: 0; }
.ops-empty { font-size: 0.85rem; padding: 8px 0; }
.rec-strip {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; font-size: 0.85rem;
}
.rec-link { font-weight: 600; }
.n8n-status {
  margin-top: 12px; padding: 10px 12px;
  background: var(--bg-elev); border-radius: 8px;
  font-size: 0.8rem; color: var(--muted); line-height: 1.45;
}
.notify-row {
  width: 100%; border: 0; background: transparent;
  cursor: pointer; text-align: left;
}
.notify-row:hover { background: var(--accent-soft); border-radius: 8px; }

.jump-palette {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.jump-palette.hidden { display: none; }
.jump-card {
  width: min(560px, 92vw);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.jump-card #jump-input {
  border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 14px 16px; font-size: 1rem;
}
.jump-hit {
  display: grid; grid-template-columns: 72px 1fr auto;
  gap: 10px; align-items: center;
  width: 100%; padding: 10px 16px;
  border: 0; background: transparent; color: var(--text);
  cursor: pointer; text-align: left; font: inherit;
  border-bottom: 1px solid var(--line-soft);
}
.jump-hit:hover { background: var(--accent-soft); }
.jump-type {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: #a5b4fc;
}
