/* HiveBrain Voice Dashboard Pro — Sidebar Edition (responsive)
   © 2021-2026 by HiveBrain Synthetic Intelligence Group. ALL RIGHTS RESERVED INTERNATIONALLY. */

:root {
  --hb-orange:      #E8611A;
  --hb-orange-dark: #C04E10;
  --hb-navy:        #1E3A5F;
  --hb-navy-light:  #2A4F7E;
  --hb-text:        #1E3A5F;
  --hb-muted:       #64748B;
  --hb-subtle:      #94A3B8;
  --hb-border:      #E2E8F0;
  --hb-bg:          #F5F7FA;
  --hb-surface:     #F0F3F7;
  --hb-card:        #FFFFFF;
}

#hivebrain-root,
#hivebrain-root * { box-sizing: border-box; }

#hivebrain-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--hb-text);
  background: var(--hb-bg);
  margin: -10px -20px -65px -22px;
  min-height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
  #hivebrain-root { margin: -10px -10px -50px -10px; }
}

#hivebrain-root .hb-shell {
  display: flex;
  min-height: calc(100vh - 32px);
  max-width: 1200px;
  margin: 0 auto;
  background: var(--hb-bg);
}

/* ── Sidebar ── */
.hb-sidebar {
  width: 230px; min-width: 230px;
  background: var(--hb-navy);
  color: #fff;
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.hb-side-brand {
  padding: 16px 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
}
.hb-side-logo {
  width: 160px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.hb-side-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.hb-side-section {
  font-size: 9px; font-weight: 600;
  color: rgba(255,255,255,.40);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 10px 6px;
}
.hb-side-divider {
  height: 1px;
  background: rgba(255,255,255,.10);
  margin: 12px 6px 6px;
}
.hb-side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 6px;
  cursor: pointer; font-size: 13px;
  color: rgba(255,255,255,.70);
  margin-bottom: 1px; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.hb-side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.hb-side-link.active { background: var(--hb-orange); color: #fff !important; }
.hb-side-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border-radius: 6px;
  font-size: 14px;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}
/* Bold green plus for Submit Support Ticket */
.hb-icon-plus {
  font-size: 22px;
  font-weight: 900;
  color: #16A34A;
  line-height: 1;
}
.hb-side-label { flex: 1; }
.hb-side-foot {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: center;
}
.hb-side-version {
  display: inline-block;
  font-family: monospace;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.08);
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 6px;
  letter-spacing: .03em;
}
.hb-side-foot-brand {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
  margin: 4px 0 4px;
  line-height: 1;
}
.hb-side-foot-group {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  letter-spacing: .01em;
  margin: 2px 0 6px;
  line-height: 1.2;
  white-space: nowrap;
}
.hb-side-foot-copy {
  font-size: 9px;
  color: rgba(255,255,255,.40);
  line-height: 1.7;
}

/* ── Main column ── */
.hb-main {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
  background: var(--hb-bg);
}
.hb-topbar {
  background: #fff;
  border-bottom: 1px solid var(--hb-border);
  padding: 0 22px;
  height: 60px;
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
}
.hb-menu-btn {
  display: none;
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--hb-navy);
  padding: 4px 8px; border-radius: 6px;
  line-height: 1;
}
.hb-menu-btn:hover { background: var(--hb-surface); }
.hb-topbar-titles { flex: 1; min-width: 0; }
.hb-topbar-title {
  font-size: 16px; font-weight: 600; color: var(--hb-navy);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hb-topbar-sub {
  font-size: 11px; color: var(--hb-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hb-topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hb-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ccc; display: inline-block;
  margin-right: 4px; transition: background .3s;
}
.hb-status-dot.ok { background: #3DBE6E; }
.hb-status-dot.err { background: #E24B4A; }
.hb-status-dot.loading { background: #F5A623; }
.hb-status-label { font-size: 12px; color: var(--hb-muted); }

.hb-content { flex: 1; overflow: auto; padding: 22px 24px; }

/* ── Metrics ── */
.hb-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.hb-metric {
  background: var(--hb-card);
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 14px 16px;
}
.hb-metric-label {
  font-size: 10px; color: var(--hb-muted);
  margin-bottom: 6px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.hb-metric-value {
  font-size: 24px; font-weight: 600; color: var(--hb-navy);
  line-height: 1.1;
}
.hb-metric-value.accent { color: var(--hb-orange); }

/* ── Section header ── */
.hb-section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.hb-section-title {
  font-size: 11px; font-weight: 600; color: var(--hb-muted);
  text-transform: uppercase; letter-spacing: .07em;
}

/* ── Toolbar (search + date filters) ── */
.hb-toolbar {
  display: flex; gap: 8px; margin-bottom: 12px;
  align-items: center; flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.hb-search-input {
  flex: 1; min-width: 240px;
  padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--hb-border); border-radius: 6px;
  background: #fff; color: var(--hb-navy);
  font-family: inherit;
}
.hb-search-input:focus { outline: none; border-color: var(--hb-orange); }
.hb-toolbar input[type=date] {
  padding: 7px 10px; font-size: 12px;
  border: 1px solid var(--hb-border); border-radius: 6px;
  background: #fff; color: var(--hb-navy);
  font-family: inherit;
}
.hb-toolbar input[type=date]:focus { outline: none; border-color: var(--hb-orange); }
.hb-toolbar-lbl {
  font-size: 11px; color: var(--hb-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}

/* ── Buttons ── */
.hb-btn {
  padding: 7px 13px;
  border: 1px solid var(--hb-border); border-radius: 6px;
  background: #fff; color: var(--hb-navy);
  font-size: 12px; cursor: pointer; font-family: inherit;
  font-weight: 500;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  text-decoration: none !important;
  display: inline-flex; align-items: center; gap: 4px;
}
.hb-btn:hover { background: var(--hb-surface); }
.hb-btn:disabled { opacity: .4; cursor: default; }

/* ── Table ── */
.hb-table-wrap {
  background: var(--hb-card);
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  overflow: hidden;
}
.hb-table-wrap table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.hb-table-wrap thead th {
  padding: 10px 14px; text-align: left;
  font-size: 10px; font-weight: 600; color: var(--hb-subtle);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--hb-border);
  background: #F8FAFC;
  white-space: nowrap;
}
.hb-table-wrap tbody tr {
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer; transition: background .1s;
}
.hb-table-wrap tbody tr:last-child { border-bottom: none; }
.hb-table-wrap tbody tr:hover { background: #FFF7F3; }
.hb-table-wrap tbody tr.archived { opacity: .55; }
.hb-table-wrap td { padding: 11px 14px; color: var(--hb-navy); vertical-align: middle; }

/* ── Pills ── */
.hb-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 10px; font-weight: 600;
  white-space: nowrap;
}
.hb-pill-ok   { background: #ECFDF5; color: #059669; }
.hb-pill-miss { background: #FFF7ED; color: #C2410C; }
.hb-pill-arch { background: #F1F5F9; color: #475569; }
.hb-pill-dot  { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.hb-mono { font-family: monospace; font-size: 11px; color: var(--hb-subtle); }

/* ── Row actions — large filled icon buttons ── */
.hb-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.hb-act-btn {
  width: 50px; height: 50px;
  padding: 6px;
  border: 1px solid var(--hb-border);
  background: #fff;
  cursor: pointer;
  color: #1A1A1A;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.hb-act-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}
.hb-act-btn:hover {
  color: #000;
  background: var(--hb-surface);
  border-color: var(--hb-subtle);
}
.hb-act-btn.hb-danger { color: #1A1A1A; }
.hb-act-btn.hb-danger:hover {
  color: #DC2626;
  background: #FEF2F2;
  border-color: #FECACA;
}

.hb-empty { padding: 50px 20px; text-align: center; color: var(--hb-subtle); font-size: 13px; }
.hb-error { color: #DC2626; }

.hb-pag {
  display: flex; gap: 10px;
  justify-content: flex-end; align-items: center;
  margin-top: 14px;
}
.hb-pag-info { font-size: 12px; color: var(--hb-muted); font-weight: 500; }

.hb-no-key {
  background: #FFF7ED; border: 1px solid #FED7AA;
  border-radius: 10px; padding: 16px 20px;
  font-size: 13px; color: #92400E;
}
.hb-no-key a { color: var(--hb-orange); font-weight: 600; }

.hb-chart-card {
  background: var(--hb-card);
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 16px 18px;
}
.hb-chart-card h3 {
  font-size: 11px; font-weight: 600;
  color: var(--hb-muted); text-transform: uppercase;
  letter-spacing: .06em; margin: 0 0 14px;
}

/* ── Slide-out panel ── */
.hb-panel-overlay {
  position: fixed; inset: 0;
  background: rgba(20,40,68,.30); z-index: 999998;
  display: none;
}
.hb-panel-overlay.on { display: block; }
.hb-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 100vw;
  background: #fff;
  border-left: 1px solid var(--hb-border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 999999;
  box-shadow: -4px 0 28px rgba(0,0,0,.12);
}
.hb-panel.open { transform: translateX(0); }
.hb-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hb-border);
  display: flex; align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #F8FAFC;
}
.hb-panel-title { font-size: 14px; font-weight: 600; color: var(--hb-navy); }
.hb-panel-actions { display: flex; gap: 4px; align-items: center; }
.hb-close-btn {
  background: none; border: 1px solid transparent;
  font-size: 18px; cursor: pointer;
  color: var(--hb-muted); line-height: 1;
  padding: 4px 8px; border-radius: 6px;
}
.hb-close-btn:hover { background: #E2E8F0; color: var(--hb-navy); }
.hb-panel-meta {
  padding: 12px 18px;
  border-bottom: 1px solid var(--hb-border);
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; flex-shrink: 0;
  background: #F8FAFC;
}
.hb-meta-key {
  font-size: 9px; color: var(--hb-subtle);
  margin-bottom: 3px; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 600;
}
.hb-meta-val { font-size: 13px; font-weight: 600; color: var(--hb-navy); }
.hb-summary-box {
  margin: 12px 18px 0;
  padding: 10px 14px;
  background: #FFF7ED; border: 1px solid #FED7AA;
  border-radius: 8px; font-size: 12px; color: #92400E;
  line-height: 1.5; flex-shrink: 0;
}
.hb-tx-label {
  padding: 10px 18px;
  border-bottom: 1px solid var(--hb-border);
  font-size: 10px; font-weight: 600; color: var(--hb-subtle);
  text-transform: uppercase; letter-spacing: .07em; flex-shrink: 0;
}
.hb-tx-area {
  flex: 1; overflow-y: auto;
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.hb-msg { max-width: 90%; }
.hb-msg-agent { align-self: flex-start; }
.hb-msg-user  { align-self: flex-end; }
.hb-bubble {
  padding: 9px 13px; border-radius: 14px;
  font-size: 13px; line-height: 1.5;
}
.hb-msg-agent .hb-bubble {
  background: #F1F5F9; border: 1px solid var(--hb-border);
  border-bottom-left-radius: 3px; color: var(--hb-navy);
}
.hb-msg-user .hb-bubble {
  background: var(--hb-orange); color: #fff;
  border-bottom-right-radius: 3px;
}
.hb-msg-label {
  font-size: 9px; color: var(--hb-subtle);
  margin-bottom: 3px; padding: 0 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.hb-msg-user .hb-msg-label { text-align: right; }

.hb-settings-card {
  background: var(--hb-card);
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 22px 24px;
}
.hb-settings-card h2 {
  font-size: 14px; margin: 0 0 16px;
  padding: 0; border: none;
  color: var(--hb-navy);
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */

/* On medium screens, narrow sidebar slightly to give content more room */
@media (max-width: 1100px) {
  .hb-metrics { grid-template-columns: repeat(2, 1fr); }
  .hb-sidebar { width: 200px; min-width: 200px; }
  .hb-side-logo { width: 130px; }
  .hb-side-brand { padding: 14px 8px 10px; }
}

/* Tablet/mobile breakpoint: sidebar slides out, hamburger appears */
@media (max-width: 900px) {
  .hb-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 99990;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
    width: 250px; min-width: 250px;
  }
  /* Inside WP admin (with admin bar) push sidebar down 32px / 46px */
  body.admin-bar:not(.hivebrain-fe) .hb-sidebar { top: 32px; }
  @media (max-width: 782px) {
    body.admin-bar:not(.hivebrain-fe) .hb-sidebar { top: 46px; }
  }
  .hb-sidebar.open { transform: translateX(0); }
  .hb-menu-btn { display: inline-flex; }
  .hb-content { padding: 14px 16px; }
  .hb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hb-table-wrap table { min-width: 640px; }
  .hb-toolbar { padding: 8px; }
  .hb-search-input { min-width: 100%; flex-basis: 100%; }
  .hb-status-label { display: none; }
  .hb-side-foot { font-size: 8.5px; }
  #hivebrain-root { margin: 0; }
}

@media (max-width: 600px) {
  .hb-metrics { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hb-metric { padding: 10px 12px; }
  .hb-metric-value { font-size: 20px; }
  .hb-topbar { padding: 0 14px; gap: 10px; height: 54px; }
  .hb-topbar-title { font-size: 14px; }
  .hb-topbar-sub { font-size: 10px; }
  .hb-content { padding: 12px; }
  .hb-panel { width: 100vw; }
  .hb-section-header { flex-direction: column; align-items: flex-start; }
  .hb-table-wrap table { min-width: 540px; }
}

/* ── Frontend (shortcode) full-width breakout ──
   Uses negative margins to escape theme content containers.
   100vw includes the scrollbar width on most platforms — using a slight
   subtraction prevents horizontal overflow. */
/* ── Frontend client portal: full-screen takeover ───────────────────────────
   When the JS detects a FRONTEND mount, it reparents #hivebrain-root onto the
   body and adds .hivebrain-takeover. We then pin the dashboard fixed across
   the entire viewport, leaving room only for the WP admin bar if visible. */
.hivebrain-frontend-wrap { display: contents; }

#hivebrain-root.hivebrain-takeover {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
  background: var(--hb-bg);
  z-index: 99990;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
}

/* If the WP admin bar is visible (logged-in users), leave its 32px reserved */
body.hb-has-admin-bar #hivebrain-root.hivebrain-takeover {
  top: 32px !important;
  height: calc(100vh - 32px) !important;
}
@media screen and (max-width: 782px) {
  body.hb-has-admin-bar #hivebrain-root.hivebrain-takeover {
    top: 46px !important;
    height: calc(100vh - 46px) !important;
  }
}

/* Inside the takeover, the shell fills the entire dashboard viewport */
#hivebrain-root.hivebrain-takeover .hb-shell {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  flex: 1;
  overflow: hidden;
  box-sizing: border-box;
}

#hivebrain-root.hivebrain-takeover .hb-main {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

#hivebrain-root.hivebrain-takeover .hb-content {
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 100%;
  flex: 1;
  box-sizing: border-box;
}

/* Body lock when takeover is active */
body.hivebrain-fe-active {
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Frontend mobile: sidebar starts at top:0 (no admin bar for visitors) */
.hivebrain-frontend-wrap .hb-sidebar { top: 0 !important; }

/* Legacy hivebrain-frontend class — kept for any code paths that didn't
   migrate to the takeover yet. Make it a no-op rather than a constraint. */
#hivebrain-root.hivebrain-frontend:not(.hivebrain-takeover) {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  background: var(--hb-bg);
  display: block;
  box-sizing: border-box;
}

/* When the shortcode is on a page, hide the WordPress page title since the
   dashboard topbar already shows Call History · Client · Agent. Most themes
   use one of these selectors for the page title — we cover all common cases. */
body.hivebrain-fe .entry-title,
body.hivebrain-fe .page-title,
body.hivebrain-fe .post-title,
body.hivebrain-fe header.entry-header,
body.hivebrain-fe .wp-block-post-title,
body.hivebrain-fe h1.entry-title,
body.hivebrain-fe h1.page-title,
body.hivebrain-fe .page-header,
body.hivebrain-fe .post-header,
body.hivebrain-fe .single-post-header,
body.hivebrain-fe .header-area,
body.hivebrain-fe .single-page-title { display: none !important; }

/* Reset the theme's content container constraints so we can break out of them.
   These selectors cover the most common WP themes (Twenty Twenty-Three through
   Twenty Twenty-Four, Astra, GeneratePress, Hello Elementor, Storefront, etc). */
body.hivebrain-fe .site-main,
body.hivebrain-fe .entry-content,
body.hivebrain-fe .post-content,
body.hivebrain-fe .page-content,
body.hivebrain-fe main#main,
body.hivebrain-fe main#primary,
body.hivebrain-fe #content,
body.hivebrain-fe .wp-site-blocks,
body.hivebrain-fe .is-layout-constrained,
body.hivebrain-fe .has-global-padding {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
body.hivebrain-fe article,
body.hivebrain-fe .post,
body.hivebrain-fe .page {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Bulk action bar (visible when items selected) */
.hb-bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--hb-navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}
.hb-bulk-bar.show { display: flex; }
.hb-bulk-count { font-weight: 600; flex: 1; }
.hb-bulk-bar button {
  padding: 6px 13px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
}
.hb-bulk-bar button:hover { background: rgba(255,255,255,.20); }
.hb-bulk-bar button.danger { background: rgba(220,38,38,.30); border-color: rgba(220,38,38,.50); }
.hb-bulk-bar button.danger:hover { background: rgba(220,38,38,.50); }

/* Selection checkboxes */
.hb-row-check, .hb-head-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--hb-orange);
}
.hb-table-wrap td.hb-check-cell,
.hb-table-wrap th.hb-check-cell {
  width: 36px;
  padding: 11px 10px 11px 14px;
  text-align: center;
}
.hb-table-wrap tbody tr.selected { background: #FFF7ED; }
.hb-table-wrap tbody tr.selected:hover { background: #FFEDD5; }

/* ── Edit Modal ── */
.hb-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,40,68,.45); z-index: 999998;
  display: none;
}
.hb-modal-overlay.on { display: block; }
.hb-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: 480px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(20,40,68,.30);
  z-index: 999999;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
}
.hb-modal.open {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.hb-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hb-border);
  display: flex; align-items: center; justify-content: space-between;
  background: #F8FAFC;
  border-radius: 12px 12px 0 0;
}
.hb-modal-title {
  font-size: 15px; font-weight: 600; color: var(--hb-navy);
}
.hb-modal-body {
  padding: 18px 20px; overflow-y: auto;
}
.hb-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--hb-border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: #F8FAFC;
  border-radius: 0 0 12px 12px;
}
.hb-field {
  margin-bottom: 14px;
}
.hb-field label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--hb-muted);
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.hb-field input, .hb-field textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid var(--hb-border); border-radius: 6px;
  background: #fff; color: var(--hb-navy);
  font-family: inherit;
  resize: vertical;
}
.hb-field input:focus, .hb-field textarea:focus {
  outline: none; border-color: var(--hb-orange);
}
.hb-btn-primary {
  background: var(--hb-orange); color: #fff !important;
  border-color: var(--hb-orange-dark) !important;
}
.hb-btn-primary:hover { background: var(--hb-orange-dark); }

/* ── Support Tickets ── */
.hb-support-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 16px;
}
.hb-support-form-card,
.hb-support-list-card {
  background: var(--hb-card);
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 22px 24px;
}
@media (max-width: 1100px) {
  .hb-support-grid { grid-template-columns: 1fr; }
}

.hb-tk-flash-ok {
  background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0;
  padding: 10px 14px; border-radius: 6px; margin-bottom: 14px;
  font-size: 13px;
}
.hb-tk-flash-err {
  background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA;
  padding: 10px 14px; border-radius: 6px; margin-bottom: 14px;
  font-size: 13px;
}

.hb-ticket {
  background: #F8FAFC;
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.hb-tk-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.hb-tk-uid {
  font-family: monospace;
  font-size: 12px; font-weight: 600;
  color: var(--hb-orange);
  margin-right: 8px;
}
.hb-tk-status-pill {
  display: inline-block;
  padding: 2px 8px; border-radius: 99px;
  font-size: 9px; font-weight: 700;
  letter-spacing: .04em;
  margin-right: 6px;
}
.hb-tk-pri {
  font-size: 9px; font-weight: 700;
  letter-spacing: .04em;
}
.hb-tk-when {
  font-size: 11px; color: var(--hb-muted);
}
.hb-tk-subject {
  font-size: 14px; font-weight: 600; color: var(--hb-navy);
  margin-bottom: 4px;
}
.hb-tk-meta {
  font-size: 11px; color: var(--hb-muted);
  margin-bottom: 10px;
}
.hb-tk-message {
  font-size: 12.5px; color: var(--hb-text);
  line-height: 1.6; padding: 10px 12px;
  background: #fff; border-radius: 6px;
  border: 1px solid var(--hb-border);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.hb-tk-pending {
  margin-top: 10px;
  font-size: 11px; color: var(--hb-muted);
  font-style: italic;
  padding: 6px 10px;
  border-left: 2px solid var(--hb-border);
}
.hb-tk-response {
  margin-top: 10px; padding: 10px 12px;
  background: #FFF7ED; border: 1px solid #FED7AA;
  border-radius: 6px;
}
.hb-tk-response-label {
  font-size: 9px; font-weight: 700;
  color: #C2410C;
  letter-spacing: .08em;
  margin-bottom: 5px;
}
.hb-tk-response-body {
  font-size: 12.5px; color: #92400E;
  line-height: 1.6;
  white-space: pre-wrap; word-wrap: break-word;
}
.hb-tk-response-when {
  margin-top: 6px;
  font-size: 10px; color: #C2410C;
  font-style: italic;
}
.hb-tk-admin-respond {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--hb-border);
}

/* ─────────────────────────────────────────────────────────────────
   Call list — card layout (replaces table for Call History/Archive)
   ───────────────────────────────────────────────────────────────── */
.hb-call-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hb-call-card {
  background: var(--hb-card);
  border: 1px solid var(--hb-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.hb-call-card:hover { background: #FFFCFA; border-color: #FED7AA; }
.hb-call-card.selected { background: #FFF7ED; border-color: #FED7AA; }
.hb-call-card.selected:hover { background: #FFEDD5; }
.hb-call-card.missed { border-left: 3px solid #C2410C; padding-left: 13px; }
.hb-call-card.archived { opacity: .6; }

.hb-call-card .hb-row-check {
  width: 18px; height: 18px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--hb-orange);
  margin: 0;
}

.hb-call-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--hb-orange);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hb-call-avatar.missed { background: #C2410C; }

.hb-call-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hb-call-row1 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.hb-call-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--hb-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.hb-call-when {
  font-size: 11px;
  color: var(--hb-subtle);
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
}
.hb-call-summary {
  font-size: 12.5px;
  color: var(--hb-muted);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.hb-call-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--hb-subtle);
  margin-top: 2px;
}
.hb-call-meta strong { color: var(--hb-muted); font-weight: 600; }
.hb-call-id { font-family: monospace; }

/* Toolbar select-all checkbox */
.hb-bar-check {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: var(--hb-orange);
  margin: 0 4px 0 2px;
}

/* Responsive — call cards on mobile stack the meta line */
@media (max-width: 700px) {
  .hb-act-btn { width: 56px; height: 56px; padding: 6px; }
  .hb-call-name { max-width: 180px; }
  .hb-call-when { font-size: 10px; }
}
@media (max-width: 480px) {
  .hb-act-btn { width: 48px; height: 48px; padding: 5px; }
  .hb-call-card { padding: 10px 12px; gap: 10px; }
  .hb-call-avatar { width: 36px; height: 36px; font-size: 12px; }
  .hb-call-name { font-size: 13px; max-width: 130px; }
  .hb-call-summary { font-size: 11.5px; }
  .hb-row-actions { gap: 4px; }
}

/* ── Ticket action buttons (archive/delete on each ticket card) ── */
.hb-tk-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hb-tk-act-btn {
  width: 36px; height: 36px;
  padding: 5px;
  border: 1px solid var(--hb-border);
  background: #fff;
  cursor: pointer;
  color: #1A1A1A;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.hb-tk-act-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}
.hb-tk-act-btn:hover {
  color: #000;
  background: var(--hb-surface);
  border-color: var(--hb-subtle);
}
.hb-tk-act-btn.hb-danger:hover {
  color: #DC2626;
  background: #FEF2F2;
  border-color: #FECACA;
}
.hb-ticket.archived { opacity: .6; }

/* ── Contact Preserve / Star ────────────────────────────────────────── */
.hb-star-cell {
  width: 38px;
  text-align: center;
  padding: 4px;
}
thead .hb-star-cell {
  font-size: 14px;
  color: var(--hb-subtle);
  font-weight: normal;
}
.hb-star-btn {
  width: 26px; height: 26px;
  border: 1.5px solid var(--hb-border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent; /* hides empty-state SVG until starred */
  transition: background .15s, border-color .15s, color .15s;
}
.hb-star-btn:hover {
  border-color: #16A34A;
  background: #F0FDF4;
}
.hb-star-btn.on {
  background: #F0FDF4;
  border-color: #16A34A;
  color: #16A34A;
}
.hb-star-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}
.hb-star-empty {
  display: block;
  width: 100%;
  height: 100%;
}
tr.starred {
  background: #F7FEF9;
}
tr.starred td {
  border-top: 1px solid #BBF7D0;
  border-bottom: 1px solid #BBF7D0;
}
tr.orphan {
  background: #FFFBEB;
}
.hb-orphan-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #C2410C;
  background: #FFEDD5;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
}

/* ── Pipeline status badges (cycle on click) ── */
.hb-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter .15s, transform .1s;
}
.hb-status-pill:hover { filter: brightness(1.05); transform: scale(1.04); }
.hb-status-new       { background: #F1F5F9; color: #64748B; border-color: #E2E8F0; }
.hb-status-contacted { background: #DBEAFE; color: #1D4ED8; border-color: #BFDBFE; }
.hb-status-quoted    { background: #FEF3C7; color: #B45309; border-color: #FDE68A; }
.hb-status-won       { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.hb-status-lost      { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }

/* ── Tag chips on call cards ── */
.hb-call-tags-row { margin-top: 4px; }
.hb-tag-chip {
  display: inline-block;
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #DBEAFE;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 10px;
  margin-right: 4px;
}

/* ── Business hours / after hours indicators ── */
.hb-bh-badge {
  display: inline-block;
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
}
.hb-ah-badge {
  display: inline-block;
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #E2E8F0;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
}
.hb-call-card.missed-bizhours { border-left-width: 4px; border-left-color: #DC2626; }

/* ── Meta editor (notes/tags/status) in transcript panel ── */
.hb-meta-editor {
  background: #F8FAFC;
  border: 1px solid var(--hb-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 14px 12px;
}
.hb-meta-editor-row { margin-bottom: 10px; }
.hb-meta-editor-row:last-child { margin-bottom: 0; }
.hb-meta-editor-row label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--hb-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.hb-meta-editor-row input,
.hb-meta-editor-row select,
.hb-meta-editor-row textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border: 1px solid var(--hb-border);
  border-radius: 5px;
  font-family: inherit;
  background: #fff;
  color: var(--hb-navy);
  resize: vertical;
}
.hb-meta-editor-row input:focus,
.hb-meta-editor-row select:focus,
.hb-meta-editor-row textarea:focus {
  outline: none;
  border-color: var(--hb-orange);
}
.hb-meta-editor-saved {
  font-size: 10px;
  font-weight: 600;
  height: 14px;
  margin-top: 4px;
}
.hb-meta-editor-saved.ok  { color: #059669; }
.hb-meta-editor-saved.err { color: #DC2626; }

/* ── Audit log rows ── */
.hb-au-rows {
  background: #fff;
  border: 1px solid var(--hb-border);
  border-radius: 8px;
  overflow: hidden;
}
.hb-au-row {
  display: grid;
  grid-template-columns: 130px 130px 160px 1fr 2fr;
  gap: 12px;
  padding: 9px 14px;
  font-size: 12px;
  border-bottom: 1px solid #F1F5F9;
  align-items: center;
}
.hb-au-row:last-child { border-bottom: none; }
.hb-au-row:hover { background: #F8FAFC; }
.hb-au-row.destructive { background: #FFFBEB; }
.hb-au-row.create { background: #F0FDF4; }
.hb-au-when { color: var(--hb-subtle); font-size: 11px; }
.hb-au-user { font-weight: 500; color: var(--hb-navy); }
.hb-au-action {
  font-family: monospace;
  font-size: 11px;
  color: var(--hb-orange);
  font-weight: 600;
  text-transform: capitalize;
}
.hb-au-tgt-pill {
  display: inline-block;
  background: #EFF6FF;
  color: #1E40AF;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-right: 4px;
}
.hb-au-tgt-id {
  font-family: monospace;
  font-size: 10.5px;
  color: var(--hb-muted);
}
.hb-au-details {
  color: var(--hb-subtle);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hb-au-row { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .hb-au-row > div { font-size: 11px; }
  .hb-au-details { grid-column: 1 / -1; white-space: normal; }
}

/* ── Inline "add" button for blank contact cells ── */
.hb-cell-add {
  font-size: 11px;
  color: var(--hb-orange);
  background: none;
  border: 1px dashed var(--hb-border);
  padding: 2px 8px;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.hb-cell-add:hover {
  background: #FFF7ED;
  border-color: var(--hb-orange);
  color: #C04E10;
}
