/* WaPilot — hand-written stylesheet (no build step required) */
:root {
  --brand: #00a884; --brand-600: #008f6f; --brand-50: #e7f8f3;
  --bg: #f4f6f8; --panel: #ffffff; --panel-2: #f8fafb; --border: #e3e8ec; --text: #1f2933; --muted: #6b7783;
  --danger: #dc2626; --warning: #d97706; --info: #2563eb; --success: #16a34a;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --sidebar: #0b1f1a; --sidebar-text: #c9d6d2; --sidebar-active: #12352c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text);
}
[data-theme="dark"] {
  --bg: #0f1417; --panel: #161d21; --panel-2: #1b2328; --border: #2a343a; --text: #e6ebee; --muted: #94a2ab;
  --brand-50: #0f2b24; --shadow: none; --sidebar: #0a1013; --sidebar-active: #13261f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
code { background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; font-size: .85em; }
[x-cloak] { display: none !important; }

/* Layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 8px 16px; }
.sidebar .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.sidebar .brand img { max-height: 30px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6f8a83; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--sidebar-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 7px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding-left: 34px; }
.topbar .search .icon { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.content { padding: 22px 24px 40px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.topbar .menu-toggle { display: none; }

/* Components */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 16px; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { margin-left: auto; }

.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: .78rem; font-weight: 500; }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .75rem; color: var(--muted); }
.kpi.alert .value { color: var(--danger); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 4px 9px; font-size: .82rem; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 34px; width: 48px; }
label { display: block; font-weight: 500; font-size: .82rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .error, .error { color: var(--danger); font-size: .8rem; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.tag { color: #fff; border: 0; }
.badge.hot { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.badge.warm { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.badge.cold { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.badge.new { background: #f1f5f9; color: #475569; }
.badge.customer, .badge.won, .badge.completed, .badge.done { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.badge.lost, .badge.cancelled { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.badge.open, .badge.pending { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.badge.urgent, .badge.high { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.badge.overdue { background: var(--danger); color: #fff; border-color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; flex: none; text-transform: uppercase; }
.avatar.sm { width: 24px; height: 24px; font-size: .65rem; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .meta { min-width: 0; }
.person .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
[data-theme="dark"] .flash.success { background: #052e22; color: #a7f3d0; border-color: #065f46; }
[data-theme="dark"] .flash.error { background: #2a0f0f; color: #fecaca; border-color: #7f1d1d; }
[data-theme="dark"] .flash.warning { background: #2b2108; color: #fde68a; border-color: #78350f; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a, .tabs button { padding: 8px 12px; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.active, .tabs button.active { color: var(--brand-600); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); color: var(--text); font-size: .8rem; font-weight: 500; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip:hover { text-decoration: none; border-color: var(--brand); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.list > * { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.list > *:last-child { border-bottom: 0; }

/* Timeline */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline .item { position: relative; padding: 0 0 14px 8px; }
.timeline .item::before { content: ""; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--brand); }
.timeline .when { font-size: .74rem; color: var(--muted); }

/* Kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column { flex: 0 0 272px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.column-head { padding: 10px 12px; border-bottom: 1px solid var(--border); border-top: 3px solid var(--c, var(--brand)); border-radius: var(--radius) var(--radius) 0 0; }
.column-head .t { font-weight: 700; display: flex; justify-content: space-between; }
.column-head .s { font-size: .75rem; color: var(--muted); }
.column-body { padding: 8px; overflow-y: auto; min-height: 80px; flex: 1; }
.deal { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.deal:active { cursor: grabbing; }
.deal .title { font-weight: 600; font-size: .86rem; }
.deal .val { font-weight: 700; color: var(--brand-600); }
.sortable-ghost { opacity: .4; }

/* Notes */
.note { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--panel); }
.note.pinned { border-color: #fcd34d; background: #fffbeb; }
[data-theme="dark"] .note.pinned { background: #2b2108; border-color: #78350f; }
.note.private { border-style: dashed; }
.note .body { white-space: pre-wrap; word-wrap: break-word; }

/* Dropdown / modal */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 220px; z-index: 50; padding: 6px; }
.dropdown-menu a, .dropdown-menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--panel-2); text-decoration: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .card-head { border-radius: 12px 12px 0 0; }
.notif-item { padding: 9px 10px; border-radius: 8px; display: block; color: var(--text); }
.notif-item.unread { background: var(--brand-50); }
.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--brand); }
.score { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; font-weight: 800; font-size: .85rem; border: 3px solid currentColor; }
.score.hot { color: #dc2626; } .score.warm { color: #ea580c; } .score.cold { color: #0284c7; }
pre.code { background: #0b1f1a; color: #d1fae5; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: .8rem; }
.pagination { display: flex; gap: 4px; list-style: none; padding: 12px 16px; margin: 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.pagination .active span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled span { opacity: .5; }

/* Auth / landing */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #e7f8f3 0%, #f4f6f8 60%); }
[data-theme="dark"] .auth { background: var(--bg); }
.auth .card { width: 100%; max-width: 440px; }
.landing-hero { padding: 72px 16px 40px; text-align: center; max-width: 880px; margin: 0 auto; }
.landing-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.landing-features { max-width: 1100px; margin: 0 auto; padding: 0 16px 60px; }
.price { font-size: 1.6rem; font-weight: 800; }

@media (max-width: 1100px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 60; transition: left .2s; }
  .sidebar.open { left: 0; }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; }
  .g6, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
}

/* Public website */
.btn-lg { padding: 11px 20px; font-size: 1rem; }
.site-header { max-width: 1100px; margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-header nav { gap: 4px; }
.section-title { text-align: center; font-size: clamp(1.3rem, 2.6vw, 1.8rem); margin: 0 0 22px; }
.landing-features { scroll-margin-top: 20px; }
.steps .step { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; margin-bottom: 8px; }
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.faq summary { cursor: pointer; }
.landing-cta { text-align: center; padding: 30px 16px 70px; }
.landing-mock { max-width: 1100px; margin: 0 auto 50px; padding: 0 16px; }
.mock { display: grid; grid-template-columns: 1fr 1.3fr 1fr; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--panel); box-shadow: 0 20px 50px rgba(15, 23, 42, .12); min-height: 340px; }
.mock-list { border-right: 1px solid var(--border); }
.mock-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mock-tabs i, .mock-actions i { font-style: normal; font-size: .72rem; font-weight: 600; border: 1px solid var(--border); border-radius: 99px; padding: 2px 8px; }
.mock-tabs i.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mock-row { display: flex; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: .85rem; align-items: center; }
.mock-row .avatar.sm { width: 30px; height: 30px; font-size: .7rem; flex: none; }
.pill { font-style: normal; font-size: .66rem; font-weight: 700; padding: 0 6px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); margin-left: 3px; }
.mock-chat { background: #efeae2; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
[data-theme="dark"] .mock-chat { background: #0b141a; }
.mock-chat .bubble { max-width: 85%; padding: 7px 10px; border-radius: 8px; background: #fff; font-size: .85rem; color: #111b21; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.mock-chat .bubble.out { align-self: flex-end; background: #d9fdd3; }
.mock-panel { border-left: 1px solid var(--border); background: var(--panel-2); padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: .85rem; }
.mock-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.mock-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.site-footer { border-top: 1px solid var(--border); background: var(--panel); margin-top: 20px; }
.site-footer-in { max-width: 1100px; margin: 0 auto; padding: 28px 16px 10px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; font-size: .9rem; }
.site-footer-in > div { display: flex; flex-direction: column; gap: 6px; }
.site-footer-in a { color: var(--muted); }
.site-footer-note { max-width: 1100px; margin: 0 auto; padding: 8px 16px 24px; font-size: .78rem; }
.doc { max-width: 780px; margin: 0 auto; padding: 24px 16px 50px; line-height: 1.65; }
.doc h2 { font-size: 1.1rem; margin-top: 26px; }
.doc ul { padding-left: 20px; }
@media (max-width: 760px) {
  .mock { grid-template-columns: 1fr; }
  .mock-chat, .mock-panel { display: none; }
  .site-footer-in { grid-template-columns: 1fr; }
}
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
[x-cloak] { display: none !important; }
