/* Design tokens and components ported from crm-html/ (see its README for the token table). */

body { margin: 0; background: #fffcf6; }
a { color: #123a88; text-decoration: none; }
a:hover { color: #032125; text-decoration: underline; }

.crm { font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-weight: 450; font-size: 14px; line-height: 1.38; letter-spacing: .014em; color: #032125; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sub { font-size: 12px; color: #354d51; }
.eyebrow { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: #437278; }
.eyebrow a { color: #437278; }

/* Shell */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; background: #fffcf6; }
.shell-nav { flex: 1 1 248px; max-width: 100%; background: #032125; display: flex; }
.shell-main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 48px; box-sizing: border-box; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.page-title { margin: 0 0 6px; font-size: 30px; line-height: 1.13; font-weight: 475; }

.stack { display: flex; flex-direction: column; gap: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 16px; }

/* Sidebar */
.nav { font-size: 14px; color: #a1c2c6; width: 100%; box-sizing: border-box; padding: 20px 12px; display: flex; flex-direction: column; gap: 24px; }
.nav a:hover { text-decoration: none; }
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 0; }
.nav-search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 1px solid #0b363b; border-radius: 2px; color: #a1c2c6; font-size: 13px; }
.nav-search:hover { color: #ffffff; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { display: flex; align-items: center; gap: 10px; padding: 0 12px 6px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.nav-item { display: flex; align-items: center; height: 36px; padding: 0 12px 0 38px; border-radius: 2px; font-size: 14px; position: relative; color: #a1c2c6; }
a.nav-item:hover { color: #ffffff; }
span.nav-item { cursor: default; opacity: .6; }
.nav-item[aria-current="page"] { background: #0b363b; color: #ffffff; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 19px; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: #abffae; }
.nav-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid #0b363b; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #0b363b; color: #abffae; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 20px; border-radius: 9999px; font: inherit; font-size: 14px; font-weight: 500; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: box-shadow .18s, background .18s; white-space: nowrap; box-sizing: border-box; background: transparent; color: #032125; }
.btn:hover { text-decoration: none; color: #032125; }
.btn-primary { background: #abffae; }
.btn-primary:hover, .btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 4px #c5f6c3; }
.btn-secondary { border-color: #0b363b; }
.btn-secondary:hover, .btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 4px #ebebeb; }
.btn-ghost:hover { background: #f3f1ea; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-primary:disabled { opacity: 1; background: #e4e9e6; color: #5b6f72; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9999px; border: 0; background: transparent; color: #a1c2c6; cursor: pointer; padding: 0; }
.icon-btn:hover { background: #0b363b; color: #ffffff; }

/* Cards, tags, chips */
.card { background: #fff; border: 1px solid #ebebeb; border-radius: 2px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 2px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 18px; }
.tag-sm { padding: 0 6px; }
.t-gray { background: #f1f1ee; color: #354d51; }
.t-blue { background: #e2f4ff; color: #123a88; }
.t-yellow { background: #faf1dc; color: #6e5117; }
.t-green { background: #eafde8; color: #0b363b; }
.t-orange { background: #fdf0e9; color: #863d1c; }
.t-teal { background: #e6f0f0; color: #437278; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid #ebebeb; background: #fff; border-radius: 9999px; font: inherit; font-size: 13px; color: #032125; cursor: pointer; box-sizing: border-box; }
.chip:hover { border-color: #869b9e; text-decoration: none; color: #032125; }
.chip[aria-pressed="true"], .chip:has(> input[type="radio"]:checked) { border-color: #0b363b; background: #0b363b; color: #fff; }
.chip:has(> input[type="radio"]:focus-visible) { box-shadow: 0 0 0 4px #c5f6c3; }
.chip input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }

/* Forms */
.label { font-size: 12px; font-weight: 500; color: #354d51; display: block; margin-bottom: 6px; }
.input { height: 40px; width: 100%; border: 1px solid #869b9e; border-radius: 2px; padding: 0 12px; font: inherit; font-size: 14px; background: #fff; color: #032125; box-sizing: border-box; transition: box-shadow .18s, border-color .18s; }
.input:focus { outline: none; border-color: #0b363b; box-shadow: 0 0 0 4px #c5f6c3; }
.input-lg { height: 44px; padding: 0 14px; font-size: 15px; }
.input-err { border-color: #863d1c; }
select.chip { appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23032125' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
/* A filter select with a value picked looks like a pressed chip, so active filters stand out. */
select.chip:has(option:checked:not([value=""])) { border-color: #0b363b; color: #fff; background: #0b363b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
select.chip option { background: #fff; color: #032125; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.req { color: #863d1c; }
.cb { width: 16px; height: 16px; accent-color: #0b363b; margin: 0; cursor: pointer; vertical-align: middle; }

/* Alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 2px; font-size: 14px; }
.alert-error { background: #fdf0e9; color: #863d1c; }
.alert-notice { background: #eafde8; color: #0b363b; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; min-width: 820px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: #354d51; padding: 10px 16px; border-bottom: 1px solid #ebebeb; background: #fafafa; white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid #ebebeb; vertical-align: middle; }
.tbl tbody tr:hover td { background: #fbfaf6; }
.tbl .w-cb { width: 18px; }
.scroll { max-height: 440px; overflow: auto; }
.scroll .tbl th { position: sticky; top: 0; z-index: 1; }
.nowrap { white-space: nowrap; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid #ebebeb; background: #fff; border-radius: 2px; }
.stat { padding: 20px 24px; border-right: 1px solid #ebebeb; }
.stat:last-child { border-right: 0; }
.stat-value { font-size: 30px; line-height: 1; font-weight: 475; }

/* Import */
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 24px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #354d51; }
.step-n { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: #ebebeb; color: #354d51; }
.step-current { color: #032125; }
.step-current .step-n { background: #0b363b; color: #ffffff; }
.step-done { color: #032125; }
.step-done .step-n { background: #abffae; color: #032125; }
.drop { flex: 2 1 420px; min-height: 340px; border: 1px dashed #437278; background: #ffffff; border-radius: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 48px 24px; box-sizing: border-box; text-align: center; transition: background .18s, border-color .18s; }
.drop:hover, .drop.is-over { background: #f6fdf5; border-color: #0b363b; }
.sec-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 16px; }
.sec-icon { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sticky-bar { position: sticky; bottom: 0; z-index: 2; margin: 0 -40px -48px; padding: 16px 40px; background: #fffcf6; border-top: 1px solid #ebebeb; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }

/* Drawer (manual lead form) */
.backdrop { position: fixed; inset: 0; background: rgba(0,25,28,.45); z-index: 20; display: flex; justify-content: flex-end; }
.drawer { width: 520px; max-width: 100%; height: 100%; background: #fffcf6; display: flex; flex-direction: column; box-sizing: border-box; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 24px 28px; border-bottom: 1px solid #ebebeb; background: #ffffff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 24px; }
.drawer-section { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.drawer-section + .drawer-section { border-top: 1px solid #ebebeb; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding: 16px 28px; border-top: 1px solid #ebebeb; background: #ffffff; }

/* Funnel */
.funnel { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.board { flex: 999 1 560px; min-width: 0; overflow-x: auto; padding-bottom: 8px; }
.board-cols { display: flex; gap: 12px; min-width: max-content; align-items: flex-start; }
.kcol { width: 208px; flex: none; background: #fafafa; border: 1px solid #ebebeb; border-radius: 2px; padding: 12px; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; min-height: 560px; transition: background .18s, border-color .18s; }
.kcol.is-over { background: #f6fdf5; border-color: #0b363b; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 6px; }
.kcard { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: #fff; border: 1px solid #ebebeb; border-radius: 2px; color: #032125; cursor: grab; transition: box-shadow .18s, border-color .18s; }
.kcard:hover { border-color: #869b9e; text-decoration: none; color: #032125; }
.kcard-on { border-color: #0b363b; box-shadow: 0 0 0 4px #c5f6c3; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid #ebebeb; }
.lead-panel { flex: 1 1 340px; max-width: 380px; padding: 24px; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; }
.lead-panel-section { display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid #ebebeb; }
.lead-panel-section h3 { margin: 0; font-size: 14px; font-weight: 600; }
.lead-panel .icon-btn { color: #354d51; }
.lead-panel .icon-btn:hover { background: #f3f1ea; color: #032125; }

/* Advanced filters and details drawer of the leads list */
.filters-panel { flex: 1 1 100%; margin: 4px -16px -16px; border-top: 1px solid #ebebeb; background: #fbfaf6; padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.filters-pills { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.count { min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9999px; background: #abffae; color: #032125; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.chip[aria-pressed="true"] .count { color: #032125; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: #fff; border: 1px solid #ebebeb; border-radius: 2px; cursor: pointer; }
.opt:hover { border-color: #869b9e; }
.opt:has(> input:checked) { border-color: #0b363b; box-shadow: inset 0 0 0 1px #0b363b; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 12px; border-radius: 9999px; background: #0b363b; color: #fff; font-size: 13px; }
.pill a { width: 22px; height: 22px; border-radius: 9999px; color: #a1c2c6; display: inline-flex; align-items: center; justify-content: center; }
.pill a:hover { color: #fff; background: #437278; }
.row-link { color: #032125; font-weight: 500; }
.row-link:hover { color: #123a88; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #ebebeb; background: #fff; border-radius: 2px; }
.fact { padding: 14px 16px; border-right: 1px solid #ebebeb; min-width: 0; }
.fact:last-child { border-right: 0; }
.fact-value { display: flex; align-items: center; gap: 6px; font-weight: 500; color: #0b363b; }
.link-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #ebebeb; }
.link-row:last-child { border-bottom: 0; }
.link-icon { width: 32px; height: 32px; flex: none; border-radius: 2px; background: #f1f1ee; color: #5b6f72; display: inline-flex; align-items: center; justify-content: center; }
.link-icon-on { background: #eafde8; color: #0b363b; }
.raw div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 16px; border-bottom: 1px solid #ebebeb; font-size: 13px; }
.raw div:last-child { border-bottom: 0; }
.raw dt { color: #354d51; }
.raw dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; gap: 12px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: #437278; margin-top: 6px; flex: none; }

/* Bulk selection bar of the leads list */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; background: #032125; color: #ffffff; }

/* WhatsApp: template preview, option list, inbox */
.row-btn { color: #032125; font-weight: 500; }
.row-btn:hover { color: #123a88; }
.row-on td { background: #eafde8; }
.wa-columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.wa-main { flex: 999 1 520px; min-width: 0; }
.wa-form { padding: 24px; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 16px 24px; border-top: 1px solid #ebebeb; background: #ffffff; }
.wa-preview { background: #efeae0; padding: 16px; border-radius: 2px; }
.wa-bubble { background: #ffffff; padding: 12px 14px; border-radius: 2px; font-size: 14px; white-space: pre-line; }
.wa-button { display: block; background: #ffffff; padding: 8px; margin-top: 4px; border-radius: 2px; text-align: center; color: #123a88; font-size: 13px; }
.opt-link { color: #032125; }
.opt-link:hover { text-decoration: none; color: #032125; }
.opt-on { border-color: #0b363b; box-shadow: 0 0 0 4px #c5f6c3; }
.radio { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #869b9e; flex: none; margin-top: 2px; box-sizing: border-box; }
.opt-on .radio { border: 5px solid #0b363b; }
.meter { height: 6px; background: #ebebeb; border-radius: 9999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: #0b363b; }
.chk { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #ebebeb; }
.chk:last-child { border-bottom: 0; }
.chk-icon { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: #abffae; color: #032125; }
.chk-warn { background: #fdf0e9; color: #863d1c; }
.wa-hero { background: #032125; color: #ffffff; border-radius: 2px; padding: 32px; display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.wa-hero dt { font-size: 12px; color: #a1c2c6; margin-bottom: 6px; }
.wa-hero dd { margin: 0; font-size: 20px; }
/* The inbox fills the page edge to edge; a flash message stays above it. */
.shell-main:has(> .inbox) { padding: 0; gap: 0; }
.shell-main:has(> .inbox) > .alert { margin: 16px 24px; }
.inbox { flex: 1; display: flex; flex-wrap: wrap; min-height: 100vh; }
.inbox-list { flex: 1 1 300px; max-width: 360px; border-right: 1px solid #ebebeb; background: #ffffff; display: flex; flex-direction: column; }
.inbox-chat { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; max-height: 100vh; }
.inbox-lead { flex: 1 1 280px; max-width: 320px; border-left: 1px solid #ebebeb; background: #ffffff; padding: 24px; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; }
.conv { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #ebebeb; color: #032125; }
.conv:hover { background: #fbfaf6; text-decoration: none; color: #032125; }
.conv[aria-current="page"] { background: #eafde8; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: #e2f4ff; color: #123a88; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; padding: 24px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.msg { max-width: 440px; padding: 10px 14px; border-radius: 2px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.msg-in { background: #ffffff; border: 1px solid #ebebeb; align-self: flex-start; }
.msg-out { background: #0b363b; color: #ffffff; align-self: flex-end; }
.msg-failed { background: #fdf0e9; color: #863d1c; }
.msg-meta { font-size: 11px; margin-top: 6px; text-align: right; white-space: normal; }
.msg-out .msg-meta { color: #a1c2c6; }
.msg-label { font-size: 11px; color: #abffae; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em; }
.msg-btn { display: inline-block; border: 1px solid #437278; padding: 4px 10px; margin: 8px 6px 0 0; border-radius: 9999px; font-size: 12px; }
.day { align-self: center; background: #ffffff; border: 1px solid #ebebeb; padding: 2px 10px; border-radius: 2px; }

/* Login */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; background: #fffcf6; }
.login-hero { flex: 1 1 520px; background: #032125; color: #ffffff; padding: 48px 64px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; gap: 64px; min-height: 560px; }
.login-form { flex: 1 1 520px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; box-sizing: border-box; }
.login-fields { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.login .label { font-size: 13px; color: #032125; }

@media (max-width: 640px) {
  .shell-main { padding: 24px 16px 32px; }
  .sticky-bar { margin: 0 -16px -32px; padding: 16px; }
  .login-hero { padding: 32px 24px; min-height: 0; }
}
