:root {
  --primary: #F5821F;
  --primary-hover: #E56E0C;
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --ink: #17191F;
  --muted: #697386;
  --line: #E8EBF0;
  --dark: #10141C;
  --sidebar: 260px;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(23, 25, 31, 0.06);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --ducon-green: #F5821F;
  --ducon-green-dark: #E56E0C;
  --ducon-gold: #F5821F;
  --ducon-coral: #d64545;
  --ducon-slate: #17191F;
  --ducon-ink: #17191F;
  --ducon-ivory: #F7F8FA;
  --ducon-line: #E8EBF0;
  --ducon-sidebar: 260px;
  --ducon-radius: 16px;
  --font-display: var(--font);
  --font-body: var(--font);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #10141C;
  --surface: #171c27;
  --ink: #f4f6f8;
  --muted: #a3adbd;
  --line: #2a3140;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --ducon-ink: #f4f6f8;
  --ducon-ivory: #10141C;
  --ducon-line: #2a3140;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); }
body, button, input, select, textarea, table, .btn, .form-control, .form-select {
  font-family: var(--font);
}
body {
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .page-header h1, .crm-page-title {
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
table, .ducon-table { font-size: 14px; line-height: 1.45; font-weight: 400; }
th, .ducon-table th { font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
[x-cloak] { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}
html.is-collapsed { --sidebar: 76px; }

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  background: var(--dark);
  color: #f7f8fa;
  overflow: hidden;
}
.brand-lockup, .side-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}
.brand-lockup { padding: 4px 8px 16px; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark img { width: 28px; height: 28px; object-fit: contain; filter: brightness(0) invert(1); }
.brand-glyph { font-weight: 700; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 14px; letter-spacing: -0.02em; }
.brand-copy span, .nav-label, .stat-copy span, .stat-copy em, .page-header p, .surface header p, .menu-meta {
  color: #b7c0cc;
  font-size: 12px;
}
html.is-collapsed .brand-copy,
html.is-collapsed .nav-label,
html.is-collapsed .nav-link span,
html.is-collapsed .side-profile .brand-copy { display: none; }
html.is-collapsed .app-sidebar { padding: 14px 8px 10px; }
html.is-collapsed .brand-lockup,
html.is-collapsed .side-profile { justify-content: center; padding-left: 0; padding-right: 0; }
html.is-collapsed .brand-lockup { padding-bottom: 12px; }
html.is-collapsed .side-nav {
  overflow-x: hidden;
  padding-right: 0;
  scrollbar-width: none;
}
html.is-collapsed .side-nav::-webkit-scrollbar { width: 0; height: 0; }
html.is-collapsed .nav-section { margin-bottom: 6px; }
html.is-collapsed .nav-link { justify-content: center; gap: 0; padding: 10px 0; }
html.is-collapsed .nav-link.is-active { box-shadow: none; }
.side-profile .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.side-nav { flex: 1; overflow: auto; padding-right: 4px; }
.nav-section { margin-bottom: 16px; }
.nav-label {
  padding: 8px 12px 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 9px 12px;
  border-radius: 12px;
  color: #d5dbe3;
  font-size: 14px;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-link svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.is-active {
  background: rgba(245, 130, 31, .16);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.side-profile {
  margin-top: 8px;
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700; flex: 0 0 auto;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }

.app-main { min-width: 0; max-width: 100%; }
.app-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-lead, .topbar-actions, .page-header, .page-header-actions, .filter-bar, .surface header, .drawer-panel header {
  display: flex; align-items: center; gap: 10px;
}
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.crumbs strong { color: var(--ink); font-weight: 600; }
.command-trigger {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  min-width: min(360px, 36vw);
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
}
.command-trigger kbd {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
}
.icon-btn, .user-chip, .menu-panel button, .menu-panel a, .filter-bar button, .btn-ducon {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  position: relative;
}
.icon-btn svg, .user-chip svg { width: 18px; height: 18px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; }
.menu-anchor { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 10px;
  padding: 9px 10px; font-size: 14px;
}
.menu-panel a:hover, .menu-panel button:hover { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.notify-panel { min-width: 280px; }
.notify-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
.notify-item { margin: 0; padding: 8px; font-size: 13px; }
.notify-item.muted { color: var(--muted); }
.notify-item.is-danger { color: #d64545; }
.dot-alert {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}

.app-content { padding: 22px; min-width: 0; max-width: 100%; }
.page-header { justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.page-header h1, .surface h2, .drawer-panel h2 { margin: 0; letter-spacing: -0.03em; }
.page-header h1 { font-size: 28px; }
.page-header p, .surface header p { margin: 4px 0 0; color: var(--muted); }

.stat-grid, .ducon-grid.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 20px;
}
.stat-grid.wa-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-card, .ducon-card, .surface, .crm-card, .crm-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
}
.table-responsive, .wa-table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; }
.stat-card {
  display: flex; gap: 12px; padding: 16px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(23, 25, 31, .08); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary);
}
.stat-copy { display: flex; flex-direction: column; }
.stat-copy strong { font-size: 26px; letter-spacing: -0.04em; line-height: 1.1; }
.stat-copy em { font-style: normal; margin-top: 4px; }

.dashboard-grid, .ducon-grid.two {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
  margin-top: 14px;
}
.surface { padding: 16px 16px 8px; }
.surface header { justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.chart-canvas { min-height: 280px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }

.data-table, .ducon-table-wrap { padding: 0; overflow: hidden; width: 100%; max-width: 100%; min-width: 0; }
.table-scroll, .ducon-table-wrap { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
.table-scroll > table, .ducon-table-wrap > table { width: max-content; min-width: 100%; border-collapse: collapse; }
table, .ducon-table { width: 100%; border-collapse: collapse; }
th, td, .ducon-table th, .ducon-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
th.text-end, td.text-end { text-align: right; font-variant-numeric: tabular-nums; }
th, .ducon-table th {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
tr:hover td { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.table-foot { padding: 12px 14px; }
.inbox-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inbox-pager[hidden] { display: none !important; }
.inbox-pager-meta { margin: 0; color: var(--muted); font-size: 13px; }
.inbox-pager .page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer;
}
.inbox-pager .page-link[disabled] { opacity: .45; cursor: default; }
.row-link { color: var(--primary); font-weight: 600; }
button.row-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

.status-badge, .ducon-pill {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary-hover);
}
.status-badge.tone-good { background: #e8f7ee; color: #157347; }
.status-badge.tone-warn { background: #fff4e5; color: #b86e00; }
.status-badge.tone-danger, .ducon-pill.danger { background: #fdecec; color: #b42318; }
html[data-theme="dark"] .status-badge.tone-good { background: #143226; color: #8ee0ad; }
html[data-theme="dark"] .status-badge.tone-danger { background: #3a1d1d; color: #ffb4b4; }

.filter-bar, .ducon-filters {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 10px;
  width: 100%; max-width: 100%; min-width: 0; margin-bottom: 14px;
  overflow-x: auto;
}
.filter-bar input, .filter-bar select, .ducon-filters input, .ducon-filters select, .ducon-auth input {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  max-width: none;
}
.filter-bar > input, .filter-bar > select, .ducon-filters > input, .ducon-filters > select {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}
.filter-bar > input[type="search"], .ducon-filters > input[type="search"] { flex: 1.4 1 160px; min-width: 140px; }
.filter-bar > select, .ducon-filters > select { flex: 1 1 120px; min-width: 108px; }
.filter-bar > input[type="date"], .ducon-filters > input[type="date"] { flex: 0 0 168px; width: 168px; min-width: 168px; }
.filter-bar > button, .filter-bar > a, .ducon-filters > button, .ducon-filters > a { flex: 0 0 auto; width: auto; }
.filter-bar button, .btn-ducon {
  background: var(--primary); color: #fff; border-color: transparent;
  padding: 10px 14px; font-weight: 600;
}
.filter-bar button:hover, .btn-ducon:hover { background: var(--primary-hover); color: #fff; }
.btn-ducon-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ducon-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-ducon-sm { display: inline-flex; align-items: center; justify-content: center; padding: 7px 12px; border-radius: 10px; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.stat-grid.users-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.surface.users-board { padding: 0; overflow: hidden; }
.surface.users-board > .table-scroll { margin: 0; max-width: 100%; }
.users-board .table-scroll > table { width: 100%; min-width: 100%; }
.users-board th:last-child,
.users-board td:last-child { padding-right: 18px; text-align: right; white-space: nowrap; }
.users-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.users-toolbar input,
.users-toolbar select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
}
.users-toolbar-actions { display: flex; gap: 8px; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
html[data-theme="dark"] .status-badge.tone-warn { background: #3a2c14; color: #ffd089; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.row-actions form, .page-header-actions form { margin: 0; }
.lead-message { display: block; max-width: 420px; white-space: normal; }
.campaign-board {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr);
  gap: 22px;
  padding: 18px 20px;
  align-items: start;
}
.campaign-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 14px 0 0; }
.campaign-facts dt { color: var(--muted); font-size: 12px; }
.campaign-facts dd { margin: 2px 0 0; font-weight: 600; }
.placement-panel { padding: 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.placement-panel h2 { margin: 0 0 12px; font-size: 14px; }
.place-row { margin-bottom: 10px; }
.place-row div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.place-track { height: 8px; margin-top: 6px; border-radius: 99px; background: var(--surface); overflow: hidden; }
.place-track span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.campaign-people { padding: 0; overflow: hidden; min-width: 0; max-width: 100%; }
.surface.campaign-people > .table-scroll { margin: 0; max-width: 100%; }
.campaign-people .row-actions { flex-wrap: nowrap; }
.campaign-people th:last-child,
.campaign-people td:last-child {
  position: sticky; right: 0; z-index: 1;
  background: var(--surface);
  white-space: nowrap;
}
.campaign-people tr:hover td:last-child { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.campaign-people header { padding: 16px 16px 0; align-items: center; }
.campaign-people header h2 { margin: 0; font-size: 16px; }
.campaign-people .filter-bar { margin: 0; flex: 1; justify-content: flex-end; }
.campaign-people .filter-bar input[type="search"] { max-width: 280px; }
.chip-inline {
  display: inline-flex; margin: 0 8px 6px 0; padding: 6px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.campaign-meta, .source-clip { display: block; color: var(--muted); font-size: 12px; }
a.source-clip { color: var(--primary); font-weight: 600; }
.source-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.btn-ducon:disabled { opacity: .45; cursor: not-allowed; }
.btn-ducon-gold { background: var(--primary); }

.source-tabs, .ducon-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.source-tabs a, .ducon-tabs a {
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600;
}
.source-tabs a.is-active, .ducon-tabs a.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.record-hero, .record-sheet { padding: 22px; }
.record-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}
.avatar {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary-hover);
  font-size: 22px; font-weight: 600; letter-spacing: -0.03em;
}
.record-kicker { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.record-identity h1 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -0.035em; }
.record-contacts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.record-contacts a, .record-contacts span { color: var(--muted); font-size: 14px; }
.record-contacts a:hover { color: var(--primary-hover); }
.record-sheet { display: grid; gap: 14px; }
.app-content > .surface + .surface { margin-top: 14px; }
.record-sheet h2, .record-sheet h3 { margin: 0; }
.record-sheet h3 { font-size: 14px; color: var(--muted); font-weight: 600; }
.fact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.fact-grid div {
  padding: 12px 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
}
.fact-grid .fact-wide { grid-column: 1 / -1; }
.fact-grid dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.fact-grid dd { margin: 0; font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row a {
  padding: 6px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.chip-row a:hover { border-color: var(--primary); color: var(--primary-hover); }
.review-resolve { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.review-resolve input {
  width: 110px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); padding: 7px 10px;
}
.chip-row span {
  padding: 6px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  font-size: 13px; font-weight: 600;
}
.record-note, .record-empty { margin: 0; color: var(--ink); }
.section-label { margin: 8px 0 0; font-size: 16px; }
.job-record { padding: 22px 24px 8px; }
.job-record-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.job-record h1 { margin: 8px 0 6px; font-size: 30px; letter-spacing: -0.035em; }
.job-summary { margin: 0 0 12px; max-width: 68ch; color: var(--muted); }
.job-copy { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink); line-height: 1.65; max-width: 78ch; }
.job-copy p { margin: 0 0 10px; }
.job-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-top: 8px; }
.job-section { padding: 18px 0 20px; border-top: 1px solid var(--line); }
.job-section-wide { grid-column: 1 / -1; }
.job-section h2 { margin: 0 0 12px; font-size: 15px; }
.job-duties { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.job-duties li {
  display: grid; gap: 2px;
  padding-left: 12px;
  border-left: 2px solid color-mix(in srgb, var(--primary) 55%, var(--line));
}
.job-duties strong { font-size: 13px; }
.job-duties span { color: var(--ink); line-height: 1.5; }
.job-list { margin: 0; padding-left: 18px; }
.job-list li + li { margin-top: 6px; }
.record-empty { color: var(--muted); }
.record-panel { padding: 0 18px 16px; }
.lead-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; }
.profile-card { padding: 18px; }
.profile-card h2 { margin: 10px 0 4px; }
.meta-list { display: grid; gap: 12px; margin-top: 16px; }
.meta-list span { display: block; color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { padding: 14px; }
.detail-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.mobile-cards { display: none; }

.empty-state, .ducon-empty {
  display: grid; justify-items: center; gap: 6px;
  padding: 28px 12px; color: var(--muted); text-align: center;
}
.command-layer, .overlay, .drawer-layer {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 20, 28, .45);
  display: grid; place-items: start center;
  padding-top: 12vh;
}
.command-card, .overlay-card {
  width: min(560px, calc(100% - 32px));
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.applicant-modal { width: min(680px, calc(100% - 32px)); }
.applicant-head, .applicant-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 18px;
}
.applicant-head { border-bottom: 1px solid var(--line); }
.applicant-head h2 { margin: 0; font-size: 22px; }
.applicant-head p, .applicant-body h3 { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.applicant-body { display: grid; gap: 12px; padding: 16px 18px; max-height: min(62vh, 560px); overflow: auto; }
.applicant-body .fact-grid { grid-template-columns: 1fr 1fr; }
.applicant-body h3 { margin: 0; font-weight: 600; }
.applicant-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.cv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.applicant-body .row-link { overflow-wrap: anywhere; }
.command-input { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.command-input input { border: 0; outline: 0; width: 100%; background: transparent; color: var(--ink); }
.command-list a { display: flex; justify-content: space-between; padding: 12px 14px; }
.command-list a:hover { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.command-empty { padding: 16px; color: var(--muted); }
.drawer-layer { display: block; padding: 0; }
.drawer-scrim { position: absolute; inset: 0; }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(420px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.drawer-panel header { justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 16px; overflow: auto; }

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr);
  background: var(--bg);
}
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 48px;
  color: #f4f6f8;
  background:
    radial-gradient(circle at 12% 18%, rgba(245, 130, 31, .34), transparent 32%),
    linear-gradient(165deg, #17191F, #10141C 70%);
}
.auth-pitch { margin: 0; max-width: 520px; }
.auth-lockup { position: absolute; top: 40px; left: 48px; display: flex; align-items: center; gap: 12px; }
.auth-lockup strong { display: block; font-size: 16px; }
.auth-lockup span, .auth-pitch li { color: #c5ccd6; }
.auth-mark {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700;
}
.auth-pitch h1 { margin: 0 0 18px; max-width: 16ch; font-size: 40px; color: #fff; }
.auth-pitch ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.auth-pitch li { padding-left: 16px; position: relative; }
.auth-pitch li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 7px; height: 7px; border-radius: 99px; background: var(--primary);
}
.auth-panel { display: grid; place-items: center; padding: 32px 24px; }
.auth-form { width: min(400px, 100%); }
.auth-form h2 { margin: 0; font-size: 28px; }
.auth-form > p { margin: 8px 0 18px; color: var(--muted); }
.auth-form label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.auth-label-row a { color: var(--primary); font-size: 13px; font-weight: 600; }
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
}
.auth-form input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
.auth-password { position: relative; }
.auth-password input { padding-right: 72px; }
.auth-reveal {
  position: absolute; top: 4px; right: 4px;
  min-width: 56px; min-height: 36px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-weight: 600; cursor: pointer;
}
.auth-reveal:hover, .auth-reveal:focus-visible { color: var(--ink); background: var(--bg); }
.auth-check {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; margin-top: 8px;
  font-weight: 500; cursor: pointer;
}
.auth-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.auth-submit { width: 100%; min-height: 44px; margin-top: 8px; border: 0; border-radius: 12px; cursor: pointer; }
.auth-submit:active { transform: scale(0.99); }
.auth-error, .auth-status { margin: 8px 0 0; font-size: 14px; }
.auth-error { color: #b42318; }
.auth-status { padding: 10px 12px; border-radius: 12px; background: #e8f7ee; color: #157347; }
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { justify-content: flex-start; gap: 16px; padding: 24px 20px 0; background: transparent; color: var(--ink); }
  .auth-lockup { position: static; }
  .auth-lockup span { color: var(--muted); }
  .auth-pitch { display: none; }
  .auth-panel { align-items: start; padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-submit:active { transform: none; }
}

.wa-layout { display: grid; grid-template-columns: 340px 1fr; gap: 14px; min-height: 70vh; }
.wa-list, .wa-thread { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wa-list-item { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.wa-list-item.is-active, .wa-list-item:hover { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.wa-thread-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.wa-messages { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow: auto; }
.wa-bubble { max-width: min(72%, 520px); padding: 10px 12px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.wa-bubble.out { align-self: flex-end; background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.wa-bubble.in { align-self: flex-start; }
.wa-bubble .time { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.pagination .page-link { border-radius: 999px; color: var(--ink); border-color: var(--line); background: var(--surface); }
.pagination .active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.ducon-panel-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.ducon-panel-title h2 { font-size: 18px; }
.qr-library { padding: 16px; }
.qr-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 14px; }
.qr-toolbar h2 { margin: 0; font-size: 18px; }
.qr-toolbar p { margin: 4px 0 0; color: var(--muted); }
.qr-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.qr-head h2 { margin: 0; font-size: 18px; }
.qr-head p { margin: 4px 0 0; color: var(--muted); }
.qr-search { margin-bottom: 14px; }
.qr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.qr-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  align-items: start;
}
.qr-card img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.qr-card-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.qr-card h3 { margin: 8px 0; font-size: 16px; letter-spacing: -0.02em; }
.qr-links { display: grid; gap: 4px; margin-bottom: 12px; }
.qr-links a, .qr-links span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qr-links a:hover { color: var(--primary); }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-view-toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
}
.qr-view-toggle a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px;
  border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 650;
}
.qr-view-toggle a.is-active { background: var(--ink); color: var(--bg); }
.qr-list-thumb {
  width: 56px; height: 56px; object-fit: contain; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
}
.qr-list-link {
  display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--muted); font-size: 12px;
}
a.qr-list-link:hover { color: var(--primary); }
.qr-scans { margin: 0 0 8px; color: var(--ink); font-size: 13px; font-weight: 600; }
.sidebar-scrim { display: none; }
.surface .data-table { box-shadow: none; border: 0; background: transparent; padding: 0; }
.surface.data-table { padding: 0; }

.filter-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.filter-grid > label, .filter-grid > .filter-actions { flex: 1 1 140px; min-width: 140px; }
.filter-grid > .filter-actions { flex: 0 0 auto; min-width: 0; }
.filter-grid label, .form-sheet label.form-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.filter-grid input, .filter-grid select, .form-sheet .form-control, .form-sheet .form-select, .thread-side .form-control {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
}
.filter-actions { display: flex; gap: 8px; align-items: end; }
.form-sheet { padding: 22px; }
.form-block { display: grid; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.form-block h2 { margin: 0; font-size: 16px; }
.form-sheet .form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-actions { display: flex; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.crm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-span { grid-column: 1 / -1; }
.crm-page-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.crm-page-title { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.crm-page-subtitle, .crm-eyebrow { color: var(--muted); }
.crm-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.crm-form-section { margin-top: 18px; }
.crm-form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.thread-layout.is-thread {
  grid-template-columns: minmax(0, 1fr) 320px;
}
.thread-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
  min-height: calc(100vh - 150px);
}
.thread-list, .thread-main, .thread-side { min-height: 70vh; display: flex; flex-direction: column; }
.thread-list { padding: 0; overflow: hidden; }
.thread-scroll { overflow: auto; flex: 1; }
.thread-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.thread-item.is-active, .thread-item:hover { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.thread-item strong { display: block; }
.thread-item small { color: var(--muted); }
.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 16px;
  max-height: 52vh;
  overflow: auto;
}
.bubble {
  max-width: min(78%, 560px);
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.bubble-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.bubble-text { white-space: pre-wrap; }
.bubble-text a { color: var(--primary-hover); font-weight: 600; text-decoration: underline; }
.bubble[data-type="interactive"] .bubble-text { line-height: 1.45; }
.bubble-media-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
.bubble-media-item {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 4px;
}
.bubble-media-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
}
.bubble-media-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
}
.bubble-media-link:hover { text-decoration: underline; }
.bubble-reactions {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}
.bubble-reactions-text {
  position: static;
  margin-top: 8px;
  pointer-events: auto;
}
.bubble-reaction-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, #000);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 15px;
  line-height: 1;
}
.bubble-copy {
  border: 0; background: transparent; color: var(--primary); font-weight: 600;
  font-size: 12px; cursor: pointer; padding: 0;
}
.template-fields { margin-top: 10px; }
.template-fields summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.bubble.out { align-self: flex-end; background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.bubble.in { align-self: flex-start; background: var(--surface); }
.bubble .meta { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.bubble .meta a { color: var(--primary); font-weight: 600; margin-left: 8px; text-decoration: none; }
.chat-media-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bubble-media {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble-media img,
.bubble-media video {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 280px;
  margin: 0;
  border-radius: 12px;
  background: #111;
}
.bubble-media audio { display: block; width: 100%; margin: 0; }
.bubble-media form { margin: 0; }
.bubble-media .meta { margin: 0; }
.chat-file {
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg); border: 1px dashed var(--line);
}
.chat-file strong { display: block; }
.chat-file span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.chat-photo {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.chat-photo img { margin-bottom: 0; }
.chat-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}
.chat-preview[hidden] { display: none !important; }
.chat-preview-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 10, 14, .82);
  cursor: zoom-out;
}
.chat-preview img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: auto;
  max-width: min(1100px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.chat-preview-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.composer { border-top: 1px solid var(--line); padding-top: 12px; }
.side-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.side-block span { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) {
  .thread-layout, .form-grid, .crm-form-grid { grid-template-columns: 1fr; }
  .thread-layout { min-height: 0; }
  .messages { max-height: none; }
}

@media (max-width: 1100px) {
  .qr-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid, .stat-grid.wa-summary, .ducon-grid.stats, .ducon-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .split, .lead-layout, .wa-layout, .ducon-grid.two { grid-template-columns: 1fr; }
  .fact-grid { grid-template-columns: 1fr 1fr; }
  .campaign-board, .job-sections, .wa-board, .wa-lower, .wa-insight-grid, .wa-split, .ops-columns, .home-qr-grid { grid-template-columns: 1fr; }
  .ops-tiles-ops { grid-template-columns: 1fr 1fr; }
  .ops-tiles { grid-template-columns: 1fr 1fr; }
  .wa-tools, .wa-steps { grid-template-columns: 1fr 1fr; }
  .wa-board-side { border-left: 0; border-top: 1px solid var(--line); }
  .job-record-head { flex-direction: column; }
  .record-hero { grid-template-columns: auto minmax(0, 1fr); }
  .record-hero .page-header-actions { grid-column: 1 / -1; }
}
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed; z-index: 40; transform: translateX(-105%);
    transition: transform .22s ease; width: 280px;
  }
  .app-sidebar.is-open { transform: none; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(16,20,28,.45); z-index: 35; }
  html.is-collapsed .brand-copy,
  html.is-collapsed .nav-label,
  html.is-collapsed .nav-link span,
  html.is-collapsed .side-profile .brand-copy { display: flex; }
  .command-trigger span, .command-trigger kbd, .user-chip-copy { display: none; }
  .command-trigger { min-width: 0; margin-left: auto; }
}
.wa-board { display: block; padding: 0; overflow: hidden; }
.wa-board-main { min-width: 0; }
.wa-board-main header { padding: 16px 16px 0; }
.wa-board-side { padding: 18px 18px 8px; background: var(--bg); border-left: 1px solid var(--line); }
.wa-board-side h2 { margin: 0 0 12px; font-size: 16px; }
.wa-board-side .wa-snap-hero {
  display: block; margin: 0 0 14px; padding: 0;
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  color: inherit; text-decoration: none;
}
.wa-snap-hero span, .wa-snap-meter-top { color: var(--muted); font-size: 12px; font-weight: 600; }
.wa-snap-hero strong { display: block; font-size: 32px; letter-spacing: -0.04em; line-height: 1.1; }
.wa-snap-hero small { color: var(--muted); }
.wa-snap-meter { margin-bottom: 12px; }
.wa-snap-meter-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.wa-snap-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); }
.wa-snap-bar .in { background: #1f8a4c; }
.wa-snap-bar .out { background: #c5ccd6; }
.wa-snap-bar .campaign { background: var(--primary); }
.wa-snap-list a, .wa-snap-list div {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none;
}
.wa-snap-list a:hover { color: var(--primary-hover); }
.wa-sync { display: grid; gap: 14px; }
.wa-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.wa-tool { display: grid; align-content: start; gap: 14px; }
.wa-tool-label { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.wa-tool h2 { margin: 4px 0 0; font-size: 18px; }
.wa-tool p { margin: 6px 0 0; color: var(--muted); }
.wa-tool-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wa-tool textarea {
    width: 100%;
    min-height: 72px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
    resize: vertical;
}
.contacts-page { display: flex; flex-direction: column; gap: 12px; }
.contacts-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
.contacts-bulk-bar[hidden] { display: none !important; }
.contacts-bulk-count { font-size: 13px; font-weight: 600; margin-right: 4px; }
.contacts-table-wrap .table-scroll {
  max-height: min(70vh, 820px);
  overflow: auto;
}
.contacts-table-wrap .table-scroll > table.contacts-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}
.contacts-table col.col-check { width: 44px; }
.contacts-table col.col-contact { width: 18%; }
.contacts-table col.col-phone { width: 14%; }
.contacts-table col.col-chats { width: 7%; }
.contacts-table col.col-type { width: 11%; }
.contacts-table col.col-campaign { width: 14%; }
.contacts-table col.col-latest { width: 16%; }
.contacts-table col.col-actions { width: 12%; }
.contacts-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}
.contacts-table th,
.contacts-table td {
  vertical-align: middle;
  padding: 12px 12px;
}
.contacts-table th.num,
.contacts-table td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.contacts-table th.actions-head,
.contacts-table td.contacts-actions {
  text-align: right;
  white-space: nowrap;
}
.contacts-check {
  text-align: center;
  padding-left: 12px;
  padding-right: 8px;
}
.contacts-table .contacts-check input {
  margin: 0;
  vertical-align: middle;
}
.contacts-row.is-clickable { cursor: pointer; }
.contacts-row.is-clickable:hover td {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.contact-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.contact-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.contact-name {
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 220px);
}
.contact-io {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.phone-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.contact-campaign {
  display: block;
  color: color-mix(in srgb, var(--primary) 80%, #fff);
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.contact-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.contact-badge.is-linked {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
}
.contact-badge.is-warn {
  color: #c9862a;
  border-color: color-mix(in srgb, #c9862a 40%, var(--line));
}
.contacts-link {
  display: inline;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}
.contacts-link + .contacts-link { margin-left: 12px; }
.contacts-link:hover { color: var(--ink); text-decoration: underline; }
.contacts-link.primary { color: var(--primary); }
.contacts-link.primary:hover { color: var(--primary-hover); }
.table-sort {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}
.table-sort:hover { color: var(--primary); }
.contact-kind,
.contact-campaign-form { display: block; margin: 0; }
.contact-kind select.is-saved,
.contact-campaign-form select.is-saved {
  outline: 1px solid color-mix(in srgb, var(--primary) 50%, transparent);
}
.contact-kind select,
.contact-campaign-form select {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.2;
}
.conversation-campaign-form select {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
.wa-tool select {
  min-width: 160px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
}
.wa-check { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--ink); }
.wa-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.wa-channel { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); }
.wa-channel + .wa-channel { margin-top: 12px; }
.wa-channel-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.wa-channel-head strong { display: block; }
.wa-channel-head span { color: var(--muted); font-size: 13px; }
.wa-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.wa-step { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.wa-step-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.wa-step-name { font-size: 13px; font-weight: 650; }
.wa-step-time { margin-top: 8px; color: var(--muted); font-size: 13px; }
.wa-step-state { border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 650; text-transform: capitalize; }
.wa-step-state.is-ok { background: #e8f7ee; color: #157347; }
.wa-step-state.is-run { background: #e7f0ff; color: #1d4f91; }
.wa-step-state.is-fail { background: #fdecec; color: #b42318; }
.wa-step-state.is-wait { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
html[data-theme="dark"] .wa-step-state.is-ok { background: #143226; color: #8ee0ad; }
html[data-theme="dark"] .wa-step-state.is-run { background: #1a2740; color: #b9d4ff; }
html[data-theme="dark"] .wa-step-state.is-fail { background: #3a1d1d; color: #ffb4b4; }
.wa-step-error { padding: 12px 16px; background: #fff6f5; color: #b42318; border-top: 1px solid #f3d4d0; }
html[data-theme="dark"] .wa-step-error { background: #3a1d1d; color: #ffd0d0; border-top-color: #6b2a2a; }
.wa-sync-foot { margin: 0; color: var(--muted); font-size: 13px; }
.wa-sync-foot code { color: var(--ink); }
.page-loader {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}
.page-loader.is-on { display: flex; }
.page-loader-bar {
  position: absolute; top: 0; left: 0; height: 3px; width: 40%;
  background: var(--primary);
  animation: page-loader-bar 1.05s ease-in-out infinite;
}
.page-loader-card {
  display: grid; justify-items: center; gap: 8px;
  min-width: 220px; padding: 22px 26px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); text-align: center;
}
.page-loader-card strong { font-size: 16px; }
.page-loader-card span { color: var(--muted); font-size: 13px; }
.page-loader-spin {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  animation: page-loader-spin .7s linear infinite;
}
@keyframes page-loader-spin { to { transform: rotate(360deg); } }
@keyframes page-loader-bar {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(280%); }
}
.wa-sync-overlay {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; background: rgba(16, 20, 28, .55);
}
.wa-sync-overlay.is-on { display: flex; }
.wa-sync-dialog {
  display: flex; gap: 14px; align-items: center;
  width: min(420px, calc(100% - 32px));
  padding: 18px 20px; border-radius: 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.wa-sync-dialog p { margin: 4px 0 0; color: var(--muted); }
.wa-table-scroll { max-height: 460px; overflow: auto; }
.wa-table { width: 100%; }
.wa-table th { position: sticky; background: var(--surface); z-index: 1; }
.wa-table .wa-head-group th { top: 0; }
.wa-table .wa-head-sub th { top: 34px; font-size: 12px; color: var(--muted); font-weight: 600; }
.wa-daily .wa-group-chats,
.wa-daily .wa-group-messages,
.wa-daily .wa-group-volume { border-left: 2px solid var(--line); }
.wa-daily .wa-group-people { border-left: 3px solid var(--primary); }
.wa-volume { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.wa-volume .progress { flex: 1; }
.wa-volume span { width: 36px; text-align: right; font-size: 12px; color: var(--muted); }
.wa-day { font-weight: 650; white-space: nowrap; }
.wa-name { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-lower, .wa-insight-grid { display: grid; gap: 14px; }
.wa-lower { grid-template-columns: 1fr 1fr; }
.wa-insight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wa-insight { display: grid; gap: 14px; }
.wa-insight-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-insight-nav a {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650; text-decoration: none;
}
.wa-insight-nav a.is-active, .wa-insight-nav a:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.wa-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 14px; align-items: start; }
.wa-split.wa-insight-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wa-insight-charts .chart-card { min-width: 0; }
.wa-insight-charts .chart-canvas { min-height: 300px; }
.wa-meter-list { display: grid; gap: 12px; }
.wa-meter-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 14px; }
.wa-meter-top span { color: var(--muted); }
.wa-meter-bar { height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); }
.wa-meter-bar i { display: block; height: 100%; background: var(--primary); }
.wa-meter-bar i.good { background: #1f8a4c; }
.wa-meter-bar i.warn { background: #d97706; }
.wa-meter-bar i.bad { background: #c24141; }
.wa-note { margin: 14px 0 0; color: var(--muted); }
.home-band { margin-top: 14px; }
.page-header-actions { flex-wrap: wrap; justify-content: flex-end; }
.sf-switch, .kind-switch {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.thread-side .kind-switch, .wa-info .kind-switch { width: 100%; margin-bottom: 14px; }
.thread-side .kind-switch button, .wa-info .kind-switch button { flex: 1; }
.sf-switch span { padding: 0 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.sf-filters { flex-wrap: wrap; overflow: visible; }
.sf-filters > input[type="search"] {
  flex: 1 1 240px;
  width: auto;
  min-width: 0;
  max-width: 100%;
}
.sf-filters > select {
  flex: 0 0 190px;
  width: 190px;
  min-width: 160px;
  max-width: 190px;
}
.sf-board .table-scroll > table { width: 100%; }
.sf-board th:last-child, .sf-board td:last-child { text-align: right; white-space: nowrap; }
.sf-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600; }
.sf-detail { max-width: 280px; }
.sf-modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 24px;
}
.sf-modal[hidden] { display: none !important; }
.sf-modal-backdrop {
  position: absolute; inset: 0; border: 0; padding: 0;
  background: rgba(8, 10, 14, .72); cursor: pointer;
}
.sf-modal-card {
  position: relative; z-index: 1; width: min(460px, 100%);
  padding: 18px; border-radius: 16px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.sf-modal-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sf-modal-card h2 { margin: 0; font-size: 18px; }
.sf-modal-card header button {
  width: 32px; height: 32px; border: 0; border-radius: 999px;
  background: var(--bg); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
}
.sf-modal-lead { margin: 8px 0 0; color: var(--muted); }
.sf-modal-list { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; }
.sf-modal-list li {
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); font-size: 14px;
}
.sf-modal-note { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.sf-modal-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.sf-modal-actions form { margin: 0; }
.sf-modal-actions button:disabled { opacity: .45; cursor: default; }
.sf-upload { display: block; margin: 12px 0 4px; }
.sf-upload input { width: 100%; color: var(--ink); }
a.stat-card.is-on { box-shadow: inset 0 0 0 2px var(--primary); }
.surface:not(.data-table):not(.users-board):not(.campaign-people) > .table-scroll { margin: 4px -16px -8px; }
.home-links { display: flex; gap: 14px; flex-wrap: wrap; }
.home-qr-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(240px, .65fr); gap: 18px; align-items: start; }
.home-qr-grid h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.ops-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.ops-tiles-two { grid-template-columns: repeat(2, minmax(160px, 240px)); }
.ops-tiles-ops { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 8px; }
.ops-tile {
  display: grid; gap: 2px; padding: 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); color: inherit; text-decoration: none;
}
.ops-tile:hover { border-color: var(--primary); }
.ops-tile strong { font-size: 20px; letter-spacing: -0.03em; }
.ops-tile span { color: var(--muted); font-size: 12px; }
.ops-columns h3, .ops-subhead { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.ops-subhead { margin-top: 16px; }
.ops-rank { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; margin-bottom: 10px; }
.ops-rank span { display: block; color: var(--muted); font-size: 12px; }
.ops-rank i { grid-column: 1 / -1; display: block; height: 6px; border-radius: 99px; background: var(--primary); }
.wa-insight-card {
  display: grid; gap: 4px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
}
.wa-insight-card:hover { border-color: var(--primary); }
.wa-insight-card span { color: var(--muted); font-size: 12px; font-weight: 650; }
.wa-insight-card strong { font-size: 26px; letter-spacing: -0.04em; }
.wa-insight-card small { color: var(--muted); }
@media (max-width: 720px) {
  .stat-grid, .stat-grid.wa-summary, .stat-grid.users-stats, .ducon-grid.stats, .detail-grid, .qr-grid, .fact-grid, .wa-tools, .wa-steps { grid-template-columns: 1fr; }
  .users-toolbar { grid-template-columns: 1fr; }
  .wa-channel-head { flex-direction: column; align-items: flex-start; }
  .qr-toolbar, .qr-card, .qr-head { display: grid; grid-template-columns: 1fr; }
  .app-content { padding: 14px; }
  .desktop-table { display: none; }
  .mobile-cards { display: grid; gap: 10px; }
  .lead-card { padding: 14px; }
}

.app-shell:has(.wa-screen) { height: 100dvh; overflow: hidden; }
.app-main:has(.wa-screen) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-main:has(.wa-screen) > .app-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.wa-screen {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  background: var(--bg);
}
.wa-screen.has-chat { grid-template-columns: 340px minmax(0, 1fr) 280px; }
.wa-chat-pane { display: contents; }
.wa-rail, .wa-stage, .wa-info { min-height: 0; min-width: 0; }
.wa-stage.is-loading { position: relative; pointer-events: none; }
.wa-stage.is-loading > :not(.wa-stage-loading):not(.wa-stage-empty) { opacity: 0.45; }
.wa-stage-loading {
  position: absolute;
  inset: auto 16px 16px auto;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.wa-rail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.wa-rail-head, .wa-chat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.wa-rail-head { justify-content: space-between; }
.wa-rail-head strong, .wa-chat-bar strong { font-size: 16px; }
.wa-rail-head span, .wa-chat-bar > div > span { color: var(--muted); font-size: 12px; }
.wa-rail-head div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.wa-chat-bar > div:first-of-type { display: grid; min-width: 0; flex: 1; }
.wa-chat-bar { justify-content: space-between; }
.wa-chat-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.wa-chat-actions .status-badge { white-space: nowrap; }
.wa-chat-bar strong, .wa-chat-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-back { display: none; color: var(--primary); font-weight: 650; font-size: 13px; }
.wa-rail-filters { display: grid; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.wa-rail-filters input, .wa-rail-filters select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
}
.wa-rail-filters details { display: grid; gap: 8px; }
.wa-rail-filters summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 650; }
.wa-rail-filters label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.wa-rail-filter-actions { display: flex; gap: 8px; }
.wa-rail-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
.wa-rail-empty { margin: 0; padding: 18px 14px; color: var(--muted); }
.wa-chat {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.wa-chat:hover, .wa-chat.is-active { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.wa-chat.is-active { box-shadow: inset 3px 0 0 var(--primary); }
.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary);
  font-weight: 700;
}
.wa-chat-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.wa-chat-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wa-chat-top time, .wa-chat small { color: var(--muted); font-size: 12px; }
.wa-chat-meta { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.wa-unread-pill {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.wa-chat.is-unread strong { font-weight: 700; }
.wa-unread-divider {
  display: grid;
  place-items: center;
  margin: 8px 0 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wa-unread-divider::before,
.wa-unread-divider::after {
  content: "";
  width: 100%;
  height: 1px;
  background: color-mix(in srgb, var(--primary) 35%, var(--line));
}
.wa-unread-divider {
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
}
.wa-load-older {
  display: flex;
  justify-content: center;
  padding: 4px 0 10px;
}
.wa-chat small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-rail .inbox-pager { flex: 0 0 auto; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.wa-rail .pagination { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.wa-rail .page-link { min-width: 28px; height: 28px; padding: 0 6px; font-size: 12px; }
.wa-stage {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.wa-stage-empty {
  margin: auto;
  max-width: 360px;
  text-align: center;
  color: var(--muted);
}
.wa-stage-empty h2 { margin: 0 0 6px; color: var(--ink); font-size: 22px; }
.wa-stage .messages {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  padding: 16px;
}
.wa-stage .messages::before { content: ""; flex: 1 0 0; }
.wa-stage .composer { flex: 0 0 auto; margin-top: 0; padding: 10px 14px 12px; background: var(--surface); }
.wa-stage .composer textarea { min-height: 52px; max-height: 96px; }
.wa-stage .composer .form-label { margin-bottom: 2px; font-size: 12px; }
.wa-stage .composer .form-grid { margin-top: 8px; }
.wa-stage .composer .text-muted { font-size: 12px; }
.wa-stage > .alert { margin: 12px 16px 0; }
.wa-info {
  overflow: auto;
  padding: 14px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.wa-info .side-block { padding: 10px 0; }
.wa-info a, .wa-info strong, .wa-info small, .wa-info span {
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media (max-width: 980px) {
  .app-shell:has(.wa-screen),
  .app-main:has(.wa-screen) { height: auto; max-height: none; overflow: visible; }
  .app-main:has(.wa-screen) > .app-content { overflow: visible; }
  .wa-screen, .wa-screen.has-chat { display: flex; flex-direction: column; min-height: calc(100dvh - 64px); }
  .wa-screen:not(.has-chat) .wa-stage { display: none; }
  .wa-screen.has-chat .wa-rail { display: none; }
  .wa-screen.has-chat .wa-stage { min-height: 70vh; }
  .wa-back { display: inline-flex; }
  .wa-info { border-left: 0; border-top: 1px solid var(--line); }
}
