/* ============================================================
   GPower Hub · Sistema de Distribuição
   Design System v1.0
============================================================ */

:root {
  --bg-0: #07090f;
  --bg-1: #0d1119;
  --bg-2: #131826;
  --bg-3: #1a2033;
  --bg-4: #232a3d;
  --line: rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.12);
  --text: #e8eaed;
  --text-muted: #8b94a8;
  --text-dim: #5a6275;
  --gold: #d4a44c;
  --gold-soft: rgba(212,164,76,0.12);
  --green: #4ade80;
  --green-soft: rgba(74,222,128,0.10);
  --red: #f87171;
  --red-soft: rgba(248,113,113,0.10);
  --blue: #60a5fa;
  --blue-soft: rgba(96,165,250,0.10);
  --purple: #a78bfa;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-0); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5; min-height: 100vh;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(800px 500px at 10% -5%, rgba(212,164,76,0.08), transparent 60%),
    radial-gradient(700px 500px at 95% 10%, rgba(96,165,250,0.06), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(167,139,250,0.05), transparent 60%);
  pointer-events: none;
}

.container { max-width: 1560px; margin: 0 auto; padding: 24px 28px 80px; }

/* ===== NAVEGAÇÃO ===== */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 28px;
  flex-wrap: wrap; gap: 18px;
}
.topnav-brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); font-family: var(--serif); font-size: 22px; font-weight: 500;
  text-decoration: none; letter-spacing: -0.01em;
}
.topnav-brand-dot { width: 9px; height: 9px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 12px var(--gold); }
.topnav-brand em { font-style: italic; color: var(--gold); }
.topnav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav-link {
  padding: 8px 16px; color: var(--text-muted); text-decoration: none;
  border-radius: 8px; font-size: 14px; font-weight: 500; transition: all 0.15s;
  white-space: nowrap;
}
.topnav-link:hover { color: var(--text); background: var(--bg-2); }
.topnav-link.active { color: var(--gold); background: var(--gold-soft); }

/* ===== HERO ===== */
.hero { margin-bottom: 30px; }
.hero-title { font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 4vw, 48px); letter-spacing: -0.02em; line-height: 1.05; }
.hero-title em { font-style: italic; color: var(--gold); }
.hero-sub { color: var(--text-muted); font-size: 15px; max-width: 720px; margin-top: 8px; }

/* ===== PANEL ===== */
.panel {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line); border-radius: 16px;
  padding: 26px; position: relative; overflow: hidden; margin-bottom: 22px;
}
.panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.4;
}
.panel-title { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 4px; letter-spacing: -0.01em; }
.panel-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }

/* ===== INPUTS ===== */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted);
}
.field-label .badge {
  font-family: var(--mono); font-size: 11px;
  background: var(--gold-soft); color: var(--gold);
  padding: 3px 10px; border-radius: 999px;
}
.input, .select, .textarea {
  background: var(--bg-3); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 12px 16px;
  color: var(--text); font-family: var(--sans); font-size: 14px;
  transition: all 0.15s; width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}
.textarea { resize: vertical; min-height: 80px; font-family: var(--sans); }
.input.mono, .input-mono { font-family: var(--mono); }

.cash-input-wrap {
  position: relative; background: var(--bg-3);
  border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 16px 22px 16px 56px; transition: border 0.2s;
}
.cash-input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.cash-input-wrap::before {
  content: 'R$'; position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  font-family: var(--serif); font-size: 22px; color: var(--gold); font-style: italic;
}
.cash-input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--mono); font-size: 24px; font-weight: 500;
}

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; background: var(--bg-1);
  border-radius: 99px; outline: none; cursor: pointer; border: 1px solid var(--line);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8862f);
  border: 3px solid var(--bg-0); cursor: grab;
  box-shadow: 0 0 0 1px var(--gold), 0 0 14px var(--gold-soft);
}
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8862f);
  border: 3px solid var(--bg-0); cursor: grab;
}

