/* Fluxa — visual de app de banco (pensado primeiro para o celular).
   Usa a cor da Personalização (--brand). Ativo pelo atributo data-skin="app" no <html>. */
.app-home, .tabbar { display: none; }
html[data-skin="app"] {
  --ink: #14182b; --muted: #687089; --line: #e8ebf3; --paper: #f1f4fa; --white: #ffffff;
  --green: #0f9a63; --mint: #e2f6ed; --red: #df4157; --redbg: #fde8eb; --amber: #c9820a; --amberbg: #fff2d9;
  --shadow: 0 4px 18px #1a24500f; --b2: color-mix(in srgb, var(--brand) 70%, #4fa3ff);
  --hover: var(--brand); --chart-pos: var(--brand); --chart-neg: #d9485c;
}
html[data-skin="app"][data-theme="dark"] { --ink: #eef1fa; --muted: #a2a9c2; --line: #252b40; --paper: #0c1020; --white: #151a2e; --mint: #0f2b21; --redbg: #3a1820; --amberbg: #33260b; }
html[data-skin="app"] .heading h1, html[data-skin="app"] .panel-head h2, html[data-skin="app"] .card-value, html[data-skin="app"] .crumb b { font-family: 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; }
html[data-skin="app"] .card, html[data-skin="app"] .panel { border-radius: 18px; border-color: transparent; box-shadow: var(--shadow); }
html[data-skin="app"] .btn { border-radius: 12px; }
html[data-skin="app"] .btn.primary { background: linear-gradient(135deg, var(--brand), var(--b2)); border-color: transparent; }
html[data-skin="app"] .field { border-radius: 10px; }
html[data-skin="app"] .status { border-radius: 999px; }
html[data-skin="app"] .nav button { border-radius: 12px; }
html[data-skin="app"] .bar { background: linear-gradient(180deg, color-mix(in srgb, var(--chart-pos) 65%, #fff), var(--chart-pos)); border-radius: 6px 6px 2px 2px; }
html[data-skin="app"] .bar.neg { background: linear-gradient(180deg, color-mix(in srgb, var(--chart-neg) 65%, #fff), var(--chart-neg)); }
/* cor de destaque ao passar o mouse (Personalização) */
html[data-skin="app"] .nav button:hover { background: color-mix(in srgb, var(--hover) 26%, transparent); color: var(--nav-ink); }
html[data-skin="app"] tbody tr:hover { background: color-mix(in srgb, var(--hover) 7%, var(--white)); }
html[data-skin="app"] .btn:hover { border-color: var(--hover); }
html[data-skin="app"] .btn.primary:hover { filter: brightness(1.06); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hover) 30%, transparent); }
html[data-skin="app"] .card-btn:hover, html[data-skin="app"] .ah-card:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--hover) 55%, transparent), var(--shadow); }
html[data-skin="app"] .ah-tile:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--hover) 55%, transparent), var(--shadow); }
html[data-skin="app"] .ah-tile:hover .ico { background: color-mix(in srgb, var(--hover) 18%, transparent); color: var(--hover); }
html[data-skin="app"] .tabs button:hover, html[data-skin="app"] .mini-actions button:hover { color: var(--hover); }
.color-row { display: flex; align-items: center; gap: 12px; } .color-row input[type=color] { width: 64px; height: 38px; padding: 3px; }
.color-row input[type=color]:disabled { opacity: .45; }

