/* =========================================================
   INTERWEG • Folha de Pagamento
   Identidade alinhada aos demais sistemas Interweg
   - Sidebar fixa, logo INTERWEG SEGUROS, MENU + FERRAMENTAS
   - KPIs com borda lateral colorida
   - Badges em pílula suave
   - Tema claro/escuro
   ========================================================= */

:root {
  --brand:        #0FBA9A;
  --brand-600:    #0CA88A;
  --brand-50:     #E6FAF5;
  --brand-glow:   rgba(15,186,154,.25);

  --bg:           #F3F5F7;
  --surface:      #FFFFFF;
  --surface-2:    #F7F9FB;
  --border:       #E6EAEE;
  --text:         #0E1B2C;
  --text-muted:   #6A7785;

  --danger:       #E5484D;
  --warning:      #F5A524;
  --success:      #19B26B;
  --info:         #3A86FF;
  --purple:       #8E5BE8;

  --shadow-sm:    0 1px 2px rgba(15,27,44,.04);
  --shadow-md:    0 4px 14px rgba(15,27,44,.06);
  --shadow-lg:    0 18px 50px rgba(15,27,44,.12);

  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;
  --sidebar-w:    250px;
}

[data-theme="dark"] {
  --bg:           #0B1620;
  --surface:      #11202C;
  --surface-2:    #15293A;
  --border:       #1F3242;
  --text:         #E8F3F0;
  --text-muted:   #8DA0B0;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow-md:    0 6px 20px rgba(0,0,0,.45);
  --shadow-lg:    0 18px 50px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* ============ Material Symbols ============ */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal; font-size: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; letter-spacing: normal; text-transform: none;
  white-space: nowrap; word-wrap: normal; direction: ltr;
  -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.fill { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.material-symbols-outlined.sz-18 { font-size: 18px; }
.material-symbols-outlined.sz-22 { font-size: 22px; }
.material-symbols-outlined.sz-28 { font-size: 28px; }
.btn .material-symbols-outlined { font-size: 18px; }
.sidebar nav a .material-symbols-outlined { font-size: 20px; opacity: .85; }
.sidebar nav a.active .material-symbols-outlined { opacity: 1; }
body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand); }

/* ============ Tema toggle (no rodapé da sidebar) ============ */
.theme-pill {
  display: inline-flex; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px;
}
.theme-pill button {
  border: 0; background: transparent; color: var(--text-muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px;
}
.theme-pill button.active {
  background: var(--brand-50); color: var(--brand-600);
  font-weight: 600;
}
[data-theme="dark"] .theme-pill button.active { background: rgba(15,186,154,.18); color: var(--brand); }

/* ============ Login ============ */
.auth-wrap {
  display: grid; grid-template-columns: 1.05fr 1fr;
  min-height: 100vh; align-items: center;
  padding: 40px 8vw; gap: 60px;
}
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; padding: 40px 24px; } }

.theme-floating { position: fixed; top: 18px; right: 22px; z-index: 50; }

.brand-block .logo {
  display: inline-flex; align-items: center; gap: 12px;
}
.brand-block .logo-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  display: inline-flex; align-items: center; justify-content: center;
  color: white; box-shadow: 0 8px 22px var(--brand-glow);
}
.brand-block .logo-text { line-height: 1.1; }
.brand-block .logo-text .name { font-weight: 800; letter-spacing: .8px; font-size: 18px; }
.brand-block .logo-text .name em { font-style: normal; color: var(--brand); }
.brand-block .logo-text .sub { font-size: 11px; letter-spacing: 2px; color: var(--text-muted); }

.brand-block h1 {
  font-size: clamp(34px, 4.5vw, 52px);
  line-height: 1.05; margin: 36px 0 18px; font-weight: 700;
}
.brand-block h1 em { font-style: normal; color: var(--brand); }
.brand-block .lead { color: var(--text-muted); max-width: 460px; }
.brand-block ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.brand-block ul li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.brand-block ul li .ic {
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--brand-50); color: var(--brand-600);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
[data-theme="dark"] .brand-block ul li .ic { background: rgba(15,186,154,.18); }

.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow-lg); width: 100%;
}
.auth-card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.auth-card .muted { color: var(--text-muted); margin-bottom: 22px; font-size: 14px; }
.auth-footer { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-top: 14px; }

