:root {
  --pix-1: #00bfa5;
  --pix-2: #32bcad;
  --pix-3: #00e0c6;
  --bg-0: #0b1012;
  --bg-1: #101619;
  --bg-2: #0e1417;
  --txt-1: #e6f6f3;
  --txt-2: #a6c8c2;
  --muted: #78938f;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --card-radius: 16px;
  --card-bg: var(--bg-1);
  --ring: rgba(0, 191, 165, 0.45);
  --sidebar-w: 260px;
}
[data-theme="light"] {
  --bg-0: #f7fbfb;
  --bg-1: #ffffff;
  --bg-2: #f0f7f6;
  --txt-1: #0a1a18;
  --txt-2: #27403a;
  --muted: #5c6f6b;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  --card-bg: #ffffff;
  --ring: rgba(0, 191, 165, 0.5);
}

/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Inter, Arial;
  color: var(--txt-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s, color .25s;
}
a { color: var(--pix-3); text-decoration: none; }

/* ===== LAYOUT ===== */
.app {
  display: flex;
  min-height: 100vh;
  padding-left: var(--sidebar-w);
}
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
[data-theme="light"] .sidebar {
  border-right-color: rgba(0, 0, 0, 0.06);
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.sbrand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  height: 64px;
}
.sbrand img { height: 30px; width: auto; }
.sbrand strong { font-weight: 900; }

.nav {
  display: flex;
  flex-direction: column;
  padding: 10px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .nav a:hover {
  background: rgba(0, 0, 0, 0.04);
}
.nav a.active {
  background: linear-gradient(90deg, var(--pix-2), var(--pix-1));
  color: #001311;
  font-weight: 800;
}
.nav .group {
  margin: 12px 8px 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .topbar {
  border-bottom-color: rgba(0, 0, 0, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent);
}
.hamb {
  display: none;
}
.hamb button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-1);
  color: var(--txt-1);
  cursor: pointer;
}
[data-theme="light"] .hamb button {
  border-color: rgba(0, 0, 0, 0.08);
}
.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-1);
  font-size: 13px;
}
[data-theme="light"] .chip {
  border-color: rgba(0, 0, 0, 0.08);
}
.btn {
  --rad: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--rad);
  font-weight: 700;
  border: 1px solid transparent;
  min-height: 40px;
  cursor: pointer;
  text-decoration: none;
}
.btn-outline {
  background: var(--bg-1);
  color: var(--txt-1);
  border-color: rgba(255, 255, 255, 0.14);
}
[data-theme="light"] .btn-outline {
  border-color: rgba(0, 0, 0, 0.08);
}
.btn-primary {
  background: linear-gradient(90deg, var(--pix-2), var(--pix-1));
  color: #001311;
  box-shadow: 0 8px 20px rgba(0, 191, 165, 0.22);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #012;
  background: linear-gradient(90deg, var(--pix-3), var(--pix-2));
  font-weight: 900;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-1);
  cursor: pointer;
}
[data-theme="light"] .theme-toggle {
  border-color: rgba(0, 0, 0, 0.08);
}

/* ===== CONTEÚDO ===== */
.content {
  padding: 18px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

.card {
  position: relative;
  border-radius: var(--card-radius);
  border: 2px solid transparent;
  background:
    linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
    conic-gradient(from var(--angle, 0deg), rgba(0,224,198,.9), rgba(0,191,165,.9), rgba(50,188,173,.9), rgba(0,224,198,.9)) border-box;
  animation: spin 8s linear infinite;
  box-shadow: var(--shadow);
}
.card .inner {
  position: relative;
  padding: 18px;
}
@keyframes spin {
  to { --angle: 360deg; }
}
.title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 900;
}
.sub {
  color: var(--txt-2);
}
.sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 12px 0;
}
[data-theme="light"] .sep {
  background: rgba(0, 0, 0, 0.06);
}
.input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-1);
  color: var(--txt-1);
  outline: none;
}
.input:focus {
  box-shadow: 0 0 0 3px var(--ring);
}
[data-theme="light"] .input {
  border-color: rgba(0, 0, 0, 0.08);
}
.progress {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
[data-theme="light"] .progress {
  background: rgba(0, 0, 0, 0.08);
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--pix-2), var(--pix-1));
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}
[data-theme="light"] .table th, [data-theme="light"] .table td {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}
.table th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.muted { color: var(--muted); }
.spacer { flex: 1; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 3;
}
.overlay.show { display: block; }

/* ===== RESPONSIVO ===== */
@media (max-width: 1100px) {
  .grid { gap: 14px; }
  .col-8, .col-6, .col-4, .col-3 {
    grid-column: span 12;
  }
}
@media (max-width: 900px) {
  .app {
    padding-left: 0;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .hamb {
    display: block;
  }
}

/* ===== TABELA RESPONSIVA COM RÓTULOS ===== */
.table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.code-wrap { word-break:break-word; overflow-wrap:anywhere; }

@media (max-width: 900px){
  .table-mobile { display:block; }
  .table-mobile thead { display:none; }
  .table-mobile tbody { display:flex; flex-direction:column; gap:12px; }
  .table-mobile tr {
    display:block;
    border:1px solid rgba(255,255,255,.12);
    border-radius:12px;
    padding:12px;
    background:var(--bg-1);
  }
  [data-theme="light"] .table-mobile tr {
    border-color:rgba(0,0,0,.08);
    background:var(--card-bg);
  }
  .table-mobile td {
    display:grid;
    grid-template-columns: 120px 1fr;  /* rótulo | valor */
    align-items:center;
    gap:8px;
    text-align:left;
    padding:6px 2px;
  }
  .table-mobile td::before {
    content: attr(data-th);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .02em;
  }
  .table-mobile td[data-th="Ações"] {
    grid-template-columns: 1fr;   /* ações em linha única */
    gap:10px;
  }
  .table-mobile td[data-th="Ações"]::before {
    content: attr(data-th);
    margin-bottom: 4px;
  }
}

/* ==== utilidades de alinhamento/coluna ==== */
.ta-left  { text-align: left  !important; }
.ta-right { text-align: right !important; }
.nowrap   { white-space: nowrap; }

/* cabeçalho tb pode alinhar à direita quando precisar */
.table th.ta-right { text-align: right !important; }

/* coluna de ações estreita no desktop */
.col-actions { width: 1%; white-space: nowrap; }

/* (já funciona no mobile com .table-mobile) */

/* ===== DESKTOP RESET p/ tabelas responsivas ===== */
@media (min-width: 901px){
  .table-mobile{ 
    display: table;
    width: 100%;
    border-collapse: collapse;
  }
  .table-mobile thead{ display: table-header-group; }
  .table-mobile tbody{ display: table-row-group; }
  .table-mobile tr   { display: table-row; }
  .table-mobile th,
  .table-mobile td   { display: table-cell; padding: 10px; text-align: left; }
  .table-mobile td::before{ content: none !important; } /* não mostra rótulos no desktop */
}

/* Alinhamentos utilitários */
.ta-right { text-align: right !important; }
.ta-center{ text-align: center !important; }

/* (opcional) deixe o padrão da tabela à esquerda no desktop
   — você já usa .ta-right onde precisar (ex.: Ações, valores) */
@media (min-width: 901px){
  .table th, .table td { text-align: left; }
}
