  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  /* Identidade Grupo Evo */
  :root {
    --ink:        #0B0B0D;   /* preto (sidebar / títulos) */
    --ink-mid:    #104E8B;
    --brand:      #5CB5F9;   /* azul da marca (CTAs) */
    --brand-ink:  #08243F;   /* texto sobre o azul da marca */
    --blue:       #104E8B;   /* azul profundo (acento/legível) */
    --blue-lite:  #E8F2FD;
    --surface:    #F7FAFC;
    --white:      #FFFFFF;
    --border:     #E2E8F0;
    --text:       #374151;
    --muted:      #6B7280;
    --green:      #2F9E5F;
    --green-bg:   #E6F7EC;
    --amber:      #C2740C;
    --amber-bg:   #FDEBD3;
    --red:        #D14D7E;   /* rosa da paleta como alerta */
    --red-bg:     #FCE7F0;
    --purple:     #5C67F9;   /* índigo da paleta */
    --purple-bg:  #E7E9FE;
    --cyan:       #5CF9EE;
    --lime:       #B5F95C;
    --orange:     #F9A05C;
    --pink:       #F95CB5;
    --sidebar-w:  260px;
    --header-h:   64px;
  }

  html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--surface); color: var(--text); }

  /* ── LAYOUT ─────────────────────────────────── */
  .app { display: flex; min-height: 100vh; align-items: flex-start; }

  /* ── SIDEBAR ─────────────────────────────────── */
  .sidebar {
    width: var(--sidebar-w);
    background: #000000;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .logo {
    padding: 28px 16px 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #5CB5F9, #5CF9EE, #B5F95C, #F95CB5, #F9A05C) 1;
    margin-bottom: 8px;
  }
  .logo-icon {
    width: 34px; height: 34px;
    background: var(--blue);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
  }
  .logo-icon svg { width: 18px; height: 18px; fill: white; }
  .logo-name { font-family: 'Sora', sans-serif; font-size: 17px; font-weight: 700; color: white; letter-spacing: -.3px; }
  .logo-name span { color: var(--brand); }

  .nav-section { padding: 0 12px 6px; }
  .nav-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: rgba(255,255,255,0.3); text-transform: uppercase; padding: 12px 12px 6px; }

  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    text-decoration: none;
    position: relative;
  }
  .nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
  .nav-item.active { background: rgba(92,181,249,0.22); color: white; }
  .nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--brand);
    border-radius: 0 3px 3px 0;
  }
  .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
  .nav-item.active svg { color: var(--brand); }
  .nav-badge {
    margin-left: auto;
    background: var(--brand);
    color: #06263F;
    font-size: 10px; font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
  }
  .nav-badge.red { background: var(--pink); color: #4A0F2E; }

  .sidebar-footer {
    margin-top: auto;
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .user-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
  }
  .user-pill:hover { background: rgba(255,255,255,0.07); }
  .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; flex-shrink: 0; }
  .user-info { flex: 1; min-width: 0; }
  .user-name { font-size: 12.5px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-role { font-size: 11px; color: rgba(255,255,255,0.4); }

  /* ── MAIN ─────────────────────────────────── */
  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

  /* header */
  .topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 28px;
    gap: 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .topbar-title { font-family: 'Sora', sans-serif; font-size: 18px; font-weight: 700; color: var(--ink); flex: 1; }
  .search-wrap {
    position: relative;
    flex: 0 0 280px;
  }
  .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
  .search-icon svg { width: 15px; height: 15px; display: block; }
  .search-input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border .15s;
  }
  .search-input:focus { border-color: var(--blue); background: var(--white); }
  .search-input::placeholder { color: var(--muted); }

  .btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
  }
  .btn-primary { background: var(--brand); color: var(--brand-ink); }
  .btn-primary:hover { background: #3FA0EE; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(92,181,249,.4); }
  .btn svg { width: 14px; height: 14px; }

  .icon-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: all .15s;
    position: relative;
  }
  .icon-btn:hover { border-color: var(--blue); color: var(--blue); }
  .icon-btn svg { width: 16px; height: 16px; }
  .notif-dot {
    position: absolute; top: 6px; right: 7px;
    width: 7px; height: 7px;
    background: var(--red); border-radius: 50%;
    border: 2px solid white;
  }

  /* content */
  .content { flex: 1; padding: 28px; display: flex; flex-direction: column; gap: 24px; }
  .hidden-section { display: none !important; }

  /* stats row */
  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    display: flex; flex-direction: column; gap: 12px;
    transition: box-shadow .2s;
  }
  .stat-card:hover { box-shadow: 0 4px 20px rgba(30,27,75,.06); }
  .stat-header { display: flex; align-items: center; justify-content: space-between; }
  .stat-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
  .stat-icon svg { width: 16px; height: 16px; }
  .stat-icon.blue { background: var(--blue-lite); color: var(--blue); }
  .stat-icon.green { background: var(--green-bg); color: var(--green); }
  .stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
  .stat-icon.red { background: var(--red-bg); color: var(--red); }
  .stat-value { font-family: 'Sora', sans-serif; font-size: 30px; font-weight: 700; color: var(--ink); line-height: 1; }
  .stat-meta { font-size: 12px; color: var(--muted); }
  .stat-meta b { color: var(--green); }
  .stat-meta b.down { color: var(--red); }

  /* section row */
  .section-row { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }

  /* ticket table panel */
  .panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
  }
  .panel-head {
    padding: 18px 22px 14px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
  }
  .panel-title { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 700; color: var(--ink); }
  .panel-copy { font-size: 13px; color: var(--muted); margin-top: 4px; }
  .workspace-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
  .workspace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .workspace-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    background: var(--surface);
  }
  .workspace-card h4 { font-family: 'Sora', sans-serif; font-size: 14px; color: var(--ink); margin-bottom: 6px; }
  .workspace-card p { font-size: 12.5px; color: var(--muted); line-height: 1.6; }

  /* filter tabs */
  .filter-tabs { display: flex; gap: 2px; background: var(--surface); border-radius: 8px; padding: 3px; }
  .filter-tab {
    padding: 5px 13px;
    border-radius: 6px;
    font-size: 12.5px; font-weight: 500;
    cursor: pointer;
    color: var(--muted);
    transition: all .15s;
    border: none; background: transparent; font-family: 'Inter', sans-serif;
  }
  .filter-tab.active { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
  .filter-tab:hover:not(.active) { color: var(--text); }

  /* ticket table */
  .ticket-table { width: 100%; border-collapse: collapse; }
  .ticket-table thead { background: var(--surface); }
  .ticket-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }
  .ticket-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
    font-size: 13.5px;
  }
  .ticket-table tr:last-child td { border-bottom: none; }
  .ticket-table tbody tr { cursor: pointer; transition: background .1s; }
  .ticket-table tbody tr:hover { background: #FAFBFF; }
  .ticket-table tbody tr.selected { background: var(--blue-lite); }
  /* A tabela rola na horizontal DENTRO deste container (células nowrap não
     empurram a página inteira → sem precisar dar zoom-out no celular). */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

  .ticket-id { font-size: 12px; font-weight: 600; color: var(--muted); font-family: 'Sora', sans-serif; }
  .ticket-subject { font-weight: 500; color: var(--ink); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ticket-sub-line { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

  /* badges / pills */
  .pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px; font-weight: 600;
    white-space: nowrap;
  }
  .pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .pill.open    { background: var(--blue-lite);   color: var(--blue); }
  .pill.pending { background: var(--amber-bg);    color: #B45309; }
  .pill.resolved{ background: var(--green-bg);    color: #065F46; }
  .pill.urgent  { background: var(--red-bg);      color: var(--red); }
  .pill.p1      { background: var(--red-bg);      color: var(--red); }
  .pill.p2      { background: var(--amber-bg);    color: #B45309; }
  .pill.p3      { background: var(--blue-lite);   color: var(--blue); }
  .pill.p4      { background: #F3F4F6;             color: var(--muted); }

  /* agent avatar row */
  .agent-cell { display: flex; align-items: center; gap: 8px; }
  .agent-av { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: white; flex-shrink: 0; }

  /* pagination */
  .table-footer {
    padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-top: 1px solid var(--border);
    font-size: 12.5px; color: var(--muted);
  }
  .pager { display: flex; gap: 4px; }
  .page-btn {
    width: 30px; height: 30px; border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text);
    transition: all .15s; font-family: 'Inter', sans-serif;
  }
  .page-btn:hover { border-color: var(--blue); color: var(--blue); }
  .page-btn.active { background: var(--blue); border-color: var(--blue); color: white; }

  /* right column */
  .right-col { display: flex; flex-direction: column; gap: 16px; }

  /* activity feed */
  .activity-list { padding: 4px 0 8px; }
  .activity-item {
    display: flex; gap: 12px;
    padding: 12px 22px;
    transition: background .1s;
    cursor: pointer;
  }
  .activity-item:hover { background: var(--surface); }
  .activity-dot-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
  .a-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
  .a-line { width: 1px; flex: 1; background: var(--border); margin-top: 4px; min-height: 18px; }
  .activity-body { flex: 1; padding-bottom: 2px; }
  .activity-text { font-size: 12.5px; color: var(--text); line-height: 1.5; }
  .activity-text b { color: var(--ink); font-weight: 600; }
  .activity-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

  /* priority breakdown */
  .priority-bar-list { padding: 16px 22px; display: flex; flex-direction: column; gap: 12px; }
  .pbar-item { display: flex; flex-direction: column; gap: 5px; }
  .pbar-header { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; color: var(--text); }
  .pbar-header span { color: var(--muted); font-weight: 400; }
  .pbar-track { height: 6px; background: #F3F4F6; border-radius: 20px; overflow: hidden; }
  .pbar-fill { height: 100%; border-radius: 20px; transition: width .6s cubic-bezier(.4,0,.2,1); }

  /* modal */
  .modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,10,40,.45);
    display: none; align-items: center; justify-content: center;
    z-index: 100;
    backdrop-filter: blur(3px);
    animation: fadein .2s ease;
  }
  .modal-overlay.open { display: flex; }
  @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
  .modal {
    background: var(--white);
    border-radius: 16px;
    width: 540px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(15,10,40,.25);
    animation: slideup .22s cubic-bezier(.4,0,.2,1);
  }
  @keyframes slideup { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
  .modal-header {
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .modal-title { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; color: var(--ink); }
  .close-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer; color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
  }
  .close-btn:hover { border-color: var(--red); color: var(--red); }
  .close-btn svg { width: 14px; height: 14px; }
  .modal-body { padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field label { font-size: 12.5px; font-weight: 600; color: var(--text); }
  .field input, .field select, .field textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px; font-family: 'Inter', sans-serif;
    color: var(--text);
    outline: none;
    transition: border .15s;
    background: var(--white);
  }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
  .field textarea { resize: vertical; min-height: 90px; }
  .modal-footer { padding: 16px 26px 22px; display: flex; gap: 10px; justify-content: flex-end; }
  .btn-ghost { background: var(--white); border: 1px solid var(--border); color: var(--text); }
  .btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

  /* toast */
  .toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--ink);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13.5px; font-weight: 500;
    display: none;
    align-items: center; gap: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    z-index: 200;
    animation: slideup .2s ease;
  }
  .toast.show { display: flex; }
  .toast-icon { width: 20px; height: 20px; background: var(--green); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .toast-icon svg { width: 11px; height: 11px; stroke: white; fill: none; }

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

  @media (max-width: 1100px) {
    .section-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2,1fr); }
    .workspace-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 720px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
  }

  /* ── TEMA ESCURO ─────────────────────────────── */
  :root[data-theme="dark"] {
    --surface:   #0E1116;
    --white:     #171B22;   /* superfícies / cards */
    --border:    #262B33;
    --text:      #D6DAE0;
    --muted:     #8A94A3;
    --ink:       #F4F6F8;   /* títulos claros */
    --blue-lite: #12283F;
    --green-bg:  #10251A;
    --amber-bg:  #2A1E0C;
    --red-bg:    #2A1320;
    --purple-bg: #191A33;
    --purple:    #9BA5FB;   /* índigo mais claro no escuro (é usado como texto) */
  }
  html, body { transition: background .2s ease, color .2s ease; }
  [data-theme="dark"] .ticket-table tbody tr:hover { background: #1C2230; }
  [data-theme="dark"] .pill.p4 { background: #232A36; color: var(--muted); }
  [data-theme="dark"] .pbar-track { background: #232A36; }
  [data-theme="dark"] .toast { background: #262E3C; }
  /* Texto sobre fundos-tint: clareia no escuro para manter contraste/legibilidade */
  [data-theme="dark"] .pill.open,
  [data-theme="dark"] .pill.p3,
  [data-theme="dark"] .stat-icon.blue { color: var(--brand); }
  [data-theme="dark"] .pill.pending,
  [data-theme="dark"] .pill.p2 { color: #F9A05C; }
  [data-theme="dark"] .pill.resolved { color: #6FDCA0; }
  [data-theme="dark"] .pill.urgent,
  [data-theme="dark"] .pill.p1 { color: #F98CBE; }
  [data-theme="dark"] .btn-ghost:hover,
  [data-theme="dark"] .icon-btn:hover,
  [data-theme="dark"] .page-btn:hover { color: var(--brand); border-color: var(--brand); }
  [data-theme="dark"] .stat-card,
  [data-theme="dark"] .panel,
  [data-theme="dark"] .workspace-card { box-shadow: 0 1px 3px rgba(0,0,0,.45); }

  /* ── BOTÕES DE TOGGLE (tema / retrair) ────────── */
  .icon-toggle {
    width: 36px; height: 36px; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--white);
    border-radius: 9px; cursor: pointer; color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, border-color .15s;
  }
  .icon-toggle:hover { color: var(--blue); border-color: var(--blue); }
  .icon-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
  :root:not([data-theme="dark"]) .theme-toggle .sun  { display: none; }
  :root[data-theme="dark"] .theme-toggle .moon { display: none; }

  /* ── SIDEBAR RETRÁTIL ────────────────────────── */
  .sidebar { transition: width .18s ease; }
  .logo-mark { display: none; }

  /* Botão de recolher/expandir no canto superior direito da barra lateral */
  .sidebar-toggle {
    position: absolute; top: 14px; right: 12px;
    width: 28px; height: 28px;
    border: none; background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.55);
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 3; transition: background .15s, color .15s;
  }
  .sidebar-toggle:hover { background: rgba(255,255,255,0.18); color: #fff; }
  .sidebar-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .app.nav-collapsed .sidebar-toggle { right: 50%; transform: translateX(50%); }
  .app.nav-collapsed .sidebar { width: 76px; }
  .app.nav-collapsed .logo-full { display: none !important; }
  .app.nav-collapsed .logo-mark { display: block; margin: 0 auto; }
  .app.nav-collapsed .logo { padding: 52px 8px 18px; justify-content: center; }
  .app.nav-collapsed .nav-label,
  .app.nav-collapsed .nav-item > span:not(.nav-badge),
  .app.nav-collapsed .user-info { display: none; }
  .app.nav-collapsed .nav-badge { display: none; }
  .app.nav-collapsed .nav-item { justify-content: center; padding: 10px; }
  .app.nav-collapsed .sidebar-footer .user-pill { justify-content: center; }
  .app.nav-collapsed .sidebar-footer > button { display: none; }

  /* ══ TELA DE LOGIN (Grupo Evo) ═══════════════════════════════ */
  .lgn { position: fixed; inset: 0; z-index: 1000; display: flex; font-family: 'Inter', sans-serif; overflow: hidden; }
  .lgn-left { flex: 0 0 50%; background: #07080B; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
  .lgn-blob { position: absolute; border-radius: 50%; filter: blur(74px); opacity: .55; mix-blend-mode: screen; }
  .lgn .lb1 { width:360px;height:360px; background:#5CB5F9; top:-70px; left:-50px;  animation:lgnDrift1 19s ease-in-out infinite; }
  .lgn .lb2 { width:300px;height:300px; background:#F95CB5; top:80px;  right:-80px; animation:lgnDrift2 23s ease-in-out infinite; }
  .lgn .lb3 { width:380px;height:380px; background:#B5F95C; bottom:-60px; left:-30px; opacity:.4; animation:lgnDrift3 27s ease-in-out infinite; }
  .lgn .lb4 { width:300px;height:300px; background:#5CF9EE; bottom:-70px; right:20px; opacity:.45; animation:lgnDrift1 21s ease-in-out infinite reverse; }
  .lgn .lb5 { width:320px;height:320px; background:#5C67F9; top:36%; left:32%; opacity:.5; animation:lgnDrift2 17s ease-in-out infinite; }
  .lgn .lb6 { width:230px;height:230px; background:#F9A05C; bottom:24%; right:24%; opacity:.4; animation:lgnDrift3 24s ease-in-out infinite reverse; }
  @keyframes lgnDrift1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(60px,50px) scale(1.2)} }
  @keyframes lgnDrift2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-55px,60px) scale(.85)} }
  @keyframes lgnDrift3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(45px,-55px) scale(1.15)} }
  .lgn-left::after { content:''; position:absolute; inset:0; z-index:3; pointer-events:none; background:radial-gradient(120% 90% at 50% 42%, transparent 42%, rgba(0,0,0,.6) 100%); }
  .lgn-grain { position:absolute; inset:0; z-index:3; pointer-events:none; opacity:.07; mix-blend-mode:overlay; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
  .lgn-chip { position:absolute; z-index:4; border-radius:6px; box-shadow:0 10px 24px rgba(0,0,0,.4); transition:transform .2s ease-out; animation:lgnPulse 5s ease-in-out infinite; }
  .lgn .lc1 { top:20%; left:15%; width:20px;height:20px; background:#B5F95C; }
  .lgn .lc2 { top:28%; right:17%; width:14px;height:14px; background:#F95CB5; animation-delay:1.2s; }
  .lgn .lc3 { bottom:22%; left:20%; width:24px;height:24px; background:#5CF9EE; animation-delay:.6s; }
  .lgn .lc4 { bottom:30%; right:22%; width:16px;height:16px; background:#5C67F9; animation-delay:1.8s; }
  @keyframes lgnPulse { 0%,100%{opacity:.45} 50%{opacity:.95} }
  .lgn-logo { position:relative; z-index:5; text-align:center; transition:transform .25s ease-out; animation:lgnEnter 1s cubic-bezier(.2,.8,.2,1) both; }
  .lgn-halo { position:absolute; inset:-34%; z-index:-1; background:radial-gradient(circle, rgba(92,181,249,.3), transparent 62%); filter:blur(12px); animation:lgnBreathe 6s ease-in-out infinite; }
  .lgn-logo img { width:min(340px,64%); height:auto; display:block; margin:0 auto; animation:lgnFloaty 7s ease-in-out infinite; filter:drop-shadow(0 12px 34px rgba(0,0,0,.5)); }
  .lgn-tag { margin-top:26px; font-size:12.5px; letter-spacing:3.5px; text-transform:uppercase; color:rgba(255,255,255,.5); animation:lgnEnter 1s .15s both; }
  .lgn-accent { position:absolute; left:0; right:0; bottom:0; height:5px; z-index:5; background:linear-gradient(90deg,#5CB5F9,#5CF9EE,#B5F95C,#F95CB5,#F9A05C,#5C67F9,#5CB5F9); background-size:200% 100%; animation:lgnFlow 8s linear infinite; }
  @keyframes lgnFloaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }
  @keyframes lgnBreathe { 0%,100%{opacity:.7; transform:scale(1)} 50%{opacity:1; transform:scale(1.08)} }
  @keyframes lgnFlow { from{background-position:0 50%} to{background-position:200% 50%} }
  @keyframes lgnEnter { from{opacity:0; transform:translateY(26px) scale(.96)} to{opacity:1; transform:none} }
  .lgn-right { flex:1; background:#F7FAFC; display:flex; align-items:center; justify-content:center; padding:40px; position:relative; }
  .lgn-right::before { content:''; position:absolute; top:0; left:0; right:0; height:4px; background:linear-gradient(90deg,#5CB5F9,#5C67F9); }
  .lgn-card { width:100%; max-width:392px; }
  .lgn-card > * { animation:lgnRise .7s both; }
  .lgn-card > *:nth-child(2){ animation-delay:.06s } .lgn-card > *:nth-child(3){ animation-delay:.12s }
  .lgn-card > *:nth-child(4){ animation-delay:.18s } .lgn-card > *:nth-child(5){ animation-delay:.24s }
  @keyframes lgnRise { from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:none} }
  .lgn-h1 { font-family:'Sora',sans-serif; font-size:27px; font-weight:800; color:#0B0B0D; margin-bottom:4px; }
  .lgn-sub { font-size:14px; color:#6B7280; margin-bottom:28px; }
  .lgn-field { margin-bottom:16px; }
  .lgn-field label { display:block; font-size:13px; font-weight:600; color:#0B0B0D; margin-bottom:7px; }
  .lgn-field input { width:100%; padding:13px 15px; border:1px solid #E6EBF1; border-radius:12px; font-size:14px; font-family:inherit; background:#fff; color:#374151; outline:none; transition:border-color .18s, box-shadow .18s; }
  .lgn-field input:focus { border-color:#5CB5F9; box-shadow:0 0 0 4px rgba(92,181,249,.18); }
  .lgn-remember { display:flex; align-items:center; gap:9px; margin:2px 0 4px; cursor:pointer; user-select:none; font-size:13.5px; color:#374151; }
  .lgn-remember input { width:17px; height:17px; accent-color:#5C67F9; cursor:pointer; flex:none; margin:0; }
  .lgn-btn { position:relative; overflow:hidden; width:100%; margin-top:10px; padding:14px; border:none; border-radius:12px; cursor:pointer; background:linear-gradient(135deg,#5CB5F9,#5C67F9); background-size:180% 180%; background-position:0 0; color:#fff; font-weight:700; font-size:15px; font-family:inherit; letter-spacing:.2px; box-shadow:0 10px 24px rgba(92,103,249,.28); transition:transform .15s, box-shadow .15s, background-position .5s; }
  .lgn-btn::after { content:''; position:absolute; top:0; left:-130%; width:55%; height:100%; transform:skewX(-18deg); background:linear-gradient(100deg,transparent,rgba(255,255,255,.5),transparent); transition:left .6s ease; }
  .lgn-btn:hover { transform:translateY(-2px); background-position:100% 100%; box-shadow:0 16px 32px rgba(92,103,249,.4); }
  .lgn-btn:hover::after { left:150%; }
  .lgn-error { font-size:12.5px; color:#EF4444; min-height:18px; margin-top:10px; text-align:center; }
  @media (max-width: 860px) { .lgn-left { display:none; } }
  @media (prefers-reduced-motion: reduce) { .lgn * { animation:none !important; } }

  /* ══ PILLS DE STATUS (pt-BR), ANDAMENTO E CANCELADO ═══════════ */
  .pill.aberto    { background: var(--blue-lite); color: var(--blue); }
  .pill.pendente  { background: var(--amber-bg);  color: #B45309; }
  .pill.resolvido { background: var(--green-bg);  color: #065F46; }
  .pill.cancelado { background: #F3F4F6;          color: var(--muted); }
  /* Andamento (progresso) — destaque igual a status/prioridade */
  .pill.pg-novo                { background: var(--blue-lite); color: var(--blue); }
  .pill.pg-lido                { background: var(--purple-bg); color: var(--purple); }
  .pill.pg-realizando          { background: var(--amber-bg);  color: #B45309; }
  .pill.pg-aguardando_resposta { background: var(--amber-bg);  color: #B45309; }
  .pill.pg-concluido           { background: var(--green-bg);  color: #065F46; }
  /* Legibilidade no tema escuro */
  [data-theme="dark"] .pill.aberto,
  [data-theme="dark"] .pill.pg-novo { color: var(--brand); }
  [data-theme="dark"] .pill.pendente,
  [data-theme="dark"] .pill.pg-realizando,
  [data-theme="dark"] .pill.pg-aguardando_resposta { color: #F9A05C; }
  [data-theme="dark"] .pill.resolvido,
  [data-theme="dark"] .pill.pg-concluido { color: #6FDCA0; }
  [data-theme="dark"] .pill.pg-lido { color: var(--purple); }
  [data-theme="dark"] .pill.cancelado { background: #232A36; color: var(--muted); }

  /* ── CARD DE NOTIFICAÇÃO (canto inferior direito, clicável) ── */
  .notif-stack { position: fixed; right: 20px; bottom: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; width: 330px; max-width: calc(100vw - 40px); }
  .notif-card {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--white); color: var(--text);
    border: 1px solid var(--border); border-left: 4px solid var(--brand);
    border-radius: 12px; padding: 12px 12px 12px 14px;
    box-shadow: 0 12px 32px rgba(2,6,23,.20); cursor: pointer;
    opacity: 0; transform: translateX(24px); transition: opacity .2s ease, transform .2s ease;
  }
  .notif-card.in { opacity: 1; transform: none; }
  .notif-card.out { opacity: 0; transform: translateX(24px); }
  .notif-card:hover { border-color: var(--brand); box-shadow: 0 14px 36px rgba(2,6,23,.28); }
  .notif-card-icon { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; background: var(--blue-lite); color: var(--blue); display: flex; align-items: center; justify-content: center; }
  .notif-card-icon svg { width: 18px; height: 18px; }
  .notif-card-body { flex: 1; min-width: 0; }
  .notif-card-title { font-weight: 700; font-size: 13.5px; color: var(--ink); }
  .notif-card-text { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .notif-card-close { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
  .notif-card-close:hover { color: var(--ink); }

  /* ══════════════════════════════════════════════════════════════════
     MOBILE / CELULAR — a barra lateral vira uma "gaveta" (drawer).
     Este bloco fica no FIM do arquivo de propósito: como tem a mesma
     especificidade das regras de desktop, a ordem de origem decide —
     e assim ele vence e reconfigura o layout no celular.
     ══════════════════════════════════════════════════════════════════ */
  .nav-backdrop { display: none; }   /* fundo escuro da gaveta — só no mobile */
  .nav-hamburger { display: none; }  /* botão ☰ — só no mobile */

  @media (max-width: 820px) {
    /* A sidebar sai do fluxo e vira gaveta fixa, escondida à esquerda */
    .sidebar {
      position: fixed; top: 0; left: 0;
      height: 100vh; height: 100dvh;
      width: min(86vw, 300px);
      z-index: 120;
      transform: translateX(-100%);
      transition: transform .24s ease;
      box-shadow: 2px 0 26px rgba(0,0,0,.4);
    }
    .app.nav-open .sidebar { transform: translateX(0); }
    .sidebar-toggle { display: none; }     /* recolher (76px) é conceito de desktop */

    /* Fundo escuro que cobre o conteúdo quando a gaveta está aberta */
    .nav-backdrop {
      display: block; position: fixed; inset: 0;
      background: rgba(0,0,0,.5); z-index: 110;
      opacity: 0; pointer-events: none; transition: opacity .24s ease;
    }
    .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

    /* O conteúdo principal ocupa a largura toda (a sidebar fixa saiu do fluxo) */
    .main { width: 100%; min-width: 0; }

    /* Botão hambúrguer */
    .nav-hamburger {
      display: inline-flex; align-items: center; justify-content: center;
      width: 40px; height: 40px; flex: none;
      border: none; background: none; cursor: pointer; color: var(--muted);
      border-radius: 9px;
    }
    .nav-hamburger:hover { background: var(--surface); }
    .nav-hamburger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
    #chatView .nav-hamburger { color: var(--wa-icon); }
    #chatView .nav-hamburger:hover { background: var(--wa-hover); }

    /* Topbar dos tickets: compacta pra caber no celular */
    .topbar { padding: 0 10px; gap: 8px; }
    .topbar-title { display: none; }
    .search-wrap { flex: 1 1 auto; min-width: 0; }
    .topbar .btn-primary { padding: 9px 12px; }
    .topbar .btn-primary .btn-label { display: none; }   /* "Novo Ticket" vira só o + */

    .content { padding: 16px 14px 26px; gap: 16px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    /* Gráficos do dashboard empilhados (o inline é 1fr 1fr) e a tabela com
       células mais estreitas pra caber mais antes de precisar rolar. */
    #dashboardCharts { grid-template-columns: 1fr !important; padding: 14px !important; gap: 16px !important; }
    .ticket-table th, .ticket-table td { padding-left: 10px; padding-right: 10px; }

    /* ANTI AUTO-ZOOM: iOS/Android dão zoom automático (e ele NÃO desfaz sozinho)
       ao focar campo com fonte < 16px. Com 16px o zoom não acontece e a página
       permanece no tamanho certo. Vale para login, busca, chat e formulários. */
    input, select, textarea {
      font-size: 16px !important;
    }
  }

  /* ── SAÚDE DO SISTEMA (painel do admin) ── */
  .hl-overall { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--white); margin-bottom: 18px; flex-wrap: wrap; }
  .hl-overall-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); }
  .hl-overall-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
  .hl-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
  .hl-actions .hl-danger { color: var(--red); border-color: var(--red-bg); }
  .hl-actions .hl-danger:hover { border-color: var(--red); }
  .hl-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); box-shadow: 0 0 0 4px rgba(107,114,128,.15); }
  .hl-dot.big { width: 16px; height: 16px; }
  .hl-ok   .hl-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(47,158,95,.18); }
  .hl-warn .hl-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(194,116,12,.18); }
  .hl-crit .hl-dot { background: var(--red);   box-shadow: 0 0 0 4px rgba(209,77,126,.2); animation: hlPulse 1.4s infinite; }
  .hl-info .hl-dot { background: var(--brand); box-shadow: 0 0 0 4px rgba(92,181,249,.18); }
  @keyframes hlPulse { 50% { box-shadow: 0 0 0 8px rgba(209,77,126,.08); } }
  .hl-overall.hl-crit { border-color: var(--red); background: var(--red-bg); }
  .hl-overall.hl-warn { border-color: var(--amber); background: var(--amber-bg); }
  .hl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 22px; }
  .hl-card { border: 1px solid var(--border); border-radius: 14px; background: var(--white); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
  .hl-card.hl-crit { border-color: var(--red); }
  .hl-card.hl-warn { border-color: var(--amber); }
  .hl-card-top { display: flex; align-items: center; gap: 9px; }
  .hl-label { font-weight: 600; font-size: 13.5px; color: var(--text); flex: 1; }
  .hl-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; background: var(--surface); color: var(--muted); }
  .hl-ok .hl-badge   { background: var(--green-bg); color: #065F46; }
  .hl-warn .hl-badge { background: var(--amber-bg); color: #B45309; }
  .hl-crit .hl-badge { background: var(--red-bg); color: var(--red); }
  .hl-info .hl-badge { background: var(--blue-lite); color: var(--blue); }
  [data-theme="dark"] .hl-ok .hl-badge { color: #6FDCA0; }
  [data-theme="dark"] .hl-warn .hl-badge { color: #F9A05C; }
  .hl-value { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
  .hl-detail { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
  .hl-action { font-size: 12.5px; color: var(--text); background: var(--surface); border-left: 3px solid var(--amber); padding: 8px 10px; border-radius: 0 8px 8px 0; margin-top: 4px; line-height: 1.45; }
  .hl-crit .hl-action { border-left-color: var(--red); }
  .hl-runbook { border: 1px solid var(--border); border-radius: 14px; background: var(--white); padding: 16px 18px; }
  .hl-runbook-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); }
  .hl-runbook-sub { font-size: 12.5px; color: var(--muted); margin: 3px 0 10px; }
  .hl-rb { border-top: 1px solid var(--border); padding: 10px 0; }
  .hl-rb summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; list-style: none; font-weight: 600; font-size: 13.5px; color: var(--text); }
  .hl-rb summary::-webkit-details-marker { display: none; }
  .hl-rb summary::before { content: '▸ '; color: var(--muted); }
  .hl-rb[open] summary::before { content: '▾ '; }
  .hl-rb summary small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 14px; }
  .hl-rb ol { margin: 8px 0 4px 30px; font-size: 13px; color: var(--text); line-height: 1.55; display: flex; flex-direction: column; gap: 5px; }
  .hl-rb code { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12px; color: var(--blue); word-break: break-all; }
  @media (max-width: 820px) { .hl-actions { margin-left: 0; width: 100%; } .hl-actions .btn { flex: 1; } }

  /* ── Chip "Instalar aplicativo" (PWA) ── */
  .pwa-chip {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 2000; display: flex; align-items: center; gap: 6px;
    background: var(--white); color: var(--text);
    border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 12px 34px rgba(2,6,23,.24);
    padding: 8px 8px 8px 12px; max-width: min(94vw, 420px);
    animation: pwaChipIn .25s ease;
  }
  .pwa-chip-main { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; background: none; border: none; cursor: pointer; font-family: inherit; text-align: left; color: inherit; padding: 2px; }
  .pwa-chip-ic { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--blue-lite); color: var(--blue); display: grid; place-items: center; }
  .pwa-chip-ic svg { width: 20px; height: 20px; }
  .pwa-chip-txt { display: flex; flex-direction: column; min-width: 0; }
  .pwa-chip-txt b { font-size: 13.5px; font-weight: 700; color: var(--ink); }
  .pwa-chip-txt small { font-size: 11.5px; color: var(--muted); }
  .pwa-chip-x { width: 32px; height: 32px; flex: none; border-radius: 8px; border: none; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
  .pwa-chip-x:hover { background: var(--surface); color: var(--text); }
  .pwa-chip-x svg { width: 16px; height: 16px; }
  @keyframes pwaChipIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
  @media (prefers-reduced-motion: reduce) { .pwa-chip { animation: none; } }
  /* Não cobrir o campo de digitar do chat nem o rodapé da gaveta (Sair/Perfil).
     O chip é irmão de #adminApp no body, então os seletores abaixo o alcançam. */
  body.chat-view-open .pwa-chip { display: none !important; }
  #adminApp.nav-open ~ .pwa-chip { display: none !important; }

  /* ── PWA instalado (standalone): reserva a área segura do topo (notch/Dynamic
     Island do iPhone) para a topbar não ficar por baixo da status bar. Em
     navegador comum env(safe-area-inset-top)=0, então não muda nada. ── */
  @media (display-mode: standalone) {
    .topbar {
      padding-top: env(safe-area-inset-top);
      height: calc(var(--header-h) + env(safe-area-inset-top));
    }
  }