/* ===== PILLS ===== */
.pill-group {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--bg-1); padding: 6px; border-radius: 10px; border: 1px solid var(--line);
}
.pill {
  flex: 1; min-width: 0; background: transparent; color: var(--text-muted);
  border: none; padding: 10px 14px; border-radius: 7px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.18s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill:hover { color: var(--text); }
.pill.active {
  background: var(--bg-3); color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ===== BUTTONS ===== */
.btn {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 10px 18px; font-family: var(--sans); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.18s;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: var(--bg-3); border-color: var(--gold); color: var(--gold); }
.btn.primary { background: var(--gold); color: var(--bg-0); border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { background: #e3b75d; color: var(--bg-0); }
.btn.danger { color: var(--red); border-color: rgba(248,113,113,0.3); }
.btn.danger:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== KPIs ===== */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 28px 0; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .kpis { grid-template-columns: 1fr; } }
.kpi {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gold); opacity: 0.5;
}
.kpi.green::after { background: var(--green); }
.kpi.blue::after { background: var(--blue); }
.kpi.purple::after { background: var(--purple); }
.kpi.red::after { background: var(--red); }
.kpi-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.kpi-value { font-family: var(--serif); font-size: 30px; font-weight: 500; letter-spacing: -0.01em; line-height: 1; }
.kpi-value.gold { color: var(--gold); }
.kpi-value.green { color: var(--green); }
.kpi-value.blue { color: var(--blue); }
.kpi-value.red { color: var(--red); }
.kpi-sub { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 6px; }

/* ===== SECTION ===== */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 24px 0 14px; flex-wrap: wrap; gap: 12px;
}
.section-title { font-family: var(--serif); font-size: 26px; font-weight: 500; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== TABLE ===== */
.table-wrap { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 800px; }
table.data-table thead { background: var(--bg-1); position: sticky; top: 0; z-index: 2; }
table.data-table th {
  text-align: left; padding: 14px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--line-strong); white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.data-table th:hover { color: var(--gold); }
table.data-table th.no-sort { cursor: default; }
table.data-table th.right, table.data-table td.right { text-align: right; }
table.data-table th.center, table.data-table td.center { text-align: center; }
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background 0.15s; }
table.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
table.data-table td.name { font-weight: 500; color: var(--text); }
table.data-table td.muted { color: var(--text-muted); font-size: 12px; }
table.data-table td.mono, table.data-table td.valor, table.data-table td.salario { font-family: var(--mono); }
table.data-table td.valor { color: var(--gold); font-weight: 500; }
table.data-table tfoot td {
  background: var(--bg-1); font-weight: 600;
  border-top: 2px solid var(--line-strong); border-bottom: none;
}
table.data-table tfoot td.label { font-family: var(--serif); font-style: italic; color: var(--text-muted); }
table.data-table tfoot td.valor { color: var(--gold); }

/* ===== BADGES ===== */
.tipo-badge {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  padding: 3px 8px; border-radius: 4px; font-weight: 600; letter-spacing: 0.08em;
}
.tipo-pj { background: var(--blue-soft); color: var(--blue); }
.tipo-clt { background: var(--green-soft); color: var(--green); }

.status-badge {
  display: inline-block; font-size: 11px; padding: 4px 10px; border-radius: 999px;
  font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.status-rascunho   { background: var(--bg-3); color: var(--text-muted); }
.status-aprovado   { background: var(--blue-soft); color: var(--blue); }
.status-pago       { background: var(--green-soft); color: var(--green); }
.status-cancelado  { background: var(--red-soft); color: var(--red); }

/* ===== ROW ACTIONS ===== */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all 0.15s; text-decoration: none;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }

/* ===== INPUTS INLINE ===== */
.mult-input {
  width: 70px; padding: 6px 8px;
  background: var(--bg-3); border: 1px solid var(--line-strong);
  border-radius: 6px; color: var(--gold);
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  text-align: right; transition: all 0.15s;
}
.mult-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.mult-input.modified { background: var(--gold-soft); border-color: var(--gold); }

.sal-input {
  width: 130px; padding: 6px 10px;
  background: transparent; border: 1px solid transparent;
  border-radius: 6px; color: var(--text);
  font-family: var(--mono); font-size: 13px;
  text-align: right; transition: all 0.15s;
}
.sal-input:hover { background: var(--bg-3); border-color: var(--line); }
.sal-input:focus {
  outline: none; background: var(--bg-3);
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); color: var(--gold);
}
.sal-input.modified { background: var(--gold-soft); border-color: rgba(212,164,76,0.3); color: var(--gold); }

