/* monitor/static/css/app.css — extraído de index.html (2026-06-09) */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --accent:      #3d7f1f;
      --accent-h:    #306618;
      --accent-soft: #f0f7eb;
      --accent-mid:  #d4edba;
      --bg:          #f4f6f9;
      --surface:     #ffffff;
      --surface2:    #f2f3f5;
      --border:      #e4e6ea;
      --text:        #111318;
      --text-mid:    #6b7280;
      --text-light:  #9ca3af;
      --red:         #dc2626;
      --red-soft:    #fef2f2;
      --red-mid:     #fecaca;
      --orange:      #d97706;
      --orange-soft: #fffbeb;
      --blue:        #3b82f6;
      --blue-soft:   #eff6ff;
      --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
      --shadow-md:   0 4px 16px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
      --shadow-lg:   0 8px 32px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
      --grad:        linear-gradient(90deg, #3d7f1f 0%, #7cdc44 50%, #3b82f6 100%);
      --radius:      10px;
      --sidebar-w:   248px;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
      font-size: 14px;
      line-height: 1.5;
      display: flex;
      min-height: 100vh;
      -webkit-font-smoothing: antialiased;
    }

    /* ── Sidebar ─────────────────────────────────────────────────────────── */
    .sidebar {
      width: var(--sidebar-w);
      background: var(--surface);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      position: fixed;
      top: 0; left: 0; bottom: 0;
      z-index: 100;
      overflow-y: auto;
    }

    .sidebar-grad {
      height: 4px;
      background: var(--grad);
      flex-shrink: 0;
    }

    .sidebar-logo {
      padding: 1.1rem 1rem;
      display: flex;
      align-items: center;
      gap: .75rem;
      border-bottom: 1px solid var(--border);
    }
    .sidebar-logo img { width: 40px; height: 40px; object-fit: contain; }
    .sidebar-logo-text { display: flex; flex-direction: column; }
    .sidebar-logo-text span { font-size: 1rem; font-weight: 800; letter-spacing: -.4px; }
    .sidebar-logo-text small { font-size: .7rem; color: var(--text-mid); font-weight: 400; }

    .sidebar-section {
      padding: .9rem 1rem .25rem;
      font-size: .68rem;
      font-weight: 600;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: .09em;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: .6rem;
      padding: .5rem 1rem;
      margin: .1rem .5rem;
      border-radius: 8px;
      cursor: pointer;
      font-size: .875rem;
      color: var(--text-mid);
      font-weight: 500;
      transition: background .15s, color .15s;
      user-select: none;
    }
    .nav-item:hover { background: var(--surface2); color: var(--text); }
    .nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
    .nav-item.active .nav-icon { color: var(--accent); }
    .nav-icon { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; color: inherit; }
    .nav-icon svg { display: block; }

    .sidebar-footer {
      padding: .8rem 1rem;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: .65rem;
      font-size: .8rem;
      color: var(--text-mid);
    }
    .sidebar-footer .avatar {
      width: 36px; height: 36px;
      background: var(--accent-soft);
      border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-weight: 700; font-size: .85rem; color: var(--accent);
      flex-shrink: 0;
      overflow: hidden;
      border: 2px solid var(--accent-mid);
    }
    .sidebar-footer .avatar img {
      width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
    }
    .sidebar-footer .user-info { flex: 1; min-width: 0; }
    .sidebar-footer .user-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-footer .user-role { font-size: .68rem; color: var(--text-light); margin-top: 1px; }
    .btn-logout-icon {
      background: none; border: none; cursor: pointer; color: var(--text-mid);
      padding: .25rem; border-radius: 4px; font-size: 1rem; line-height: 1;
      transition: color .15s, background .15s;
    }
    .btn-logout-icon:hover { color: var(--red); background: var(--red-soft); }
    .btn-adduser-icon {
      background: none; border: none; cursor: pointer; color: var(--text-mid);
      padding: .25rem; border-radius: 4px; font-size: 1rem; line-height: 1;
      transition: color .15s, background .15s;
    }
    .btn-adduser-icon:hover { color: var(--accent); background: var(--accent-soft); }

    /* ── Main ────────────────────────────────────────────────────────────── */
    .main {
      margin-left: var(--sidebar-w);
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }

    .topbar {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: .75rem 1.5rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      z-index: 50;
      box-shadow: var(--shadow-sm);
    }
    .topbar-left { display: flex; align-items: center; gap: .5rem; }
    .topbar-title { font-size: .95rem; font-weight: 700; letter-spacing: -.2px; }
    .topbar-right { display: flex; align-items: center; gap: .75rem; }
    .topbar-refresh {
      background: none; border: 1px solid var(--border); color: var(--text-mid);
      border-radius: 6px; padding: .3rem .6rem; cursor: pointer; font-size: .85rem;
      transition: border-color .15s, color .15s;
    }
    .topbar-refresh:hover { border-color: var(--accent); color: var(--accent); }

    .content { padding: 1.5rem; flex: 1; }

    .page { display: none; }
    .page.active { display: block; animation: fadeIn .2s ease; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

    /* ── Stat cards ──────────────────────────────────────────────────────── */
    .stat-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 1rem;
      margin-bottom: 1.5rem;
    }
    .stat-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.2rem 1.35rem;
      box-shadow: var(--shadow-sm);
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: .75rem;
    }
    .stat-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 3px;
    }
    .stat-card.green::before { background: var(--accent); }
    .stat-card.red::before   { background: var(--red); }
    .stat-card.orange::before { background: var(--orange); }
    .stat-card.blue::before  { background: var(--blue); }
    .stat-card-body { display: flex; flex-direction: column; }
    .stat-label { font-size: .7rem; color: var(--text-mid); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .5rem; }
    .stat-value { font-size: 2.2rem; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
    .stat-card.green .stat-value  { color: var(--accent); }
    .stat-card.red .stat-value    { color: var(--red); }
    .stat-card.orange .stat-value { color: var(--orange); }
    .stat-card.blue .stat-value   { color: var(--blue); }
    .stat-icon {
      display: flex; align-items: center; justify-content: center;
      width: 40px; height: 40px; border-radius: 10px;
      background: rgba(0,0,0,.05); flex-shrink: 0; margin-top: .15rem;
    }
    .stat-card.green .stat-icon { background: var(--accent-soft); color: var(--accent); }
    .stat-card.red   .stat-icon { background: var(--red-soft);    color: var(--red); }
    .stat-card.orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
    .stat-card.blue  .stat-icon { background: var(--blue-soft);   color: var(--blue); }

    /* ── Cards genéricos ─────────────────────────────────────────────────── */
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.25rem;
      margin-bottom: 1rem;
      box-shadow: var(--shadow-sm);
    }
    .card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 1.1rem;
    }
    .card-title { font-size: .95rem; font-weight: 700; letter-spacing: -.2px; }

    /* ── Campo de busca ─────────────────────────────────────────────────────── */
    .search-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }
    .search-wrap svg {
      position: absolute;
      left: .6rem;
      color: var(--text-light);
      pointer-events: none;
      flex-shrink: 0;
    }
    .search-input {
      padding: .38rem .75rem .38rem 2rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: .82rem;
      font-family: inherit;
      background: var(--surface2);
      color: var(--text);
      width: 220px;
      transition: border-color .15s, box-shadow .15s, background .15s;
      outline: none;
    }
    .search-input:focus {
      border-color: var(--accent);
      background: var(--surface);
      box-shadow: 0 0 0 3px rgba(61,127,31,.12);
    }
    .search-input::placeholder { color: var(--text-light); }
    .card-header-actions {
      display: flex;
      align-items: center;
      gap: .5rem;
    }

    /* ── Posto cards (monitor) ───────────────────────────────────────────── */
    /* ── Posto list table ──────────────────────────────────────────────────── */
    .posto-grid { overflow-x: auto; }
    .posto-table {
      width: 100%; border-collapse: collapse;
      font-size: .83rem;
    }
    .posto-table thead th {
      padding: .55rem 1rem;
      text-align: left;
      font-size: .7rem; font-weight: 700;
      text-transform: uppercase; letter-spacing: .07em;
      color: var(--text-mid);
      border-bottom: 2px solid var(--border);
      white-space: nowrap;
      background: var(--bg);
    }
    .posto-row {
      border-bottom: 1px solid var(--border);
      transition: background .1s;
    }
    .posto-row:last-child { border-bottom: none; }
    .posto-row:hover { background: #f8fafc; }
    .posto-row.online  > td:first-child { border-left: 3px solid var(--accent); }
    .posto-row.offline > td:first-child { border-left: 3px solid var(--red); }
    .posto-row td {
      padding: .75rem 1rem;
      vertical-align: middle;
    }
    .posto-row td:first-child { padding-left: 1.1rem; }
    .posto-nome { font-weight: 700; font-size: .88rem; color: var(--text); line-height: 1.3; }
    .posto-detalhe { font-size: .73rem; color: var(--text-mid); margin-top: .18rem; display: flex; align-items: center; gap: .3rem; }
    .posto-detalhe svg { flex-shrink: 0; opacity: .55; }
    .posto-status-pill {
      display: inline-flex; align-items: center; gap: .35rem;
      font-size: .72rem; font-weight: 700; padding: .25rem .65rem;
      border-radius: 20px; white-space: nowrap;
    }
    .posto-status-pill.online  { background: var(--accent-soft); color: var(--accent); }
    .posto-status-pill.offline { background: var(--red-soft); color: var(--red); }
    .posto-ping { font-size: .72rem; color: var(--text-mid); white-space: nowrap; }
    .posto-ip   { font-size: .71rem; color: var(--text-light); margin-top: .15rem; font-family: monospace; }
    .wa-badge {
      display: inline-flex; align-items: center; gap: .3rem;
      font-size: .71rem; font-weight: 600; padding: .22rem .6rem;
      border-radius: 20px; border: 1.5px solid transparent; white-space: nowrap;
    }
    .wa-badge.connected    { background: #dcfce7; color: #15803d; border-color: #86efac; }
    .wa-badge.qr_code      { background: #fef9c3; color: #92400e; border-color: #fde047; }
    .wa-badge.disconnected { background: #f1f5f9; color: #475569;  border-color: #cbd5e1; }
    .wa-badge svg { flex-shrink: 0; }
    .agents-pill {
      display: inline-flex; align-items: center; gap: .3rem;
      font-size: .72rem; font-weight: 700; padding: .22rem .65rem;
      border-radius: 20px; border: 1.5px solid #bfdbfe;
      background: #dbeafe; color: #1e40af;
      cursor: pointer; white-space: nowrap;
      transition: background .15s;
    }
    .agents-pill:hover { background: #bfdbfe; }
    .wa-phone-num {
      font-size: .75rem; color: #15803d; font-weight: 700;
      margin-top: .2rem; letter-spacing: .02em;
    }
    .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
    .dot-green { background: var(--accent); animation: pulse 2s infinite; }
    .dot-red { background: var(--red); }
    @keyframes pulse {
      0%, 100% { box-shadow: 0 0 0 2px var(--accent-soft); }
      50% { box-shadow: 0 0 0 4px var(--accent-mid); }
    }
    @keyframes agent-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); opacity: 1; }
      50%      { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); opacity: .85; }
    }

    /* ── Tabelas ─────────────────────────────────────────────────────────── */
    .table-wrap { overflow-x: auto; }
    table { width: 100%; border-collapse: collapse; font-size: .855rem; }
    thead tr { border-bottom: 2px solid var(--border); }
    th {
      color: var(--text-mid);
      text-align: left;
      padding: .5rem .75rem;
      font-weight: 600;
      font-size: .72rem;
      text-transform: uppercase;
      letter-spacing: .06em;
      white-space: nowrap;
    }
    td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
    tr:last-child td { border-bottom: none; }
    tbody tr:hover { background: var(--surface2); }
    .td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: .78rem; color: var(--text-mid); }

    /* ── Chips / Badges ──────────────────────────────────────────────────── */
    .chip {
      display: inline-flex; align-items: center; gap: .25rem;
      padding: .2rem .6rem;
      border-radius: 20px; font-size: .72rem; font-weight: 600;
      white-space: nowrap;
    }
    .chip-green  { background: var(--accent-soft); color: var(--accent); }
    .chip-red    { background: var(--red-soft); color: var(--red); }
    .chip-gray   { background: var(--surface2); color: var(--text-mid); border: 1px solid var(--border); }
    .chip-blue   { background: var(--blue-soft); color: var(--blue); }
    .chip-orange { background: var(--orange-soft); color: var(--orange); }

    /* ── Cliente card list ───────────────────────────────────────────────── */
    .cliente-list { display: flex; flex-direction: column; }
    .cliente-row {
      display: flex; flex-direction: column;
      border-bottom: 1px solid var(--border);
      padding: .9rem 0;
      transition: background .1s;
    }
    .cliente-row:first-child { padding-top: 0; }
    .cliente-row:last-child  { border-bottom: none; padding-bottom: 0; }
    .cliente-row-top {
      display: flex; align-items: center; gap: .75rem;
    }
    .cliente-status-dot {
      width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
    }
    .cliente-status-dot.ativo   { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 2s infinite; }
    .cliente-status-dot.inativo { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
    .cliente-name-block { flex: 1; min-width: 0; }
    .cliente-name-line {
      display: flex; align-items: center; gap: .5rem;
      font-weight: 700; font-size: .92rem; color: var(--text); flex-wrap: wrap;
    }
    .cliente-row-bottom {
      display: flex; align-items: center; gap: 1.25rem; margin-top: .5rem;
      padding-left: 21px; /* alinha com nome (após dot) */
      flex-wrap: wrap;
    }
    .cliente-detail {
      display: flex; align-items: center; gap: .3rem;
      font-size: .75rem; color: var(--text-mid);
    }
    .cliente-detail svg { opacity: .5; flex-shrink: 0; }
    /* token area removida — botões integrados no action row */

    /* ── User card list ──────────────────────────────────────────────────── */
    .user-list { display: flex; flex-direction: column; gap: 0; }
    .user-row {
      display: flex; flex-direction: column; gap: 0;
      border-bottom: 1px solid var(--border);
      padding: .9rem 0;
      transition: background .1s;
    }
    .user-row:first-child { padding-top: 0; }
    .user-row:last-child  { border-bottom: none; padding-bottom: 0; }
    .user-row-top {
      display: flex; align-items: center; gap: .85rem;
    }
    .user-avatar-lg {
      width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-weight: 800; font-size: 1rem; color: var(--accent);
      background: var(--accent-soft); border: 2px solid var(--accent-mid);
      overflow: hidden;
    }
    .user-avatar-lg img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
    .user-name-block { flex: 1; min-width: 0; }
    .user-name-line {
      display: flex; align-items: center; gap: .4rem;
      font-weight: 700; font-size: .92rem; color: var(--text); flex-wrap: wrap;
    }
    .user-meta-line {
      font-size: .72rem; color: var(--text-mid); margin-top: .2rem;
      display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
    }
    .user-actions-row {
      display: flex; align-items: center; gap: .3rem; flex-shrink: 0;
    }
    /* ── Action pill buttons (global) ───────────────────────────────────── */
    .btn-icon-act {
      height: 34px; padding: 0 .7rem; border-radius: 10px;
      display: inline-flex; align-items: center; gap: .35rem;
      border: 1.5px solid var(--border); background: var(--surface);
      color: var(--text-mid); cursor: pointer;
      font-size: .74rem; font-weight: 600; white-space: nowrap;
      transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .12s;
      flex-shrink: 0;
      box-shadow: 0 1px 3px rgba(0,0,0,.06);
    }
    .btn-icon-act:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.1); }
    .btn-icon-act.v-blue:hover   { background: #eff6ff; color: #2563eb; border-color: #93c5fd; }
    .btn-icon-act.v-green:hover  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-mid); }
    .btn-icon-act.v-amber:hover  { background: #fffbeb; color: #d97706; border-color: #fcd34d; }
    .btn-icon-act.v-purple:hover { background: #f5f3ff; color: #7c3aed; border-color: #c4b5fd; }
    .btn-icon-act.v-orange:hover { background: #fff7ed; color: #ea580c; border-color: #fdba74; }
    .btn-icon-act.v-teal:hover   { background: #f0fdfa; color: #0d9488; border-color: #5eead4; }
    .btn-icon-act.danger:hover   { background: var(--red-soft); color: var(--red); border-color: var(--red); }
    .act-sep {
      width: 1px; height: 22px; background: var(--border); flex-shrink: 0; margin: 0 3px;
    }
    /* barra de ações abaixo do card (clientes e usuários) */
    .card-actions-bar {
      display: flex; align-items: center; gap: .3rem;
      flex-wrap: wrap; margin-top: .55rem;
    }
    .user-row-bottom {
      display: flex; align-items: center; gap: .4rem; margin-top: .5rem;
      padding-left: 54px;
      flex-wrap: wrap;
    }
    .user-empresas-ico {
      display: flex; align-items: center; gap: .25rem;
      font-size: .7rem; font-weight: 600; color: var(--text-light); white-space: nowrap;
    }

    /* ── Formulários ─────────────────────────────────────────────────────── */
    .form-group { margin-bottom: .9rem; }
    .form-group label {
      display: block; font-size: .78rem; font-weight: 600;
      color: var(--text-mid); margin-bottom: .3rem;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: .6rem .9rem;
      color: var(--text);
      font-size: .9rem;
      outline: none;
      transition: border-color .2s, box-shadow .2s;
      font-family: inherit;
    }
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-soft);
      background: #fff;
    }
    .form-row { display: grid; gap: .75rem; }

    /* ── Botões ──────────────────────────────────────────────────────────── */
    .btn {
      display: inline-flex; align-items: center; gap: .4rem;
      padding: .55rem 1.1rem;
      border-radius: 8px; border: none; cursor: pointer;
      font-size: .875rem; font-weight: 600;
      transition: opacity .15s, box-shadow .15s;
      white-space: nowrap;
      font-family: inherit;
    }
    .btn:disabled { opacity: .5; cursor: not-allowed; }
    .btn:hover:not(:disabled) { opacity: .88; }
    .btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 6px rgba(61,127,31,.25); }
    .btn-primary:hover:not(:disabled) { opacity: 1; background: var(--accent-h); }
    .btn-danger  { background: var(--red); color: #fff; }
    .btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
    .btn-ghost:hover:not(:disabled) { background: var(--border); }
    .btn-sm { padding: .3rem .7rem; font-size: .78rem; border-radius: 6px; }
    .btn-icon { padding: .3rem .4rem; font-size: .9rem; }

    /* ── Alertas inline ──────────────────────────────────────────────────── */
    .alert {
      padding: .7rem 1rem; border-radius: 8px;
      font-size: .85rem; margin-bottom: .9rem;
      display: none; font-weight: 500;
    }
    .alert-success { background: var(--accent-soft); border: 1px solid var(--accent-mid); color: var(--accent); }
    .alert-error   { background: var(--red-soft); border: 1px solid var(--red-mid); color: var(--red); }

    /* ── Modal ───────────────────────────────────────────────────────────── */
    .modal-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(17,19,24,.45);
      backdrop-filter: blur(3px);
      z-index: 200; align-items: center; justify-content: center;
    }
    .modal-overlay.open { display: flex; }
    .modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 1.75rem;
      max-width: 500px; width: 90%;
      box-shadow: var(--shadow-lg);
      animation: modalIn .2s cubic-bezier(.22,1,.36,1);
    }
    @keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
    .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
    .modal-title { font-size: 1rem; font-weight: 700; }
    .modal-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-mid); padding: .2rem; border-radius: 4px; }
    .modal-close:hover { color: var(--text); background: var(--surface2); }
    .modal-footer { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

    /* ── Token box ───────────────────────────────────────────────────────── */
    .token-box {
      background: var(--accent-soft);
      border: 1.5px solid var(--accent-mid);
      border-radius: 8px; padding: .8rem 1rem;
      font-family: 'SF Mono', 'Fira Code', monospace;
      font-size: 1.1rem; font-weight: 700;
      color: var(--accent); text-align: center;
      letter-spacing: .12em; word-break: break-all;
      margin: .75rem 0;
    }
    .token-box-small {
      background: var(--surface2); border: 1px solid var(--border);
      border-radius: 6px; padding: .35rem .6rem;
      font-family: monospace; font-size: .78rem; color: var(--text-mid);
    }
    .token-hint { font-size: .78rem; color: var(--text-mid); text-align: center; margin-bottom: .5rem; }

    /* ── Logs ──────────────────────────────────────────────────────────────── */
    .log-table { width:100%; border-collapse:collapse; font-size:.8rem; font-family:monospace }
    .log-table th { background:var(--surface2); padding:.55rem .9rem; text-align:left; font-family:var(--font); font-size:.72rem; font-weight:700; color:var(--text-mid); border-bottom:2px solid var(--border); position:sticky; top:0; text-transform:uppercase; letter-spacing:.04em }
    .log-table td { padding:.42rem .9rem; border-bottom:1px solid var(--border); vertical-align:top; line-height:1.5 }
    .log-table tr:last-child td { border-bottom:none }
    .log-table tr:hover td { background:#f8faf6 }
    .log-wrap { max-height:calc(100vh - 340px); overflow-y:auto }
    .log-nivel { display:inline-flex; align-items:center; gap:.25rem; padding:.15rem .5rem; border-radius:6px; font-size:.69rem; font-weight:700; font-family:var(--font); white-space:nowrap }
    .log-INFO     { background:#e0f2fe; color:#0369a1; border:1px solid #bae6fd }
    .log-WARNING  { background:#fef3c7; color:#92400e; border:1px solid #fde68a }
    .log-ERROR    { background:#fee2e2; color:#b91c1c; border:1px solid #fecaca }
    .log-CRITICAL { background:#7f1d1d; color:#fff; border:1px solid #991b1b }
    .log-cat { display:inline-flex; align-items:center; gap:.2rem; padding:.15rem .5rem; border-radius:6px; font-size:.68rem; font-weight:600; background:var(--surface2); color:var(--text-mid); font-family:var(--font); border:1px solid var(--border) }
    .log-ts { color:var(--text-mid); white-space:nowrap; font-size:.75rem; font-family:monospace }
    .log-msg { font-size:.79rem; color:var(--text); word-break:break-word; line-height:1.5 }
    .log-clientes-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:.85rem; margin-top:.25rem }
    .log-cliente-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1.1rem 1.25rem; cursor:pointer; transition:box-shadow .15s,border-color .15s,transform .15s; display:flex; flex-direction:column; gap:.5rem; border-left:4px solid var(--border); box-shadow:var(--shadow-sm) }
    .log-cliente-card:hover { box-shadow:var(--shadow-md); border-color:var(--accent); border-left-color:var(--accent); transform:translateY(-1px) }
    .log-cliente-card h4 { margin:0; font-size:.92rem; font-weight:700; color:var(--text) }
    .log-cliente-card .lc-meta { font-size:.74rem; color:var(--text-mid) }
    .log-cliente-card .lc-badges { display:flex; gap:.35rem; flex-wrap:wrap }
    .lc-erros    { background:#fee2e2; color:#b91c1c; border-radius:20px; padding:.18rem .55rem; font-size:.72rem; font-weight:700; border:1px solid #fecaca }
    .lc-warnings { background:#fef3c7; color:#92400e; border-radius:20px; padding:.18rem .55rem; font-size:.72rem; font-weight:600; border:1px solid #fde68a }
    .lc-total    { background:#e0f2fe; color:#0369a1; border-radius:20px; padding:.18rem .55rem; font-size:.72rem; border:1px solid #bae6fd }
    .log-back-btn { display:inline-flex; align-items:center; gap:.4rem; font-size:.82rem; color:var(--accent); cursor:pointer; margin-bottom:1.1rem; background:none; border:none; padding:0; font-weight:600 }
    .log-back-btn:hover { text-decoration:underline }
    .log-filter-label { font-size:.7rem; font-weight:700; color:var(--text-mid); text-transform:uppercase; letter-spacing:.05em; margin-bottom:.3rem; display:block }
    .log-filter-sel { padding:.4rem .65rem; border:1px solid var(--border); border-radius:7px; font-size:.82rem; background:var(--surface); color:var(--text); outline:none; height:34px; transition:border-color .15s }
    .log-filter-sel:focus { border-color:var(--accent) }
    .log-counter-chip { display:inline-flex; align-items:center; gap:.3rem; padding:.28rem .7rem; border-radius:20px; font-size:.75rem; font-weight:700; border:1px solid transparent; white-space:nowrap }
    .log-counter-info    { background:#e0f2fe; color:#0369a1; border-color:#bae6fd }
    .log-counter-warn    { background:#fef3c7; color:#92400e; border-color:#fde68a }
    .log-counter-error   { background:#fee2e2; color:#b91c1c; border-color:#fecaca }

    /* ── Empty state ─────────────────────────────────────────────────────── */
    .empty-state {
      text-align: center; padding: 2.5rem 1rem; color: var(--text-mid);
    }
    .empty-state .empty-icon { font-size: 2rem; margin-bottom: .5rem; }
    .empty-state p { font-size: .875rem; }

    /* ── Menu permission cards ───────────────────────────────────────────── */
    /* ── Menu permissions — layout compacto escalável ───────────────────────── */
    .menu-perm-body {
      max-height: 58vh; overflow-y: auto;
      padding-right: 6px; margin-right: -6px;
    }
    .menu-perm-body::-webkit-scrollbar { width: 4px; }
    .menu-perm-body::-webkit-scrollbar-track { background: transparent; }
    .menu-perm-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

    /* Cabeçalho de seção com toggle */
    .mp-sec-hdr {
      display: flex; align-items: center; justify-content: space-between;
      padding: .45rem 0 .25rem;
      margin-top: .7rem; border-bottom: 1px solid var(--border);
    }
    .mp-sec-hdr:first-child { margin-top: 0; }
    .mp-sec-name {
      font-size: .67rem; font-weight: 700; color: var(--text-light);
      text-transform: uppercase; letter-spacing: .1em;
    }
    .mp-sec-toggle {
      font-size: .71rem; font-weight: 600; color: var(--accent);
      cursor: pointer; padding: .1rem .45rem; border-radius: 4px; user-select: none;
    }
    .mp-sec-toggle:hover { background: var(--accent-soft); }

    /* Grade de chips — 4 colunas, auto-ajusta para textos longos */
    .mp-chips {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: .28rem; padding: .4rem 0 .1rem;
    }

    /* Chip individual */
    .menu-perm-card {
      display: flex; align-items: center; gap: .35rem;
      padding: .28rem .55rem;
      border: 1.5px solid var(--border); border-radius: 6px;
      background: var(--surface); cursor: pointer; user-select: none;
      transition: border-color .12s, background .12s;
      min-width: 0;
    }
    .menu-perm-card:hover  { border-color: var(--accent); background: var(--accent-soft); }
    .menu-perm-card.selected {
      border-color: var(--accent); background: var(--accent);
    }
    .mp-box {
      width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0;
      border: 1.5px solid var(--border); background: #fff;
      display: flex; align-items: center; justify-content: center;
      font-size: .6rem; color: transparent; transition: all .12s;
    }
    .menu-perm-card.selected .mp-box { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.2); color: #fff; }
    .menu-perm-name {
      font-size: .75rem; font-weight: 600; color: var(--text-mid);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      flex: 1; min-width: 0;
    }
    .menu-perm-card.selected .menu-perm-name { color: #fff; }

    /* Sub-menus expandíveis (chatbot e sistema) */
    .mp-submenu-block { margin: -.2rem 1.25rem .75rem 1.25rem; padding: .55rem .75rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 0 0 8px 8px; border-top: none; }
    .mp-submenu-label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
    .mp-sub-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
    .mp-sub-chip { display: inline-flex; align-items: center; gap: .2rem; padding: .22rem .5rem; border-radius: 999px; border: 1.5px solid var(--border); font-size: .73rem; font-weight: 500; cursor: pointer; user-select: none; background: var(--surface); color: var(--text-mid); transition: all .12s; }
    .mp-sub-chip.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
    .mp-sub-chip:hover { border-color: var(--accent); }
    .mp-submenu-toggle-all { font-size: .68rem; color: var(--accent); cursor: pointer; }
    .mp-submenu-toggle-all:hover { text-decoration: underline; }

    /* Rodapé do seletor de menus */
    .menu-perm-footer {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: .6rem;
    }
    .menu-perm-all-toggle {
      display: inline-flex; align-items: center; gap: .4rem;
      padding: .32rem .65rem;
      background: var(--surface2); border: 1px solid var(--border);
      border-radius: 7px; cursor: pointer; user-select: none;
      font-size: .76rem; font-weight: 600; color: var(--text-mid);
      transition: background .15s;
    }
    .menu-perm-all-toggle:hover { background: var(--border); }
    .menu-perm-badge { font-size: .68rem; background: var(--accent-soft); color: var(--accent); padding: .1rem .4rem; border-radius: 10px; font-weight: 700; }

    /* ── Modal de usuário (1 coluna — menus ficam em Clientes › Menus) ───── */
    .user-modal {
      max-width: 600px !important; width: 94% !important;
      padding: 0 !important;  /* header/grid/footer já têm padding próprio */
    }
    .user-modal .modal-header { padding: 1.25rem 1.5rem; margin-bottom: 0; border-bottom: 1px solid var(--border); }
    .user-modal .modal-footer { padding: 1rem 1.5rem; margin-top: 0; border-top: 1px solid var(--border); }

    /* ── Modal de permissões do cliente (menus + modos conexão) ──────────── */
    .cmenus-modal {
      max-width: 1080px !important; width: 96% !important; padding: 0 !important;
    }
    .cmenus-modal .modal-header { padding: 1.25rem 1.6rem; margin-bottom: 0; border-bottom: 1px solid var(--border); }
    .cmenus-modal .modal-footer { padding: 1rem 1.6rem; margin-top: 0; border-top: 1px solid var(--border); }
    .cm-modo {
      display: flex; align-items: flex-start; gap: .55rem; cursor: pointer;
      border: 1px solid var(--border); border-radius: 10px; padding: .65rem .75rem;
      transition: border-color .15s, background .15s;
    }
    .cm-modo:hover { border-color: var(--accent); background: var(--accent-soft); }
    .cm-modo input { width: auto; margin: .2rem 0 0; flex-shrink: 0; }
    .cm-modo span { font-size: .82rem; line-height: 1.3; }
    .cm-modo small { color: var(--text-mid); font-size: .72rem; }
    @media (max-width: 760px) {
      .cmenus-modal .cm-grid { grid-template-columns: 1fr !important; gap: 1.25rem !important; }
    }

    /* ── Client chip toggle (seletor no modal) ───────────────────────────── */
    .client-chips-grid {
      display: flex; flex-wrap: wrap; gap: .45rem;
      padding: .65rem;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      min-height: 50px;
      align-content: flex-start;
    }
    .client-chip-toggle {
      display: inline-flex; align-items: center; gap: .3rem;
      padding: .28rem .75rem;
      border-radius: 20px;
      font-size: .78rem; font-weight: 600;
      cursor: pointer;
      border: 1.5px solid var(--border);
      background: var(--surface);
      color: var(--text-mid);
      transition: border-color .15s, background .15s, color .15s;
      user-select: none;
    }
    .client-chip-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
    .client-chip-toggle.selected {
      background: var(--accent-soft);
      border-color: var(--accent);
      color: var(--accent);
    }
    .client-chips-empty { font-size: .8rem; color: var(--text-light); padding: .25rem; }

    /* ── Atualizações ────────────────────────────────────────────────────── */
    .upd-badge { display:inline-flex;align-items:center;gap:.3rem;padding:.2rem .55rem;border-radius:12px;font-size:.75rem;font-weight:600;white-space:nowrap }
    .upd-pending    { background:#fef3c7;color:#92400e }
    .upd-notificado { background:#dbeafe;color:#1e40af }
    .upd-downloading{ background:#ede9fe;color:#5b21b6 }
    .upd-aplicado   { background:#d1fae5;color:#065f46 }
    .upd-error      { background:#fee2e2;color:#991b1b }
    .upd-ok         { background:#d1fae5;color:#065f46 }
    .upd-none       { background:var(--surface2);color:var(--text-mid) }
    .online-dot  { width:8px;height:8px;border-radius:50%;display:inline-block;flex-shrink:0 }
    .dot-on  { background:#22c55e }
    .dot-off { background:#e5e7eb }
    /* ── Chips inline na tabela (clientes do usuário) ────────────────────── */
    .td-clients { display: flex; flex-wrap: wrap; gap: .3rem; }

    /* ── Scrollbar ───────────────────────────────────────────────────────── */
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

    /* ── Layout Responsivo / Toggle ─────────────────────────────────────── */
    .sidebar { transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s; }

    .btn-hamburger {
      display: none; align-items: center; justify-content: center;
      background: none; border: 1px solid var(--border); border-radius: 6px;
      padding: .3rem .45rem; cursor: pointer; color: var(--text-mid);
      transition: border-color .15s, color .15s; line-height: 1; flex-shrink: 0;
    }
    .btn-hamburger:hover { border-color: var(--accent); color: var(--accent); }

    .btn-layout-toggle {
      display: flex; align-items: center; gap: .3rem;
      background: none; border: 1px solid var(--border); border-radius: 6px;
      padding: .28rem .55rem; cursor: pointer; color: var(--text-mid);
      font-size: .78rem; font-weight: 600; white-space: nowrap;
      transition: border-color .15s, color .15s, background .15s;
    }
    .btn-layout-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
    .btn-layout-toggle.lyt-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

    .sidebar-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,.5); z-index: 98;
      backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    }
    .sidebar-overlay.visible { display: block; }

    /* ─── AUTO-MOBILE: CSS puro, sem JS, funciona no primeiro render ─────── */
    @media (max-width: 768px) {
      .sidebar                    { transform: translateX(-100%); }
      .sidebar.open               { transform: translateX(0); box-shadow: var(--shadow-lg); }
      .sidebar-overlay.visible    { display: block; }
      .main                       { margin-left: 0; }
      .btn-hamburger              { display: flex; }
      .stat-grid                  { grid-template-columns: repeat(2, 1fr); }
      .content                    { padding: 1rem .875rem; }
      .posto-table                { font-size: .78rem; }
      .card-header                { flex-wrap: wrap; gap: .5rem; }
      .card-header-actions        { flex-wrap: wrap; gap: .5rem; }
      .search-input               { width: 100%; }
    }

    /* ─── FORÇAR WEB: usuário escolheu web mesmo em tela pequena ─────────── */
    body.lyt-web .sidebar         { transform: none !important; box-shadow: none !important; }
    body.lyt-web .main            { margin-left: var(--sidebar-w) !important; }
    body.lyt-web .btn-hamburger   { display: none !important; }
    body.lyt-web .sidebar-overlay { display: none !important; }

    /* ─── FORÇAR MOBILE: usuário escolheu mobile em tela grande ─────────── */
    body.lyt-mob .sidebar         { transform: translateX(-100%) !important; }
    body.lyt-mob .sidebar.open    { transform: translateX(0) !important; box-shadow: var(--shadow-lg); }
    body.lyt-mob .sidebar-overlay.visible { display: block; }
    body.lyt-mob .main            { margin-left: 0 !important; }
    body.lyt-mob .btn-hamburger   { display: flex !important; }
    body.lyt-mob .stat-grid       { grid-template-columns: repeat(2, 1fr); }
    body.lyt-mob .content         { padding: 1rem .875rem; }