/* ============ Forms ============ */
.field { display: block; margin-bottom: 16px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .9px; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; transition: all .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-glow);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; font-size: 13.5px;
  transition: all .15s; text-decoration: none; line-height: 1;
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-600));
  color: white; border-color: transparent; box-shadow: 0 4px 14px var(--brand-glow);
}
.btn-primary:hover { transform: translateY(-1px); background: linear-gradient(180deg, var(--brand), var(--brand-600)); }
.btn-block { width: 100%; padding: 12px 18px; font-size: 14.5px; }
.btn-danger  { background: transparent; color: var(--danger); border-color: rgba(229,72,77,.35); }
.btn-danger:hover { background: rgba(229,72,77,.08); color: var(--danger); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: white; border-color: transparent; }
.btn-danger-solid:hover { filter: brightness(.95); background: var(--danger); color: white; }

/* Linha de acoes em tabelas: alinhamento direita, altura iguais, centralizado vertical */
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline-flex; margin: 0; align-items: center; }
.row-actions .btn, .row-actions form .btn { height: 28px; line-height: 1; padding: 4px 12px; font-size: 11.5px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.row-actions form button { height: 100%; }
table.data td:has(.row-actions) { vertical-align: middle; text-align: right; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-outline { background: transparent; }

/* ============ App layout ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
@media (max-width: 900px) { .sidebar { display: none; } }

.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.sidebar .brand .mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  display: inline-flex; align-items: center; justify-content: center;
  color: white; box-shadow: 0 6px 16px var(--brand-glow);
}
.sidebar .brand .name { font-weight: 800; letter-spacing: .6px; font-size: 15px; }
.sidebar .brand .name em { font-style: normal; color: var(--brand); }
.sidebar .brand .sub { font-size: 10px; letter-spacing: 2px; color: var(--text-muted); }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; align-content: flex-start; }
.sidebar nav a { align-self: stretch; }
.sidebar .user-card { margin-top: auto; }
.sidebar nav .group {
  font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-muted); padding: 12px 12px 6px; font-weight: 700;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--text);
  font-size: 13.5px;
}
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a.active {
  background: var(--brand-50); color: var(--brand-600); font-weight: 600;
}
[data-theme="dark"] .sidebar nav a.active { background: rgba(15,186,154,.15); color: var(--brand); }
.sidebar nav a .ic { width: 18px; text-align: center; }

.sidebar .user-card {
  margin-top: 12px; padding: 10px 8px 4px; border-top: 1px solid var(--border);
}
.sidebar .user-card .row {
  display: flex; align-items: center; gap: 10px; padding: 4px 4px 8px;
}
.sidebar .user-card .avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--brand); color: white; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px;
}
.sidebar .user-card .name { font-size: 13px; font-weight: 600; line-height: 1.1; }
.sidebar .user-card .meta { font-size: 11px; color: var(--text-muted); }
.sidebar .user-card .actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 0 0; }

/* ============ Topbar / Page header ============ */
.main { padding: 22px 28px 60px; }
@media (max-width: 600px) { .main { padding: 18px 16px 60px; } }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ KPI cards ============ */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--brand);
}
.kpi.brand::before  { background: var(--brand); }
.kpi.info::before   { background: var(--info); }
.kpi.success::before{ background: var(--success); }
.kpi.danger::before { background: var(--danger); }
.kpi.warning::before{ background: var(--warning); }