/* ===== BAR ===== */
.bar-cell { position: relative; min-width: 140px; }
.bar-bg { position: absolute; inset: 6px 16px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--gold), #b8862f);
  border-radius: 4px; transition: width 0.4s ease;
}
.bar-label {
  position: relative; z-index: 1; font-family: var(--mono); font-size: 11px;
  color: var(--text); text-shadow: 0 0 4px var(--bg-0); padding: 0 6px;
}

/* ===== INFO BOX ===== */
.info-box {
  margin-top: 18px; padding: 14px 18px; border-radius: 10px;
  background: var(--blue-soft); border: 1px solid rgba(96,165,250,0.25);
  font-size: 13px; color: var(--text); display: none; line-height: 1.55;
}
.info-box.active { display: block; }
.info-box strong { color: var(--blue); }
.info-box.warn { background: var(--red-soft); border-color: rgba(248,113,113,0.25); }
.info-box.warn strong { color: var(--red); }
.info-box.ok { background: var(--green-soft); border-color: rgba(74,222,128,0.25); }
.info-box.ok strong { color: var(--green); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7,9,15,0.85);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-strong); border-radius: 16px;
  width: 100%; max-width: 580px; padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.modal h3 { font-family: var(--serif); font-size: 28px; font-weight: 500; margin-bottom: 6px; }
.modal .modal-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.form-field input, .form-field select, .form-field textarea {
  background: var(--bg-3); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 11px 14px;
  color: var(--text); font-family: var(--sans); font-size: 14px;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}
.modal-cash-wrap { position: relative; }
.modal-cash-prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gold); font-family: var(--mono); font-size: 14px;
  pointer-events: none; z-index: 1;
}
.modal-cash-wrap input {
  width: 100%; padding-left: 38px !important;
  font-family: var(--mono) !important; text-align: right;
}
.modal-actions { display: flex; gap: 10px; margin-top: 24px; justify-content: flex-end; }
.modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.modal-close:hover { color: var(--red); border-color: var(--red); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-strong); border-left: 3px solid var(--green);
  border-radius: 10px; padding: 14px 22px;
  font-size: 14px; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
}
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--gold); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px;
  transition: all 0.2s; cursor: pointer; text-decoration: none; color: inherit;
  display: block;
}
.card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.card-title {
  font-family: var(--serif); font-size: 20px; font-weight: 500;
  margin-bottom: 4px; letter-spacing: -0.01em;
}
.card-subtitle { color: var(--text-muted); font-size: 12px; margin-bottom: 16px; font-family: var(--mono); }
.card-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-top: 12px; }
.card-meta strong { color: var(--text); font-family: var(--mono); }

/* ===== EMPTY STATE ===== */
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 14px;
}
.empty .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }
.empty .empty-title { font-family: var(--serif); font-size: 22px; color: var(--text); margin-bottom: 6px; }

/* ===== LOGIN ===== */
.login-screen {
  position: fixed; inset: 0; background: var(--bg-0);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.login-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 40px; width: 100%; max-width: 400px; text-align: center;
}
.login-card h1 { font-family: var(--serif); font-weight: 500; margin-bottom: 8px; letter-spacing: -0.02em; }
.login-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

/* ===== UTILS ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 18px; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-mono { font-family: var(--mono); }
.text-serif { font-family: var(--serif); }
.text-sm { font-size: 13px; } .text-xs { font-size: 11px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.hidden { display: none !important; }

/* ===== PRINT (documento) ===== */
@media print {
  body { background: white; color: black; }
  body::before { display: none; }
  .topnav, .section-actions, .row-actions, .no-print { display: none !important; }
  .panel, .kpi, .table-wrap, .card { border: 1px solid #ccc !important; background: white !important; box-shadow: none !important; }
  table.data-table th, table.data-table td { color: black !important; }
}
