:root {
  color-scheme: light;
  font: 13px/1.45 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #232a35;
  background: #f6f7fa;
  --surface: #fff;
  --line: #e5e8ef;
  --muted: #636f83;
  --accent: #354acd;
  --tint: #eef1ff;
}
* { box-sizing: border-box; }
body { margin: 0; }
[v-cloak] { display: none; }
a { color: inherit; text-decoration: none; }
.sidebar { width: 194px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; gap: 24px; background: #fbfcfe; border-right: 1px solid var(--line); padding: 17px 12px 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #232a35; font-size: 15px; letter-spacing: -.025em; }
.sidebar .brand { padding: 0 7px; }
.brand > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #262f57; color: #fff; font-size: 11px; font-weight: 750; letter-spacing: .03em; }
.brand small { display: block; color: var(--muted); font-size: 10px; font-weight: 450; letter-spacing: .02em; }
.sidebar nav a { display: flex; align-items: center; gap: 9px; min-height: 35px; padding: 0 11px; border-radius: 7px; font-weight: 650; }
.nav-active { background: var(--tint); color: #3348ba; }
.nav-active span { font-size: 17px; }
.account { margin-top: auto; display: flex; gap: 7px; align-items: center; padding: 10px 2px 0; border-top: 1px solid var(--line); color: var(--muted); min-width: 0; }
.account > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account form { margin-left: auto; }
.account button { border: 0; background: transparent; padding-inline: 4px; white-space: nowrap; }
.avatar { border-radius: 50%; display: grid; place-items: center; width: 25px; height: 25px; flex: none; background: #e8ecf7; color: #38456e; font-weight: 700; }
main { margin-left: 194px; padding: 12px 16px 14px; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
.heading, .heading-title, .heading-actions, .toolbar, .filters, .search, .pagination, .batch, .page-controls, .page-jump { display: flex; align-items: center; gap: 8px; }
.heading { justify-content: space-between; min-height: 35px; flex-wrap: wrap; }
.heading-title { gap: 10px; }
h1 { margin: 0; font-size: 21px; letter-spacing: -.035em; font-weight: 730; }
.sync, .count, .pagination { color: var(--muted); font-size: 12px; }
.sync i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; background: #398b66; }
.count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: 0 2px 5px #272f4310; }
.toolbar { padding: 8px 10px; }
.filters { flex-wrap: wrap; gap: 6px; }
.filters input { width: min(185px, 50vw); }
.search { gap: 3px; }
input, select, textarea, button, .button { min-height: 30px; font: inherit; border: 1px solid #dce1eb; border-radius: 6px; padding: 4px 8px; background: #fff; color: inherit; }
input::placeholder { color: #6f7a8c; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; min-height: 0; cursor: pointer; margin: 0; vertical-align: middle; }
button, .button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 600; }
button:hover:not(:disabled), .button:hover { border-color: #8692af; }
button:disabled, .button[aria-disabled=true] { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #687bf4; outline-offset: 1px; }
.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.quiet { border-color: transparent; color: var(--muted); }
.filter-toggle[aria-expanded=true], select:has(option:checked:not([value=""])) { background-color: var(--tint); color: #3348ba; border-color: #d9defc; }
.filter-count { margin-left: 6px; }
.advanced { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 7px 9px; padding: 8px 10px 10px; background: #f7f8fc; border-top: 1px solid var(--line); }
.advanced label { display: grid; gap: 3px; min-width: 0; color: var(--muted); font-size: 11px; }
.advanced select, .advanced input { min-width: 0; width: 100%; font-size: 12px; }
.batch, .alert { padding: 7px 10px; margin: 0; border-top: 1px solid var(--line); background: var(--tint); }
.alert { background: #fff2ef; color: #942f2a; }
.toast { position: fixed; z-index: 10; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 9px; padding: 10px 14px 10px 10px; color: #fff; background: #242c42; border-radius: 8px; box-shadow: 0 8px 24px #1e244339; }
.toast span { display: grid; place-items: center; width: 20px; height: 20px; color: #d8fbe8; background: #306847; border-radius: 50%; }
.toast.failure span { color: #ffdfd8; background: #99463b; }
.table-scroll { flex: 1; overflow: auto; min-height: 0; border-block: 1px solid var(--line); }
table { border-spacing: 0; min-width: 100%; font-size: 12px; }
th, td { border-bottom: 1px solid #edf0f5; text-align: left; padding: 6px 9px; vertical-align: middle; min-width: 86px; overflow-wrap: anywhere; }
th { position: sticky; top: 0; z-index: 2; background: #f1f3f8; color: #566176; font-size: 11px; white-space: nowrap; letter-spacing: .01em; height: 32px; }
td { height: 37px; background: var(--surface); }
tbody tr:nth-child(even) td { background: #fbfcff; }
tbody tr:hover td { background: #f1f4ff; }
.check { min-width: 36px; width: 36px; text-align: center; position: sticky; left: 0; z-index: 1; }
th.check { z-index: 3; }
.contact_id, .whatsapp_number, .first_conversation_at, .message_count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.contact_id { font-weight: 700; color: #374363; }
.contact_name { min-width: 132px; max-width: 190px; }
.first_conversation_at { min-width: 116px; }
.notes, .address, .own_whatsapp { min-width: 153px; max-width: 230px; }
.customer_stage { min-width: 110px; max-width: 180px; }
.cell { display: block; width: 100%; min-height: 24px; text-align: left; font-weight: 450; border-color: transparent; padding: 2px 4px; background: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.cell:hover:not(:disabled) { border-color: #c8d0f0; background: #fff; }
.tag { display: inline-block; width: auto; min-height: 0; border-radius: 5px; padding: 2px 6px; background: #edf0f5; white-space: nowrap; }
.confirmed { background: #e1f3e9; color: #24563f; }
.probable { background: #fff1d5; color: #745410; }
.editor input, .editor select, .editor textarea { width: 100%; min-height: 24px; padding: 2px 4px; border-color: #8d9cf5; font-size: inherit; }
.editor textarea { min-height: 58px; resize: vertical; }
.empty { padding: 24px 12px; color: var(--muted); }
.pagination { justify-content: flex-end; min-height: 40px; padding: 5px 10px; flex-wrap: wrap; }
.page-summary { margin-right: auto; font-variant-numeric: tabular-nums; }
.page-controls, .page-jump { gap: 3px; }
.page-controls button, .page-jump button { min-width: 27px; min-height: 26px; padding: 2px 5px; }
.page-controls button[aria-current=page] { background: var(--tint); border-color: #c8d1ff; color: var(--accent); font-weight: 750; }
.page-jump input { width: 48px; min-height: 26px; padding: 2px 4px; }
.ellipsis { padding-inline: 2px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(100%, 375px); background: #fff; padding: 24px; border-radius: 12px; border: 1px solid var(--line); display: grid; gap: 9px; }
.login-card h1 { margin: 6px 0; }
@media (max-width: 950px) {
  .sidebar { width: 144px; padding-inline: 8px; }
  main { margin-left: 144px; padding-inline: 10px; }
}
@media (max-width: 640px) {
  .sidebar { width: auto; position: static; flex-direction: row; align-items: center; gap: 7px; padding: 5px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0; }
  .sidebar .brand strong { display: none; }
  .sidebar nav a { padding-inline: 7px; }
  .account { margin: 0 0 0 auto; border: 0; padding: 0; }
  main { margin: 0; height: calc(100dvh - 45px); padding: 6px; gap: 5px; }
  .heading-actions { gap: 5px; }
  .sync { font-size: 10px; }
  h1 { font-size: 17px; }
  .advanced { max-height: 27vh; overflow: auto; }
}

.sidebar-toggle { position: absolute; top: 18px; right: 7px; padding: 0; width: 23px; min-height: 23px; color: var(--muted); font-size: 19px; line-height: 1; }
.sidebar .brand { margin-right: 19px; }
.nav-active .nav-label { font-size: inherit; white-space: nowrap; }
.sidebar-collapsed .sidebar { width: 58px; align-items: center; gap: 13px; padding-inline: 6px; }
.sidebar-collapsed .sidebar .brand { margin: 0; padding: 0; }
.sidebar-collapsed .sidebar-toggle { position: static; order: -1; }
.sidebar-collapsed .sidebar-toggle span { transform: rotate(180deg); }
.sidebar-collapsed .brand strong, .sidebar-collapsed .nav-label, .sidebar-collapsed .account > span,
.sidebar-collapsed .account .avatar { display: none; }
.sidebar-collapsed .account { justify-content: center; }
.sidebar-collapsed .account form { margin: 0; }
.sidebar-collapsed main { margin-left: 58px; }
.chat-link { min-height: 23px; padding: 1px 5px; color: var(--accent); border-color: transparent; background: transparent; font-variant-numeric: tabular-nums; }
.chat-link:hover { background: var(--tint); }
.chat-window { position: fixed; z-index: 8; top: 72px; left: max(8px, calc(100vw - var(--chat-width, 550px) - 18px)); display: flex; flex-direction: column; width: min(var(--chat-width, 550px), calc(100vw - 16px)); height: min(660px, calc(100dvh - 88px)); min-height: 180px; background: var(--surface); border: 1px solid #d7ddea; border-radius: 12px; box-shadow: 0 15px 55px #232a353d; overflow: hidden; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px 9px 15px; gap: 8px; background: #fff; border-bottom: 1px solid var(--line); cursor: grab; touch-action: none; user-select: none; }
.chat-header:active { cursor: grabbing; }
.chat-title { min-width: 0; }
.chat-title h2 { font-size: 15px; line-height: 1.3; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.chat-close { width: 29px; min-height: 29px; padding: 0; font-size: 20px; line-height: 1; flex: none; }
.chat-history { flex: 1; overflow: auto; overscroll-behavior: contain; background: #f5f7fc; padding: 12px; min-height: 0; }
.chat-feedback { margin: 14px 0; text-align: center; color: var(--muted); }
.chat-earlier { display: flex; margin: 0 auto 10px; }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 10px; }
.chat-message.outbound { align-items: flex-end; }
.chat-meta { color: var(--muted); font-size: 10px; margin: 0 3px 3px; }
.chat-bubble { max-width: 88%; min-width: 0; background: #fff; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; overflow-wrap: anywhere; }
.outbound .chat-bubble { background: #e9edff; border-color: #dce2fc; }
.chat-text, .chat-ad { white-space: pre-wrap; }
.chat-ad { border-left: 2px solid #adb9ee; margin: 4px 0; padding-left: 7px; }
.chat-bubble img, .chat-bubble video, .chat-bubble audio { display: block; width: auto; max-width: min(320px, 100%); max-height: 210px; margin-top: 3px; }
.chat-bubble audio { width: 240px; }
.chat-bubble a { color: var(--accent); text-decoration: underline; }
.chat-media-note { color: var(--muted); font-size: 11px; }
@media (max-width: 640px) {
  .sidebar-toggle { position: static; order: -1; }
  .sidebar .brand { margin-right: 0; }
  .sidebar-collapsed .sidebar { width: auto; gap: 7px; }
  .sidebar-collapsed .sidebar-toggle { order: -1; }
  .sidebar-collapsed main { margin-left: 0; }
  .chat-window { top: 48px; left: 8px; height: calc(100dvh - 56px); }
}

.stage-screening { color: #2256a0; background: #e7f0ff; }
.stage-closing { color: #21613f; background: #e3f5e9; }
td.own_whatsapp { white-space: pre-wrap; }

.chat-resize { position: absolute; z-index: 1; inset-block: 55px 8px; width: 12px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: ew-resize; touch-action: none; }
.chat-resize-left { left: 0; }
.chat-resize-right { right: 0; }
.chat-resize::after { content: ""; width: 3px; height: 32px; border-radius: 3px; background: #b9c3d9; }
.chat-resize:hover::after, .chat-resize:focus-visible::after { background: var(--accent); }
.chat-history { padding-inline: 15px; }

.chat-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.chat-translate { min-height: 29px; white-space: nowrap; font-size: 12px; color: var(--accent); }
.chat-translation { margin-top: 5px; padding-top: 5px; border-top: 1px solid #c9d2ed; color: #304269; white-space: pre-wrap; }
.translation-status { margin: 0; padding: 4px 15px; color: var(--muted); background: #f1f4ff; font-size: 11px; }
.translation-error { color: #942f2a; background: #fff2ef; }

.copy-number { min-height: 23px; padding: 1px 4px; border-color: transparent; background: transparent; color: var(--accent); font-variant-numeric: tabular-nums; user-select: text; }
.copy-number:hover { background: var(--tint); }

.whatsapp-cell { display: inline-flex; align-items: center; gap: 5px; }
.chat-shortcut { gap: 5px; border-color: #dce3fb; background: #f3f5ff; }
.chat-shortcut-icon { position: relative; width: 11px; height: 9px; border: 1px solid currentColor; border-radius: 3px; }
.chat-shortcut-icon::after { content: ""; position: absolute; left: 1px; bottom: -3px; width: 3px; height: 3px; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; background: #f3f5ff; transform: skewY(-35deg); }

.history-column { min-width: 94px; white-space: nowrap; }
.history-overlay { position: fixed; inset: 0; z-index: 9; background: #17264240; display: grid; place-items: center; padding: 12px; }
.history-window { width: min(670px, 100%); max-height: min(690px, calc(100dvh - 24px)); display: flex; flex-direction: column; border-radius: 12px; background: var(--surface); box-shadow: 0 18px 48px #20284642; overflow: hidden; }
.history-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.history-header h2 { font-size: 16px; margin: 0; }
.history-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.history-list { overflow: auto; }
.history-entry { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.history-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; color: var(--muted); font-size: 12px; }
.history-meta strong { color: #26334f; }
.history-meta time { margin-left: auto; }
.history-changes { display: grid; grid-template-columns: minmax(90px, 25%) 1fr; gap: 5px 10px; margin: 7px 0 0; }
.history-changes dt { font-weight: 600; }
.history-changes dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; margin: 0; min-width: 0; }
.history-before, .history-after { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.history-before { color: #6a7484; }
.history-after { color: #2d8055; }
.history-arrow { color: var(--muted); }

.filter-filled { background-color: var(--tint); color: #3348ba; border-color: #d9defc; }
.advanced-choice { display: grid; gap: 3px; min-width: 0; color: var(--muted); font-size: 11px; }
.searchable-filter { position: relative; min-width: 0; }
.filter-trigger { gap: 7px; justify-content: space-between; max-width: 100%; font-weight: 400; }
.filter-trigger span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.advanced .filter-trigger { width: 100%; font-size: 12px; }
.searchable-filter:has(.filter-popup) { z-index: 5; }
.panel:has(.filter-popup) { overflow: visible; }
.filter-popup { position: absolute; top: calc(100% + 4px); left: 0; width: max(100%, 130px); padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #263149; box-shadow: 0 7px 20px #20284026; font-size: 12px; }
.filter-popup input { width: 100%; }
.filter-results { max-height: 180px; overflow-y: auto; margin-top: 4px; }
.filter-results button { width: 100%; justify-content: start; text-align: left; font-weight: 400; border-color: transparent; }
.filter-results p { margin: 7px 5px; color: var(--muted); }

.completeness-partial { color: #785014; background: #fff1d9; }
