/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL DE COBRANÇAS — VISUAL 3 (mesmo padrão do OS MVMS-Ti, nov/2026)
   "Claro e arejado": menu fino de ícones à esquerda (computador), busca
   grande no topo, faixa escura com o resumo, cartões brancos arredondados,
   janelas ocupando a área toda.
   Substitui o admin-premium.css. Ativado por <body class="ui-v3">.
   Não altera IDs nem regras do sistema — só a aparência.
═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

/* ─── Cores e medidas ───────────────────────────────────────────────────── */
html[data-theme="dark"] body.ui-v3 {
  --bg: #0f141c; --surface: #182030; --surface2: #1f293b; --surface3: #283347; --input-bg: #131a25;
  --border: #253046; --border2: #334058; --rail-bg: #0a0f17; --topo-bg: #0f141c;
  --text: #f1f4fa; --text-muted: #b3bdd1; --text-dim: #8e9ab2;
  --ui-accent-text: color-mix(in srgb, var(--primary) 66%, #ffffff);
  --blue: #5b9bf8; --blue-bg: rgba(91,155,248,.15); --blue-text: #a9cbfd;
  --yellow: #f5a524; --yellow-bg: rgba(245,165,36,.15); --yellow-text: #fcd38a;
  --red: #f0555a; --red-bg: rgba(240,85,90,.15); --red-text: #ffb0b3; --red-border: rgba(240,85,90,.36);
  --green: #34cc70; --green-bg: rgba(52,204,112,.15); --green-text: #8ceeb1; --green-border: rgba(52,204,112,.34);
  --gray-bg: rgba(255,255,255,.07); --gray-dot: #8391ab;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.25); --shadow-card: 0 1px 2px rgba(0,0,0,.18);
  --shadow-pop: 0 12px 32px -12px rgba(0,0,0,.55); --shadow-elevated: 0 24px 64px rgba(0,0,0,.5);
  color-scheme: dark;
}
html:not([data-theme="dark"]) body.ui-v3 {
  --bg: #f4f6fb; --surface: #ffffff; --surface2: #f2f5fa; --surface3: #e8edf5; --input-bg: #ffffff;
  --border: #e4e9f1; --border2: #d0d8e4; --rail-bg: #0f172a; --topo-bg: #f4f6fb;
  --text: #0f172a; --text-muted: #475569; --text-dim: #64748b;
  --ui-accent-text: color-mix(in srgb, var(--primary) 52%, #000000);
  --blue: #2563eb; --blue-bg: rgba(37,99,235,.1); --blue-text: #1d4ed8;
  --yellow: #d97706; --yellow-bg: rgba(217,119,6,.12); --yellow-text: #92400e;
  --red: #dc2626; --red-bg: rgba(220,38,38,.1); --red-text: #b91c1c; --red-border: rgba(220,38,38,.3);
  --green: #16a34a; --green-bg: rgba(22,163,74,.1); --green-text: #15803d; --green-border: rgba(22,163,74,.3);
  --gray-bg: rgba(15,23,42,.06); --gray-dot: #64748b;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05); --shadow-card: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px -10px rgba(15,23,42,.10);
  --shadow-pop: 0 12px 32px -12px rgba(15,23,42,.22); --shadow-elevated: 0 24px 64px rgba(15,23,42,.18);
  color-scheme: light;
}
body.ui-v3 {
  --ui-on-accent: var(--text-on-primary, #ffffff);
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: var(--font);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --header-bg: var(--topo-bg);
  background: var(--bg) !important; color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.5; letter-spacing: 0;
}
body.ui-v3::before, body.ui-v3::after { display: none !important; }
body.ui-v3 h1, body.ui-v3 h2, body.ui-v3 h3, body.ui-v3 .admin-page-title,
body.ui-v3 .modal-title, body.ui-v3 .stat-value { font-family: var(--font); }
body.ui-v3 ::selection { background: color-mix(in srgb, var(--primary) 35%, transparent); }
body.ui-v3 :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── Formulários ───────────────────────────────────────────────────────── */
body.ui-v3 input, body.ui-v3 select, body.ui-v3 textarea {
  min-height: 42px; background: var(--input-bg); border: 1px solid var(--border2);
  border-radius: 12px; color: var(--text); font-family: var(--font); font-size: .9rem; box-shadow: none;
}
body.ui-v3 textarea { min-height: 84px; }
body.ui-v3 input:focus, body.ui-v3 select:focus, body.ui-v3 textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); outline: none;
}
body.ui-v3 input::placeholder, body.ui-v3 textarea::placeholder { color: var(--text-dim); opacity: 1; }
body.ui-v3 input[type="checkbox"], body.ui-v3 input[type="radio"] { min-height: 0; width: 17px; height: 17px; flex: 0 0 17px; padding: 0; accent-color: var(--primary); }
body.ui-v3 input[type="file"], body.ui-v3 input[type="range"] { min-height: 0; }
body.ui-v3 select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e9ab2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
body.ui-v3 .field label, body.ui-v3 label.field-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

/* ─── Botões ────────────────────────────────────────────────────────────── */
body.ui-v3 .btn-primary, body.ui-v3 .btn-secondary, body.ui-v3 .btn-danger, body.ui-v3 .btn-ghost-on-dark {
  min-height: 42px; padding: 9px 18px; border-radius: 12px; font-family: var(--font); font-size: .86rem; font-weight: 700;
  letter-spacing: 0; box-shadow: none; transform: none; transition: background .15s, border-color .15s, color .15s;
}
body.ui-v3 .btn-primary { background: var(--primary); color: var(--ui-on-accent); border: 1px solid transparent; }
body.ui-v3 .btn-primary:hover { background: var(--primary-hover, var(--primary)); box-shadow: none; transform: none; filter: brightness(1.04); }
body.ui-v3 .btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border2); font-weight: 600; }
body.ui-v3 .btn-secondary:hover { background: var(--surface2); border-color: var(--border2); }
body.ui-v3 .btn-danger { background: var(--red-bg); color: var(--red-text); border: 1px solid var(--red-border); }
body.ui-v3 .btn-icon, body.ui-v3 .btn-theme-toggle, body.ui-v3 .btn-menu-toggle {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border2);
  color: var(--text-muted); box-shadow: none;
}
body.ui-v3 .btn-icon:hover, body.ui-v3 .btn-theme-toggle:hover, body.ui-v3 .btn-menu-toggle:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }

/* ─── Cartões, seções e tabelas ─────────────────────────────────────────── */
body.ui-v3 .card, body.ui-v3 .result-section, body.ui-v3 .stat-card {
  background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 20px !important;
  box-shadow: var(--shadow-card) !important; backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.ui-v3 .card:hover { transform: none; }
body.ui-v3 .section-label, body.ui-v3 .section-title { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
body.ui-v3 .table-scroll, body.ui-v3 .table-wrap { border-radius: 20px; }
body.ui-v3 .table { font-size: .87rem; }
body.ui-v3 .table th {
  background: var(--surface); color: var(--text-dim); font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
body.ui-v3 .table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
body.ui-v3 .table tbody tr:last-child td { border-bottom: 0; }
body.ui-v3 .table tbody tr:nth-child(even) { background: transparent; }
body.ui-v3 .table tbody tr:hover { background: var(--surface2); box-shadow: none; }

/* Selos */
body.ui-v3 .badge { padding: 4px 10px 4px 9px; gap: 6px; font-size: .74rem; font-weight: 700; border-radius: 999px; border: 0; }
body.ui-v3 .badge-yellow { background: var(--yellow-bg); color: var(--yellow-text); }
body.ui-v3 .badge-blue { background: var(--blue-bg); color: var(--blue-text); }

/* Abas */
body.ui-v3 .tabs { gap: 2px; border-bottom: 1px solid var(--border); background: none; padding: 0; border-radius: 0; }
body.ui-v3 .tab-btn { padding: 10px 14px; border-radius: 0; background: none; color: var(--text-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; box-shadow: none; }
body.ui-v3 .tab-btn:hover { color: var(--text); background: none; }
body.ui-v3 .tab-btn.active { color: var(--ui-accent-text); border-bottom-color: var(--primary); background: none; }

/* ─── Cabeçalho de cada página ─────────────────────────────────────────── */
body.ui-v3 .admin-page-header { margin-bottom: 22px; gap: 14px; align-items: flex-end; padding: 0; }
body.ui-v3 .admin-page-header::before { display: none; }
body.ui-v3 .admin-page-title { font-size: clamp(1.45rem, 1vw + 1.05rem, 1.85rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.25; color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
body.ui-v3 .admin-page-desc { font-size: .88rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Barra do topo ─────────────────────────────────────────────────────── */
body.ui-v3 .topbar {
  min-height: 64px; height: auto; padding: 10px 16px; gap: 10px;
  background: var(--topo-bg) !important; backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--border) !important; box-shadow: none !important;
}
body.ui-v3 .topbar::after { display: none !important; }
body.ui-v3 .topbar-context, body.ui-v3 .admin-user-chip, body.ui-v3 .topbar-ao-vivo, body.ui-v3 .status-ao-vivo { display: none !important; }
body.ui-v3 .logo-mark { width: 36px; height: 36px; border-radius: 10px; box-shadow: none !important; }
body.ui-v3 .sidebar-empresa-nome { font-family: var(--font); font-size: .95rem; font-weight: 800; color: var(--text); white-space: normal; line-height: 1.15; overflow: visible; text-overflow: clip; max-width: none !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.ui-v3 .topbar-actions { gap: 8px; }
body.ui-v3 .badge-count { border: 2px solid var(--topo-bg); }
body.ui-v3 .alertas-painel { background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; box-shadow: var(--shadow-pop); }

/* Elementos novos do topo (só no computador) */
body.ui-v3 .topbar-busca, body.ui-v3 .topbar-avatar, body.ui-v3 .topbar-nova { display: none; }

/* ─── Menu (no celular: painel que desliza) ─────────────────────────────── */
body.ui-v3 .menu-dropdown {
  background: var(--surface) !important; border-right: 1px solid var(--border); backdrop-filter: none;
  padding: 16px 12px; gap: 2px;
}
body.ui-v3 .nav-group-label { padding: 16px 12px 6px; font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--text-dim); text-transform: uppercase; }
body.ui-v3 .menu-dropdown .nav-item {
  min-height: 42px; padding: 9px 12px; gap: 11px; border-radius: 12px; border: 0;
  color: var(--text-muted); font-size: .9rem; font-weight: 600; background: none; box-shadow: none;
}
body.ui-v3 .menu-dropdown .nav-item svg { width: 18px; height: 18px; }
body.ui-v3 .menu-dropdown .nav-item:hover { background: var(--surface2); color: var(--text); }
body.ui-v3 .menu-dropdown .nav-item.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--ui-accent-text); }
body.ui-v3 .menu-dropdown .nav-item.active::before { display: none; }
body.ui-v3 .menu-dropdown-footer { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }

/* ─── Menu fino de ícones (computador) ──────────────────────────────────── */
body.ui-v3 .rail { display: none; }
@media (min-width: 1024px) {
  body.ui-v3 .rail {
    display: flex; position: fixed; left: 0; top: 0; bottom: 0; width: 88px; z-index: 130;
    flex-direction: column; align-items: center; gap: 4px; padding: 16px 0 14px;
    background: var(--rail-bg); overflow-y: auto; scrollbar-width: none;
  }
  body.ui-v3 .rail::-webkit-scrollbar { display: none; }
  body.ui-v3 .rail-logo { width: 46px; height: 46px; border-radius: 14px; overflow: hidden; flex-shrink: 0; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
  body.ui-v3 .rail-logo img, body.ui-v3 .rail-logo svg { width: 100%; height: 100%; object-fit: contain; }
  body.ui-v3 .rail .rail-item, body.ui-v3 .rail .rail-mais {
    width: 72px; min-height: 60px; padding: 6px 2px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    border: 0; border-radius: 16px; background: none; color: #94a3b8;
    font: inherit; font-size: .66rem; font-weight: 600; line-height: 1.15; text-align: center; cursor: pointer;
    transition: background .15s, color .15s;
  }
  body.ui-v3 .rail .rail-item svg, body.ui-v3 .rail .rail-mais svg { width: 22px; height: 22px; flex-shrink: 0; }
  body.ui-v3 .rail .rail-item:hover, body.ui-v3 .rail .rail-mais:hover { background: rgba(255,255,255,.08); color: #e2e8f0; }
  body.ui-v3 .rail .nav-item.rail-item.active { background: var(--primary); color: var(--ui-on-accent); font-weight: 700; }
  body.ui-v3 .rail .nav-item.rail-item.active::before { display: none; }
  body.ui-v3 .rail .rail-mais.aberto { background: rgba(255,255,255,.12); color: #ffffff; }
  body.ui-v3 .rail-espaco { flex: 1; min-height: 12px; }

  body.ui-v3 .topbar {
    margin-left: 88px; min-height: 76px; padding: 14px clamp(20px, 3vw, 44px);
    background: var(--bg) !important; border-bottom: 0 !important; gap: 12px; position: sticky; top: 0; z-index: 110;
  }
  body.ui-v3 .topbar-logo, body.ui-v3 .btn-menu-toggle { display: none !important; }
  body.ui-v3 .topbar-spacer { flex: 1 1 0; }
  body.ui-v3 .topbar-busca {
    display: flex; position: relative; align-items: center; gap: 10px; flex: 1 1 420px; max-width: 580px; height: 48px; padding: 0 14px;
    border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); box-shadow: var(--shadow-xs); cursor: text;
  }
  body.ui-v3 .topbar-busca:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
  body.ui-v3 .topbar-busca input { flex: 1; min-width: 0; min-height: 0; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none !important; font-size: .9rem; }
  body.ui-v3 .topbar-busca kbd { font-family: var(--font); font-size: .7rem; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
  body.ui-v3 .topbar-actions { gap: 10px; }
  body.ui-v3 .topbar-actions .btn-icon, body.ui-v3 .topbar-actions .btn-theme-toggle {
    display: inline-flex !important; width: 46px; height: 46px; border-radius: 14px; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs);
  }
  body.ui-v3 #btn-sair-mobile:hover { color: #dc2626; border-color: rgba(220,38,38,.35); background: rgba(220,38,38,.08); }
  body.ui-v3 .topbar-nova {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 16px;
    background: var(--rail-bg); color: #ffffff; border: 0; font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  }
  body.ui-v3 .topbar-nova:hover { background: #1e293b; }
  body.ui-v3 .topbar-nova svg { width: 16px; height: 16px; }
  html[data-theme="dark"] body.ui-v3 .topbar-nova { background: var(--primary); color: var(--ui-on-accent); }
  body.ui-v3 .topbar-avatar {
    display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; padding: 0;
    border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); background: #e0e7ff; color: #3730a3;
    font: inherit; font-weight: 800; font-size: .86rem; cursor: pointer;
  }
  html[data-theme="dark"] body.ui-v3 .topbar-avatar { background: #312e81; color: #e0e7ff; }
  body.ui-v3 .alertas-painel { top: 80px; }

  /* O menu completo vira um painel que abre pelo botão "Mais" do trilho */
  body.ui-v3 .menu-dropdown {
    left: 88px !important; top: 0 !important; height: 100vh !important; width: 292px !important; z-index: 125;
    transform: translateX(calc(-100% - 100px)) !important; transition: transform .22s ease !important;
    box-shadow: var(--shadow-elevated); border-radius: 0;
  }
  body.ui-v3 .menu-dropdown.aberto { transform: none !important; }
  body.ui-v3 .menu-dropdown-header { display: flex !important; }
  body.ui-v3 .menu-overlay.aberto { display: block !important; left: 88px; z-index: 124; background: rgba(15,23,42,.28); }

  body.ui-v3 .admin-content { margin: 0 0 0 88px !important; width: calc(100% - 88px) !important; max-width: none !important; padding: 10px clamp(20px, 3vw, 44px) 56px !important; }
  body.ui-v3 .admin-content > .admin-page { max-width: 1480px; margin-left: auto; margin-right: auto; }
}

/* ─── Dashboard ─────────────────────────────────────────────────────────── */
body.ui-v3 .relogio-brasilia { background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin-left: auto; }
body.ui-v3 .relogio-icone { display: none; }
body.ui-v3 .relogio-texto { text-align: right; }
body.ui-v3 .relogio-hora { font-family: var(--mono); font-size: 1.4rem; font-weight: 600; color: var(--text); letter-spacing: 0; }
body.ui-v3 .relogio-data { font-size: .8rem; color: var(--text-muted); text-transform: none; }
body.ui-v3 .relogio-data::first-letter { text-transform: uppercase; }

/* Faixa escura de destaque (era o "hero" com brilho) */
body.ui-v3 .dashboard-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 0 22px; padding: 22px 26px;
  border-radius: 22px; background: var(--rail-bg) !important; border: 0 !important; box-shadow: none !important; color: #ffffff; overflow: hidden;
}
body.ui-v3 .dashboard-hero::before, body.ui-v3 .dashboard-hero::after { display: none !important; }
body.ui-v3 .dashboard-hero-copy { flex: 1 1 340px; min-width: 0; }
body.ui-v3 .dashboard-hero .eyebrow { display: inline-block; margin-bottom: 6px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.1); color: #cbd5e1; border: 0; font-size: .68rem; font-weight: 700; letter-spacing: .08em; }
body.ui-v3 .dashboard-hero h1 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; color: #ffffff; margin: 0 0 4px; }
body.ui-v3 .dashboard-hero p { font-size: .88rem; color: #a5b4c8; margin: 0; max-width: 640px; }
body.ui-v3 .dashboard-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
body.ui-v3 .dashboard-hero-actions .btn-primary { min-height: 44px; }
body.ui-v3 .btn-ghost-on-dark { background: rgba(255,255,255,.1) !important; color: #ffffff !important; border: 0 !important; min-height: 44px; }
body.ui-v3 .btn-ghost-on-dark:hover { background: rgba(255,255,255,.17) !important; }

/* Cartões de números */
body.ui-v3 .resumo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
body.ui-v3 .card-stat {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center;
  column-gap: 12px; row-gap: 14px; padding: 20px 20px 22px; min-height: 0;
  background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 20px !important;
  box-shadow: var(--shadow-card) !important; overflow: hidden; backdrop-filter: none;
}
body.ui-v3 .card-stat::before { display: none !important; }
body.ui-v3 .card-stat::after { content: ''; position: absolute; left: 20px; right: 20px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--stat-c, var(--primary)); opacity: .55; }
body.ui-v3 .card-stat:hover { transform: none; }
body.ui-v3 .card-stat-body { display: contents; }
body.ui-v3 .card-stat-icon {
  grid-row: 1; grid-column: 1; order: 0; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--stat-c, var(--primary)) 15%, transparent) !important; color: var(--stat-c, var(--primary)) !important; border: 0 !important;
}
body.ui-v3 .card-stat-icon svg { width: 19px; height: 19px; }
body.ui-v3 .card-stat .stat-label { grid-row: 1; grid-column: 2; margin: 0; font-size: .84rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-muted); }
body.ui-v3 .card-stat .stat-value {
  grid-row: 2; grid-column: 1 / -1; font-size: clamp(1.5rem, 1.3vw + .9rem, 2rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05;
  font-variant-numeric: tabular-nums; color: var(--text) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: none;
}
body.ui-v3 .card-stat .stat-value + div { grid-column: 1 / -1; margin-top: -8px !important; font-size: .76rem !important; color: var(--text-dim) !important; }

/* ─── Janelas (modais) ocupando a área toda ─────────────────────────────── */
body.ui-v3 .modal-overlay { background: rgba(6,10,18,.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); padding: 16px; align-items: stretch; justify-content: stretch; }
html:not([data-theme="dark"]) body.ui-v3 .modal-overlay { background: rgba(15,23,42,.38); }
body.ui-v3 .modal-overlay .modal, body.ui-v3 .modal-overlay .modal[class*="modal-"] {
  width: 100% !important; max-width: none !important; height: 100% !important; max-height: none !important; margin: 0;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border2); border-radius: 20px; box-shadow: var(--shadow-elevated);
}
body.ui-v3 .modal-header { padding: 18px 28px; background: none; border-bottom: 1px solid var(--border); }
body.ui-v3 .modal-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
body.ui-v3 .modal-overlay .modal > .modal-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; padding: 24px 28px; }
body.ui-v3 .modal-footer { padding: 14px 28px; background: none; border-top: 1px solid var(--border); }
@media (min-width: 900px) {
  body.ui-v3 .modal .modal-body .form-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (min-width: 1024px) { body.ui-v3 .modal-overlay { left: 88px; } }
@media (max-width: 720px) {
  body.ui-v3 .modal-overlay { padding: 8px; }
  body.ui-v3 .modal-overlay .modal { border-radius: 16px; }
  body.ui-v3 .modal-header, body.ui-v3 .modal-overlay .modal > .modal-body, body.ui-v3 .modal-footer { padding-left: 18px; padding-right: 18px; }
}

/* ─── Busca do topo (resultados) ────────────────────────────────────────── */
.busca-caixa {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 140; max-height: 420px; overflow-y: auto; padding: 8px;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; box-shadow: var(--shadow-pop);
}
.busca-caixa[hidden] { display: none; }
.busca-grupo { padding: 8px 10px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.busca-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.busca-item:hover, .busca-item.sel { background: var(--surface2); }
.busca-item-ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--ui-accent-text); font-weight: 800; font-size: .8rem; }
.busca-item-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.busca-item-txt strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busca-item-txt span { font-size: .78rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busca-vazio { padding: 18px; text-align: center; font-size: .84rem; color: var(--text-dim); }

/* ─── Celular ───────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  body.ui-v3 .admin-content { padding: 18px 14px 40px !important; }
  body.ui-v3 .topbar { position: sticky; top: 0; z-index: 110; }
}
@media (max-width: 640px) {
  body.ui-v3 .resumo-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body.ui-v3 .card-stat { padding: 14px 14px 16px; grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; row-gap: 10px; }
  body.ui-v3 .card-stat-icon { width: 32px; height: 32px; border-radius: 9px; }
  body.ui-v3 .card-stat .stat-label { font-size: .74rem; }
  body.ui-v3 .card-stat .stat-value { font-size: 1.3rem; }
  body.ui-v3 .dashboard-hero { padding: 18px; }
  body.ui-v3 #page-dashboard .admin-page-header { align-items: flex-start; }
  body.ui-v3 .relogio-brasilia { margin-left: 0; }
  body.ui-v3 .relogio-texto { text-align: left; }
}

/* ─── Ajustes finos ─────────────────────────────────────────────────────── */
body.ui-v3 .topbar-actions > div:has(> .dot-refresh) { display: none !important; } /* selo "ao vivo" */
body.ui-v3 .rail-logo { color: #ffffff; background: var(--primary); }
body.ui-v3 .rail-logo:has(img) { background: transparent; }
body.ui-v3 .rail-logo svg { width: 26px !important; height: 26px !important; }
body.ui-v3 .admin-page-header { padding-bottom: 0 !important; border-bottom: 0 !important; }
body.ui-v3 .admin-page-header select { max-width: none !important; min-width: 150px; width: auto; }
body.ui-v3 .card-stat::after { width: auto; height: 3px; right: 20px; bottom: 0; border-radius: 3px 3px 0 0; }
body.ui-v3 .dashboard-hero { min-height: 0; align-items: center; animation: none; }
body.ui-v3 .dashboard-hero-copy { max-width: none; }
body.ui-v3 .dashboard-hero .eyebrow { color: #cbd5e1; }
html:has(body.ui-v3) { background: var(--bg); }
html:not([data-theme="dark"]):has(body.ui-v3) { background: #f4f6fb; }
html[data-theme="dark"]:has(body.ui-v3) { background: #0f141c; }
body.ui-v3 .tabs { padding: 0 !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; background: none !important; width: auto !important; }
body.ui-v3 .badge-green { background: var(--green-bg) !important; color: var(--green-text) !important; }
body.ui-v3 .badge-red { background: var(--red-bg) !important; color: var(--red-text) !important; }
body.ui-v3 .badge-gray { background: var(--gray-bg) !important; color: var(--text-muted) !important; }
body.ui-v3 .table td .badge { margin-left: 8px; vertical-align: 1px; }
@media (min-width: 721px) {
  body.ui-v3 .table td.td-actions { display: table-cell; white-space: nowrap; text-align: right; }
  body.ui-v3 .table td.td-actions > * { margin-left: 6px; vertical-align: middle; }
  body.ui-v3 .table td.td-actions > .contract-action-row { display: inline-flex; gap: 6px; }
}

/* ═══ Clientes: resumo, chips, lista enxuta e ficha (mestre-detalhe) ═══════ */
.cli-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.cli-resumo:empty { display: none; }
.cli-resumo-item { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); overflow: hidden; }
.cli-resumo-item::after { content: ''; position: absolute; left: 20px; right: 20px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--c); opacity: .55; }
.cli-resumo-item span { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.cli-resumo-item strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.cli-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 16px; }
.cli-chips:empty { display: none; }
.cli-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border2); background: var(--surface); color: var(--text-muted); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.cli-chip b { font-size: .74rem; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface2); color: var(--text-muted); text-align: center; }
.cli-chip:hover { border-color: var(--text-dim); color: var(--text); }
.cli-chip.ativo { background: var(--text); border-color: var(--text); color: var(--bg); }
.cli-chip.ativo b { background: color-mix(in srgb, var(--bg) 22%, transparent); color: var(--bg); }

body.ui-v3 .lista-simples thead { display: none; }
body.ui-v3 .lista-simples, body.ui-v3 .lista-simples tbody { display: block; width: 100%; }
body.ui-v3 .lista-simples tr.ls-item { display: block; cursor: pointer; border: 0; border-bottom: 1px solid var(--border); background: transparent; box-shadow: none; margin: 0; border-radius: 0; padding: 0; }
body.ui-v3 .lista-simples tr.ls-item:last-child { border-bottom: 0; }
body.ui-v3 .lista-simples tr.ls-item td { display: block; padding: 0; border: 0; }
body.ui-v3 .lista-simples tr.ls-item td::before { display: none; }
body.ui-v3 .lista-simples tr.ls-item:hover, body.ui-v3 .lista-simples tr.ls-item:focus-visible { background: var(--surface2); outline: none; }
.ls-linha { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 9px 18px; }
.ls-avatar { width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--ui-accent-text); font-weight: 800; font-size: .86rem; }
.ls-nome { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ls-nome strong { font-size: .95rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-nome small { font-size: .78rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-linha .badge { flex-shrink: 0; margin: 0 !important; }
.ls-seta { color: var(--text-dim); flex-shrink: 0; }

.cd-info { margin-bottom: 16px; }
.cd-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; padding: 18px; border-radius: 16px; background: var(--surface2); }
.cd-campo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cd-campo span, .cd-obs span { font-size: .74rem; font-weight: 600; color: var(--text-dim); }
.cd-campo strong { font-size: .9rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.cd-obs { margin-top: 12px; padding: 14px 18px; border-radius: 14px; background: var(--surface2); }
.cd-obs p { margin: 4px 0 0; font-size: .88rem; white-space: pre-wrap; }
.cd-acoes { display: flex; flex-wrap: wrap; gap: 10px; }
.cd-acoes .cd-wa { color: var(--green-text) !important; border-color: var(--green-border) !important; background: var(--green-bg) !important; text-decoration: none; display: inline-flex; align-items: center; }
.cd-cobs { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.cd-cob { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px; border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.cd-cob:first-child { border-top: 0; }
.cd-cob:hover { background: var(--surface2); }
.cd-cob-desc { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cd-cob-desc strong { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-cob-desc small { font-size: .76rem; color: var(--text-dim); }
.cd-cob-valor { font-family: var(--mono); font-size: .86rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 640px) {
  .cli-resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cli-resumo-item { padding: 14px; }
  .cli-resumo-item strong { font-size: 1.15rem; }
  .cli-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .cli-chip { flex-shrink: 0; }
  .ls-linha { padding: 8px 12px; gap: 10px; }
  body.ui-v3 .result-section:has(.lista-simples) .table-scroll { border: 0; background: transparent; }
}
@media (max-width: 980px) {
  body.ui-v3 .admin-page-header { align-items: stretch; }
  body.ui-v3 .admin-page-header > .btn-primary { align-self: stretch; }
}
body.ui-v3 .menu-dropdown:not(.aberto) { box-shadow: none !important; }

/* ===== Mobile: hero do painel compacto (botões não esticam) ===== */
@media (max-width: 760px) {
  body.ui-v3 .dashboard-hero { flex-direction: column; align-items: stretch; gap: 14px; }
  body.ui-v3 .dashboard-hero-copy { flex: 0 0 auto !important; }
  body.ui-v3 .dashboard-hero-actions { flex: 0 0 auto !important; display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  body.ui-v3 .dashboard-hero-actions > * { flex: 0 0 auto !important; height: auto !important; min-height: 46px; width: 100%; justify-content: center; }
  body.ui-v3 .dashboard-hero-actions > *:only-child,
  body.ui-v3 .dashboard-hero-actions > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
