:root{
  --brand: #094E67;
  --brand-rgb: 9, 78, 103;
  --bg: #0b1220;
  --panel: #0f1a2d;
  --panel-2: #0c1528;
  --text: #d8e6ee;
  --muted: #9fb9c6;
  --grid: rgba(216,230,238,.10);
  --stroke: rgba(216,230,238,.12);
  --accent: rgba(var(--brand-rgb),.55);
  --good: #19c37d;
  --warn: #ff4d4d;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
}

*{ box-sizing: border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", sans-serif;
  background: radial-gradient(1200px 800px at 15% 10%, rgba(var(--brand-rgb),.30), transparent 55%),
              radial-gradient(1200px 800px at 90% 30%, rgba(var(--brand-rgb),.18), transparent 60%),
              var(--bg);
  color: var(--text);
}

.app{
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 16px 36px;
}

/* Top bar */
.topbar{
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(15,26,45,.92), rgba(12,21,40,.92));
  box-shadow: var(--shadow);
  position: sticky;
  top: 10px;
  z-index: 20;
  backdrop-filter: blur(8px);
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 240px;
}
.brand .dot{
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), rgba(var(--brand-rgb),.35));
  box-shadow: inset 0 0 0 1px rgba(216,230,238,.14);
}
.brand h1{
  font-size: 14px;
  margin:0;
  letter-spacing: .4px;
  font-weight: 800;
  line-height: 1.25;
}
.brand .sub{
  display:block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.controls{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;
  justify-content:flex-end;
}
.logoutBtn{
  border: 1px solid rgba(216,230,238,.14);
  background: rgba(12,21,40,.75);
  color: rgba(216,230,238,.9);
  padding: 8px 10px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 800;
  font-size: 12px;
  display:flex;
  gap:8px;
  align-items:center;
  transition: .15s ease;
}
.logoutBtn:hover{ transform: translateY(-1px); }

/* Filters row */
.filterRow{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
  margin: 12px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(15, 26, 45, .88), rgba(12, 21, 40, .88));
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}
.filterRow .pill.grow{
  min-width: 280px;
  flex: 1;
  max-width: 520px;
}
.pill{
  display:flex;
  gap:8px;
  align-items:center;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(12,21,40,.75);
  transition: all .2s ease;
}
.pill:hover{
  background: rgba(12, 21, 40, .9);
  border-color: rgba(216, 230, 238, .18);
}
.pill label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}
.pillValue{
  font-weight: 900;
  color: rgba(216,230,238,.95);
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(var(--brand-rgb),.12);
  border: 1px solid rgba(216,230,238,.10);
}

select, input[type="text"], input[type="email"]{
  background: rgba(var(--brand-rgb),.12);
  border: 1px solid rgba(216,230,238,.14);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  outline: none;
  font-size: 12px;
  font-weight: 600;
  transition: all .2s ease;
}
input[type="text"], input[type="email"]{ width: 100%; cursor: text; }
select:hover, input:hover{
  background-color: rgba(var(--brand-rgb), .18);
  border-color: rgba(216, 230, 238, .25);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(var(--brand-rgb), .15);
}
select:focus, input:focus{
  border-color: rgba(var(--brand-rgb),.8);
  background-color: rgba(var(--brand-rgb), .18);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15);
}
input::placeholder{ color: rgba(159,185,198,.5); }
select option{ background: var(--panel); color: var(--text); }

/* Layout */
.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel{
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(15,26,45,.92), rgba(12,21,40,.92));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panelHeader{
  padding: 10px 12px;
  background: rgba(var(--brand-rgb),.12);
  border-bottom: 1px solid var(--stroke);
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
}
.panelHeader h2{
  margin:0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .2px;
  display:flex;
  align-items:center;
  gap:10px;
}
.panelHeader h2 i{ color: rgba(216,230,238,.85); }

.rightHint{ display:flex; align-items:center; gap:10px; }
.pillHint{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(216,230,238,.14);
  background: rgba(12,21,40,.65);
  color: rgba(216,230,238,.9);
  font-size: 12px;
  font-weight: 800;
}

.panelBody{
  padding: 14px 12px;
  background: rgba(12,21,40,.55);
}

.msg{
  margin-bottom: 12px;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 12px;
  display: none;
  text-align: left;
  font-weight: 700;
  letter-spacing: .2px;
  border: 1px solid rgba(216,230,238,.12);
}
.msg.ok{
  background: rgba(25,195,125,.15);
  color: #a8ffd6;
  border-color: rgba(25,195,125,.25);
}
.msg.error{
  background: rgba(255,77,77,.15);
  color: #ffb3b3;
  border-color: rgba(255,77,77,.25);
}
.loading{
  display:inline-flex;
  gap:10px;
  align-items:center;
  color: rgba(216,230,238,.85);
  font-weight: 800;
}