.kpi .label { color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.kpi .value { font-size: 30px; font-weight: 800; margin-top: 6px; line-height: 1; }
.kpi .delta { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.kpi.brand   .value { color: var(--brand); }
.kpi.info    .value { color: var(--info); }
.kpi.success .value { color: var(--success); }
.kpi.danger  .value { color: var(--danger); }
.kpi.warning .value { color: var(--warning); }

/* ============ Card / Toolbar ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }

.toolbar { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 1100px) { .toolbar { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px)  { .toolbar { grid-template-columns: 1fr; } }
.toolbar input, .toolbar select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13.5px;
}
.toolbar .search { position: relative; }
.toolbar .search input { padding-left: 12px; }

.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list-head h2 { margin: 0; }

/* ============ Tabela ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th {
  background: var(--surface-2); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted);
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--surface-2); }
table.data td.right, table.data th.right { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.center, table.data th.center { text-align: center; }
table.data .neg { color: var(--danger); }
table.data .pos { color: var(--success); }

.cell-2 { line-height: 1.2; }
.cell-2 .top { font-weight: 600; }
.cell-2 .bot { font-size: 12px; color: var(--text-muted); }

.user-chip { display: inline-flex; align-items: center; gap: 8px; }
.user-chip .av {
  width: 26px; height: 26px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 700;
}

/* ============ Badges (pílula suave, igual aos outros sistemas) ============ */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-muted);
}
.badge.brand    { background: var(--brand-50); color: var(--brand-600); }
.badge.info     { background: rgba(58,134,255,.12); color: var(--info); }
.badge.success  { background: rgba(25,178,107,.14); color: var(--success); }
.badge.warning  { background: rgba(245,165,36,.16); color: #B07512; }
.badge.danger   { background: rgba(229,72,77,.14); color: var(--danger); }
.badge.purple   { background: rgba(142,91,232,.14); color: var(--purple); }
[data-theme="dark"] .badge.brand    { background: rgba(15,186,154,.18); color: var(--brand); }
[data-theme="dark"] .badge.warning  { color: #FFC870; }

/* ============ Forms grid ============ */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ============ Flash ============ */
.flash { display: grid; gap: 8px; margin-bottom: 18px; }
.flash > div { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; border: 1px solid transparent; }
.flash .success { background: rgba(25,178,107,.10); color: #117a4a; border-color: rgba(25,178,107,.25); }
.flash .danger  { background: rgba(229,72,77,.10);  color: #b3262b; border-color: rgba(229,72,77,.25); }
.flash .warning { background: rgba(245,165,36,.10); color: #8a6212; border-color: rgba(245,165,36,.25); }
.flash .info { background: rgba(58,134,255,.10); color: #1a4ec4; border-color: rgba(58,134,255,.25); }

/* ============ Reducao geral de tamanhos de fonte (v2) ============ */
body { font-size: 12px; }
.page-head h1 { font-size: 16px; }
.page-head .sub { font-size: 11.5px; }
.kpi { padding: 13px 15px; }
.kpi .label { font-size: 9.5px; }
.kpi .value { font-size: 19px; }
.kpi .delta { font-size: 10.5px; }
.card { padding: 15px; }
.card h2 { font-size: 13px; }
table.data { font-size: 11.5px; }
table.data th { font-size: 9.5px; padding: 7px 10px; }
table.data td { padding: 7px 10px; }
.cell-2 .top { font-size: 11.5px; }
.cell-2 .bot { font-size: 10px; }
.btn { font-size: 11.5px; padding: 7px 11px; }
.btn-sm { font-size: 10.5px; padding: 4px 8px; }
.btn-block { font-size: 12.5px; padding: 10px 14px; }
.field label { font-size: 9.5px; }
.field input, .field select, .field textarea { font-size: 12px; padding: 8px 10px; }
.toolbar input, .toolbar select { font-size: 11.5px; padding: 7px 9px; }
.sidebar nav a { font-size: 11.5px; padding: 7px 9px; }
.sidebar .brand .name { font-size: 13px; }
.sidebar .brand .sub { font-size: 9px; }
.sidebar .group { font-size: 9px; padding: 9px 9px 4px; letter-spacing: 1.2px; }
.sidebar .user-card .name { font-size: 11.5px; }
.sidebar .user-card .meta { font-size: 10px; }
.sidebar .user-card .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.theme-pill button { font-size: 10.5px; padding: 4px 9px; }
.badge { font-size: 10px; padding: 2px 8px; }
.flash > div { font-size: 11.5px; }
.material-symbols-outlined { font-size: 18px; }
.material-symbols-outlined.sz-18 { font-size: 16px; }
.btn .material-symbols-outlined { font-size: 16px; }
.sidebar nav a .material-symbols-outlined { font-size: 18px; }
.kpis { gap: 12px; margin-bottom: 14px; }
.main { padding: 16px 22px 50px; }
.badge { font-size: 11px; padding: 2px 9px; }
.auth-card h2 { font-size: 18px; }
.auth-card .muted { font-size: 12.5px; }
.brand-block .logo-text .name { font-size: 16px; }
.brand-block .logo-text .sub { font-size: 10px; }
.brand-block ul li { font-size: 12.5px; }
.flash > div { font-size: 12.5px; }

/* ============ Logo INTERWEG (imagem PNG) ============ */
.sidebar .brand {
  padding: 4px 6px 14px;
  justify-content: center;
}
.brand-logo {
  max-height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
}
.brand-logo-lg {
  max-height: 64px;
}
[data-theme="dark"] .brand-logo {
  filter: brightness(0) invert(1) sepia(0.2) saturate(2) hue-rotate(140deg);
}
.brand-block .logo {
  display: inline-block;
}
.auth-card { padding-top: 32px; }

/* ============ Filter bar (relatorios) ============ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-bar label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.filter-bar select {
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
}
.filter-bar select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-glow);
}

/* ============ Tabelas densas (relatorios com muitas colunas) ============ */
table.data { font-size: 11px; }
table.data th { font-size: 9px; padding: 6px 7px; letter-spacing: .3px; white-space: nowrap; }
table.data td { padding: 6px 7px; }
table.data td.right, table.data th.right { white-space: nowrap; }
table.data .cell-2 .top { font-size: 11px; }
table.data .cell-2 .bot { font-size: 9.5px; }