/* Funnelo — design system recreated from the Claude Design prototype.
   Tokens: brand green #17a05e, sidebar #0f1720, page bg #f5f6f8, card #fff. */

:root {
  --green: #17a05e;
  --green-dark: #0f8a55;
  --blue: #2f7de1;
  --purple: #9b47e8;
  --amber: #f79009;
  --red: #d92d20;
  --sidebar: #0f1720;
  --page-bg: #f5f6f8;
  --ink: #161c26;
  --ink-2: #1a1f2b;
  --text-2: #6b7383;
  --text-3: #8b93a3;
  --text-4: #a3aab8;
  --border: #e7e9ee;
  --border-2: #eceef2;
  --border-3: #f2f3f6;
  --input-border: #d7dbe3;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--page-bg);
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5d9e0; border-radius: 8px; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { color: #0b6e44; }
input, textarea, select, button { font-family: inherit; }

/* ---------- App shell ---------- */
.app { display: flex; height: 100vh; width: 100%; background: var(--page-bg); color: var(--ink); overflow: hidden; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 252px; flex-shrink: 0; background: var(--sidebar); color: #c7ccd6;
  display: flex; flex-direction: column; padding: 20px 14px; box-sizing: border-box;
  transition: width .15s ease;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px 10px; }
.sidebar__logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--green);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar__brandname { font-weight: 800; font-size: 15px; color: #fff; line-height: 1.1; }
.sidebar__brandsub { font-size: 11px; color: #7d8798; line-height: 1.1; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  cursor: pointer; font-size: 13.5px; font-weight: 500; color: #a7aebb; background: transparent;
  text-decoration: none;
}
.nav-item:hover { color: #d7dbe3; background: #161e2b; }
.nav-item.is-active { font-weight: 700; color: #fff; background: var(--green); }
.nav-item.is-active:hover { color: #fff; background: var(--green); }
.nav-item svg { flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--green); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
}
.is-active .nav-badge { background: #fff; color: var(--green); }
.sidebar__logout-form { margin-top: auto; }
.sidebar__user {
  padding: 12px 10px; border-top: 1px solid #232c38;
  display: flex; align-items: center; gap: 10px; cursor: pointer; background: none;
  border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; color: inherit;
}
@media (max-width: 879px) { .sidebar__user { justify-content: center; } }
.sidebar__avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #2a3444; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.sidebar__username { font-size: 12.5px; font-weight: 600; color: #fff; }
.sidebar__logout { font-size: 11px; color: #7d8798; }

/* ---------- Main ---------- */
.main { flex: 1; overflow-y: auto; padding: 30px 40px 60px 40px; box-sizing: border-box; min-width: 0; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px;
  flex-wrap: wrap; gap: 14px;
}
.page-title { font-size: 23px; font-weight: 800; color: #0f1720; }
.page-sub { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.head-actions { display: flex; gap: 10px; }

/* ---------- Buttons ---------- */
.btn { cursor: pointer; border-radius: 9px; font-weight: 600; font-size: 13px; border: none; display: inline-block; text-align: center; }
.btn-primary { padding: 10px 18px; background: var(--green); color: #fff; }
.btn-primary:hover { color: #fff; background: #158a51; }
.btn-secondary { padding: 10px 16px; border: 1px solid var(--input-border); background: #fff; color: #2c3444; }
.btn-secondary:hover { color: #2c3444; background: #f7f8fa; }
.btn-sm { padding: 9px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.card-pad { padding: 22px; }
.card-title { font-weight: 700; font-size: 15px; }
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-stat { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.grid-seg { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid-creative { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-380 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.min0 { min-width: 0; }

.kpi { padding: 18px 20px; }
.kpi__label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.kpi__value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.kpi__delta { font-size: 12px; margin-top: 4px; font-weight: 600; }
.kpi__delta.green { color: var(--green); }
.kpi__delta.muted { color: var(--text-2); font-weight: 400; }
.bar { width: 100%; height: 6px; background: #eef0f3; border-radius: 6px; margin-top: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; }

/* ---------- Pills / badges ---------- */
.pill { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; display: inline-block; }
.pill-sm { font-size: 11px; padding: 3px 10px; }
.tag-pill { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: #eef2fb; color: #2f5fc7; }

/* ---------- Tables (grid rows) ---------- */
.tbl { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.tbl__head, .tbl__row { display: grid; align-items: center; }
.tbl__head {
  padding: 12px 20px; background: #fafbfc; border-bottom: 1px solid var(--border-2);
  font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em;
}
.tbl__row { padding: 13px 20px; border-bottom: 1px solid var(--border-3); font-size: 13px; }
.tbl__row:last-child { border-bottom: none; }
.tbl__empty { padding: 30px; text-align: center; color: var(--text-3); font-size: 13px; }
.muted { color: var(--text-2); }
.muted-3 { color: var(--text-3); }
.strong { font-weight: 600; }

/* ---------- Filter pills / tabs ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  cursor: pointer; padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--input-border); background: #fff; color: #4a5163;
}
.chip.is-active { border-color: var(--green); background: var(--green); color: #fff; }
.chip-tab { padding: 8px 14px; border-radius: 8px; font-size: 12.5px; border: none; background: #f0f1f4; color: #4a5163; }
.chip-tab.is-active { background: var(--green); color: #fff; }

.input {
  padding: 10px 14px; border-radius: 9px; border: 1px solid var(--input-border);
  font-size: 13px; width: 100%; box-sizing: border-box;
}
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

/* ---------- Search row ---------- */
.searchbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.searchbar .input { flex: 1; max-width: 320px; }

/* ---------- Segmentation cards ---------- */
.seg-card { border-left: 4px solid; border-radius: 12px; padding: 16px; }
.seg-card__label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.seg-card__desc { font-size: 11.5px; color: var(--text-4); margin: 2px 0 8px 0; }
.seg-card__value { font-size: 24px; font-weight: 800; }

/* ---------- Stat cards (delivery) ---------- */
.stat { padding: 16px; border-radius: 12px; }
.stat__label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat__value { font-size: 22px; font-weight: 800; margin-top: 4px; }

/* ---------- Campaign card ---------- */
.camp {
  padding: 20px 22px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.camp__thumb { width: 74px; height: 56px; border-radius: 10px; flex-shrink: 0; }
.camp__body { flex: 1; min-width: 0; }
.camp__name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.camp__msg { font-size: 12.5px; color: var(--text-2); margin-top: 5px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camp__meta { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.camp__steps { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.step-chip { font-size: 11px; font-weight: 600; color: #4a5163; background: #f0f1f4; padding: 3px 9px; border-radius: 20px; }
.camp__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* image drop placeholder */
.slot {
  width: 100%; height: 100%; border: 1.5px dashed #cfd5df; border-radius: 10px; background: #f7f8fa;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--text-3); font-size: 11.5px; font-weight: 600; padding: 6px; box-sizing: border-box;
}

/* ---------- Creative card ---------- */
.creative { overflow: hidden; }
.creative__thumb { width: 100%; height: 130px; }
.creative__body { padding: 14px; }
.creative__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* ---------- Funnels ---------- */
.funnel { padding: 20px 22px; }
.funnel__top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.funnel__steps { display: flex; gap: 10px; margin-top: 16px; overflow-x: auto; padding-bottom: 4px; }
.funnel__step {
  min-width: 200px; background: #f7f8fa; border: 1px solid var(--border-2); border-radius: 10px; padding: 12px;
}
.funnel__step-head { font-size: 11px; font-weight: 700; color: var(--green); }
.funnel__step-msg {
  font-size: 12.5px; color: var(--ink-2); margin-top: 6px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ---------- Reports funnel bars ---------- */
.funbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.funbar__label { width: 110px; font-size: 12.5px; font-weight: 600; color: #4a5163; }
.funbar__track { flex: 1; height: 26px; background: #eef0f3; border-radius: 7px; overflow: hidden; }
.funbar__fill { height: 100%; border-radius: 7px; }
.funbar__value { width: 64px; text-align: right; font-size: 13.5px; font-weight: 800; }

/* ---------- Dashboard lists ---------- */
.list-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f0f1f4; }
.list-row:last-child { border-bottom: none; }
.stage-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stage-row__name { width: 84px; font-size: 12px; color: #4a5163; font-weight: 600; }
.stage-row__track { flex: 1; height: 8px; background: #eef0f3; border-radius: 6px; overflow: hidden; }
.stage-row__count { width: 20px; text-align: right; font-size: 12.5px; font-weight: 700; }
.link-cta { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--green); cursor: pointer; }

/* ---------- Kanban ---------- */
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px;
  height: calc(100vh - 190px); overflow-x: auto; padding-bottom: 6px;
}
.kanban__col { background: #f0f1f4; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; min-width: 0; }
.kanban__col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px 6px; }
.kanban__col-name { font-weight: 700; font-size: 13px; color: #3a4150; }
.kanban__col-count { font-size: 11.5px; font-weight: 700; color: var(--text-3); background: #fff; padding: 2px 8px; border-radius: 20px; }
.kanban__list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lead-card { background: #fff; border: 1px solid var(--border-2); border-radius: 10px; padding: 12px; cursor: pointer; display: block; }
.lead-card:hover { border-color: #d7dbe3; }
.lead-card__name { font-weight: 700; font-size: 13px; color: var(--ink); }
.lead-card__src { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.lead-card__msg { font-size: 12px; color: #4a5163; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card__val { font-size: 12px; font-weight: 700; color: var(--green); margin-top: 8px; }

/* ---------- Lead drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15,20,28,.4); z-index: 40; border: 0; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 94vw); background: #fff; z-index: 41;
  box-shadow: -8px 0 30px rgba(0,0,0,.12); display: flex; flex-direction: column;
}
.drawer__head { padding: 20px 22px; border-bottom: 1px solid var(--border-2); display: flex; align-items: center; justify-content: space-between; }
.drawer__name { font-weight: 800; font-size: 16px; }
.drawer__sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.drawer__close { cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; padding: 4px; text-decoration: none; }
.drawer__stages { padding: 14px 22px; border-bottom: 1px solid var(--border-2); display: flex; gap: 6px; flex-wrap: wrap; }
.stage-btn { cursor: pointer; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; border: none; background: #f0f1f4; color: #4a5163; }
.drawer__thread { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; background: #f7f8fa; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.bubble--me { align-self: flex-end; background: var(--green); color: #fff; }
.bubble--lead { align-self: flex-start; background: #fff; color: var(--ink-2); }
.bubble__time { font-size: 10.5px; opacity: .6; margin-top: 4px; }
.tick { font-weight: 700; opacity: .95; }
.tick--read { color: #7fd4ff; }
.tick--failed { color: #ffd0cb; }
.drawer__foot { padding: 14px 22px; border-top: 1px solid var(--border-2); }
.compose { display: flex; gap: 8px; margin-bottom: 10px; }
.compose .input { flex: 1; }
.tasks-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; margin: 14px 0 8px; }
.task-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid #b9bfca; flex-shrink: 0; cursor: pointer; background: #fff; padding: 0; }
.checkbox.is-done { background: var(--green); border-color: var(--green); }
.task-text { font-size: 12.5px; flex: 1; color: var(--ink-2); }
.task-text.is-done { text-decoration: line-through; color: var(--text-4); }
.task-due { font-size: 11px; color: var(--text-4); }

/* ---------- Cleanup ---------- */
.banner {
  background: #fff4ea; border: 1px solid #fbdbb3; border-radius: 12px; padding: 16px 20px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.banner__title { font-weight: 700; font-size: 14px; color: #93500e; }
.banner__sub { font-size: 12.5px; color: #a3702c; margin-top: 2px; }
.btn-keep { padding: 9px 14px; border-radius: 8px; border: 1px solid #e2b784; background: #fff; font-weight: 600; font-size: 12.5px; color: #93500e; cursor: pointer; }
.btn-danger { padding: 9px 14px; border-radius: 8px; border: none; background: var(--red); font-weight: 600; font-size: 12.5px; color: #fff; cursor: pointer; }
.row-keep { cursor: pointer; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--input-border); font-size: 12px; font-weight: 600; background: #fff; }
.row-remove { cursor: pointer; padding: 6px 12px; border-radius: 7px; border: none; font-size: 12px; font-weight: 600; background: #fdeceb; color: var(--red); }

/* ---------- Quotation ---------- */
.qi-grid { display: grid; grid-template-columns: 2fr .7fr 1fr .3fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.qi-head { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; margin-bottom: 8px; }
.qi-input { padding: 8px 10px; border-radius: 7px; border: 1px solid var(--input-border); font-size: 12.5px; width: 100%; box-sizing: border-box; }
.qi-remove { cursor: pointer; color: var(--red); font-weight: 700; text-align: center; font-size: 16px; }
.dashed { cursor: pointer; text-align: center; padding: 9px; border-radius: 8px; border: 1px dashed #c7cdd8; color: #4a5163; font-weight: 600; font-size: 12.5px; }
.wa-preview { flex: 1; background: #e9f5ee; border-radius: 12px; padding: 16px; }
.wa-msg { background: #fff; border-radius: 10px; padding: 14px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: var(--ink-2); }
.qt-row { display: flex; justify-content: space-between; padding-top: 6px; font-size: 13px; color: #4a5163; }
.qt-total { display: flex; justify-content: space-between; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border-2); font-size: 16px; font-weight: 800; }

/* ---------- Modals ---------- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(15,20,28,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { background: #fff; border-radius: 16px; padding: 26px; width: min(380px, 92vw); box-sizing: border-box; }
.modal--wide { width: min(460px, 92vw); }
.modal--wider { width: min(520px, 94vw); max-height: 86vh; overflow-y: auto; }
.modal__title { font-weight: 800; font-size: 16px; margin-bottom: 16px; }
.modal__title--tight { margin-bottom: 6px; }
.modal__hint { font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
.modal__fields { display: flex; flex-direction: column; gap: 10px; }
.modal__actions { display: flex; gap: 8px; margin-top: 20px; }
.modal textarea.input { height: 80px; resize: none; }
.hidden { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; background: var(--sidebar); box-sizing: border-box; padding: 24px; }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 18px; padding: 32px; box-sizing: border-box; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--green); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.login-tabs { display: flex; background: #f0f1f4; border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.login-tab { flex: 1; text-align: center; padding: 9px 0; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; background: transparent; color: #4a5163; }
.login-tab.is-active { background: var(--green); color: #fff; }
.login-input { padding: 11px 14px; border-radius: 9px; border: 1px solid var(--input-border); font-size: 13.5px; width: 100%; box-sizing: border-box; }
.login-btn { margin-top: 18px; width: 100%; text-align: center; cursor: pointer; padding: 11px; border-radius: 9px; background: var(--green); color: #fff; font-weight: 700; font-size: 13.5px; border: none; }
.login-note { text-align: center; font-size: 11.5px; color: var(--text-4); margin-top: 18px; }
.login-hint { font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
.login-code { background: #e7f8ee; color: var(--green-dark); border: 1px solid #b8e6cd; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 14px; text-align: center; }
.login-error { background: #fdeceb; color: var(--red); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 14px; text-align: center; }

/* ---------- Responsive: collapse sidebar under 880px ---------- */
@media (max-width: 879px) {
  .sidebar { width: 72px; padding: 20px 10px; }
  .sidebar__labels { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .main { padding: 22px 18px 40px 18px; }
}