/* table */
.tableWrap{
  max-height: 560px;
  overflow:auto;
  border-top: 1px solid rgba(216,230,238,.10);
}
table{
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th, td{
  padding: 10px 10px;
  text-align:left;
  border-bottom: 1px solid rgba(216,230,238,.06);
}
th:last-child, td:last-child{ text-align:right; }
th{
  color: rgba(216,230,238,.88);
  font-weight: 900;
  background: rgba(var(--brand-rgb),.10);
  position: sticky;
  top: 0;
  z-index: 2;
}
tbody tr:hover{ background: rgba(var(--brand-rgb),.08); }

.rowActions{
  display:inline-flex;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
}
.iconAction{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(216,230,238,.14);
  background: rgba(12,21,40,.75);
  color: rgba(216,230,238,.9);
  cursor:pointer;
  font-weight: 900;
  transition: .15s ease;
}
.iconAction:hover{ transform: translateY(-1px); }
.iconAction.danger{
  border-color: rgba(255,77,77,.22);
  color: #ffb3b3;
}

/* empty state */
.emptyState{
  margin-top: 14px;
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed rgba(216,230,238,.18);
  color: rgba(216,230,238,.75);
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:center;
  font-weight: 800;
  background: rgba(var(--brand-rgb),.08);
}
.hidden{ display:none !important; }

/* modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 100;
  padding: 20px;
}
.modalCard{
  width: min(760px, 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(15,26,45,.97), rgba(12,21,40,.97));
  box-shadow: var(--shadow);
  padding: 14px;
}
.modalTitle{
  font-weight: 900;
  letter-spacing: .2px;
  margin-bottom: 8px;
  display:flex;
  gap:10px;
  align-items:center;
}
.modalText{
  color: rgba(216,230,238,.85);
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 12px;
}
.modalGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.field input{
  width: 100%;
  background: rgba(var(--brand-rgb),.12);
  border: 1px solid rgba(216,230,238,.14);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  outline:none;
  font-weight: 700;
}

.colorRow{
  display:flex;
  gap: 10px;
  align-items: center;
}
.colorRow input[type="color"]{
  width: 46px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(216,230,238,.14);
  background: rgba(12,21,40,.72);
  cursor: pointer;
}
.colorRow input[type="text"]{
  flex: 1;
}
.miniHint{
  margin-top: 6px;
  font-size: 12px;
  color: rgba(216,230,238,.7);
  line-height: 1.4;
}

/* ✅ Password with buttons */
.passwordWrap{
  position: relative;
}
.passwordWrap input{
  padding-right: 44px;
}
.passwordWrap.hasGen input{
  padding-right: 84px;
}
.eyeBtn{
  position:absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(216,230,238,.14);
  background: rgba(12,21,40,.72);
  color: rgba(216,230,238,.85);
  cursor:pointer;
}
.eyeBtn:hover{
  color: rgba(216,230,238,.95);
}
.eyeBtn.genBtn{
  right: 42px;
}

.modalActions{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  margin-top: 12px;
}
.modalBtn{
  border: 1px solid rgba(216,230,238,.14);
  background: linear-gradient(135deg, rgba(var(--brand-rgb),.85), rgba(var(--brand-rgb),.35));
  color: rgba(216,230,238,.95);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 900;
  font-size: 12px;
  display:inline-flex;
  gap:8px;
  align-items:center;
}
.modalBtn.ghost{
  background: rgba(12,21,40,.75);
}
.modalBtn.danger{
  background: rgba(255,77,77,.16);
  border-color: rgba(255,77,77,.24);
  color: #ffb3b3;
}

@media (max-width: 900px){
  .modalGrid{ grid-template-columns: 1fr; }
}
@media (max-width: 560px){
  .topbar{
    position: static;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }
  .controls{ justify-content:flex-start; }
  .filterRow{ padding: 12px; gap: 8px; }
  .pill{ flex: 1 1 auto; min-width: 140px; }
  select{ min-width: 140px; }
}


/* =========================
   THEME (Light) + Toggle
   ========================= */
html{
  color-scheme: dark;
}
html[data-theme="light"]{
  color-scheme: light;

  --bg: #f5f8fb;
  --panel: #ffffff;
  --panel-2: #eef3f7;
  --text: #0b1220;
  --muted: #35505e;
  --grid: rgba(var(--brand-rgb),.12);
  --stroke: rgba(11,18,32,.12);
  --accent: rgba(var(--brand-rgb),.18);
  --shadow: 0 10px 30px rgba(2,6,23,.10);
}

body{
  transition: background .25s ease, color .25s ease;
}
html[data-theme="light"] body{
  background: radial-gradient(1200px 800px at 15% 10%, rgba(var(--brand-rgb),.12), transparent 55%),
              radial-gradient(1200px 800px at 90% 30%, rgba(var(--brand-rgb),.08), transparent 60%),
              var(--bg);
}

/* Botões (padronização) */
.logoutBtn{
  border: 1px solid var(--stroke);
  background: rgba(12,21,40,.75);
  color: var(--text);
  height: 38px;
  min-height: 38px;
}
html[data-theme="light"] .logoutBtn{
  background: rgba(241,245,249,.85);
}
.logoutBtn:hover{
  background: rgba(12,21,40,.9);
  border-color: rgba(216,230,238,.22);
}
html[data-theme="light"] .logoutBtn:hover{
  background: rgba(241,245,249,1);
  border-color: rgba(11,18,32,.18);
}

/* Botão primário "Novo" */
#newBtn{
  background: linear-gradient(135deg, rgba(var(--brand-rgb),.85), rgba(var(--brand-rgb),.35));
  border-color: rgba(216,230,238,.18);
  color: rgba(216,230,238,.96);
}
html[data-theme="light"] #newBtn{
  color: #ffffff;
  border-color: rgba(var(--brand-rgb),.25);
}

