/* Mesmo visual do Conta Comigo: tokens, fontes, sidebar, topbar, cards, KPIs, bottom-sheet e toast. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #EEF1F5; --surface: #FFFFFF; --surface2: #F4F6F9; --border: #E1E5EB;
  --text: #131722; --muted: #6B7686;
  --accent: #2F6FED; --accent-dark: #2258C7; --accent-soft: #EAF1FE;
  --green: #16A34A; --green-soft: #EAF9EF; --red: #E0362E; --red-soft: #FDEDEC;
  --amber: #D97706; --amber-soft: #FEF3E1;
  --radius: 16px; --sidebar-w: 232px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141A; --surface: #1A1D25; --surface2: #20232C; --border: #2C303A;
    --text: #EBEDF2; --muted: #8A93A3; --accent-soft: #182B4D;
    --green-soft: #10241A; --red-soft: #2C1615; --amber-soft: #2B2110;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
[hidden] { display: none !important; }
.num { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }

/* Estrutura */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { padding: 22px 20px; font-weight: 800; font-size: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-header .mark, .login-card .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.sidebar-section { padding: 18px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.sidebar-nav { flex: 1; padding-bottom: 12px; }
.sidebar-link { display: flex; align-items: center; gap: 11px; padding: 10px 20px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; border-left: 3px solid transparent; cursor: pointer; }
.sidebar-link .ico { width: 18px; text-align: center; font-size: 15px; }
.sidebar-link:hover { background: var(--surface2); color: var(--text); }
.sidebar-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sidebar-footer button { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--muted); cursor: pointer; font-family: inherit; }
.menu-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; width: 26px; height: 26px; line-height: 1; cursor: pointer; color: var(--muted); font-size: 14px; }
.menu-toggle:hover { background: var(--surface2); color: var(--text); }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 32px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 15; }
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hamburger { display: none; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text); }
.content { padding: 28px 32px 60px; max-width: 1180px; }

/* Cards, textos */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; }
h2 { font-size: 14.5px; font-weight: 700; margin: 0 0 4px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 18px; }

/* KPIs */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.kpi-value { font-family: 'IBM Plex Mono', monospace; font-size: 20px; font-weight: 700; }
.kpi-delta { font-size: 12px; margin-top: 4px; font-weight: 600; color: var(--muted); }
.kpi-delta.up { color: var(--green); } .kpi-delta.dn { color: var(--red); }

/* Controles */
.btn { padding: 11px 20px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text); font-family: inherit; }
.btn:hover { background: var(--surface2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 13.5px; background: var(--surface2); color: var(--text); }
input:focus, select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input[type=checkbox] { width: auto; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; align-items: end; }
.modo-pills { display: inline-flex; background: var(--surface2); border-radius: 11px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.modo-pill { border: none; background: transparent; padding: 8px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); font-family: inherit; }
.modo-pill.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.filtro { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 16px 20px; }
.filtro .field { width: 150px; }

.banner { padding: 12px 16px; border-radius: 11px; font-size: 12.5px; line-height: 1.5; margin-bottom: 18px; border: 1px solid; }
.banner.accent { background: var(--accent-soft); border-color: #C7DAFC; color: var(--accent-dark); }
.banner.neutral { background: var(--surface2); border-color: var(--border); color: var(--muted); }
.banner.amber { background: var(--amber-soft); border-color: #F3D9A8; color: var(--amber); }

/* Badges (classes de item e segmentos de cliente) */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.badge.success { background: var(--green-soft); color: var(--green); }
.badge.warning { background: var(--amber-soft); color: var(--amber); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.badge.accent { background: var(--accent-soft); color: var(--accent-dark); }
.badge.neutral { background: var(--surface2); color: var(--muted); }

/* Tabelas */
.tabela-rolavel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
td.n, th.n { text-align: right; font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
tr.clicavel { cursor: pointer; } tr.clicavel:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }

/* Barras e gráfico */
.barra-linha { display: grid; grid-template-columns: 120px 1fr 100px; gap: 10px; align-items: center; font-size: 12.5px; margin: 7px 0; }
.barra { height: 12px; background: var(--accent-soft); border-radius: 6px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.barra-linha .v { text-align: right; font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.grafico { width: 100%; height: 170px; display: block; }

/* Bottom-sheet (padrão do Conta Comigo) e toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,18,25,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-backdrop.show { opacity: 1; pointer-events: all; }
.modal-sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 20px; padding: 22px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); transform: translateY(14px) scale(.98); transition: transform .2s; }
.modal-backdrop.show .modal-sheet { transform: none; }
.modal-handle { display: none; width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 3px; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }
.modal-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: #1c1f27; color: #fff; font-size: 13px; font-weight: 600; padding: 10px 20px; border-radius: 20px; z-index: 80; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; width: 100%; max-width: 380px; }
.login-card .mark { width: 38px; height: 38px; border-radius: 11px; }
.login-card h1 { font-size: 20px; margin: 14px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-card .btn { width: 100%; margin-top: 6px; padding: 12px; }
.login-erro { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 4px 0 10px; }

/* Menu recolhido (desktop) e celular */
@media (min-width: 761px) {
  .sidebar { transition: width .18s; }
  .menu-mini { --sidebar-w: 64px; }
  .menu-mini .sidebar { overflow: hidden; }
  .menu-mini .sidebar .txt { display: none; }
  .menu-mini .sidebar-header { flex-direction: column; padding: 14px 0; gap: 8px; justify-content: center; }
  .menu-mini .sidebar-section { padding: 8px 0; margin-top: 4px; justify-content: center; font-size: 9px; text-align: center; }
  .menu-mini .sidebar-link { padding: 11px 0; justify-content: center; }
  .menu-mini .sidebar-link .ico { width: auto; font-size: 17px; }
  .menu-mini .sidebar-footer { padding: 12px 4px; justify-content: center; }
  .menu-mini .sidebar-footer > span { display: none; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); z-index: 30; transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
  .menu-toggle { display: none; }
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 14px 16px; }
  .barra-linha { grid-template-columns: 90px 1fr 80px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-sheet { max-width: none; border-radius: 20px 20px 0 0; }
  .modal-handle { display: block; }
}
