:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --card-bg: #0b1220;
  --border: #1f2937;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --text: #e5e7eb;
  --text-soft: #9ca3af;
  --danger: #ef4444;
  --radius-lg: 14px;
  --radius-md: 10px;
}

/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0, #020617 55%);
  color: var(--text);
  min-height: 100vh;
}

/* TOPO */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
}

.topbar-left h1 {
  font-size: 20px;
  font-weight: 600;
}

.topbar-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}

/* LAYOUT PRINCIPAL */

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 56px);
}

/* SIDEBAR */

.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(to bottom, #020617, #020617 60%, #020617);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  padding: 8px 10px;
  text-align: left;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar button:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: var(--border);
  color: var(--text);
}

.sidebar button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* CONTEÚDO */

.content {
  padding: 16px 20px;
}

.card {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 12px;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(148, 163, 184, 0.08);
  overflow: auto;
}

/* TABELA */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table thead {
  background: rgba(15, 23, 42, 0.9);
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  padding: 6px 8px;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, 0.98);
  font-weight: 500;
  color: var(--text-soft);
}

.data-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.6);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.3);
}

.data-table tbody tr:hover {
  background: rgba(30, 64, 175, 0.5);
}

/* Inputs na tabela */

.data-table input[type="text"],
.data-table input:not([type]),
.data-table input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(55, 65, 81, 0.9);
  border-radius: 4px;
  padding: 3px 4px;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
}

.data-table input[type="text"]:focus,
.data-table input:not([type]):focus,
.data-table input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.data-table input[type="checkbox"] {
  transform: scale(1.1);
}

/* Botões na tabela */

.data-table button {
  margin-right: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-soft);
  transition: all 0.15s ease;
}

.data-table button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* LOGIN */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: rgba(15, 23, 42, 0.96);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px 20px 20px;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(148, 163, 184, 0.08);
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 20px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#login-form label {
  font-size: 13px;
  color: var(--text-soft);
}

#login-form input[type="password"] {
  border-radius: 6px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 8px 10px;
  font-size: 14px;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
}

#login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.btn-primary {
  margin-top: 6px;
  border-radius: 999px;
  border: none;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 500;
  background: linear-gradient(to right, #38bdf8, #0ea5e9);
  color: #0b1120;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.4);
}

.login-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
}

/* RESPONSIVO */

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .sidebar button {
    white-space: nowrap;
  }

  .content {
    padding: 12px;
  }

  .card {
    padding: 8px;
  }
}
/* === Melhorar visual da tabela no modo dark === */
table {
  width: 100%;
  border-collapse: collapse;
  background: #111827; /* cinza bem escuro */
  color: #e5e7eb;      /* cinza claro */
}

table th {
  background: #1f2937; /* cabeçalho */
  color: #f3f4f6;
  padding: 10px;
  font-weight: 600;
  border-bottom: 2px solid #374151;
}

table td {
  padding: 6px;
  border-bottom: 1px solid #1f2937;
}

/* Inputs dentro da tabela */
table input {
  width: 100%;
  padding: 6px 8px;
  background: #1f2937;      /* fundo escuro */
  border: 1px solid #374151; /* borda sutil */
  color: #f9fafb;
  border-radius: 4px;
  font-size: 14px;
}

/* Quando o campo ganhar foco */
table input:focus {
  outline: none;
  border-color: #3b82f6;   /* azul */
  background: #111827;
}

/* Alternância de linhas para melhorar leitura */
table tr:nth-child(even) {
  background: #0f172a;
}


/* ===== COLUNAS AJUSTÁVEIS ===== */

.table-container {
  overflow-x: auto;
  padding-bottom: 10px;
}

/* Tabela com colunas redimensionáveis */
.data-table {
  width: max-content; 
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  white-space: nowrap;
  padding: 6px 10px;
}

/* Permite arrastar a largura das colunas */
.data-table th {
  position: relative;
  resize: horizontal;
  overflow: auto;
  min-width: 120px;
  max-width: 500px;
  background: #1b1f2a; /* mantém o visual dark */
  color: #fff;
  border-right: 1px solid #333;
}

/* visual melhor para células */
.data-table td {
  background: #0f1117;
  border-bottom: 1px solid #222;
  border-right: 1px solid #222;
  color: #dcdcdc;
}