/* ===== Toggle de Tema (mesmo padrão das outras páginas) ===== */
.theme-toggle{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(12,21,40,.75);
  color: var(--text);
  cursor:pointer;
  transition: all .2s ease;
  height: 38px;
  min-height: 38px;
  white-space: nowrap;
}
html[data-theme="light"] .theme-toggle{
  background: rgba(241,245,249,.85);
}
.theme-toggle:hover{
  transform: translateY(-1px);
  background: rgba(12,21,40,.9);
  border-color: rgba(216,230,238,.22);
}
html[data-theme="light"] .theme-toggle:hover{
  background: rgba(241,245,249,1);
  border-color: rgba(11,18,32,.18);
}

.theme-toggle-icon{
  font-size: 14px;
  color: var(--muted);
}
.theme-toggle-switch{
  position: relative;
  width: 40px;
  height: 20px;
  background: rgba(var(--brand-rgb),.30);
  border-radius: 10px;
  transition: all .2s ease;
  flex-shrink: 0;
}
.theme-toggle-switch::before{
  content:'';
  position:absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: linear-gradient(135deg, rgba(200,210,220,.95), rgba(180,190,200,.95));
  box-shadow: 0 2px 4px rgba(0,0,0,.20);
  transition: transform .2s ease;
}
html[data-theme="light"] .theme-toggle-switch::before{
  transform: translateX(20px);
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(235,240,245,.95));
}

.theme-toggle-text{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Containers no Light Theme (para não ficar com painel escuro) */
html[data-theme="light"] .topbar{
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(241,245,249,.92));
  border-color: var(--stroke);
}
html[data-theme="light"] .filterRow{
  background: linear-gradient(180deg, rgba(255,255,255,.90), rgba(241,245,249,.90));
  border-color: var(--stroke);
  box-shadow: 0 4px 12px rgba(2,6,23,.08);
}
html[data-theme="light"] .panel{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(241,245,249,.96));
  border-color: var(--stroke);
}
html[data-theme="light"] .panelBody{
  background: rgba(241,245,249,.70);
}
html[data-theme="light"] .panelHeader{
  background: rgba(var(--brand-rgb),.08);
}
html[data-theme="light"] .pill{
  background: rgba(255,255,255,.75);
}
html[data-theme="light"] .pill:hover{
  background: rgba(255,255,255,.92);
  border-color: rgba(11,18,32,.16);
}
html[data-theme="light"] .pillHint{
  background: rgba(255,255,255,.70);
  border-color: rgba(11,18,32,.12);
  color: var(--text);
}
html[data-theme="light"] th{
  background: rgba(var(--brand-rgb),.08);
  color: rgba(11,18,32,.88);
}
html[data-theme="light"] tbody tr:hover{
  background: rgba(var(--brand-rgb),.06);
}
html[data-theme="light"] .iconAction{
  background: rgba(255,255,255,.75);
  border-color: rgba(11,18,32,.12);
  color: var(--text);
}
html[data-theme="light"] .iconAction.danger{
  border-color: rgba(255,77,77,.28);
  color: rgba(179,32,32,.92);
}

