  :root {
      --navy-dark: #0A192F;
      --navy-card: #112240;
      --navy-light: #1E3E62;
      --cyan-accent: #00D2FF;
      --blue-primary: #008DDA;
      --wa-green: #25D366;
      --wa-dark-green: #128C7E;
      --warning-orange: #FF6B00;
      --bg-light: #F4F7FE;
      --text-dark: #1E293B;
      --text-muted: #64748B;
      --card-radius: 16px;
    }

    .access-gate {
      position: fixed;
      inset: 0;
      z-index: 2000;
      display: grid;
      place-items: center;
      padding: 1.25rem;
      background:
        radial-gradient(circle at 15% 15%, rgba(0, 210, 255, 0.18), transparent 32rem),
        linear-gradient(135deg, var(--navy-dark), var(--navy-light));
    }

    .access-card {
      width: min(100%, 420px);
      padding: 2.5rem;
      border: 1px solid rgba(255, 255, 255, 0.14);
      border-radius: 1.25rem;
      background: #ffffff;
      box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
      text-align: center;
    }

    .access-icon {
      display: grid;
      width: 3.5rem;
      height: 3.5rem;
      margin: 0 auto 1.25rem;
      place-items: center;
      border-radius: 1rem;
      background: rgba(0, 141, 218, 0.1);
      color: var(--blue-primary);
      font-size: 1.4rem;
    }

    .access-brand {
      margin-bottom: 0.35rem;
      color: var(--blue-primary);
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .access-card h1 {
      margin-bottom: 0.5rem;
      color: var(--navy-dark);
      font-size: 1.6rem;
      font-weight: 700;
    }

    .access-description {
      margin-bottom: 1.5rem;
      color: var(--text-muted);
    }

    .access-error {
      margin: 0.75rem 0 0;
      color: #b42318;
      font-size: 0.9rem;
    }

    body {
      font-family: 'Inter', sans-serif;
      background-color: var(--bg-light);
      color: var(--text-dark);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    h1, h2, h3, h4, h5, .font-heading {
      font-family: 'Poppins', sans-serif;
    }

    /* Top Navigation Header */
    .app-header {
      background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-light) 100%);
      color: #ffffff;
      padding: 1.75rem 0;
      border-bottom: 3px solid var(--cyan-accent);
      box-shadow: 0 8px 28px rgba(10, 25, 47, 0.18);
    }

    .brand-logo {
      display: flex;
      align-items: center;
      gap: 1rem;
      color: #ffffff;
    }

    .brand-name {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 0.15rem;
      color: #ffffff;
      line-height: 1.1;
    }

    .brand-wordmark {
      color: var(--cyan-accent);
      font-family: 'Inter', sans-serif;
      font-size: 0.95rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .brand-app-name {
      color: #ffffff;
      font-size: clamp(1.55rem, 2.6vw, 2.15rem);
      font-weight: 700;
      letter-spacing: -0.04em;
      white-space: nowrap;
    }

    .subtitle-badge {
      background: rgba(0, 210, 255, 0.1);
      color: #8beaff;
      font-size: 0.9rem;
      font-weight: 600;
      padding: 0.65rem 1rem;
      border-radius: 999px;
      border: 1px solid rgba(0, 210, 255, 0.28);
      display: inline-block;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }

    /* Metric Cards */
    .metric-card {
      background: #ffffff;
      border-radius: var(--card-radius);
      padding: 1rem 1.25rem;
      min-height: 98px;
      border: 1px solid #E2E8F0;
      box-shadow: 0 3px 12px rgba(15, 23, 42, 0.035);
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .metrics-row > [class*="col-"] {
      min-width: 0;
    }

    .metric-card > div:last-child {
      min-width: 0;
    }

    .metric-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    }

    .metric-icon {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.2rem;
    }

    /* Custom Cards */
    .custom-card {
      background: #ffffff;
      border-radius: var(--card-radius);
      border: 1px solid #E2E8F0;
      box-shadow: 0 6px 22px rgba(15, 23, 42, 0.045);
      margin-bottom: 1.5rem;
      overflow: hidden;
    }

    .custom-card-header {
      background: #ffffff;
      border-bottom: 1px solid #F1F5F9;
      padding: 1.25rem 1.5rem;
      font-weight: 600;
      font-size: 1.1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .custom-card-body {
      padding: 1.5rem;
    }

    /* Status Badges */
    .status-verifying {
      background-color: #FEF3C7;
      color: #92400E;
      border: 1px solid #FCD34D;
    }

    .status-available {
      background-color: #DCFCE7;
      color: #166534;
      border: 1px solid #86EFAC;
    }

    .status-unconfirmed {
      background-color: #FEE2E2;
      color: #991B1B;
      border: 1px solid #FCA5A5;
    }

    /* Variable Chips */
    .var-chip {
      background-color: #EFF6FF;
      color: var(--blue-primary);
      border: 1px dashed #93C5FD;
      padding: 0.25rem 0.6rem;
      border-radius: 6px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
      user-select: none;
    }

    .var-chip:hover {
      background-color: var(--blue-primary);
      color: #ffffff;
      border-style: solid;
    }

    /* WhatsApp Live Preview Simulation Card */
    .wa-preview-card {
      background: #E5DDD5;
      background-image: radial-gradient(#CBD5E1 1px, transparent 0);
      background-size: 12px 12px;
      border-radius: 12px;
      padding: 1rem;
      min-height: 200px;
      border: 1px solid #CBD5E1;
    }

    .wa-preview-bubble {
      background: #DCF8C6;
      border-radius: 10px 0px 10px 10px;
      padding: 0.85rem 1rem;
      max-width: 90%;
      margin-left: auto;
      box-shadow: 0 1px 2px rgba(0,0,0,0.15);
      position: relative;
      font-size: 0.92rem;
      color: #111827;
      word-break: break-word;
      white-space: pre-wrap;
    }

    .wa-preview-time {
      font-size: 0.7rem;
      color: #6B7280;
      text-align: right;
      margin-top: 0.35rem;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 0.25rem;
    }

    .wa-preview-header {
      background: #075E54;
      color: #ffffff;
      border-radius: 10px 10px 0 0;
      padding: 0.75rem 1rem;
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .wa-preview-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: #128C7E;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      font-weight: bold;
    }

    /* Custom Buttons */
    .btn-wa {
      background-color: var(--wa-green);
      color: #ffffff;
      font-weight: 600;
      border: none;
      box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
    }

    .btn-wa:hover {
      background-color: var(--wa-dark-green);
      color: #ffffff;
      box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
    }

    .btn-conecta {
      background-color: var(--navy-dark);
      color: #ffffff;
      font-weight: 600;
      border: none;
    }

    .btn-conecta:hover {
      background-color: var(--navy-light);
      color: #ffffff;
    }

    .image-preview-box {
      border: 2px dashed #CBD5E1;
      border-radius: 12px;
      padding: 1rem;
      text-align: center;
      background: #F8FAFC;
    }

    .image-preview-box img {
      max-height: 180px;
      border-radius: 8px;
      object-fit: contain;
    }

    .responsible-notice {
      background: #FFFBEB;
      border: 1px solid #FCD34D;
      color: #92400E;
      font-size: 0.85rem;
      border-radius: 10px;
      padding: 0.75rem 1rem;
    }

    .toast-container {
      position: fixed;
      bottom: 1.5rem;
      right: 1.5rem;
      z-index: 1080;
    }
    /* Keep contact details and action icons on a single line. */
    #contacts-table {
      min-width: 900px;
    }

    #contacts-table th,
    #contacts-table td {
      padding: 0.85rem 0.75rem;
    }

    #contacts-table th,
    #contacts-table td:nth-child(n + 3) {
      white-space: nowrap;
    }

    #contacts-table td:nth-child(1),
    #contacts-table td:nth-child(2) {
      min-width: 160px;
      overflow-wrap: anywhere;
    }

    #contacts-table th:last-child,
    #contacts-table td:last-child {
      width: 104px;
      min-width: 104px;
    }

    #contacts-table td:last-child .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      padding: 0;
      vertical-align: middle;
    }
    .brand-image {
      display: block;
      width: 80px;
      max-width: 100%;
      height: auto;
      object-fit: contain;
    }

    .form-control,
    .form-select,
    .input-group-text {
      border-color: #D7E0EB;
      border-radius: 0.65rem;
    }

    .form-control,
    .form-select {
      min-height: 44px;
    }

    .form-control:focus,
    .form-select:focus {
      border-color: var(--blue-primary);
      box-shadow: 0 0 0 0.22rem rgba(0, 141, 218, 0.14);
    }

    .btn {
      border-radius: 0.65rem;
      font-weight: 600;
      transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    }

    .btn:hover {
      transform: translateY(-1px);
    }

    #managementTabs {
      width: 100%;
      min-width: 0;
      margin-bottom: 0;
    }

    #managementTabs > .nav-item {
      flex-shrink: 0;
    }

    .nav-tabs {
      flex-wrap: nowrap;
      overflow-x: auto;
      overflow-y: hidden;
      scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
      width: 0;
      height: 0;
      display: none;
    }

    .nav-tabs .nav-link {
      white-space: nowrap;
    }

    .nav-tabs .nav-link.active {
      color: var(--blue-primary) !important;
      background: #F8FAFC;
      box-shadow: inset 0 -3px 0 var(--blue-primary);
    }

    .table thead th {
      color: #475569;
      font-size: 0.82rem;
      font-weight: 700;
      letter-spacing: 0.025em;
      text-transform: uppercase;
    }

    .wa-preview-card {
      min-height: 220px;
    }

    @media (max-width: 767.98px) {
      .app-header {
        padding: 1.25rem 0;
      }

      .app-header > .container > .d-flex {
        align-items: stretch !important;
        text-align: center;
      }

      .app-brand {
        width: 100%;
      }

      .brand-logo {
        justify-content: center;
        gap: 0.75rem;
        text-align: left;
      }

      .app-header .brand-image {
        width: 64px;
        flex: 0 0 64px;
      }

      .brand-name {
        gap: 0.1rem;
      }

      .brand-wordmark {
        font-size: 0.75rem;
      }

      .brand-app-name {
        font-size: clamp(1.25rem, 6vw, 1.7rem);
        white-space: normal;
      }

      .app-header p {
        text-align: center;
        font-size: 0.9rem !important;
      }

      .subtitle-badge {
        font-size: 0.82rem;
        padding: 0.5rem 0.8rem;
      }

      .metric-card {
        min-height: 82px;
        gap: 0.65rem !important;
        padding: 0.8rem;
      }

      .metric-icon {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        font-size: 1rem;
      }

      .metric-card .text-muted {
        font-size: 0.75rem !important;
        line-height: 1.25;
      }

      .custom-card-header {
        padding: 1rem;
        font-size: 0.98rem;
        gap: 0.5rem;
      }

      .custom-card-body {
        padding: 1rem;
      }

      .sticky-top {
        position: static !important;
      }

      #managementTabs .nav-link {
        padding: 0.8rem 0.9rem !important;
        font-size: 0.85rem;
      }

      .tab-pane > .d-flex {
        align-items: flex-start !important;
        flex-wrap: wrap;
        gap: 0.75rem;
      }

      .toast-container {
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
      }
    }

    @media (max-width: 575.98px) {
      .metric-card {
        min-height: 76px;
      }

      .metric-card .h5 {
        font-size: 1.1rem;
      }

      .custom-card-header .badge {
        font-size: 0.7rem;
      }

      #char-counter {
        white-space: nowrap;
      }
    }