/* Início */
html[data-skin="app"] #page-dashboard > .heading, html[data-skin="app"] #dashHero, html[data-skin="app"] #summaryCards { display: none; }
html[data-skin="app"] .app-home { display: block; margin: -28px -34px 18px; }
.ah-top { --hb: var(--home, var(--brand)); background: radial-gradient(120% 160% at 100% 0%, color-mix(in srgb, var(--hb) 82%, #ffffff) 0%, var(--hb) 55%, color-mix(in srgb, var(--hb) 70%, #05081f) 100%); color: #fff; padding: 26px 34px 70px; }
.ah-top { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.ah-top-left { flex: 1; min-width: 0; }
.ah-scope { flex: 0 0 auto; align-self: flex-start; }
.ah-scope .scope-bar { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; padding: 0; background: none; border: 0; }
.ah-scope .scope-bar label { display: block; font-size: 0; }
.ah-scope .scope-bar .field { min-width: 0; width: 170px; height: 32px; padding: 0 28px 0 12px; font-size: 12px; font-weight: 600; color: #fff; border: 1px solid #ffffff38; border-radius: 999px; background-color: #ffffff1a; cursor: pointer;
  appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.ah-scope .scope-bar .field:hover { background-color: #ffffff29; }
.ah-scope .scope-bar .field:focus { border-color: #ffffff80; box-shadow: none; }
.ah-scope .scope-bar .field option { color: #14182b; background: #fff; }
.ah-hello { font: 800 24px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; letter-spacing: -.02em; }
.ah-ask { font-size: 15px; opacity: .85; margin: 2px 0 16px; }
.ah-search { position: relative; max-width: 620px; }
.ah-search input { width: 100%; border: 0; border-radius: 999px; padding: 13px 18px 13px 42px; font-size: 14px; color: #14182b; background: #fff; box-shadow: 0 8px 20px #0003; outline: none; }
.ah-s-ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #7b839c; font-size: 16px; z-index: 1; }
.ah-sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border-radius: 14px; box-shadow: 0 14px 30px #0003; padding: 6px; z-index: 5; }
.ah-sugg button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; color: #14182b; font-size: 13px; }
.ah-sugg button:hover { background: #f1f4fa; }
.ah-body { margin: -52px 34px 0; position: relative; }
.ah-sec { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 10px; font: 800 15px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; color: var(--ink); }
.ah-body > .ah-sec:first-child { color: #fff; margin-top: 0; }
.ah-link { border: 0; background: none; color: inherit; font-size: 12px; font-weight: 600; opacity: .9; cursor: pointer; }
.ah-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ah-card { background: var(--white); border-radius: 18px; padding: 15px 16px; box-shadow: var(--shadow); cursor: pointer; min-width: 0; }
.ah-k { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 600; }
.ah-eye { border: 0; background: none; color: var(--brand); padding: 0; cursor: pointer; display: grid; }
.ah-eye svg { width: 18px; height: 18px; }
.ah-v { font: 800 20px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; letter-spacing: -.02em; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ah-v.bad { color: var(--red); } .ah-v.good { color: var(--green); }
.ah-f { font-size: 11px; color: var(--muted); margin-top: 3px; }
.ah-tiles { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.ah-tile { background: var(--white); border: 0; border-radius: 16px; box-shadow: var(--shadow); padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink); font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; min-height: 92px; }
.ah-tile .ico { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 11%, transparent); color: var(--brand); }
.ah-tile .ico svg { width: 21px; height: 21px; }
.ah-tile:hover { transform: translateY(-1px); }
.ah-banner { margin-top: 14px; width: 100%; border: 0; border-radius: 18px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; text-align: left; cursor: pointer; color: #fff;
  background: linear-gradient(120deg, var(--brand), var(--b2)); box-shadow: var(--shadow); }
.ah-banner b { display: block; font: 800 15px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; }
.ah-banner span { font-size: 12px; opacity: .9; }
.ah-banner.bad { background: linear-gradient(120deg, #b8324a, #e2566b); }
.ah-banner.warn { background: linear-gradient(120deg, #b56a00, #e39a1f); }
.ah-go { font-size: 28px !important; opacity: .9; }

@media (max-width: 1120px) { .ah-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } html[data-skin="app"] .app-home { margin: -25px -23px 18px; } .ah-top { padding-left: 23px; padding-right: 23px; } .ah-body { margin-left: 23px; margin-right: 23px; } }
@media (max-width: 760px) {
  html[data-skin="app"] .app-home { margin: -16px -12px 14px; }
  .ah-top { padding: 20px 16px 62px; flex-direction: column; align-items: stretch; gap: 14px; }
  .ah-scope { align-self: stretch; }
  .ah-scope .scope-bar label { flex: 1; min-width: 0; }
  .ah-scope .scope-bar .field { width: 100%; }
  .ah-hello { font-size: 21px; }
  .ah-body { margin: -46px 12px 0; }
  .ah-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ah-cards .ah-card:first-child { grid-column: 1 / -1; }
  .ah-v { font-size: 18px; }
  .ah-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .ah-tile { min-height: 84px; padding: 10px 4px; font-size: 10.5px; }
  /* barra inferior */
  html[data-skin="app"] body.logged-in .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; background: var(--white);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 20px #1a24501a; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  html[data-skin="app"] .tabbar button { border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; padding: 4px 0; }
  html[data-skin="app"] .tabbar button .ico svg { width: 21px; height: 21px; }
  html[data-skin="app"] .tabbar button.active { color: var(--brand); }
  html[data-skin="app"] .tabbar .tb-center .ico { width: 52px; height: 52px; border-radius: 50%; margin-top: -26px; background: linear-gradient(135deg, var(--brand), var(--b2)); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 45%, transparent); border: 4px solid var(--white); }
  html[data-skin="app"] .tabbar .tb-center .ico svg { width: 24px; height: 24px; }
  html[data-skin="app"] .content { padding-bottom: 96px; }
  html[data-skin="app"] .help-fab { display: none; }
  html[data-skin="app"] body.drawer-open .tabbar { display: none; }
}
html[data-skin="app"][data-theme="dark"] .ah-tile .ico { background: color-mix(in srgb, var(--b2) 22%, transparent); color: color-mix(in srgb, var(--b2) 55%, #fff); }
html[data-skin="app"][data-theme="dark"] .ah-eye { color: color-mix(in srgb, var(--b2) 55%, #fff); }
html[data-skin="app"][data-theme="dark"] .tabbar button.active { color: color-mix(in srgb, var(--b2) 55%, #fff); }

/* ---------- Empresas em cards, por grupo ---------- */
.company-groups { display: grid; gap: 22px; }
.group-sec { --g: var(--brand); }
.gs-head { display: flex; align-items: center; gap: 12px; margin: 0 2px 12px; }
.gs-head > div { flex: 1; min-width: 0; }
.gs-head h2 { margin: 0; font: 800 17px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; color: var(--ink); }
.gs-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.g-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; background: var(--white); box-shadow: 0 0 0 2px var(--g), var(--shadow); }
.g-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.g-logo.g-initial { background: var(--g); color: #fff; font: 800 18px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; box-shadow: var(--shadow); }
.g-logo.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; box-shadow: 0 0 0 1.5px var(--g); }
.g-logo.sm.g-initial { box-shadow: none; }
.g-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.company-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; align-items: start; }
.company-card { background: var(--white); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; position: relative; border: 1px solid transparent; transition: box-shadow .15s, transform .15s; }
.company-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--g); }
.company-card:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--hover, var(--g)) 55%, transparent), var(--shadow); }
.company-card.open { grid-column: 1 / -1; }
.cc-main { padding: 16px 16px 12px; cursor: pointer; }
.cc-top { display: flex; align-items: center; gap: 8px; }
.cc-group { font-size: 11px; font-weight: 700; color: color-mix(in srgb, var(--g) 80%, var(--ink)); text-transform: uppercase; letter-spacing: .06em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-actions { display: flex; gap: 6px; }
.cc-actions .btn.small { padding: 6px 8px; }
.cc-name { font: 800 17px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; margin: 12px 0 2px; color: var(--ink); }
.cc-doc { font-size: 11.5px; color: var(--muted); }
.cc-stats { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cc-stats span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.cc-stats b { font: 800 15px 'Manrope', 'DM Sans', 'Liberation Sans', Arial, sans-serif; color: var(--ink); }
.cc-stats b.bad, .cc-stats em.bad { color: var(--red); } .cc-stats em { font-style: normal; font-size: 11px; font-weight: 700; }
.cc-stats > div:last-child { text-align: right; }
.cc-more { margin-top: 10px; font-size: 11.5px; font-weight: 700; color: color-mix(in srgb, var(--g) 85%, var(--ink)); }
.company-card .company-detail { display: block; padding: 4px 16px 16px; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .company-cards { grid-template-columns: 1fr; } }

/* ===== Modo escuro: cores que estavam fixas para o tema claro ===== */
html[data-theme="dark"] { color-scheme: dark; } /* campos nativos (arquivo, data, seleção, barras de rolagem) escuros */
html[data-theme="dark"] .status.gray { background: #262a45; color: #b9bdd6; }
html[data-theme="dark"] .notice:not(.notice-warn):not(.notice-ok) { background: #1a1e3a; border-color: #2c3156; color: #c3c7e0; }
html[data-theme="dark"] .notice-ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: #6fd3a5; }
html[data-theme="dark"] .notice-warn { color: #f0b54a; }
html[data-theme="dark"] .notice a, html[data-theme="dark"] .sub a, html[data-theme="dark"] p a, html[data-theme="dark"] td a, html[data-theme="dark"] li a, html[data-theme="dark"] .acc-status a { color: color-mix(in srgb, var(--brand) 40%, #fff); }
html[data-theme="dark"] .form-group label { color: #aeb3cc; }
html[data-theme="dark"] th { color: #8f95b3; }
html[data-theme="dark"] .close { color: #a0a4bd; }
html[data-theme="dark"] .btn:hover { border-color: #4a5078; }
html[data-theme="dark"] .src-badge.f360 { background: color-mix(in srgb, var(--brand) 30%, var(--white)); color: color-mix(in srgb, var(--brand) 35%, #fff); }
html[data-theme="dark"] .src-badge.saipos { background: color-mix(in srgb, #e5532d 25%, var(--white)); color: #fdba8c; }
html[data-theme="dark"] .src-badge.inter { background: color-mix(in srgb, #ff7a00 25%, var(--white)); color: #fdc58a; }
html[data-theme="dark"] .src-badge.cora { background: color-mix(in srgb, #fe3e6d 25%, var(--white)); color: #fda4b8; }
html[data-theme="dark"] .tabs button.active,
html[data-theme="dark"] .mini-actions button:hover,
html[data-theme="dark"] .bell-read:hover { color: color-mix(in srgb, var(--brand) 40%, #fff); }
html[data-theme="dark"] .tabs button.active { border-bottom-color: color-mix(in srgb, var(--brand) 55%, #fff); }
html[data-theme="dark"] .group-tag:not(.none) { background: color-mix(in srgb, var(--brand) 28%, transparent); color: color-mix(in srgb, var(--brand) 40%, #fff); }
html[data-theme="dark"] .group-tag.none { color: #f39a90; }
html[data-theme="dark"] .avatar { background: color-mix(in srgb, var(--brand) 35%, var(--white)); color: #fff; }
html[data-theme="dark"] .cc-group { color: color-mix(in srgb, var(--g, var(--brand)) 40%, #fff); }
html[data-theme="dark"] .cc-more { color: color-mix(in srgb, var(--g, var(--brand)) 45%, #fff); }

/* ===== Tela de login: sempre clara (o tema escuro vale só depois de entrar) ===== */
.login-screen {
  color-scheme: light;
  --ink: #181a2b; --muted: #6c7080; --line: #e6e7f0; --paper: #f5f6fb; --white: #fff;
  --mint: #e6f5ee; --redbg: #fdeeec; --amberbg: #fdf3e0; --shadow: 0 8px 28px #14163a0d;
  color: var(--ink);
}
html[data-theme="dark"] .login-screen .form-group label { color: #565a6c; }
#loginThemeToggle { display: none !important; }
html[data-theme="dark"] .notice.notice-warn { background: var(--amberbg); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: #f0b54a; }
html[data-theme="dark"] .notice.notice-ok { border-color: color-mix(in srgb, var(--green) 35%, transparent); }
html[data-theme="dark"] .due-edit, html[data-theme="dark"] .sub.due-moved { color: color-mix(in srgb, var(--brand) 40%, #fff); }
