    :root {
      color-scheme: light;
      --bg: #eef2f6;
      --surface: #ffffff;
      --surface-2: #f8fafc;
      --ink: #101828;
      --muted: #667085;
      --line: #d8dee8;
      --green: #128c7e;
      --green-soft: #dff7ef;
      --blue: #1d4ed8;
      --blue-soft: #e0ecff;
      --amber: #b45309;
      --amber-soft: #fff3d6;
      --red: #b42318;
      --red-soft: #ffe4e1;
      --slate: #203040;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--ink);
      font-family: Arial, Helvetica, sans-serif;
      line-height: 1.4;
    }
    button, input, textarea, select { font: inherit; }
    .topbar {
      min-height: 74px;
      display: flex;
      justify-content: space-between;
      gap: 16px;
      align-items: center;
      padding: 16px 22px;
      background: #0b1f1d;
      color: #ffffff;
      border-bottom: 4px solid var(--green);
    }
    .topbar h1 {
      margin: 0;
      font-size: 24px;
      letter-spacing: 0;
    }
    .topbar p {
      margin: 4px 0 0;
      color: #c6d3dd;
      font-size: 13px;
    }
    .top-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .wa-labels-inline {
      display: inline-flex;
      gap: 6px;
      align-items: center;
      flex-wrap: wrap;
      max-width: min(520px, 48vw);
      justify-content: flex-end;
    }
    .wa-label-chip {
      min-height: 26px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 9px;
      border-radius: 999px;
      background: #eef4ff;
      border: 1px solid #d1e0ff;
      color: #1849a9;
      font-size: 12px;
      font-weight: 800;
      white-space: nowrap;
      max-width: 160px;
    }
    button.wa-label-chip {
      cursor: pointer;
      margin: 0;
    }
    .wa-label-chip.active {
      box-shadow: 0 0 0 2px var(--blue-soft);
      border-color: var(--blue);
      background: #dbeafe;
      color: var(--blue);
    }
    .wa-label-chip span {
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .wa-label-chip small {
      min-width: 18px;
      padding: 1px 5px;
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.08);
      color: inherit;
      font-size: 11px;
      text-align: center;
    }
    .wa-label-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: currentColor;
      flex: 0 0 auto;
    }
    .app-nav {
      display: flex;
      gap: 8px;
      padding: 10px 22px;
      background: #ffffff;
      border-bottom: 1px solid var(--line);
      overflow-x: auto;
    }
    .nav-button {
      min-height: 36px;
      border: 1px solid var(--line);
      background: #ffffff;
      color: #344054;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    .nav-button.active {
      border-color: var(--green);
      background: var(--green);
      color: #ffffff;
    }
    .nav-button.locked-feature {
      background: #f8fafc;
      color: #667085;
      border-color: #e4e7ec;
    }
    main {
      width: min(1440px, calc(100vw - 28px));
      margin: 16px auto 38px;
      display: grid;
      grid-template-columns: minmax(360px, 0.82fr) minmax(480px, 1.18fr);
      gap: 14px;
    }
    section, .stat, .panel {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    section { padding: 15px; }
    .wide { grid-column: 1 / -1; }
    .view { display: none !important; }
    .view.active { display: block !important; }
    .stats.view.active { display: grid !important; }
    .stats {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 10px;
    }
    .stats.prospecting-hidden {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .stat {
      padding: 12px;
      min-height: 78px;
    }
    .stat span {
      display: block;
      color: var(--muted);
      font-size: 11px;
      text-transform: uppercase;
      font-weight: 700;
    }
    .stat strong {
      display: block;
      margin-top: 8px;
      font-size: 20px;
      overflow-wrap: anywhere;
    }
    h2 {
      margin: 0 0 12px;
      font-size: 17px;
    }
    h3 {
      margin: 0 0 10px;
      font-size: 15px;
    }
    label {
      display: block;
      margin: 10px 0 6px;
      color: #344054;
      font-size: 12px;
      font-weight: 700;
    }
    input, textarea, select {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      color: var(--ink);
      padding: 9px 10px;
      outline-color: var(--green);
    }
    textarea { min-height: 92px; resize: vertical; }
    button {
      border: 0;
      border-radius: 8px;
      min-height: 38px;
      padding: 9px 13px;
      background: var(--green);
      color: #ffffff;
      font-weight: 700;
      cursor: pointer;
    }
    button.secondary { background: var(--blue); }
    button.warn { background: var(--amber); }
    button.ghost { background: #e7edf4; color: #182230; }
    .button-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 34px;
      padding: 8px 10px;
      border-radius: 8px;
      text-decoration: none;
      font-weight: 800;
    }
    .button-link.ghost {
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.07);
      color: #dbeafe;
    }
    button:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }
    .row {
      display: flex;
      gap: 8px;
      align-items: end;
      flex-wrap: wrap;
    }
    .row > * { flex: 1 1 180px; }
    .row > button { flex: 0 0 auto; }
    .badge {
      display: inline-flex;
      align-items: center;
      min-height: 28px;
      padding: 4px 10px;
      border-radius: 999px;
      background: #e8eef5;
      color: #182230;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }
    .badge.ok { background: var(--green-soft); color: #05603a; }
    .badge.off { background: var(--red-soft); color: #912018; }
    .badge.wait { background: var(--amber-soft); color: #93370d; }
    .badge.warn { background: var(--amber-soft); color: #93370d; }
    .muted { color: var(--muted); font-size: 13px; }
    .error { color: var(--red); font-weight: 700; }
    .ok-text { color: var(--green); font-weight: 700; }
    .setup-grid {
      display: grid;
      grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.7fr);
      gap: 14px;
    }
    .qr-box {
      min-height: 268px;
      display: grid;
      place-items: center;
      border: 1px dashed #98a2b3;
      border-radius: 8px;
      background: var(--surface-2);
      padding: 12px;
      text-align: center;
    }
    .qr-box img {
      width: min(250px, 100%);
      aspect-ratio: 1 / 1;
      object-fit: contain;
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    .qr-code {
      max-height: 150px;
      width: 100%;
      overflow: auto;
      font-size: 12px;
      white-space: pre-wrap;
    }
    .pairing-code-result {
      display: grid;
      justify-items: center;
      gap: 12px;
      width: 100%;
    }
    .pairing-code-value {
      margin: 0;
      font-size: 26px;
      font-weight: 800;
      letter-spacing: 0;
      overflow-wrap: anywhere;
    }
    .crm-shell {
      position: relative;
      grid-column: 1 / -1;
      min-height: 620px;
      padding: 0;
      overflow: hidden;
    }
    .crm-header {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      padding: 14px 15px;
      border-bottom: 1px solid var(--line);
      background: #ffffff;
    }
    .crm-grid {
      display: grid;
      grid-template-columns: 340px minmax(420px, 1fr) 320px;
      min-height: 560px;
    }
    .inbox, .conversation, .details {
      min-width: 0;
      border-right: 1px solid var(--line);
    }
    .details { border-right: 0; }
    .inbox-toolbar, .details-body {
      padding: 12px;
      border-bottom: 1px solid var(--line);
    }
    .contact-list {
      max-height: 500px;
      overflow: auto;
    }
    .contact-item {
      width: 100%;
      display: grid;
      grid-template-columns: 44px minmax(0, 1fr);
      gap: 10px;
      align-items: center;
      border: 0;
      border-bottom: 1px solid #edf1f6;
      border-radius: 0;
      background: #ffffff;
      color: var(--ink);
      text-align: left;
      padding: 12px;
      cursor: pointer;
    }
    .contact-item.active { background: var(--blue-soft); }
    .contact-body { min-width: 0; }
    .contact-top {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      align-items: center;
      margin-bottom: 5px;
    }
    .contact-top .badge { flex: 0 0 auto; }
    .contact-time { display: none; }
    .contact-name { font-weight: 800; overflow-wrap: anywhere; }
    .contact-preview {
      color: var(--muted);
      font-size: 12px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .contact-preview-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
    }
    .contact-unread-badge {
      display: inline-grid;
      place-items: center;
      min-width: 21px;
      height: 21px;
      padding: 0 6px;
      border-radius: 999px;
      background: #22c55e;
      color: #04120a;
      font-size: 11px;
      font-weight: 900;
      line-height: 1;
      box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.13);
    }
    button.contact-item.has-unread .contact-name,
    button.contact-item.has-unread .contact-preview {
      color: #f8fffb;
      font-weight: 800;
    }
    .prospect-board {
      display: grid;
      grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
      gap: 14px;
    }
    .prospecting-context {
      display: grid;
      grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
      gap: 10px;
      padding: 12px;
      margin: 0 0 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .prospecting-context label { margin: 0; }
    .prospecting-tabs {
      margin: 0 0 14px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--line);
      overflow-x: auto;
    }
    .prospecting-tabs .segment-button:not(.active) {
      color: #cbd8e6;
      background: rgba(255, 255, 255, 0.055);
    }
    .prospect-panel { display: none; }
    .prospect-panel.active { display: block; }
    .prospect-panel-grid {
      display: grid;
      grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
      gap: 14px;
      align-items: start;
    }
    .panel-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      margin-top: 8px;
    }
    .prospect-list, .campaign-list, .activity-list {
      display: grid;
      gap: 8px;
      max-height: 330px;
      overflow: auto;
    }
    .lead-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
      padding: 10px;
    }
    .lead-card.prospected {
      background: #fff8db;
      border-color: #f6c453;
      box-shadow: inset 3px 0 0 #d97706;
    }
    .lead-card.invalid-number {
      background: #fff1f0;
      border-color: #fda29b;
      box-shadow: inset 3px 0 0 var(--red);
    }
    .lead-card.locked-lead {
      opacity: 0.78;
    }
    .lead-card.base-lead:not(.prospected) {
      border-color: #b7d7c8;
      background: #fbfffd;
    }
    .lead-badges {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-top: 7px;
    }
    .lead-card strong {
      display: block;
      margin-bottom: 4px;
      overflow-wrap: anywhere;
    }
    .lead-card p {
      margin: 4px 0;
      color: var(--muted);
      font-size: 12px;
    }
    .campaign-metrics {
      display: flex;
      align-items: stretch;
      margin: 9px 0 7px;
      padding: 7px 0;
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      font-variant-numeric: tabular-nums;
    }
    .campaign-city-binding {
      display: flex;
      align-items: end;
      gap: 8px;
      margin-top: 10px;
      flex-wrap: wrap;
    }
    .campaign-city-binding label {
      flex: 1 1 190px;
      min-width: 0;
    }
    .campaign-city-binding select {
      width: 100%;
      margin-top: 4px;
    }
    .campaign-city-binding button {
      min-height: 36px;
      flex: 0 0 auto;
    }
    .linked-accounts-heading,
    .linked-group-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }
    .linked-accounts-heading h3,
    .linked-group-heading h4 { margin: 0; }
    .linked-accounts-list { display: grid; gap: 18px; }
    .linked-account-group { border-top: 1px solid var(--line); padding-top: 12px; }
    .linked-group-heading { margin-bottom: 8px; }
    .linked-account-list { display: grid; }
    .linked-account-row {
      display: grid;
      grid-template-columns: minmax(120px, 1.4fr) auto minmax(110px, 0.9fr) minmax(150px, 1fr);
      align-items: center;
      gap: 10px;
      min-height: 58px;
      padding: 8px 0;
      border-bottom: 1px solid var(--line);
      font-variant-numeric: tabular-nums;
    }
    .linked-account-name { min-width: 0; }
    .linked-account-name strong,
    .linked-account-name small { display: block; overflow-wrap: anywhere; }
    .linked-account-name small,
    .linked-account-total { color: var(--muted); font-size: 12px; }
    .linked-account-timer { color: var(--accent); font-size: 12px; font-weight: 700; }
    @media (max-width: 700px) {
      .linked-account-row { grid-template-columns: minmax(0, 1fr) auto; }
      .linked-account-total,
      .linked-account-timer { grid-column: 1 / -1; }
    }
    .campaign-metric {
      flex: 1 1 0;
      min-width: 0;
      color: var(--muted);
      font-size: 11px;
    }
    .campaign-metric + .campaign-metric {
      padding-left: 10px;
      border-left: 1px solid var(--line);
    }
    .campaign-metric b {
      display: block;
      margin-top: 2px;
      color: var(--text);
      font-size: 16px;
      line-height: 1.15;
    }
    .lead-card .campaign-countdown {
      min-height: 18px;
      margin: 7px 0;
      color: var(--accent);
      font-size: 13px;
      font-weight: 800;
      font-variant-numeric: tabular-nums;
    }
    .campaign-card-footer,
    .campaign-card-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .campaign-card-footer {
      justify-content: space-between;
      margin-top: 8px;
    }
    .campaign-card-actions button {
      min-height: 34px;
      padding: 7px 11px;
      font-size: 12px;
    }
    .campaign-share-code {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-top: 8px;
      color: var(--muted);
      font-size: 12px;
    }
    .campaign-share-code code {
      overflow-wrap: anywhere;
      color: var(--text);
      user-select: all;
    }
    .campaign-offer {
      overflow-wrap: anywhere;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .campaign-video-links {
      margin: 7px 0;
      color: var(--muted);
      font-size: 12px;
      overflow-wrap: anywhere;
    }
    .campaign-video-links a {
      color: var(--accent);
    }
    .prospecting-link-controls {
      display: flex;
      flex-wrap: wrap;
      align-items: end;
      gap: 8px;
      margin-bottom: 12px;
    }
    .prospecting-link-controls label { flex: 1 1 220px; margin: 0; min-width: 0; }
    .prospecting-sent-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 46%);
      gap: 12px;
      min-width: 0;
    }
    .prospecting-sent-row > div { min-width: 0; }
    .prospecting-sent-row p { overflow-wrap: anywhere; }
    .prospecting-sent-row .badge { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
    .prospecting-sent-row small { display: block; margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
    @media (max-width: 600px) {
      .prospecting-sent-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    }
    .template-help {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 12px;
    }
    .prospecting-video-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      margin: 8px 0 12px;
    }
    .prospecting-video-card {
      display: grid;
      grid-template-columns: 64px minmax(0, 1fr);
      gap: 9px;
      align-items: center;
      min-width: 0;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .prospecting-video-card video {
      display: block;
      width: 64px;
      height: 96px;
      border-radius: 6px;
      object-fit: cover;
      background: #000000;
    }
    .prospecting-video-card strong,
    .prospecting-video-card small { overflow-wrap: anywhere; }
    .prospecting-video-card small {
      display: block;
      margin-top: 3px;
      color: var(--muted);
    }
    .conversation {
      display: grid;
      grid-template-rows: auto 1fr auto;
      background: #f7faf9;
    }
    .conversation-title {
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      background: #ffffff;
    }
    .mobile-chat-back,
    .mobile-inbox-title { display: none; }
    .conversation-heading {
      display: flex;
      gap: 10px;
      align-items: center;
      min-width: 0;
    }
    .conversation-copy { min-width: 0; }
    .conversation-name-row {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      flex-wrap: wrap;
    }
    .conversation-copy strong {
      display: block;
      overflow-wrap: anywhere;
    }
    .avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      display: inline-grid;
      place-items: center;
      flex: 0 0 auto;
      overflow: hidden;
      border: 1px solid #d0d5dd;
      background: linear-gradient(135deg, #dff7ef, #e0ecff);
      color: #0b4f46;
      font-size: 14px;
      font-weight: 800;
      text-transform: uppercase;
    }
    .avatar img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }
    .avatar-lg {
      width: 48px;
      height: 48px;
      font-size: 16px;
    }
    .messages {
      padding: 14px;
      overflow: auto;
      min-height: 420px;
      max-height: min(72vh, 780px);
      display: flex;
      flex-direction: column;
      gap: 8px;
      scroll-behavior: smooth;
    }
    .bubble {
      position: relative;
      max-width: min(680px, 86%);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 9px 38px 9px 10px;
      background: #ffffff;
      overflow-wrap: anywhere;
    }
    .message-action-button {
      position: absolute;
      top: 4px;
      right: 4px;
      display: inline-grid;
      place-items: center;
      width: 28px;
      height: 28px;
      min-height: 28px;
      padding: 0;
      border: 0;
      border-radius: 50%;
      color: var(--muted);
      background: rgba(17, 24, 32, 0.88);
      box-shadow: none;
      opacity: 0;
      transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
    }
    .message-action-button::before {
      width: 7px;
      height: 7px;
      border-right: 2px solid currentColor;
      border-bottom: 2px solid currentColor;
      content: "";
      transform: translateY(-2px) rotate(45deg);
    }
    .bubble:hover .message-action-button,
    .bubble:focus-within .message-action-button,
    .message-action-button[aria-expanded="true"] {
      opacity: 1;
    }
    .message-action-button:hover,
    .message-action-button:focus-visible {
      color: var(--ink);
      background: #18212b;
    }
    .message-favorite-indicator {
      display: inline-block;
      margin-left: 6px;
      color: #f7c948;
      font-size: 13px;
      line-height: 1;
      vertical-align: -1px;
    }
    .message-pin-indicator {
      display: inline-block;
      margin-left: 6px;
      color: #72b7ff;
      font-size: 12px;
      line-height: 1;
    }
    .message-forwarded-label {
      display: block;
      margin: 0 0 5px;
      color: var(--muted);
      font-size: 11px;
      font-style: italic;
    }
    .message-reaction-chip {
      position: absolute;
      right: 8px;
      bottom: -12px;
      display: inline-grid;
      place-items: center;
      min-width: 31px;
      height: 25px;
      padding: 0 7px;
      border: 1px solid var(--line);
      border-radius: 13px;
      background: var(--surface-2);
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
      font-size: 16px;
      line-height: 1;
    }
    .bubble:has(.message-reaction-chip) { margin-bottom: 12px; }
    .message-action-menu {
      position: fixed;
      z-index: 10120;
      display: grid;
      width: min(250px, calc(100vw - 24px));
      max-height: calc(100vh - 16px);
      padding: 4px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 8px;
      background: #202020;
      box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48);
      overflow: auto;
    }
    .message-action-menu[hidden] { display: none; }
    .message-action-menu button {
      display: grid;
      grid-template-columns: 24px minmax(0, 1fr);
      align-items: center;
      width: 100%;
      min-height: 40px;
      padding: 7px 9px;
      border: 0 !important;
      border-radius: 6px;
      color: #f1f1f1 !important;
      text-align: left;
      background: #202020 !important;
      box-shadow: none !important;
    }
    .message-action-menu button:hover,
    .message-action-menu button:focus-visible {
      background: #303030 !important;
    }
    .message-action-menu button.danger {
      margin-top: 4px;
      border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
      border-radius: 0 0 6px 6px;
      color: #f1f1f1 !important;
      background: #202020 !important;
    }
    .message-action-menu button.danger:hover,
    .message-action-menu button.danger:focus-visible {
      background: #303030 !important;
    }
    .message-menu-icon {
      display: inline-grid;
      place-items: center;
      width: 20px;
      height: 20px;
      color: currentColor;
      font-size: 19px;
      font-weight: 500;
      line-height: 1;
    }
    .conversation-pinned-bar {
      padding: 7px 12px;
      border-bottom: 1px solid var(--line);
      background: rgba(24, 199, 168, 0.08);
    }
    .conversation-pinned-bar[hidden] { display: none; }
    .conversation-pinned-button {
      display: grid;
      grid-template-columns: 28px minmax(0, 1fr) auto;
      gap: 9px;
      align-items: center;
      width: 100%;
      min-height: 42px;
      padding: 5px 7px;
      color: var(--ink);
      text-align: left;
      background: transparent;
      box-shadow: none;
    }
    .conversation-pinned-button:hover { background: rgba(24, 199, 168, 0.10); }
    .conversation-pinned-copy {
      min-width: 0;
    }
    .conversation-pinned-copy strong,
    .conversation-pinned-copy span { display: block; }
    .conversation-pinned-copy span {
      overflow: hidden;
      color: var(--muted);
      font-size: 12px;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .message-data-grid {
      display: grid;
      grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
      gap: 0;
      margin: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
    }
    .message-data-grid dt,
    .message-data-grid dd {
      min-width: 0;
      margin: 0;
      padding: 9px 10px;
      border-bottom: 1px solid var(--line);
      overflow-wrap: anywhere;
    }
    .message-data-grid dt { color: var(--muted); background: var(--surface-2); }
    .message-data-grid dd { color: var(--ink); }
    .message-data-grid dt:last-of-type,
    .message-data-grid dd:last-of-type { border-bottom: 0; }
    .message-reaction-options {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
      gap: 8px;
    }
    .message-reaction-option {
      min-height: 48px;
      padding: 4px;
      font-size: 25px;
    }
    .message-forward-search { margin-bottom: 10px; }
    .message-forward-list {
      display: grid;
      gap: 6px;
      max-height: min(52vh, 420px);
      overflow: auto;
    }
    .message-forward-contact {
      display: grid;
      grid-template-columns: 34px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      min-height: 48px;
      padding: 7px 9px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: var(--surface-2);
    }
    .message-forward-contact input { width: 18px; height: 18px; }
    .message-forward-contact-copy { min-width: 0; }
    .message-forward-contact-copy strong,
    .message-forward-contact-copy span { display: block; }
    .message-forward-contact-copy span { color: var(--muted); font-size: 12px; }
    .message-reply-reference {
      margin: 0 0 7px;
      padding: 7px 9px;
      border-left: 3px solid var(--primary);
      border-radius: 4px;
      color: var(--muted);
      background: rgba(5, 9, 14, 0.34);
      font-size: 12px;
    }
    .composer-reply-context {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 32px;
      align-items: center;
      gap: 8px;
      margin-bottom: 7px;
      padding: 8px 9px;
      border-left: 3px solid var(--primary);
      border-radius: 6px;
      background: rgba(24, 199, 168, 0.10);
    }
    .composer-reply-context[hidden] { display: none; }
    .composer-reply-copy {
      min-width: 0;
    }
    .composer-reply-copy strong,
    .composer-reply-copy span {
      display: block;
    }
    .composer-reply-copy span {
      margin-top: 2px;
      overflow: hidden;
      color: var(--muted);
      font-size: 12px;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .composer-reply-close {
      width: 32px;
      height: 32px;
      min-height: 32px;
      padding: 0;
      border-radius: 50%;
      font-size: 22px;
      line-height: 1;
    }
    .bubble.selectable {
      cursor: pointer;
    }
    .bubble.selectable:hover {
      border-color: var(--blue);
      box-shadow: 0 0 0 2px var(--blue-soft);
    }
    .bubble.selected-source {
      border-color: var(--blue);
      background: #eef5ff;
      box-shadow: 0 0 0 2px var(--blue-soft);
    }
    .bubble .selected-note {
      display: inline-block;
      margin-top: 6px;
      color: var(--blue);
      font-size: 11px;
      font-weight: 700;
    }
    .bubble.out {
      align-self: flex-end;
      background: #dcf8ef;
      border-color: #b7eadc;
    }
    .bubble small {
      display: block;
      margin-top: 5px;
      color: var(--muted);
      font-size: 11px;
    }
    .bubble.pending-send {
      opacity: 0.86;
    }
    .message-delivery-status {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-left: 7px;
      font-weight: 700;
    }
    .message-delivery-status.pending {
      color: #7dd3fc;
    }
    .message-delivery-status.failed {
      color: #fca5a5;
    }
    .message-media {
      position: relative;
      margin-bottom: 8px;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f8fafc;
    }
    .message-media img,
    .message-media video {
      display: block;
      width: min(360px, 100%);
      max-width: 100%;
      aspect-ratio: 4 / 3;
      max-height: 360px;
      object-fit: contain;
      background: #0f172a;
    }
    .message-media audio {
      display: block;
      width: min(360px, 100%);
      min-height: 44px;
      padding: 8px;
    }
    .audio-player-shell {
      display: grid;
      grid-template-columns: 40px minmax(0, 1fr) auto;
      align-items: center;
      gap: 9px;
      padding: 9px;
    }
    .audio-player-shell[hidden] { display: none; }
    .audio-play-button {
      display: inline-grid;
      place-items: center;
      width: 40px;
      height: 40px;
      min-height: 40px;
      padding: 0;
      border-radius: 50%;
      font-size: 16px;
      line-height: 1;
    }
    .audio-seek {
      width: 100%;
      min-width: 0;
      accent-color: var(--primary);
    }
    .audio-time {
      min-width: 72px;
      color: var(--muted);
      font-size: 11px;
      font-variant-numeric: tabular-nums;
      text-align: right;
    }
    .audio-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 0 8px 8px;
    }
    .audio-download-button {
      min-height: 34px;
      padding: 6px 10px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 800;
    }
    .audio-download-button.is-downloaded,
    .audio-download-button:disabled.is-downloaded {
      border-color: rgba(24, 199, 168, 0.42);
      background: rgba(24, 199, 168, 0.16);
      color: #9fffe9;
      opacity: 1;
    }
    .audio-download-status {
      min-width: 0;
      flex: 1;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
    }
    .audio-actions .media-open {
      position: static;
      margin-left: auto;
      flex: 0 0 auto;
    }
    .album-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      margin-bottom: 8px;
      max-width: min(420px, 100%);
    }
    .album-grid .message-media {
      margin: 0;
      min-height: 88px;
    }
    .album-grid .message-media img,
    .album-grid .message-media video {
      width: 100%;
      height: 160px;
      max-height: 160px;
      object-fit: cover;
    }
    .media-file {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px;
      color: var(--ink);
      text-decoration: none;
      font-weight: 700;
    }
    .media-open {
      position: absolute;
      right: 8px;
      bottom: 8px;
      padding: 5px 8px;
      border-radius: 8px;
      background: rgba(15, 23, 42, 0.76);
      color: #ffffff;
      font-size: 11px;
      font-weight: 800;
      text-decoration: none;
    }
    .media-fallback {
      padding: 10px;
      color: var(--muted);
      font-weight: 700;
    }
    .media-load-notice {
      padding: 8px 10px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }
    .message-loading {
      padding: 18px;
      color: var(--muted);
      text-align: center;
      border: 1px dashed var(--line);
      border-radius: 8px;
      background: #ffffff;
    }
    .message-caption {
      white-space: pre-wrap;
    }
    .composer {
      padding: 8px 10px 10px;
      border-top: 1px solid var(--line);
      background: #ffffff;
    }
    .composer textarea#replyText {
      min-height: 76px;
    }
    .composer-actions {
      margin-top: 8px;
    }
    .composer-status:empty {
      display: none;
    }
    .details-scroll {
      max-height: 560px;
      overflow: auto;
      padding: 12px;
    }
    .automation-box {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: var(--surface-2);
    }
    .training-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin: 8px 0;
    }
    .training-autofill-box {
      display: grid;
      gap: 10px;
      margin: 0 0 14px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .training-autofill-box h3 {
      margin: 0;
      font-size: 16px;
    }
    .training-autofill-box p {
      margin: 3px 0 0;
    }
    .training-autofill-box textarea {
      min-height: 96px;
    }
    .niche-memory-modal-card {
      width: min(980px, 100%);
    }
    .niche-memory-summary {
      display: grid;
      gap: 4px;
      margin: 0 0 14px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .niche-memory-summary strong { font-size: 15px; }
    .niche-memory-grid textarea { min-height: 116px; }
    .niche-memory-wide { grid-column: 1 / -1; }
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 9000;
      display: grid;
      place-items: center;
      padding: 22px;
      background: rgba(12, 24, 36, 0.48);
      contain: layout paint;
    }
    .modal-backdrop[hidden] { display: none; }
    .modal-card {
      width: min(920px, 100%);
      max-height: min(92vh, 820px);
      overflow: auto;
      overscroll-behavior: contain;
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
    }
    .ai-thinking-card {
      width: min(520px, 100%);
      text-align: center;
    }
    .notice-modal-card {
      width: min(460px, 100%);
    }
    .audio-viewer-card {
      width: min(560px, 100%);
      overflow: hidden;
    }
    .audio-viewer-body {
      display: grid;
      gap: 14px;
    }
    .audio-viewer-player {
      display: block;
      width: 100%;
      min-height: 48px;
    }
    .audio-viewer-download {
      justify-self: start;
    }
    .courses-modal-card {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      width: min(1180px, 100%);
      height: min(92vh, 850px);
      max-height: min(92vh, 850px);
      overflow: hidden;
    }
    .courses-modal-body {
      position: relative;
      min-height: 360px;
      padding: 0;
      overflow: hidden;
      background: #080b10;
    }
    .courses-frame {
      width: 100%;
      height: 100%;
      border: 0;
      opacity: 0;
      background: #080b10;
      transition: opacity 0.18s ease;
    }
    .courses-frame.is-ready { opacity: 1; }
    .courses-loading {
      position: absolute;
      inset: 0;
      z-index: 1;
      display: grid;
      place-items: center;
      padding: 24px;
      color: var(--muted);
      text-align: center;
      background: #080b10;
    }
    .courses-loading[hidden] { display: none; }
    .notice-modal-card .modal-body {
      display: grid;
      gap: 8px;
    }
    .ai-thinking-card .modal-body { padding: 28px; }
    .ai-thinking-card h2 {
      margin: 0 0 8px;
      font-size: 22px;
    }
    .ai-thinking-card p {
      max-width: 410px;
      margin: 0 auto;
      line-height: 1.45;
    }
    .modal-header {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: start;
      padding: 16px;
      border-bottom: 1px solid var(--line);
      background: var(--surface-2);
    }
    .modal-body { padding: 16px; }
    .small-modal-card { width: min(620px, calc(100vw - 28px)); }
    .form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
    }
    .form-grid > label { display: grid; gap: 6px; }
    .form-grid .full-row { grid-column: 1 / -1; }
    .form-grid .modal-actions {
      margin: 0 -16px -16px;
      background: var(--surface-2);
    }
    .modal-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      flex-wrap: wrap;
      padding: 14px 16px;
      border-top: 1px solid var(--line);
      background: #ffffff;
      position: sticky;
      bottom: 0;
    }
    .training-panel { display: none; }
    .training-panel.active { display: block; }
    .settings-block {
      display: grid;
      gap: 8px;
      margin: 14px 0;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .settings-block h3 {
      margin: 0;
      font-size: 16px;
    }
    .admin-openai-heading,
    .admin-openai-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }
    .admin-openai-key-row {
      display: grid;
      grid-template-columns: minmax(260px, 1fr) auto;
      gap: 10px;
      align-items: end;
    }
    .admin-openai-key-row label { margin: 0; }
    .setting-help {
      margin: 0;
      line-height: 1.45;
    }
    .grid.two {
      display: grid;
      grid-template-columns: repeat(2, minmax(180px, 1fr));
      gap: 10px;
    }
    .portfolio-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
      gap: 10px;
      margin-top: 10px;
    }
    .portfolio-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      background: #ffffff;
    }
    .portfolio-card img,
    .portfolio-card video {
      display: block;
      width: 100%;
      aspect-ratio: 16 / 10;
      object-fit: cover;
      background: #101828;
    }
    .portfolio-card-body { padding: 10px; }
    .portfolio-media-unavailable {
      display: grid;
      place-items: center;
      width: 100%;
      aspect-ratio: 16 / 10;
      padding: 16px;
      background: #101828;
      color: var(--muted);
      text-align: center;
    }
    .price-grid {
      display: grid;
      gap: 8px;
      max-height: min(54vh, 460px);
      overflow: auto;
      margin-top: 10px;
      content-visibility: auto;
      contain-intrinsic-size: 420px;
    }
    .price-card {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .price-service-main {
      display: grid;
      grid-template-columns: 64px minmax(0, 1fr);
      gap: 10px;
      align-items: center;
      min-width: 0;
    }
    .price-service-thumb {
      display: grid;
      place-items: center;
      width: 64px;
      height: 64px;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--surface);
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
      text-align: center;
    }
    .price-service-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .price-card strong,
    .price-card p {
      overflow-wrap: anywhere;
    }
    .price-card p {
      margin: 4px 0 0;
    }
    .service-category-badge {
      display: inline-flex;
      align-items: center;
      width: fit-content;
      margin-bottom: 5px;
      padding: 4px 7px;
      border: 1px solid rgba(45, 212, 191, 0.34);
      border-radius: 999px;
      background: rgba(15, 118, 110, 0.14);
      color: #83f7df;
      font-size: 11px;
      font-weight: 900;
    }
    .price-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .payment-settings-box {
      display: grid;
      gap: 12px;
      margin: 12px 0 18px;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-2);
    }
    .payment-settings-box h4,
    .payment-settings-box p {
      margin: 0;
    }
    .payment-detail-fields[hidden] {
      display: none !important;
    }
    .payment-method-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 8px;
    }
    .payment-method-option {
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 42px;
      padding: 8px 10px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: var(--surface);
      cursor: pointer;
    }
    .payment-method-option input {
      width: 18px;
      height: 18px;
      margin: 0;
    }
    .locked .crm-grid,
    .loading .crm-grid {
      filter: grayscale(0.2);
      opacity: 0.42;
      pointer-events: none;
    }
    .crm-lock,
    .crm-loading {
      display: none;
      position: absolute;
      inset: 56px 14px 14px;
      z-index: 4;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 20px;
      background: rgba(255, 255, 255, 0.86);
    }
    .locked .crm-lock { display: flex; }
    .loading .crm-loading { display: flex; }
    .loading .crm-lock { display: none; }
    .lock-panel {
      width: min(560px, 100%);
      padding: 22px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #ffffff;
    }
    .loading-dots {
      display: inline-flex;
      gap: 5px;
      margin-top: 12px;
    }
    .loading-dots span {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--green);
      opacity: 0.35;
      animation: loadingDot 1s infinite ease-in-out;
    }
    .loading-dots span:nth-child(2) { animation-delay: 0.14s; }
    .loading-dots span:nth-child(3) { animation-delay: 0.28s; }
    @keyframes loadingDot {
      0%, 100% { opacity: 0.25; transform: translateY(0); }
      50% { opacity: 1; transform: translateY(-4px); }
    }
    .lock-qr-box {
      min-height: 236px;
      margin-top: 14px;
      display: none;
    }
    .lock-qr-box.active {
      display: grid;
    }
    .module-lock {
      max-width: 620px;
      margin: 22px auto;
      text-align: center;
      padding: 38px 22px;
    }
    .lock-mark {
      position: relative;
      display: inline-block;
      width: 12px;
      height: 10px;
      border: 2px solid currentColor;
      border-radius: 2px;
      color: currentColor;
      vertical-align: -1px;
      flex: 0 0 auto;
    }
    .lock-mark::before {
      content: "";
      position: absolute;
      left: 2px;
      top: -8px;
      width: 6px;
      height: 7px;
      border: 2px solid currentColor;
      border-bottom: 0;
      border-radius: 7px 7px 0 0;
    }
    .module-lock .lock-mark {
      width: 30px;
      height: 24px;
      border-width: 3px;
      margin-bottom: 18px;
    }
    .module-lock .lock-mark::before {
      left: 5px;
      top: -19px;
      width: 14px;
      height: 18px;
      border-width: 3px;
      border-bottom: 0;
      border-radius: 14px 14px 0 0;
    }
    .mini-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }
    .check-row {
      display: flex;
      gap: 8px;
      align-items: center;
      margin: 9px 0;
      font-size: 13px;
      color: #344054;
    }
    .check-row input { width: 18px; height: 18px; }
    .segmented {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin: 8px 0 10px;
    }
    .segment-button {
      border: 1px solid var(--line);
      background: #ffffff;
      color: #344054;
      min-height: 34px;
    }
    .segment-button.active {
      border-color: var(--green);
      background: var(--green);
      color: #ffffff;
    }
    pre {
      white-space: pre-wrap;
      background: #111827;
      color: #e5e7eb;
      border-radius: 8px;
      padding: 12px;
      min-height: 74px;
      overflow: auto;
    }
    /* Premium cockpit theme */
    :root {
      color-scheme: dark;
      --bg: #070a0f;
      --surface: #0d131b;
      --surface-2: #121b26;
      --ink: #edf5ff;
      --muted: #91a4bb;
      --line: rgba(148, 163, 184, 0.22);
      --green: #18c7a8;
      --green-soft: rgba(24, 199, 168, 0.14);
      --blue: #34d6c3;
      --blue-soft: rgba(52, 214, 195, 0.13);
      --amber: #ffb020;
      --amber-soft: rgba(255, 176, 32, 0.15);
      --red: #ff5c6c;
      --red-soft: rgba(255, 92, 108, 0.15);
      --slate: #d9e7f5;
    }
    body {
      background: #05070a;
      color: var(--ink);
      font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    }
    ::selection { background: rgba(24, 199, 168, 0.34); color: #ffffff; }
    *::-webkit-scrollbar { width: 10px; height: 10px; }
    *::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
    *::-webkit-scrollbar-thumb {
      background: rgba(145, 164, 187, 0.34);
      border: 2px solid transparent;
      border-radius: 8px;
      background-clip: padding-box;
    }
    *::-webkit-scrollbar-thumb:hover { background: rgba(24, 199, 168, 0.62); background-clip: padding-box; }
    .topbar {
      position: sticky;
      top: 0;
      z-index: 12;
      background: rgba(7, 10, 15, 0.92);
      border-bottom: 1px solid rgba(24, 199, 168, 0.34);
      box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
      backdrop-filter: blur(18px);
    }
    .topbar h1 {
      font-size: 23px;
      font-weight: 900;
    }
    .topbar p { color: var(--muted); }
    .app-nav {
      background: rgba(9, 13, 19, 0.94);
      border-bottom: 1px solid var(--line);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.20);
      backdrop-filter: blur(14px);
    }
    .nav-button,
    .segment-button {
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.055);
      color: #cbd8e6;
      box-shadow: none;
      transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
    }
    .nav-button:hover,
    .segment-button:hover,
    button.ghost:hover {
      border-color: rgba(24, 199, 168, 0.46);
      background: rgba(24, 199, 168, 0.12);
      color: #ffffff;
    }
    .nav-button.active,
    .segment-button.active,
    button:not(.ghost):not(.wa-label-chip):not(.nav-button):not(.segment-button):not(.contact-item) {
      background: linear-gradient(135deg, #18c7a8, #34d6c3);
      color: #031018;
      box-shadow: 0 12px 28px rgba(24, 199, 168, 0.22);
    }
    button.secondary {
      background: linear-gradient(135deg, #12a893, #18c7a8);
      color: #02100d;
    }
    button.warn {
      background: linear-gradient(135deg, #ffb020, #ff7a59);
      color: #111827;
    }
    button.danger {
      border: 1px solid rgba(248, 113, 113, 0.52) !important;
      background: linear-gradient(135deg, #dc2626, #ef4444) !important;
      color: #ffffff !important;
      box-shadow: 0 12px 28px rgba(220, 38, 38, 0.20) !important;
    }
    button.ghost {
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.07);
      color: #d9e7f5;
      box-shadow: none;
    }
    button.ghost.active-filter {
      border-color: rgba(24, 199, 168, 0.60);
      background: rgba(24, 199, 168, 0.14);
      color: #7df6dc;
    }
    button:disabled {
      background: rgba(148, 163, 184, 0.12) !important;
      color: rgba(237, 245, 255, 0.62) !important;
      box-shadow: none !important;
    }
    main { width: min(1680px, calc(100vw - 28px)); }
    section,
    .stat,
    .panel,
    .crm-shell,
    .lead-card,
    .modal-card,
    .automation-box,
    .portfolio-card,
    .example {
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.072), rgba(255, 255, 255, 0.035));
      border-color: var(--line);
      box-shadow: 0 18px 44px rgba(0, 0, 0, 0.20);
    }
    .stat {
      min-height: 86px;
      position: relative;
      overflow: hidden;
    }
    .stat::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 2px;
      background: linear-gradient(90deg, #18c7a8, #34d6c3, #ffb020);
      opacity: 0.78;
    }
    .stat span {
      color: #9fb1c7;
      letter-spacing: 0;
    }
    .stat strong {
      color: #ffffff;
      font-size: 23px;
    }
    h2,
    h3,
    .contact-name,
    .conversation-copy strong { color: #f7fbff; }
    label,
    .check-row { color: #cbd8e6; }
    .muted,
    .template-help,
    .lead-card p,
    .contact-preview,
    .bubble small { color: var(--muted); }
    input,
    textarea,
    select {
      border-color: var(--line);
      background: rgba(5, 9, 14, 0.78);
      color: var(--ink);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }
    input::placeholder,
    textarea::placeholder { color: rgba(203, 216, 230, 0.46); }
    input:focus,
    textarea:focus,
    select:focus {
      border-color: rgba(24, 199, 168, 0.78);
      outline: 2px solid rgba(24, 199, 168, 0.16);
      outline-offset: 0;
    }
    .badge,
    .wa-label-chip {
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.07);
      color: #dbeafe;
    }
    .badge.ok {
      border-color: rgba(24, 199, 168, 0.40);
      background: rgba(24, 199, 168, 0.16);
      color: #7df6dc;
    }
    .badge.off {
      border-color: rgba(255, 92, 108, 0.38);
      background: rgba(255, 92, 108, 0.14);
      color: #ffb7bf;
    }
    .badge.wait,
    .badge.warn {
      border-color: rgba(255, 176, 32, 0.42);
      background: rgba(255, 176, 32, 0.15);
      color: #ffd58a;
    }
    .wa-label-chip.active {
      border-color: rgba(24, 199, 168, 0.70);
      background: rgba(24, 199, 168, 0.16);
      color: #7df6dc;
      box-shadow: 0 0 0 2px rgba(24, 199, 168, 0.11);
    }
    .setup-grid,
    .prospect-board,
    .prospect-panel-grid { align-items: start; }
    .qr-box,
    .message-loading,
    .lock-panel {
      background: rgba(5, 9, 14, 0.72);
      border-color: var(--line);
    }
    .qr-box img {
      background: #ffffff;
      border: 0;
      box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
    }
    .crm-shell {
      border-color: rgba(24, 199, 168, 0.22);
      overflow: hidden;
    }
    .crm-header,
    .conversation-title,
    .composer,
    .inbox-toolbar,
    .details-body,
    .modal-header,
    .modal-actions {
      background: rgba(8, 12, 18, 0.86);
      border-color: var(--line);
    }
    .crm-grid { background: rgba(255, 255, 255, 0.02); }
    .inbox,
    .conversation,
    .details { border-color: var(--line); }
    .contact-list,
    .messages,
    .details-scroll,
    .prospect-list,
    .campaign-list,
    .activity-list {
      contain: content;
      scrollbar-color: rgba(145, 164, 187, 0.38) transparent;
    }
    button.contact-item {
      background: rgba(255, 255, 255, 0.025);
      border-color: rgba(148, 163, 184, 0.14);
      color: var(--ink);
      box-shadow: none;
    }
    button.contact-item:hover {
      background: rgba(24, 199, 168, 0.08);
    }
    button.contact-item.active {
      background: rgba(24, 199, 168, 0.12);
      box-shadow: inset 3px 0 0 #18c7a8;
    }
    .avatar {
      border-color: rgba(24, 199, 168, 0.30);
      background: linear-gradient(135deg, rgba(24, 199, 168, 0.28), rgba(74, 168, 255, 0.22));
      color: #dffff8;
      box-shadow: 0 0 0 3px rgba(24, 199, 168, 0.08);
    }
    .conversation {
      background:
        linear-gradient(180deg, rgba(8, 12, 18, 0.86), rgba(7, 10, 15, 0.94)),
        linear-gradient(135deg, rgba(24, 199, 168, 0.045) 0 1px, transparent 1px 28px);
    }
    .messages {
      scroll-behavior: auto;
    }
    .bubble {
      background: rgba(255, 255, 255, 0.075);
      border-color: rgba(148, 163, 184, 0.22);
      color: #f1f7ff;
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
    }
    .bubble.out {
      background: linear-gradient(135deg, rgba(24, 199, 168, 0.24), rgba(24, 199, 168, 0.14));
      border-color: rgba(24, 199, 168, 0.32);
      color: #f6fffc;
    }
    .bubble.selectable:hover,
    .bubble.selected-source {
      border-color: rgba(74, 168, 255, 0.78);
      background: rgba(74, 168, 255, 0.14);
      box-shadow: 0 0 0 2px rgba(74, 168, 255, 0.16);
    }
    .bubble .selected-note { color: #8cc8ff; }
    .message-media {
      background: rgba(5, 9, 14, 0.72);
      border-color: rgba(148, 163, 184, 0.20);
    }
    .media-file,
    .media-fallback { color: #d9e7f5; }
    .media-open {
      background: rgba(5, 9, 14, 0.82);
      border: 1px solid rgba(255, 255, 255, 0.12);
    }
    .lead-card.prospected {
      background: rgba(255, 176, 32, 0.12);
      border-color: rgba(255, 176, 32, 0.36);
      box-shadow: inset 3px 0 0 #ffb020;
    }
    .lead-card.invalid-number {
      background: rgba(255, 92, 108, 0.12);
      border-color: rgba(255, 92, 108, 0.36);
      box-shadow: inset 3px 0 0 #ff5c6c;
    }
    .lead-card.base-lead:not(.prospected) {
      background: rgba(24, 199, 168, 0.075);
      border-color: rgba(24, 199, 168, 0.26);
    }
    .prospecting-context,
    .automation-box,
    .training-autofill-box {
      background: rgba(255, 255, 255, 0.045);
      border-color: var(--line);
    }
    .modal-backdrop {
      background: rgba(3, 6, 10, 0.86);
    }
    .modal-card {
      background: #0d131b;
      box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
    }
    .install-modal-card {
      width: min(560px, 100%);
    }
    .install-guide-intro {
      display: grid;
      grid-template-columns: 64px minmax(0, 1fr);
      gap: 14px;
      align-items: center;
    }
    .install-guide-icon {
      width: 64px;
      height: 64px;
      border-radius: 8px;
      object-fit: cover;
    }
    .install-guide-intro h3,
    .install-guide-intro p { margin: 0; }
    .install-guide-intro p { margin-top: 4px; }
    .install-steps {
      display: grid;
      gap: 8px;
      margin: 12px 0;
    }
    .install-step {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px 12px;
      background: rgba(255, 255, 255, 0.04);
      color: #d9e7f5;
    }
    .install-step strong {
      display: block;
      margin-bottom: 3px;
      color: #ffffff;
    }
    .install-guide-video {
      display: block;
      width: 100%;
      max-height: min(52vh, 520px);
      margin: 14px 0 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #000000;
      object-fit: contain;
    }
    .install-guide-video[hidden] { display: none; }
    .boot-loading {
      position: fixed;
      inset: 0;
      z-index: 9999;
      display: grid;
      place-items: center;
      background: #000000;
      color: #ffffff;
      text-align: center;
    }
    .boot-loading[hidden] { display: none; }
    .boot-loading-box {
      width: min(360px, calc(100vw - 44px));
    }
    .boot-loading h2 {
      margin: 0;
      font-size: 22px;
      color: #ffffff;
    }
    .boot-loading p {
      margin: 10px 0 0;
      color: #8fa3b8;
      font-size: 14px;
    }
    .app-booting .topbar,
    .app-booting .app-nav,
    .app-booting main {
      visibility: hidden;
    }
    .app-login {
      position: fixed;
      inset: 0;
      z-index: 10010;
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 20px;
      background: #000000;
      color: #ffffff;
    }
    .app-login[hidden] { display: none; }
    .app-login-card {
      width: min(520px, calc(100vw - 32px));
      padding: 34px 30px;
      border-radius: 14px;
      background: linear-gradient(180deg, #111418, #07090b);
      border: 1px solid rgba(255,255,255,.12);
      box-shadow: 0 28px 90px rgba(0,0,0,.5);
    }
    .app-login-card h1 {
      margin: 0;
      font-size: 31px;
      letter-spacing: 0;
    }
    .app-login-card p {
      margin: 8px 0 24px;
      color: #a9b7c7;
    }
    .app-login-card label {
      display: block;
      color: #d8e3ee;
      font-weight: 800;
    }
    .app-login-card input {
      width: 100%;
      min-height: 54px;
      margin-top: 7px;
      margin-bottom: 16px;
      border-radius: 9px;
      border: 1px solid #2c3440;
      background: #05080b;
      color: #ffffff;
      padding: 0 14px;
      outline: none;
    }
    .app-login-card input:focus {
      border-color: #28d1bd;
      box-shadow: 0 0 0 3px rgba(40,209,189,.2);
    }
    .app-login-card label.app-login-remember {
      display: flex;
      align-items: center;
      gap: 10px;
      min-height: 38px;
      margin: -2px 0 16px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 750;
    }
    .app-login-card .app-login-remember input {
      width: 19px;
      min-height: 19px;
      height: 19px;
      flex: 0 0 19px;
      margin: 0;
      padding: 0;
      border: 0;
      box-shadow: none;
      accent-color: #28d1bd;
    }
    .app-login-card button {
      width: 100%;
      min-height: 54px;
      margin-top: 4px;
      border-radius: 9px;
      background: #28d1bd;
      color: #001311;
      border-color: #28d1bd;
      font-weight: 900;
    }
    .app-login-status {
      min-height: 22px;
      margin-top: 14px;
      color: #fda29b;
      font-weight: 700;
    }
    .app-locked .topbar,
    .app-locked .app-nav,
    .app-locked main {
      visibility: hidden;
    }
    .labels-modal-card {
      width: min(680px, 100%);
    }
    .labels-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
      gap: 8px;
      max-width: none;
      justify-content: stretch;
    }
    .labels-grid .wa-label-chip {
      width: 100%;
      min-height: 44px;
      justify-content: space-between;
      border-radius: 8px;
      padding: 10px 12px;
    }
    .quick-replies-modal-card {
      width: min(760px, calc(100vw - 112px));
    }
    .saved-leads-modal-card {
      width: min(820px, calc(100vw - 112px));
    }
    .saved-leads-list {
      display: grid;
      gap: 8px;
      max-height: min(62vh, 560px);
      overflow: auto;
    }
    .saved-lead-card {
      display: grid;
      grid-template-columns: 46px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.045);
    }
    .saved-lead-card strong,
    .saved-lead-card p {
      overflow-wrap: anywhere;
    }
    .saved-lead-card p {
      margin: 3px 0 0;
    }
    .saved-lead-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
    .quick-replies-body {
      display: grid;
      gap: 12px;
    }
    .quick-reply-form {
      display: grid;
      grid-template-columns: minmax(170px, 0.42fr) minmax(260px, 1fr) auto;
      gap: 8px;
      align-items: start;
    }
    .quick-reply-form textarea {
      min-height: 72px;
      max-height: 120px;
    }
    .quick-replies-list {
      display: grid;
      gap: 8px;
      max-height: min(54vh, 460px);
      overflow: auto;
    }
    .quick-reply-card {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.045);
    }
    .quick-reply-card strong,
    .quick-reply-card p {
      overflow-wrap: anywhere;
    }
    .quick-reply-card p {
      margin: 4px 0 0;
    }
    .quick-reply-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .schedule-grid {
      display: grid;
      grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 1.25fr);
      gap: 12px;
      margin-bottom: 16px;
    }
    .schedule-panel,
    .appointment-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.045);
      padding: 14px;
    }
    .slot-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .slot-chip {
      border: 1px solid rgba(35, 213, 183, 0.35);
      border-radius: 999px;
      padding: 7px 10px;
      color: #bbfff3;
      background: rgba(35, 213, 183, 0.10);
      font-weight: 800;
    }
    .appointment-card {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      margin-bottom: 8px;
    }
    .appointment-card.attention {
      border-color: rgba(255, 199, 86, 0.55);
      background: rgba(255, 199, 86, 0.08);
    }
    .appointment-card p { margin: 4px 0 0; }
    .order-details-modal-card { width: min(620px, calc(100vw - 24px)); }
    .order-refund-modal-card { width: min(560px, calc(100vw - 24px)); }
    .refund-summary {
      margin-bottom: 14px;
      padding: 12px;
      border: 1px solid rgba(248, 113, 113, 0.30);
      border-radius: 8px;
      background: rgba(127, 29, 29, 0.14);
    }
    .order-details-grid { display: grid; gap: 0; }
    .order-details-row {
      display: grid;
      grid-template-columns: 150px minmax(0, 1fr);
      gap: 16px;
      padding: 12px 0;
      border-bottom: 1px solid var(--line);
    }
    .order-details-row:last-child { border-bottom: 0; }
    .order-details-row strong { color: var(--muted); }
    .order-details-row span { overflow-wrap: anywhere; }
    .appointment-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }
    .order-duration-control {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      min-height: 42px;
      padding: 6px 9px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #0b1219;
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
    }
    .order-duration-control input {
      width: 68px;
      min-height: 32px;
      padding: 5px 7px;
      border-radius: 6px;
      text-align: center;
    }
    .payment-confirmation-controls {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
      padding: 8px;
      border: 1px solid rgba(35, 213, 183, 0.34);
      border-radius: 7px;
      background: rgba(35, 213, 183, 0.07);
    }
    .payment-confirmation-controls .order-duration-control {
      color: #dce9f4;
      background: #081017;
    }
    .appointment-order-clock {
      min-width: 104px;
      padding: 8px 10px;
      border: 1px solid rgba(35, 213, 183, 0.32);
      border-radius: 7px;
      background: rgba(35, 213, 183, 0.08);
      color: #bafff3;
      text-align: center;
    }
    .appointment-order-clock small,
    .appointment-order-clock strong {
      display: block;
      color: inherit;
      white-space: nowrap;
    }
    .appointment-order-clock small {
      margin-bottom: 2px;
      color: #91a5ba;
      font-size: 9px;
      font-weight: 800;
      text-transform: uppercase;
    }
    .appointment-order-clock strong {
      font-size: 16px;
    }
    .appointment-order-clock.is-late {
      border-color: rgba(255, 189, 102, 0.5);
      color: #ffbd66;
    }
    .appointment-order-clock.is-ready {
      border-color: rgba(125, 247, 204, 0.5);
      color: #7df7cc;
    }
    .appointment-reminder-clock.is-started {
      border-color: rgba(255, 189, 102, 0.5);
      color: #ffbd66;
    }
    .appointment-notify-button[data-notified="true"] {
      border-color: rgba(125, 247, 204, 0.42);
      color: #9fffe0;
    }
    .appointment-notify-button[data-notified="true"]::after {
      content: "  OK";
    }
    body.niche-hamburgueria #traditionalSchedulingContent,
    body.niche-hamburgueria #newAppointmentButton {
      display: none !important;
    }
    .working-days-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }
    .working-day-row {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: rgba(255, 255, 255, 0.035);
    }
    .working-day-row.is-today {
      border-color: rgba(35, 213, 183, 0.72);
      box-shadow: inset 3px 0 0 var(--brand);
    }
    .working-day-today {
      display: inline-flex;
      margin-left: 7px;
      padding: 2px 6px;
      border-radius: 999px;
      background: rgba(35, 213, 183, 0.16);
      color: #7df7dc;
      font-size: 11px;
      line-height: 1.2;
    }
    .working-day-row .mini-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .appointment-alert {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: 80;
      width: min(380px, calc(100vw - 104px));
      border: 1px solid rgba(35, 213, 183, 0.42);
      border-radius: 8px;
      padding: 14px;
      background: rgba(8, 12, 18, 0.98);
      box-shadow: 0 22px 60px rgba(0, 0, 0, 0.44);
    }
    .appointment-alert strong {
      display: block;
      color: #ffffff;
      margin-bottom: 6px;
    }
    .appointment-alert p {
      margin: 0 0 10px;
    }
    .appointment-alert-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .schedule-realtime-option {
      position: relative;
      display: flex;
      align-items: center;
      gap: 7px;
      min-height: 46px;
      padding: 7px 9px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.035);
    }
    .free-order-card {
      margin: 12px 0 16px;
      padding: 14px;
      border: 1px solid rgba(35, 213, 183, 0.26);
      border-radius: 8px;
      background: rgba(35, 213, 183, 0.045);
    }
    .free-order-card > .check-row {
      margin: 0;
      font-size: 15px;
    }
    .barbershop-schedule-settings {
      display: grid;
      gap: 12px;
      margin: 12px 0 16px;
      padding: 14px;
      border: 1px solid rgba(35, 213, 183, 0.26);
      border-radius: 8px;
      background: rgba(35, 213, 183, 0.045);
    }
    .barbershop-schedule-settings[hidden],
    .appointment-barbershop-fields[hidden] {
      display: none !important;
    }
    .appointment-barbershop-fields {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }
    .free-order-description {
      margin: 7px 0 0;
      color: #9eb0c4;
      font-size: 13px;
      line-height: 1.45;
    }
    .free-order-settings {
      margin-top: 14px;
      padding-top: 14px;
      border-top: 1px solid var(--line);
    }
    .free-order-settings[hidden] {
      display: none;
    }
    .order-mode-options {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      margin: 10px 0;
    }
    .order-mode-options .check-row {
      min-height: 44px;
      margin: 0;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.025);
    }
    .free-order-switches {
      display: grid;
      gap: 8px;
      margin: 12px 0;
    }
    .schedule-realtime-option .check-row {
      margin: 0;
      white-space: nowrap;
      cursor: pointer;
    }
    .schedule-realtime-info-button,
    .realtime-schedule-collapse {
      display: inline-grid;
      place-items: center;
      width: 30px;
      height: 30px;
      min-width: 30px;
      padding: 0;
      border-radius: 50%;
      font-size: 15px;
      line-height: 1;
    }
    .schedule-realtime-help {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      z-index: 120;
      width: min(360px, calc(100vw - 32px));
      padding: 11px 12px;
      border: 1px solid rgba(35, 213, 183, 0.38);
      border-radius: 8px;
      background: #0d141d;
      color: var(--muted);
      box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
      font-size: 13px;
      line-height: 1.45;
    }
    .schedule-realtime-help[hidden],
    .realtime-schedule-panel[hidden] {
      display: none;
    }
    .realtime-schedule-panel {
      position: fixed;
      top: 82px;
      right: 18px;
      z-index: 78;
      display: flex;
      flex-direction: column;
      width: min(420px, calc(100vw - 108px));
      max-height: calc(100dvh - 102px);
      overflow: hidden;
      border: 1px solid rgba(35, 213, 183, 0.48);
      border-radius: 8px;
      background: rgba(8, 12, 18, 0.985);
      box-shadow: 0 24px 72px rgba(0, 0, 0, 0.56);
    }
    .realtime-schedule-panel.is-minimized {
      width: min(330px, calc(100vw - 108px));
    }
    .realtime-schedule-panel.is-minimized .realtime-schedule-summary,
    .realtime-schedule-panel.is-minimized .realtime-store-control,
    .realtime-schedule-panel.is-minimized .realtime-schedule-list {
      display: none;
    }
    .realtime-schedule-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-height: 58px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
    }
    .realtime-schedule-heading {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0;
    }
    .realtime-live-dot {
      width: 10px;
      height: 10px;
      flex: 0 0 10px;
      border-radius: 50%;
      background: var(--accent);
      box-shadow: 0 0 0 5px rgba(35, 213, 183, 0.12);
      animation: realtimePulse 1.8s ease-in-out infinite;
    }
    @keyframes realtimePulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.52; transform: scale(0.78); }
    }
    .realtime-schedule-title {
      min-width: 0;
    }
    .realtime-schedule-title strong,
    .realtime-schedule-title small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .realtime-schedule-title small {
      margin-top: 2px;
      color: var(--muted);
      font-size: 11px;
    }
    .realtime-schedule-summary {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      padding: 8px 12px;
      border-bottom: 1px solid var(--line);
      color: var(--muted);
      font-size: 12px;
    }
    .realtime-store-control {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 9px 12px;
      border-bottom: 1px solid var(--line);
      background: rgba(35, 213, 183, 0.05);
    }
    .realtime-store-control[hidden] {
      display: none;
    }
    .realtime-store-state {
      min-width: 0;
    }
    .realtime-store-state strong,
    .realtime-store-state small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .realtime-store-state strong {
      color: #a7fff0;
      font-size: 12px;
    }
    .realtime-store-state small {
      margin-top: 2px;
      color: var(--muted);
      font-size: 11px;
    }
    .store-status-button {
      flex: 0 0 auto;
      min-height: 36px;
      padding: 7px 11px;
      border: 1px solid rgba(248, 113, 113, 0.5);
      border-radius: 7px;
      background: rgba(127, 29, 29, 0.24) !important;
      color: #fecaca !important;
      font-size: 12px;
      font-weight: 900;
    }
    .store-status-button.is-closed {
      border-color: rgba(248, 113, 113, 0.62);
      background: rgba(185, 28, 28, 0.34) !important;
      color: #ffffff !important;
    }
    .store-status-button:disabled {
      cursor: wait;
      opacity: 0.58;
    }
    .realtime-schedule-panel.is-store-closed {
      border-color: rgba(248, 113, 113, 0.5);
    }
    .realtime-schedule-panel.is-store-closed .realtime-live-dot {
      background: #f87171;
      box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.12);
    }
    .realtime-schedule-panel.is-store-closed .realtime-store-control {
      background: rgba(127, 29, 29, 0.13);
    }
    .realtime-schedule-panel.is-store-closed .realtime-store-state strong {
      color: #fecaca;
    }
    body.store-closed-mode {
      --green: #ef4444;
      --green-soft: rgba(239, 68, 68, 0.16);
      --blue: #f87171;
      --blue-soft: rgba(248, 113, 113, 0.14);
      --accent: #ef4444;
      --red: #ff5c6c;
      --red-soft: rgba(255, 92, 108, 0.18);
    }
    body.store-closed-mode ::selection {
      background: rgba(239, 68, 68, 0.38);
    }
    body.store-closed-mode .topbar,
    body.store-closed-mode .app-nav,
    body.store-closed-mode .crm-shell,
    body.store-closed-mode .realtime-schedule-panel {
      border-color: rgba(248, 113, 113, 0.48);
    }
    body.store-closed-mode .nav-button.active,
    body.store-closed-mode .segment-button.active,
    body.store-closed-mode button:not(.ghost):not(.contact-item) {
      border-color: rgba(248, 113, 113, 0.62) !important;
      background: linear-gradient(135deg, #b91c1c, #ef4444) !important;
      color: #ffffff !important;
      box-shadow: 0 10px 24px rgba(185, 28, 28, 0.24) !important;
    }
    body.store-closed-mode #storeStatusButton.is-closed {
      border-color: rgba(52, 211, 153, 0.7) !important;
      background: linear-gradient(135deg, #16a34a, #34d399) !important;
      color: #03110b !important;
      box-shadow: 0 10px 24px rgba(22, 163, 74, 0.28) !important;
    }
    body.store-closed-mode button.ghost,
    body.store-closed-mode .nav-button:not(.active),
    body.store-closed-mode .segment-button:not(.active) {
      border-color: rgba(248, 113, 113, 0.34);
      background: rgba(127, 29, 29, 0.16);
      color: #fecaca;
    }
    body.store-closed-mode button.contact-item:hover,
    body.store-closed-mode button.contact-item.active {
      background: rgba(239, 68, 68, 0.12);
      box-shadow: inset 3px 0 0 #ef4444;
    }
    body.store-closed-mode .badge.ok,
    body.store-closed-mode .contact-auto-toggle,
    body.store-closed-mode #conversationAutomationBadge {
      border-color: rgba(248, 113, 113, 0.52);
      background: rgba(185, 28, 28, 0.24);
      color: #fecaca;
    }
    body.store-closed-mode .avatar,
    body.store-closed-mode .realtime-schedule-order,
    body.store-closed-mode .professional-availability-avatar {
      border-color: rgba(248, 113, 113, 0.48);
      background: linear-gradient(135deg, rgba(185, 28, 28, 0.34), rgba(239, 68, 68, 0.2));
      color: #fee2e2;
      box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
    }
    body.store-closed-mode .bubble.out {
      border-color: rgba(248, 113, 113, 0.38);
      background: linear-gradient(135deg, rgba(185, 28, 28, 0.28), rgba(239, 68, 68, 0.16));
    }
    body.store-closed-mode input:focus,
    body.store-closed-mode textarea:focus,
    body.store-closed-mode select:focus {
      border-color: rgba(248, 113, 113, 0.78);
      outline-color: rgba(248, 113, 113, 0.2);
    }
    .realtime-schedule-list {
      min-height: 82px;
      overflow-y: auto;
      padding: 8px;
    }
    .realtime-schedule-empty {
      margin: 0;
      padding: 22px 12px;
      color: var(--muted);
      text-align: center;
    }
    .realtime-schedule-item {
      display: grid;
      grid-template-columns: 32px minmax(0, 1fr) auto;
      gap: 9px;
      align-items: center;
      width: 100%;
      min-height: 66px;
      margin: 0 0 6px;
      padding: 9px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #121a23 !important;
      color: #f8fafc !important;
      text-align: left;
      box-shadow: none;
      cursor: pointer;
    }
    .realtime-confirm-payment {
      min-height: 38px;
      padding: 8px 12px;
      border-radius: 7px;
      background: var(--accent) !important;
      color: #03110f !important;
      font-size: 13px;
      font-weight: 900;
    }
    .realtime-payment-actions {
      grid-column: 2 / -1;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .realtime-schedule-item:hover,
    .realtime-schedule-item:focus-visible {
      border-color: rgba(35, 213, 183, 0.58);
      background: #17242d !important;
      transform: none;
    }
    .realtime-schedule-item.is-new {
      animation: realtimeNewItem 1.2s ease-out;
    }
    @keyframes realtimeNewItem {
      from { background: #17443e; }
      to { background: #121a23; }
    }
    .realtime-schedule-order {
      display: grid;
      place-items: center;
      width: 32px;
      height: 32px;
      border: 1px solid rgba(35, 213, 183, 0.38);
      border-radius: 50%;
      color: #bafff3;
      font-size: 12px;
      font-weight: 900;
    }
    .realtime-schedule-copy {
      min-width: 0;
    }
    .realtime-schedule-copy strong,
    .realtime-schedule-copy span,
    .realtime-schedule-copy small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .realtime-schedule-copy strong {
      color: #f8fafc !important;
    }
    .realtime-schedule-copy span {
      margin-top: 3px;
      color: #c8d5e3;
      font-size: 12px;
    }
    .professional-availability-item {
      cursor: default;
    }
    .professional-availability-item.is-offline {
      opacity: 0.72;
    }
    .professional-availability-item.is-offline .realtime-schedule-order {
      border-color: rgba(148, 163, 184, 0.32);
      color: #94a3b8;
    }
    .professional-name-line {
      display: flex !important;
      align-items: center;
      gap: 7px;
      min-width: 0;
      overflow: visible !important;
    }
    .professional-name-line strong {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .professional-pending-badge {
      display: inline-grid;
      flex: 0 0 auto;
      place-items: center;
      width: auto;
      min-width: 20px;
      min-height: 20px;
      height: 20px;
      padding: 0 6px;
      border: 1px solid rgba(254, 202, 202, 0.42);
      border-radius: 999px;
      background: #dc2626;
      color: #ffffff;
      font-size: 11px;
      font-weight: 900;
      line-height: 1;
      box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.13);
      cursor: pointer;
      transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
    }
    .professional-pending-badge:hover {
      background: #ef4444;
      transform: translateY(-1px);
      box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
    }
    .professional-pending-badge:focus-visible {
      outline: 2px solid #ffffff;
      outline-offset: 2px;
    }
    .professional-photo-manager {
      display: grid;
      gap: 12px;
      padding: 14px;
      border: 1px solid rgba(148, 163, 184, 0.2);
      border-radius: 7px;
      background: rgba(7, 13, 20, 0.52);
    }
    .professional-photo-manager h4 {
      margin: 0 0 4px;
      color: #f8fafc;
      font-size: 14px;
    }
    .professional-photo-list {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 9px;
    }
    .professional-photo-card {
      display: grid;
      grid-template-columns: 48px minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
      min-height: 66px;
      padding: 9px;
      border: 1px solid rgba(148, 163, 184, 0.18);
      border-radius: 7px;
      background: #111923;
    }
    .professional-photo-avatar,
    .professional-availability-avatar {
      display: grid;
      place-items: center;
      width: 48px;
      height: 48px;
      overflow: hidden;
      border: 1px solid rgba(35, 213, 183, 0.42);
      border-radius: 50%;
      background: #123139;
      color: #bafff3;
      font-size: 15px;
      font-weight: 900;
      object-fit: cover;
    }
    .professional-availability-avatar {
      width: 32px;
      height: 32px;
      font-size: 12px;
    }
    .professional-photo-copy {
      min-width: 0;
    }
    .professional-photo-copy strong,
    .professional-photo-copy small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .professional-photo-copy small {
      margin-top: 3px;
      color: var(--muted);
      font-size: 11px;
    }
    .professional-photo-actions {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .professional-photo-upload,
    .professional-photo-remove {
      min-height: 34px;
      padding: 7px 9px;
      font-size: 11px;
      font-weight: 900;
    }
    .professional-photo-upload input {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      opacity: 0;
      pointer-events: none;
    }
    .professional-status-toggle {
      min-width: 98px;
      min-height: 36px;
      padding: 7px 10px;
      border: 1px solid rgba(35, 213, 183, 0.42);
      border-radius: 7px;
      background: rgba(35, 213, 183, 0.12) !important;
      color: #a7fff0 !important;
      font-size: 12px;
      font-weight: 900;
    }
    .professional-status-toggle.is-online {
      border-color: rgba(248, 113, 113, 0.42);
      background: rgba(127, 29, 29, 0.18) !important;
      color: #fecaca !important;
    }
    .professional-status-toggle:disabled {
      cursor: wait;
      opacity: 0.58;
    }
    .realtime-schedule-copy small {
      margin-top: 3px;
      color: var(--muted);
      font-size: 11px;
    }
    .realtime-schedule-time {
      min-width: 56px;
      color: #bafff3;
      font-size: 13px;
      font-weight: 900;
      text-align: right;
    }
    .realtime-schedule-time small,
    .realtime-schedule-time strong {
      display: block;
      color: inherit;
      white-space: nowrap;
    }
    .realtime-schedule-time small {
      margin-bottom: 2px;
      color: #91a5ba;
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
    }
    .realtime-schedule-time.is-late {
      color: #ffbd66;
    }
    .realtime-schedule-time.is-ready {
      color: #7df7cc;
    }
    .install-toast {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: 10030;
      width: min(390px, calc(100vw - 104px));
      border: 1px solid rgba(35, 213, 183, 0.42);
      border-radius: 8px;
      padding: 14px;
      background: rgba(8, 12, 18, 0.98);
      box-shadow: 0 22px 60px rgba(0, 0, 0, 0.44);
    }
    .install-toast[hidden] {
      display: none;
    }
    .install-toast strong {
      display: block;
      color: #ffffff;
      margin-bottom: 6px;
    }
    .install-toast p {
      margin: 0 0 10px;
    }
    .install-toast-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .admin-evolution-modal-card {
      width: min(560px, calc(100vw - 32px));
    }
    .admin-connection-modes {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }
    .admin-connection-modes button.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #041713;
    }
    .admin-connection-status {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--muted);
    }
    .admin-connection-status::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--red);
    }
    .admin-connection-status.connected::before {
      background: var(--accent);
    }
    .appointments-modal-card {
      width: min(860px, calc(100vw - 112px));
    }
    #appointmentsModal {
      z-index: 10060;
    }
    .appointments-modal-list {
      display: grid;
      gap: 8px;
      max-height: min(68vh, 620px);
      overflow: auto;
    }
    .orders-realtime-control {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 12px;
      padding: 12px 14px;
      border: 1px solid rgba(45, 212, 191, 0.34);
      border-radius: 8px;
      background: rgba(15, 118, 110, 0.12);
    }
    .orders-realtime-control[hidden] { display: none !important; }
    .orders-realtime-control .check-row { flex: 0 0 auto; }
    .orders-realtime-control small {
      color: var(--muted);
      line-height: 1.4;
      text-align: right;
    }
    .orders-modal-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 12px;
      padding-bottom: 10px;
      overflow-x: auto;
      border-bottom: 1px solid var(--line);
    }
    .orders-modal-tabs[hidden] { display: none !important; }
    .orders-modal-tabs button { flex: 0 0 auto; }
    .orders-history-filters {
      display: grid;
      grid-template-columns: repeat(4, minmax(140px, 1fr));
      gap: 10px;
      margin-bottom: 12px;
    }
    .orders-history-filters label,
    .orders-finance-toolbar label {
      display: grid;
      gap: 6px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
    }
    .orders-finance-toolbar {
      display: flex;
      justify-content: flex-end;
      margin-bottom: 12px;
    }
    .orders-finance-dashboard {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }
    .finance-stat {
      min-width: 0;
      padding: 16px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.045);
    }
    .finance-stat small,
    .finance-stat strong { display: block; }
    .finance-stat small {
      margin-bottom: 6px;
      color: var(--muted);
      font-weight: 800;
    }
    .finance-stat strong {
      color: #f4fbff;
      font-size: 24px;
      overflow-wrap: anywhere;
    }
    .finance-timezone-note { margin-top: 12px; }
    .finance-stat.is-negative strong { color: #ff9c9c; }
    .finance-activity {
      margin-top: 14px;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.025);
    }
    .finance-activity-heading {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }
    .finance-activity-heading h3 { margin: 0; }
    .finance-activity-list { display: grid; gap: 8px; }
    .finance-transaction {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.035);
    }
    .finance-transaction p { margin: 3px 0 0; }
    .finance-transaction-amount { color: #83f7df; font-size: 18px; }
    .finance-transaction.is-refund {
      border-color: rgba(248, 113, 113, 0.30);
      background: rgba(127, 29, 29, 0.10);
    }
    .finance-transaction.is-refund .finance-transaction-amount { color: #ff9c9c; }
    .menu-portfolio-box {
      margin-bottom: 16px;
      padding: 16px;
      border: 1px solid rgba(38, 208, 183, 0.34);
      border-radius: 8px;
      background: rgba(38, 208, 183, 0.055);
    }
    .menu-portfolio-box h3 { margin: 0 0 6px; }
    .menu-portfolio-current {
      display: grid;
      grid-template-columns: 74px minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      margin-top: 12px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.18);
    }
    .menu-portfolio-current img {
      width: 74px;
      height: 74px;
      border-radius: 6px;
      object-fit: cover;
    }
    .crm-lock,
    .crm-loading {
      inset: 0;
      background: #000000;
      backdrop-filter: blur(8px);
    }
    .crm-loading .lock-panel {
      width: min(360px, calc(100vw - 44px));
      padding: 0;
      border: 0;
      background: transparent;
      box-shadow: none;
    }
    .crm-loading .lock-panel p { display: none; }
    .crm-loading .lock-panel h2 {
      margin: 0;
      color: #ffffff;
    }
    .stats.view.active,
    [data-view="crm"].view.active:not(#crmSection),
    .topbar,
    #crmUnlockBadge,
    #crmSummary,
    #globalStatus,
    #activeNumberBadge {
      display: none !important;
    }
    .app-nav {
      position: fixed;
      inset: 0 auto 0 0;
      z-index: 30;
      width: 72px;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      padding: 12px 8px;
      border-right: 1px solid rgba(148, 163, 184, 0.18);
      border-bottom: 0;
      overflow: visible;
    }
    .nav-button {
      position: relative;
      width: 52px;
      height: 52px;
      min-height: 52px;
      padding: 0;
      border-radius: 8px;
      font-size: 0;
    }
    .nav-button::before {
      content: attr(data-icon);
      font-size: 19px;
      font-weight: 900;
      line-height: 1;
    }
    .nav-button[data-icon-image="true"]::before {
      content: "";
      width: 46px;
      height: 46px;
      border-radius: 11px;
      background-image: var(--nav-icon-image);
      background-position: center;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
    }
    .nav-button::after {
      content: attr(data-label);
      position: absolute;
      left: calc(100% + 10px);
      top: 50%;
      transform: translateY(-50%);
      width: max-content;
      max-width: 180px;
      padding: 7px 9px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #0d131b;
      color: #edf5ff;
      font-size: 12px;
      opacity: 0;
      pointer-events: none;
      box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
      transition: opacity 0.14s ease;
    }
    .nav-button:hover::after { opacity: 1; }
    .nav-count-badge {
      position: absolute;
      top: -5px;
      right: -5px;
      z-index: 3;
      min-width: 21px;
      height: 21px;
      padding: 0 6px;
      border: 2px solid #080d13;
      border-radius: 999px;
      background: #ef3340;
      color: #ffffff;
      font-size: 11px;
      font-weight: 900;
      line-height: 17px;
      text-align: center;
      box-shadow: 0 5px 16px rgba(239, 51, 64, 0.42);
    }
    .logout-nav-button {
      margin-top: auto;
      border-color: rgba(255, 92, 108, 0.30);
      color: #ffb7bf;
    }
    .logout-nav-button:hover {
      border-color: rgba(255, 92, 108, 0.55);
      background: rgba(255, 92, 108, 0.12);
      color: #ffffff;
    }
    .install-nav-button {
      border-color: rgba(24, 199, 168, 0.38);
      color: #7df6dc;
      background: rgba(24, 199, 168, 0.08);
    }
    .install-nav-button:hover {
      border-color: rgba(24, 199, 168, 0.64);
      background: rgba(24, 199, 168, 0.16);
      color: #ffffff;
    }
    .logout-nav-button::after {
      color: #ffd6db;
    }
    .topbar {
      position: fixed;
      top: 0;
      left: 72px;
      right: 0;
      width: calc(100% - 72px);
      margin-left: 72px;
      min-height: 64px;
      padding: 10px 16px;
    }
    .topbar h1 {
      font-size: 18px;
    }
    .topbar p {
      display: none;
    }
    main {
      width: auto;
      height: 100vh;
      min-height: 0;
      margin: 0 0 0 72px;
      padding: 0;
      display: block;
      overflow: hidden;
    }
    .crm-shell,
    #crmSection.crm-shell.view.active {
      height: 100vh;
      min-height: 0;
      border-radius: 0;
      border-left: 0;
      border-right: 0;
      border-bottom: 0;
      display: grid !important;
      grid-template-rows: auto minmax(0, 1fr);
      overflow: hidden;
    }
    #crmSection .crm-header {
      position: relative;
      min-height: 42px;
      padding: 6px 10px;
      align-items: center;
      overflow: visible;
    }
    .crm-header-titleline {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    #crmSection .crm-header h2 {
      margin: 0;
      font-size: 15px;
      line-height: 1.1;
      white-space: nowrap;
    }
    #crmSection .crm-header p {
      display: none;
    }
    .crm-more-toggle {
      min-height: 30px;
      padding: 6px 10px;
      font-size: 12px;
    }
    #crmSection .crm-header-actions {
      position: absolute;
      top: calc(100% - 1px);
      right: 10px;
      z-index: 8;
      display: flex;
      max-width: min(640px, calc(100vw - 112px));
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(8, 12, 18, 0.96);
      box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
      opacity: 0;
      transform: translateY(-6px);
      pointer-events: none;
      transition: opacity 0.14s ease, transform 0.14s ease;
    }
    #crmSection .crm-header-actions::before {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      top: -10px;
      height: 10px;
    }
    #crmSection .crm-header:hover .crm-header-actions,
    #crmSection .crm-header.expanded .crm-header-actions {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .crm-grid {
      display: grid;
      height: 100%;
      min-height: 0;
      grid-template-columns: 318px minmax(0, 1fr);
      grid-template-rows: minmax(0, 1fr);
      overflow: hidden;
    }
    .details {
      display: none;
    }
    .contact-list,
    .details-scroll {
      max-height: none;
    }
    .inbox {
      width: 318px;
      max-width: 318px;
      min-height: 0;
      height: 100%;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      overflow: hidden;
    }
    .contact-list {
      height: auto;
      min-height: 0;
      overflow: auto;
    }
    .conversation {
      height: 100%;
      min-height: 0;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr) auto;
      overflow: hidden;
    }
    .messages {
      min-height: 0;
      height: auto;
      max-height: none;
      overflow: auto;
    }
    .composer {
      position: relative;
      z-index: 2;
      display: grid;
      gap: 8px;
      padding: 10px 12px 34px;
      min-height: 0;
      overflow: visible;
    }
    .composer .row {
      margin: 0;
      flex-wrap: wrap;
    }
    .composer textarea {
      min-height: 96px;
      max-height: 150px;
    }
    .module-modal-card,
    .lead-modal-card {
      width: min(1120px, calc(100vw - 112px));
      max-height: min(92vh, 860px);
    }
    .module-modal-content {
      display: grid;
      gap: 12px;
    }
    .module-modal-content > .view,
    .lead-details-mount > .details-scroll {
      display: block !important;
    }
    .module-modal-content > section,
    .lead-details-mount > .details-scroll {
      padding: 0;
      border: 0;
      background: transparent;
      box-shadow: none;
    }
    .lead-details-mount .details-scroll {
      max-height: min(74vh, 680px);
      padding: 0;
    }
    .portfolio-modal-card {
      width: min(680px, calc(100vw - 112px));
    }
    .portfolio-controls-home {
      display: none;
    }
    .portfolio-modal-mount .portfolio-controls-home {
      display: block;
    }
    .portfolio-modal-mount .portfolio-controls-home > .row {
      display: flex;
    }
    .inbox {
      background: rgba(255, 255, 255, 0.018);
    }
    .inbox-toolbar {
      padding: 8px 10px;
    }
    .inbox-toolbar input {
      min-height: 38px;
      padding: 8px 10px;
      font-size: 13px;
    }
    button.contact-item {
      min-height: 74px;
      grid-template-columns: 42px minmax(0, 1fr);
      gap: 9px;
      padding: 8px 10px;
    }
    button.contact-item .avatar {
      width: 42px;
      height: 42px;
      font-size: 13px;
    }
    .contact-top {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 6px;
      align-items: center;
      margin-bottom: 2px;
    }
    .contact-name {
      min-width: 0;
      font-size: 14px;
      line-height: 1.18;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      overflow-wrap: normal;
    }
    .contact-top .badge {
      min-height: 21px;
      padding: 2px 7px;
      font-size: 10px;
      line-height: 1;
    }
    .contact-auto-toggle {
      cursor: pointer;
      user-select: none;
    }
    #conversationAutomationBadge {
      cursor: pointer;
      user-select: none;
    }
    .contact-auto-toggle:hover {
      border-color: rgba(24, 199, 168, 0.62);
      color: #7df6dc;
    }
    .contact-auto-toggle.badge.ok {
      border-color: rgba(24, 199, 168, 0.48);
      background: rgba(24, 199, 168, 0.14);
      color: #7df6dc;
    }
    .contact-body > .muted {
      display: block;
      min-width: 0;
      margin-bottom: 2px;
      font-size: 11px;
      line-height: 1.18;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .contact-preview {
      font-size: 11px;
      line-height: 1.22;
      -webkit-line-clamp: 1;
    }
    .conversation-title {
      padding: 9px 14px;
    }
    .conversation-copy strong {
      font-size: 15px;
    }
    .avatar-lg {
      width: 44px;
      height: 44px;
      font-size: 15px;
    }
    pre {
      background: rgba(5, 9, 14, 0.82);
      border: 1px solid var(--line);
      color: #d9e7f5;
    }
    @media (max-width: 1120px) {
      main { grid-template-columns: 1fr; }
      .setup-grid { grid-template-columns: 1fr; }
      .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .prospect-board { grid-template-columns: 1fr; }
      .prospecting-context, .prospect-panel-grid { grid-template-columns: 1fr; }
      .crm-grid { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); }
      .inbox, .conversation, .details { border-right: 0; border-bottom: 1px solid var(--line); }
    }
    @media (max-width: 720px) {
      .admin-openai-key-row { grid-template-columns: 1fr; }
      .admin-openai-key-row button { width: 100%; }
      .app-nav {
        inset: auto 0 0 0;
        width: auto;
        height: 74px;
        flex-direction: row;
        justify-content: center;
        border-right: 0;
        border-top: 1px solid rgba(148, 163, 184, 0.18);
      }
      .topbar {
        left: 0;
        width: 100%;
        margin-left: 0;
        align-items: flex-start;
        flex-direction: column;
      }
      .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      main {
        width: auto;
        margin: 0;
        padding-bottom: 74px;
      }
      .crm-shell {
        height: calc(100vh - 74px);
        min-height: calc(100vh - 74px);
      }
      .crm-grid { grid-template-columns: 1fr; }
      .conversation { min-height: 520px; }
      .mini-grid { grid-template-columns: 1fr; }
      .module-modal-card,
      .lead-modal-card,
      .portfolio-modal-card,
      .quick-replies-modal-card,
      .saved-leads-modal-card {
        width: min(100%, calc(100vw - 24px));
      }
      .saved-lead-card {
        grid-template-columns: 42px minmax(0, 1fr);
      }
      .saved-lead-card .saved-lead-actions {
        grid-column: 1 / -1;
      }
      .quick-reply-form {
        grid-template-columns: 1fr;
      }
      .grid.two {
        grid-template-columns: 1fr;
      }
      #crmSection .crm-header-actions {
        left: 10px;
        right: 10px;
        max-width: none;
      }
      .schedule-realtime-option {
        width: 100%;
        justify-content: space-between;
      }
      .schedule-realtime-help {
        right: auto;
        left: 0;
      }
      .realtime-schedule-panel,
      .realtime-schedule-panel.is-minimized {
        top: auto;
        right: 10px;
        bottom: 84px;
        left: 10px;
        width: auto;
        max-height: min(62dvh, 560px);
      }
    }

    /* Mobile CRM: inbox and conversation behave as separate app screens. */
    @media (max-width: 720px) {
      html,
      body {
        width: 100%;
        height: 100%;
        min-height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
        -webkit-text-size-adjust: 100%;
      }
      main {
        height: calc(100vh - 74px);
        height: calc(100dvh - 74px);
        padding-bottom: 0;
      }
      .app-nav {
        justify-content: flex-start;
        gap: 8px;
        height: 74px;
        padding: 7px max(10px, env(safe-area-inset-right)) 5px max(10px, env(safe-area-inset-left));
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
      }
      .app-nav::-webkit-scrollbar {
        display: none;
      }
      .app-nav .nav-button {
        flex: 0 0 62px;
        width: 62px;
        height: 60px;
        min-height: 60px;
        padding: 0 0 13px;
        scroll-snap-align: start;
      }
      .app-nav .nav-button[data-icon-image="true"]::before {
        width: 42px;
        height: 42px;
      }
      .app-nav .nav-button::after {
        content: attr(data-label);
        position: absolute;
        inset: auto 2px 2px;
        width: auto;
        max-width: none;
        padding: 0;
        overflow: hidden;
        transform: none;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #9fb0c3;
        box-shadow: none;
        font-size: 8px;
        line-height: 1.1;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        opacity: 1;
      }
      .app-nav .nav-button.active::after {
        color: #dffff8;
      }
      .app-nav .nav-button:first-child {
        margin-left: 8px;
      }
      .app-nav .nav-button:last-child {
        margin-right: 8px;
      }
      .app-nav .logout-nav-button {
        margin-top: 0;
      }
      #crmSection.crm-shell,
      #crmSection.crm-shell.view.active {
        height: calc(100vh - 74px);
        height: calc(100dvh - 74px);
        min-height: 0;
        grid-template-rows: minmax(0, 1fr);
        border: 0;
      }
      #crmSection .crm-header {
        position: absolute;
        top: 58px;
        right: 8px;
        z-index: 45;
        width: 0;
        min-height: 0;
        padding: 0;
        border: 0;
        background: transparent;
      }
      #crmSection .crm-header-titleline {
        display: none;
      }
      #crmSection .crm-header-actions {
        top: 0;
        right: 0;
        left: auto;
        width: min(330px, calc(100vw - 24px));
        max-width: none;
        max-height: calc(100dvh - 150px);
        padding: 9px;
        overflow: auto;
        justify-content: stretch;
        background: #0d131b;
      }
      #crmSection .crm-header-actions > button {
        flex: 1 1 132px;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 12px;
      }
      #crmSection .crm-header:hover:not(.expanded) .crm-header-actions {
        opacity: 0;
        transform: translateY(-6px);
        pointer-events: none;
      }
      #crmSection .crm-header.expanded .crm-header-actions {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
      }
      .crm-grid {
        position: relative;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
      }
      .inbox {
        width: 100%;
        max-width: none;
        height: 100%;
        min-height: 0;
        border: 0;
        background: #0b1017;
      }
      .mobile-inbox-title {
        display: flex;
        min-height: 50px;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 8px;
      }
      .mobile-inbox-title h2 {
        margin: 0;
        font-size: 23px;
        line-height: 1.1;
      }
      .mobile-inbox-title p {
        display: none;
      }
      #mobileInboxMoreButton {
        width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        border-radius: 50%;
        font-size: 22px;
        line-height: 1;
      }
      .inbox-toolbar {
        padding: max(9px, env(safe-area-inset-top)) 10px 9px;
        background: #0b1017;
      }
      .inbox-toolbar input {
        min-height: 40px;
        border-radius: 8px;
        background: #151b23;
      }
      .contact-list {
        height: 100%;
        min-height: 0;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        background: #0b1017;
      }
      button.contact-item {
        min-height: 70px;
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 10px;
        padding: 9px 11px;
        background: #0b1017;
        border-bottom-color: rgba(148, 163, 184, 0.14);
      }
      button.contact-item.active {
        background: rgba(24, 199, 168, 0.10);
      }
      button.contact-item .avatar {
        width: 48px;
        height: 48px;
      }
      .contact-name {
        font-size: 14px;
      }
      .contact-body > .muted,
      .contact-preview {
        color: #91a4bb;
      }
      .conversation {
        display: none;
        width: 100%;
        height: 100%;
        min-height: 0;
        grid-template-rows: auto minmax(0, 1fr) auto;
        border: 0;
        background: #070b10;
      }
      #crmSection.mobile-chat-open .inbox {
        display: none;
      }
      #crmSection.mobile-chat-open .conversation {
        display: grid;
      }
      #crmSection.mobile-chat-open .crm-header {
        display: none;
      }
      .conversation-title {
        min-height: 58px;
        padding: max(7px, env(safe-area-inset-top)) 9px 7px;
        background: #10161e;
      }
      .conversation-heading {
        gap: 8px;
      }
      .mobile-chat-back {
        display: inline-grid;
        place-items: center;
        width: 38px;
        height: 38px;
        min-height: 38px;
        flex: 0 0 38px;
        padding: 0 0 3px;
        border: 0 !important;
        background: transparent !important;
        color: #7df6dc !important;
        font-size: 34px;
        line-height: 1;
      }
      .avatar-lg {
        width: 40px;
        height: 40px;
      }
      .conversation-copy strong {
        max-width: calc(100vw - 160px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
      }
      .conversation-name-row {
        flex-wrap: nowrap;
      }
      #conversationAutomationBadge {
        max-width: 142px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 3px 7px;
        font-size: 9px;
      }
      #conversationMeta {
        max-width: calc(100vw - 112px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 10px;
      }
      .messages {
        min-height: 0;
        height: auto;
        max-height: none;
        padding: 10px 8px 14px;
        gap: 6px;
        scroll-behavior: auto;
        overscroll-behavior: contain;
      }
      .bubble {
        max-width: 88%;
        padding: 8px 9px;
        font-size: 14px;
        line-height: 1.34;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: pan-y;
      }
      .bubble *,
      .message-action-menu,
      .message-action-menu * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
      }
      .message-action-button {
        display: none;
      }
      .bubble.message-long-press-active {
        border-color: rgba(255, 255, 255, 0.34);
        filter: brightness(1.12);
      }
      .bubble small {
        font-size: 9px;
      }
      .message-media audio {
        width: 100%;
        min-width: 0;
      }
      .audio-player-shell {
        grid-template-columns: 40px minmax(0, 1fr);
      }
      .audio-time {
        grid-column: 2;
        min-width: 0;
        text-align: left;
      }
      .audio-actions {
        flex-wrap: wrap;
      }
      .audio-download-button {
        min-height: 38px;
      }
      .audio-viewer-card {
        width: 100%;
        max-height: 100%;
      }
      .audio-viewer-body {
        padding: 18px 14px;
      }
      .audio-viewer-player,
      .audio-viewer-download {
        width: 100%;
      }
      .composer {
        z-index: 6;
        gap: 6px;
        padding: 7px 8px max(8px, env(safe-area-inset-bottom));
        border-top-color: rgba(148, 163, 184, 0.20);
        background: #10161e;
      }
      .composer textarea,
      .composer textarea#replyText {
        min-height: 54px;
        max-height: 92px;
        padding: 9px 10px;
        border-radius: 8px;
        font-size: 14px;
        resize: none;
      }
      .composer .composer-actions {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        width: 100%;
        margin: 0;
        padding: 0 0 2px;
        overflow-x: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
      }
      .composer .composer-actions::-webkit-scrollbar {
        display: none;
      }
      .composer .composer-actions button {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 8px 11px;
        font-size: 12px;
        white-space: nowrap;
      }
      .composer-status {
        margin: 0;
        max-height: 34px;
        overflow: auto;
        font-size: 10px;
      }
      body.mobile-chat-active .app-nav {
        display: none;
      }
      body.mobile-chat-active #realtimeSchedulePanel {
        display: none !important;
      }
      body.mobile-chat-active main,
      body.mobile-chat-active #crmSection.crm-shell,
      body.mobile-chat-active #crmSection.crm-shell.view.active {
        height: 100vh;
        height: 100dvh;
      }
      body.mobile-chat-active main {
        padding-bottom: 0;
      }

      /* Mobile dialogs use the screen efficiently and never trigger Safari zoom. */
      body input,
      body textarea,
      body select,
      .inbox-toolbar input,
      .composer textarea,
      .composer textarea#replyText {
        font-size: 16px !important;
      }
      button,
      input,
      textarea,
      select,
      [role="button"] {
        touch-action: manipulation;
      }
      .modal-backdrop {
        align-items: end;
        justify-items: stretch;
        padding: 0;
        background: rgba(0, 0, 0, 0.72);
        contain: none;
      }
      .modal-card,
      .labels-modal-card,
      .notice-modal-card,
      .install-modal-card,
      .portfolio-modal-card,
      .quick-replies-modal-card,
      .courses-modal-card,
      .saved-leads-modal-card,
      .appointments-modal-card,
      .lead-modal-card {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        width: 100%;
        max-width: none;
        max-height: min(88vh, 760px);
        max-height: min(88dvh, 760px);
        margin: 0;
        overflow: hidden;
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 8px 8px 0 0;
        box-shadow: 0 -18px 58px rgba(0, 0, 0, 0.52);
      }
      .module-modal-card,
      .courses-modal-card,
      #trainingModal .modal-card,
      .lead-modal-card {
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-top: 0;
        border-radius: 0;
      }
      .modal-header {
        position: sticky;
        top: 0;
        z-index: 4;
        min-height: 58px;
        align-items: center;
        gap: 8px;
        padding: max(10px, env(safe-area-inset-top)) 12px 10px;
      }
      .modal-header > div {
        min-width: 0;
      }
      .modal-header h2 {
        margin: 0;
        font-size: 17px;
        line-height: 1.15;
      }
      .modal-header p {
        display: none;
      }
      .modal-header > button {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 8px 11px;
        font-size: 13px;
      }
      .modal-body,
      .module-modal-content,
      .lead-details-mount {
        min-height: 0;
        padding: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
      }
      .modal-actions {
        position: static;
        z-index: 4;
        padding: 9px 12px max(9px, env(safe-area-inset-bottom));
        background: #0b1017;
      }
      .modal-actions button {
        min-height: 42px;
      }
      .ai-thinking-card {
        width: calc(100% - 24px);
        max-height: none;
        margin: auto 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
      }
      .ai-thinking-card .modal-body {
        padding: 22px 16px;
      }
      .ai-thinking-card h2 {
        font-size: 18px;
      }
      .segmented {
        flex-wrap: nowrap;
        width: 100%;
        margin-bottom: 12px;
        padding-bottom: 4px;
        overflow-x: auto;
        scrollbar-width: none;
      }
      .segmented::-webkit-scrollbar {
        display: none;
      }
      .segmented .segment-button {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 8px 12px;
      }
      .mini-grid,
      .working-days-grid,
      .working-day-row .mini-grid,
      .appointment-barbershop-fields,
      .payment-method-grid,
      .portfolio-grid,
      .labels-grid,
      .quick-reply-form,
      .schedule-grid,
      #moduleModal .grid,
      #trainingModal .grid {
        grid-template-columns: 1fr;
      }
      .settings-block,
      .training-autofill-box,
      .payment-settings-box,
      .working-day-row {
        padding: 10px;
      }
      .panel-actions {
        gap: 7px;
      }
      .panel-actions button {
        flex: 1 1 145px;
        min-height: 42px;
      }
      .saved-leads-list,
      .appointments-modal-list,
      .quick-replies-list,
      .lead-details-mount .details-scroll {
        max-height: none;
      }
      .saved-lead-card {
        grid-template-columns: 42px minmax(0, 1fr);
      }
      .quick-reply-card,
      .appointment-card {
        grid-template-columns: 1fr;
      }
      .saved-lead-actions,
      .quick-reply-actions {
        grid-column: 1 / -1;
      }
      .quick-reply-actions,
      .appointment-actions {
        justify-content: flex-start;
      }
      .orders-history-filters,
      .orders-finance-dashboard {
        grid-template-columns: 1fr 1fr;
      }
      .orders-modal-tabs button {
        min-height: 42px;
        padding: 9px 12px;
      }
      #labelsModal .modal-card,
      #statusModal .modal-card,
      #portfolioModal .modal-card,
      #appointmentsModal .modal-card,
      #savedLeadsModal .modal-card,
      #quickRepliesModal .modal-card {
        min-height: 42dvh;
      }
    }
    @media (max-width: 720px) {
      .orders-history-filters,
      .orders-finance-dashboard {
        grid-template-columns: 1fr;
      }
      .orders-finance-toolbar,
      .orders-finance-toolbar label {
        width: 100%;
      }
      .order-mode-options {
        grid-template-columns: 1fr;
      }
      .free-order-card {
        padding: 12px;
      }
      .realtime-schedule-panel,
      .realtime-schedule-panel.is-minimized {
        width: calc(100vw - 24px);
        right: 12px;
      }
      .realtime-schedule-item {
        grid-template-columns: 28px minmax(0, 1fr) auto;
        min-height: 62px;
        padding: 8px;
      }
      .orders-realtime-control {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
      }
      .orders-realtime-control small { text-align: left; }
      .realtime-schedule-order {
        width: 28px;
        height: 28px;
      }
      .professional-status-toggle {
        min-width: 88px;
        padding-inline: 8px;
      }
      .professional-photo-list {
        grid-template-columns: 1fr;
      }
      .professional-photo-card {
        grid-template-columns: 44px minmax(0, 1fr);
      }
      .professional-photo-avatar {
        width: 44px;
        height: 44px;
      }
      .professional-photo-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
      }
      .order-details-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px 0;
      }
      .form-grid { grid-template-columns: 1fr; }
      .form-grid .full-row { grid-column: 1; }
    }
