:root {
  --ink: #142033;
  --muted: #5d6b82;
  --line: #e4e9f2;
  --bg: #f3f6fb;
  --card: #ffffff;
  --sidebar: #10192b;
  --sidebar-2: #182338;
  --accent: #1d4ed8;
  --accent-2: #1e3a8a;
  --hot: #be123c;
  --warm: #b45309;
  --cold: #0369a1;
  --ok: #047857;
  --bad: #b91c1c;
  --shadow: 0 10px 30px rgba(16, 25, 43, 0.06);
  --radius: 14px;
  font-family: "Segoe UI", "Plus Jakarta Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }

.app { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.nav-toggle { display: none; }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), #0c1424 70%);
  color: #d5deee;
  padding: 18px 12px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: white; font-weight: 700; letter-spacing: -0.03em;
  font-size: 18px; padding: 6px 10px 16px;
}
.brand .icon { width: 22px; height: 22px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  color: #c5d0e4; padding: 9px 12px; border-radius: 10px; font-size: 14px;
}
.sidebar nav a em {
  margin-left: auto; background: #be123c; color: white; font-style: normal;
  border-radius: 99px; min-width: 18px; text-align: center; font-size: 11px; padding: 1px 6px;
}
.sidebar nav a.on, .sidebar nav a:hover { background: var(--sidebar-2); color: white; }
.side-foot { margin-top: auto; padding: 14px 12px 4px; color: #8ea0bd; font-size: 12px; line-height: 1.45; }
.side-foot strong { color: white; font-size: 13px; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; background: rgba(243,246,251,.9);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.nav-btn { display: none; cursor: pointer; }
.top-search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: white; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  max-width: 460px; color: var(--muted);
}
.top-search input { border: 0; outline: 0; width: 100%; background: transparent; }
.user-menu { margin-left: auto; position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer; background: white; border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-weight: 600;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.user-menu a {
  display: block; background: white; padding: 10px 12px; color: var(--ink);
}
.user-menu a:hover { background: #f8fafc; }
.user-menu[open] { background: white; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.user-menu[open] summary { border: 0; border-radius: 0; }

.content { padding: 6px 22px 40px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin: 8px 0 16px; }
.page-head h1 { font-size: 28px; letter-spacing: -0.04em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 9px 14px; border: 1px solid transparent;
  background: var(--accent); color: white; cursor: pointer; font-weight: 600; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: white; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #fff1f2; color: var(--bad); border-color: #fecdd3; }
.btn.small { padding: 6px 10px; font-size: 13px; font-weight: 600; }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.flash.ok { background: #ecfdf5; color: #065f46; }
.flash.bad { background: #fff1f2; color: #9f1239; }

.stat-grid, .split, .form-grid, .kanban { display: grid; gap: 14px; }
.stat-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.stat, .card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat { padding: 16px 16px 14px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 6px; font-size: 26px; letter-spacing: -0.04em; }
.stat em { font-style: normal; color: var(--muted); font-size: 12px; }
.card { padding: 16px; }
.card h2 { font-size: 16px; margin-bottom: 12px; letter-spacing: -0.02em; }
.split { grid-template-columns: 1.4fr .8fr; align-items: start; }
.split-3 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; align-items: start; }

.insight { display: flex; flex-direction: column; gap: 8px; }
.insight a {
  display: block; padding: 10px 12px; border-radius: 10px; background: #f8fafc; color: var(--ink); border: 1px solid var(--line);
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select, .field input, .field select, .field textarea {
  width: 100%; background: white; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none;
}
.filters input, .filters select { width: auto; min-width: 140px; background: white; }
.field textarea { min-height: 90px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; }
.form-grid { grid-template-columns: 1fr 1fr; }
.help { color: var(--muted); font-size: 12px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #fafbfe; }
td.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.name-cell { font-weight: 700; color: var(--ink); }
.name-cell small, .muted { color: var(--muted); font-weight: 500; }

.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px;
  font-size: 12px; font-weight: 700; background: #eef2ff; color: #3730a3;
}
.score-hot, .st-lost, .pr-high { background: #ffe4e6; color: var(--hot); }
.score-warm, .st-negotiation, .st-proposal, .pr-medium { background: #ffedd5; color: var(--warm); }
.score-cold, .st-new, .st-contacted { background: #e0f2fe; color: var(--cold); }
.st-qualified { background: #ede9fe; color: #6d28d9; }
.st-won, .pr-low { background: #d1fae5; color: var(--ok); }
.st-paid, .st-active, .st-done { background: #d1fae5; color: var(--ok); }
.st-draft, .st-open, .st-inactive { background: #f1f5f9; color: #475569; }
.st-sent, .st-pending, .st-in_progress { background: #e0f2fe; color: var(--cold); }
.st-overdue, .st-missed { background: #ffe4e6; color: var(--hot); }

.pager { display: flex; gap: 6px; margin-top: 14px; }
.pager a, .pager .gap { min-width: 34px; text-align: center; padding: 6px; border-radius: 8px; background: white; border: 1px solid var(--line); color: var(--ink); }
.pager a.on { background: var(--accent); color: white; border-color: var(--accent); }

.kanban { grid-template-columns: repeat(6, minmax(180px, 1fr)); overflow: auto; align-items: start; }
.kanban-col { background: #e9eef7; border-radius: 14px; padding: 10px; min-height: 240px; }
.kanban-col header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.kanban-card {
  display: block; background: white; border-radius: 12px; padding: 10px; margin-bottom: 8px;
  border: 1px solid white; color: var(--ink); cursor: grab;
}
.kanban-card strong { display: block; }
.kanban-card span { color: var(--muted); font-size: 12px; }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline article { border-left: 3px solid #dbe3f0; padding: 2px 0 8px 12px; }
.timeline strong { font-size: 14px; }
.timeline p { white-space: pre-wrap; margin-top: 4px; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bar { height: 8px; background: #e8eef8; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.bubble { max-width: 760px; padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; }
.bubble.user { margin-left: auto; background: var(--accent-2); color: white; }
.bubble.bot { background: white; border: 1px solid var(--line); }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.suggest button { background: white; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; }

.invoice-sheet { max-width: 860px; margin: 0 auto; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.invoice-top { display: flex; justify-content: space-between; gap: 20px; }
.totals { margin-left: auto; width: 260px; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.item-row { display: grid; grid-template-columns: 1.6fr .5fr .6fr auto; gap: 8px; margin-bottom: 8px; }

.guest { min-height: 100vh; background:
  radial-gradient(900px 400px at 10% -10%, #dbe7ff, transparent 50%),
  linear-gradient(180deg, #f7f9fd, #eef3fb);
}
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr;
}
.auth-side { padding: 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-side h1 { font-size: 46px; letter-spacing: -0.05em; line-height: 1.05; max-width: 560px; }
.auth-side p.lead { margin-top: 14px; color: var(--muted); font-size: 18px; max-width: 480px; }
.auth-side ul { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.auth-side li { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-width: 420px; }
.auth-card { display: flex; align-items: center; justify-content: center; padding: 28px; }
.panel { width: min(440px, 100%); background: white; border-radius: 20px; padding: 26px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel h2 { font-size: 24px; letter-spacing: -0.03em; }
.panel .sub { color: var(--muted); margin: 6px 0 16px; }
.mark { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--accent-2); margin-bottom: 18px; }

.punch {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.big-time { font-size: 32px; letter-spacing: -0.04em; font-weight: 700; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .split, .split-3, .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 22px 0; }
  .auth-side h1 { font-size: 34px; }
  .kanban { grid-template-columns: repeat(3, minmax(200px, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .nav-btn { display: inline-flex; background: white; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
  .sidebar {
    position: fixed; z-index: 20; transform: translateX(-105%); transition: transform .2s ease; width: 260px;
  }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .form-grid, .stat-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .kanban { grid-template-columns: repeat(1, minmax(220px, 1fr)); }
}
.site { background: #f6f3ee; color: #1c1915; }
.site-top {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #083f3b; color: #d7efe9; font-size: 13px; padding: 8px 22px;
}
.site-bar {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; background: #fffdf8; border-bottom: 1px solid #e3d9c8;
  position: sticky; top: 0; z-index: 10;
}
.site-brand { color: #083f3b; font-weight: 800; font-size: 20px; letter-spacing: -0.04em; order: 1; }
.site-nav { display: flex; gap: 16px; margin-left: 12px; order: 2; }
.site-nav a { color: #3f3a33; font-weight: 600; }
.site-login {
  margin-left: auto; order: 3; background: #0f5c56; color: white; border-radius: 999px;
  padding: 9px 16px; font-weight: 700;
}
.site-login:hover { color: white; filter: brightness(1.06); }
.site-nav-toggle, .site-burger { display: none; }
.hero, .band, .account, .login-wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: center; padding: 54px 0 24px; }
.eyebrow { color: #0f5c56; font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; }
.hero h1 { font-size: 46px; line-height: 1.05; letter-spacing: -0.045em; max-width: 640px; }
.lede { margin-top: 14px; color: #5c564c; font-size: 18px; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-board { display: grid; gap: 12px; }
.hero-board article, .tile-grid article, .split-cards article {
  background: white; border: 1px solid #e3d9c8; border-radius: 16px; padding: 16px 16px 14px;
}
.hero-board span, .steps span { color: #6b645a; }
.hero-board strong, .tile-grid h3, .split-cards h3 { display: block; margin: 4px 0; letter-spacing: -0.03em; }
.hero-board em { font-style: normal; color: #6b645a; font-size: 13px; }
.band { padding: 28px 0 10px; }
.band-plain { background: transparent; }
.band-head { margin-bottom: 14px; }
.band-head h2, .account h1 { letter-spacing: -0.04em; font-size: 32px; }
.band-head p, .account-head p { color: #5c564c; margin-top: 4px; }
.tile-grid, .split-cards { display: grid; gap: 14px; }
.tile-grid { grid-template-columns: repeat(4, 1fr); }
.split-cards { grid-template-columns: 1fr 1fr; }
.split-cards a { font-weight: 700; color: #0f5c56; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li { background: white; border: 1px solid #e3d9c8; border-radius: 16px; padding: 16px; }
.steps strong { display: block; margin-bottom: 6px; }
.faqs { display: grid; gap: 8px; }
.faqs details { background: white; border: 1px solid #e3d9c8; border-radius: 14px; padding: 12px 14px; }
.faqs summary { cursor: pointer; font-weight: 700; }
.faqs p { color: #5c564c; margin-top: 8px; }
.site-foot {
  margin-top: 36px; background: #083f3b; color: #d7efe9;
  display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px;
  padding: 28px 22px 18px;
}
.site-foot a { display: block; color: white; margin: 4px 0; }
.site-foot p { color: #b7d4cc; margin-top: 6px; }
.site-copy { grid-column: 1 / -1; margin: 0; }
.login-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 32px 0 10px; }
.account { padding: 28px 0 10px; }
.account-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.site .btn { background: #0f5c56; }
.site .btn.ghost { background: white; color: #1c1915; border-color: #e3d9c8; }

@media (max-width: 980px) {
  .hero, .tile-grid, .split-cards, .steps { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 36px; }
}
@media (max-width: 760px) {
  .site-bar { flex-wrap: wrap; }
  .site-burger { display: inline-flex; order: 4; margin-left: 8px; border: 1px solid #e3d9c8; border-radius: 999px; padding: 7px 12px; font-weight: 700; }
  .site-nav { display: none; order: 5; flex-basis: 100%; margin: 8px 0 0; }
  .site-nav-toggle:checked ~ .site-nav { display: flex; flex-direction: column; gap: 10px; background: white; border: 1px solid #e3d9c8; border-radius: 14px; padding: 12px; }
  .site-login { margin-left: auto; }
  .hero, .tile-grid, .split-cards, .steps, .site-foot { grid-template-columns: 1fr; }
  .hero { padding-top: 28px; }
  .hero h1, .band-head h2 { font-size: 30px; }
}

@media print {
  .sidebar, .topbar, .no-print, .actions { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .invoice-sheet { border: 0; box-shadow: none; }
}
