:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --card: rgba(255, 255, 255, 0.08);
  --card-solid: #ffffff;
  --line: #e5e7eb;
  --line-dark: rgba(255, 255, 255, 0.12);
  --text: #0f172a;
  --text-light: #e5e7eb;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --transition: 0.2s ease;
  --font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: #f8fafc;
  color: var(--text);
}

body {
  min-height: 100vh;
}

/* =========================
   LOGIN
========================= */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.25), transparent 30%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.18), transparent 25%),
    linear-gradient(135deg, #0f172a, #111827 55%, #1e293b);
}

.login-brand {
  padding: 56px;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-top h1 {
  margin: 0 0 12px;
  font-size: 42px;
  line-height: 1.1;
}

.brand-top p {
  margin: 0;
  color: #cbd5e1;
  font-size: 18px;
  max-width: 560px;
}

.brand-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-dark);
  color: #e2e8f0;
  font-size: 14px;
}

.brand-footer {
  font-size: 14px;
  color: #94a3b8;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.35);
  padding: 32px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-card .subtitle {
  margin: 0 0 28px;
  color: var(--muted);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  height: 48px;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.btn {
  height: 48px;
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  filter: brightness(0.95);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.full-width {
  width: 100%;
}

.alert {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
}

.alert.show {
  display: block;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* =========================
   APP / TABELA
========================= */
.app-page {
  background: #f8fafc;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e7eb;
}

.topbar-left h1 {
  margin: 0;
  font-size: 24px;
}

.topbar-left p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eef2f7;
}

.panel-header h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid #eef2f7;
  background: #fcfdff;
}

.filters .form-control {
  height: 44px;
}

.table-wrapper {
  width: 100%;
  overflow: auto;
  max-height: calc(100vh - 260px);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1800px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  color: #334155;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  padding: 14px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  background: #fff;
}

.data-table tbody tr:hover td {
  background: #f8fbff;
}

.data-table td input,
.data-table td textarea {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: #0f172a;
  resize: vertical;
  min-height: 36px;
  font-family: inherit;
}

.data-table td input:focus,
.data-table td textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  background: #eff6ff;
}

.data-table td.readonly input {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

.data-table tbody tr.modified td {
  background: #fffbeb;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid #eef2f7;
  background: #fff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}

.small-text {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.center {
  text-align: center;
}

.loader {
  width: 22px;
  height: 22px;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   RESPONSIVO
========================= */
@media (max-width: 1080px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .filters {
    grid-template-columns: 1fr;
  }
}