/* Inputs/selects ficam legíveis no light também */
select, input[type="text"], input[type="email"]{
  color: var(--text);
}
select option, select optgroup{
  background: var(--panel);
  color: var(--text);
}

/* =========================
   FIXES: Light theme numbers + Modals (Novo / Editar / Excluir)
   ========================= */

/* Total (pillValue) fica legível no Claro */
html[data-theme="light"] .pillValue{
  color: #0b1220;
  background: rgba(var(--brand-rgb),.10);
  border-color: rgba(var(--brand-rgb),.18);
}

/* Overlay do modal no Claro */
html[data-theme="light"] .modal{
  background: rgba(2,6,23,.45);
}

/* Card do modal no Claro (para não ficar "dark" com texto escuro) */
html[data-theme="light"] .modalCard{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(241,245,249,.96));
  border-color: rgba(11,18,32,.12);
  box-shadow: 0 20px 60px rgba(2,6,23,.18);
}

html[data-theme="light"] .modalTitle{
  color: #0b1220;
}

html[data-theme="light"] .modalTitle i{
  color: rgba(53,80,94,.85);
}

html[data-theme="light"] .modalText{
  color: rgba(11,18,32,.85);
}

html[data-theme="light"] .miniHint{
  color: rgba(53,80,94,.85);
}

html[data-theme="light"] .field label{
  color: rgba(53,80,94,.90);
}

html[data-theme="light"] .field input{
  background: rgba(var(--brand-rgb),.05);
  border-color: rgba(var(--brand-rgb),.22);
  color: #0b1220;
}

html[data-theme="light"] .field input::placeholder{
  color: rgba(53,80,94,.55);
}

/* Botões dentro do input de senha */
html[data-theme="light"] .eyeBtn{
  background: rgba(255,255,255,.92);
  border-color: rgba(11,18,32,.12);
  color: rgba(53,80,94,.92);
}

html[data-theme="light"] .eyeBtn:hover{
  color: #0b1220;
  border-color: rgba(var(--brand-rgb),.22);
}

/* Botões do modal (Cancelar / Salvar / Excluir) no Claro */
html[data-theme="light"] .modalBtn.ghost{
  background: rgba(255,255,255,.92);
  border-color: rgba(11,18,32,.12);
  color: #0b1220;
}

html[data-theme="light"] .modalBtn.ghost:hover{
  border-color: rgba(var(--brand-rgb),.22);
}

html[data-theme="light"] .modalBtn.danger{
  background: rgba(255,77,77,.12);
  border-color: rgba(255,77,77,.26);
  color: rgba(179,32,32,.95);
}

/* Safari/Chrome autofill (evita fundo amarelo/verde e texto ilegível) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus{
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

html[data-theme="light"] input:-webkit-autofill,
html[data-theme="light"] input:-webkit-autofill:hover,
html[data-theme="light"] input:-webkit-autofill:focus{
  -webkit-text-fill-color: #0b1220;
}
.senhaCell{
  display:flex;
  align-items:center;
  gap:8px;
}
.senhaMask{
  font-weight: 800;
  letter-spacing: .6px;
}
.senhaBtn{
  border: 1px solid rgba(216,230,238,.14);
  background: rgba(12,21,40,.72);
  color: rgba(216,230,238,.85);
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
}
.senhaBtn:hover{
  color: rgba(216,230,238,.95);
}

html[data-theme="light"] .senhaBtn{
  background: rgba(255,255,255,.8);
  border-color: rgba(0,0,0,.12);
  color: #000;
}
html[data-theme="light"] .msg.ok {
  background: #1e8b5a;
  color: #ffffff;
  border-color: #157247;
}
html[data-theme="light"] .msg.error {
  background: #b02a37;
  color: #ffffff;
  border-color: #8a1f2a;
}
/* table header full bar + rounded */
thead tr{
  background: rgba(var(--brand-rgb), .12);
}

thead th{
  background: transparent;
}

thead th:first-child{
  border-top-left-radius: 10px;
}

thead th:last-child{
  border-top-right-radius: 10px;
}
/* header bar stretch to full width */
thead{
  display: table;
  width: 100%;
  table-layout: fixed;
}

tbody{
  display: table;
  width: 100%;
  table-layout: fixed;
}

.tableWrap{
  overflow: auto;
}

/* ===== Footer ===== */
.page-footer {
  margin: 24px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.page-footer .footer-img {
  max-width: 260px;
  width: 70%;
  height: auto;
  display: none;
}

.page-footer .footer-dark {
  display: block;
}

[data-theme="light"] .page-footer .footer-dark {
  display: none;
}

[data-theme="light"] .page-footer .footer-light {
  display: block;
}
