:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18); }
button:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.ghost-button, .outline-button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
.ghost-button:hover, .outline-button:hover { box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08); }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow {
  color: var(--brand);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .75rem;
  margin: 0 0 6px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .78fr);
  gap: 32px;
  align-items: center;
  padding: 48px;
  background:
    radial-gradient(circle at 16% 10%, rgba(37, 99, 235, .18), transparent 360px),
    radial-gradient(circle at 92% 92%, rgba(22, 163, 74, .10), transparent 420px),
    linear-gradient(135deg, #f8fafc, #eef4ff);
}
.auth-hero h1 {
  max-width: 820px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: .95;
  letter-spacing: -.065em;
  margin: 28px 0 18px;
}
.auth-hero p { color: var(--muted); max-width: 680px; font-size: 1.1rem; line-height: 1.7; }
.auth-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.auth-badges span {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.74);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
  font-weight: 750;
}
.auth-panel { display: grid; gap: 18px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row strong { display: block; font-size: 1rem; }
.brand-row span { display: block; color: var(--muted); font-size: .85rem; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #1e40af);
  color: #fff;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(37, 99, 235, .25);
}

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.sidebar-brand { padding: 0 8px 8px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a {
  padding: 11px 13px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
}
.side-nav a.active, .side-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.privacy-mini {
  margin-top: auto;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
}
.privacy-mini span { color: var(--muted); font-size: .82rem; line-height: 1.45; }

.content-shell { padding: 24px; display: grid; gap: 22px; min-width: 0; }
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.secondary-card { background: rgba(255,255,255,.78); }
.card-title p { margin: 0 0 4px; color: var(--brand); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 900; }
.card-title h2, .card-title h3 { margin: 0 0 16px; font-size: 1.35rem; letter-spacing: -.025em; }
.form-card, .search-form { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: #334155; font-weight: 760; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
.hint { color: var(--muted); font-size: .86rem; line-height: 1.5; margin: 2px 0 0; }
.check { grid-template-columns: auto 1fr; align-items: flex-start; }
.check input { width: auto; margin-top: 4px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar h2 { margin: 0 0 4px; font-size: 1.65rem; letter-spacing: -.035em; }
.topbar p { margin-top: 0; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.balance-pill {
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  display: grid;
  gap: 2px;
  justify-items: end;
}
.balance-pill span, .balance-pill small { color: var(--muted); font-size: .78rem; }
.balance-pill strong { color: var(--brand-dark); font-size: 1.1rem; }

.grid { display: grid; gap: 18px; }
.two-cols { grid-template-columns: minmax(0, .86fr) minmax(0, 1.4fr); align-items: start; }
.two-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card, .metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.metric-card span, .metric span { color: var(--muted); display: block; font-size: .82rem; font-weight: 750; }
.metric-card strong, .metric strong { display: block; margin-top: 6px; font-size: 1.08rem; }

.package-list { display: grid; gap: 12px; max-height: 520px; overflow: auto; padding-right: 4px; }
.package {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  background: #fff;
  display: grid;
  gap: 9px;
}
.package strong { font-size: 1.05rem; }
.package p { margin: 0; color: var(--muted); font-size: .92rem; }
.package .price { color: var(--brand-dark); font-weight: 900; }
.package button { padding: 10px 13px; }

.result-panel { scroll-margin-top: 20px; }
.result-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.result-header h3 { margin: 0 0 4px; font-size: 1.45rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.data-check-result { display: grid; gap: 16px; }
.result-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.result-block-header {
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.result-block-header h4 { margin: 0; font-size: 1rem; }
.result-block-header span { color: var(--muted); font-size: .82rem; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.result-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 7px;
}
.result-card .label { color: var(--muted); font-size: .8rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.result-card .value { font-size: 1.25rem; font-weight: 950; }
.result-card .note { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.table-list, .source-table { display: grid; gap: 9px; }
.row, .source-row, .source-head, .debt-row {
  display: grid;
  grid-template-columns: 1.15fr .85fr .85fr .7fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.source-head, .debt-head {
  color: #334155;
  font-size: .8rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #f8fafc;
}
.debt-head { display: grid; grid-template-columns: 1.15fr .85fr .85fr .7fr; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; }
.row small, .source-row small, .debt-row small { color: var(--muted); }
.badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 900;
  font-size: .74rem;
}
.badge.success { background: var(--success-soft); color: #166534; }
.badge.warning { background: var(--warning-soft); color: #92400e; }
.badge.danger { background: var(--danger-soft); color: #991b1b; }
.badge.info { background: var(--brand-soft); color: var(--brand-dark); }
.delivery-box { margin-top: 16px; display: grid; gap: 12px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  background: #0f172a;
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.toast.error { background: #991b1b; }

@media (max-width: 1100px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .side-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-cols, .status-grid, .result-metrics, .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-page { grid-template-columns: 1fr; padding: 26px; }
}

@media (max-width: 680px) {
  .content-shell { padding: 14px; }
  .panel-card { padding: 16px; }
  .topbar, .result-header, .top-actions { flex-direction: column; align-items: stretch; }
  .two-fields, .two-cols, .status-grid, .result-metrics, .result-grid, .side-nav { grid-template-columns: 1fr; }
  .row, .source-row, .source-head, .debt-row, .debt-head { grid-template-columns: 1fr; }
  .auth-hero h1 { font-size: 2.45rem; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .status-grid, #consulta, #historico, #creditos, #adminUsersPanel, .actions, .toast { display: none !important; }
  .app-layout { display: block; }
  .content-shell { padding: 0; }
  .panel-card { box-shadow: none; border: 1px solid #ddd; }
}


.language-switch {
  margin: 16px 16px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fbff;
}

.language-switch label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .03em;
}

.language-switch select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.side-nav a.active {
  background: #dbeafe;
  color: #1d4ed8;
}
