:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #101c30;
  --panel-soft: #16243b;
  --line: rgba(148, 163, 184, .2);
  --text: #f8fafc;
  --muted: #9fb0c7;
  --purple: #8b5cf6;
  --cyan: #22d3ee;
  --green: #34d399;
  --red: #fb7185;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 10% 0, #1d1950 0, transparent 32%), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
.admin-shell { min-height: 100vh; }
.login-view { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(100%, 430px); padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: rgba(16, 28, 48, .96); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.brand { display: inline-block; width: 220px; max-width: 75%; }
.brand img { display: block; width: 100%; height: auto; }
.eyebrow { margin: 22px 0 6px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .13em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 42px); }
h2 { margin: 4px 0 14px; font-size: 21px; }
.muted { color: var(--muted); }
form { display: grid; gap: 10px; margin-top: 26px; }
label { color: #dbeafe; font-size: 14px; font-weight: 700; }
input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #081322; color: var(--text); }
input:focus { outline: 3px solid rgba(34, 211, 238, .3); border-color: var(--cyan); }
button { min-height: 44px; padding: 10px 16px; border: 0; border-radius: 10px; background: linear-gradient(135deg, var(--purple), #6d28d9); color: white; font-weight: 800; }
button:hover { filter: brightness(1.1); }
button:focus-visible, a:focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; }
.secondary { border: 1px solid var(--line); background: var(--panel-soft); }
.danger { border: 1px solid rgba(251, 113, 133, .4); background: rgba(159, 18, 57, .55); }
.back-link { display: inline-block; margin-top: 18px; color: var(--cyan); }
.message { min-height: 22px; margin: 14px 0 0; color: var(--muted); }
.message.error { color: #fda4af; }
.message.success { color: #6ee7b7; }
.dashboard-view { width: min(1480px, 100%); margin: 0 auto; padding: 26px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16, 28, 48, .92); }
.admin-header .eyebrow { margin-top: 0; }
.header-actions { display: flex; gap: 10px; }
.admin-grid-layout { display: grid; gap: 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi-card, .admin-card { border: 1px solid var(--line); border-radius: 16px; background: rgba(16, 28, 48, .92); box-shadow: 0 14px 35px rgba(0, 0, 0, .15); }
.kpi-card { padding: 20px; }
.kpi-title { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.kpi-value { margin: 8px 0; color: var(--cyan); font-size: clamp(26px, 4vw, 38px); font-weight: 800; }
.kpi-sub { color: var(--muted); font-size: 13px; }
.admin-card { padding: 22px; }
.section-heading { display: flex; justify-content: space-between; gap: 14px; }
.section-heading .eyebrow, .admin-card > .eyebrow { margin-top: 0; }
.live { color: var(--muted); font-size: 12px; white-space: nowrap; }
.live span { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--green); }
.admin-disclaimer { margin: 0 0 18px; padding: 10px 12px; border: 1px solid rgba(245, 158, 11, .25); border-radius: 10px; background: rgba(245, 158, 11, .07); color: #fcd98b; font-size: 13px; }
.analytics-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.analytics-kpis > div { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0a1627; }
.analytics-kpis strong { display: block; color: var(--text); font-size: 25px; }
.analytics-kpis span { color: var(--muted); font-size: 12px; }
.analytics-pages { margin-top: 20px; }
.finance-flex { display: grid; grid-template-columns: minmax(290px, .95fr) minmax(280px, 1.05fr); gap: 18px; align-items: start; }
.finance-inputs { display: grid; gap: 8px; }
.finance-status-display { display: grid; place-items: stretch; }
.placement-inputs { display: grid; gap: 8px; margin: 10px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0a1627; }
.placement-inputs legend { padding: 0 7px; color: var(--cyan); font-weight: 800; }
.placement-result { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.placement-result strong { color: var(--text); }
.status-indicator { display: grid; align-content: center; min-height: 210px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: #0a1627; text-align: center; }
.status-indicator.profit { border-color: rgba(52, 211, 153, .45); }
.status-indicator.loss { border-color: rgba(251, 113, 133, .45); }
.indicator-icon { font-size: 34px; }
.charts-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-container { position: relative; min-height: 310px; }
.table-wrapper { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.admin-table code { color: var(--cyan); }
.bug-sev-badge, .bug-status { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.bug-sev-badge.leve { background: rgba(52, 211, 153, .15); color: #6ee7b7; }
.bug-sev-badge.medio { background: rgba(251, 191, 36, .15); color: #fcd34d; }
.bug-sev-badge.grave, .bug-status.pendente { background: rgba(251, 113, 133, .15); color: #fda4af; }
.bug-status.resolvido { background: rgba(52, 211, 153, .15); color: #6ee7b7; }
.bug-date { color: var(--muted); font-size: 11px; }
.bug-description { max-width: 320px; color: var(--text); font-size: 13px; overflow-wrap: anywhere; white-space: normal; }
.btn-resolve { min-height: 32px; padding: 4px 10px; border-radius: 6px; font-size: 11px; }
.bug-done { color: var(--green); font-size: 12px; font-weight: 800; }

@media (max-width: 900px) {
  .kpi-row, .charts-row { grid-template-columns: 1fr; }
  .analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-flex { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dashboard-view { padding: 12px; }
  .admin-header { align-items: stretch; flex-direction: column; }
  .header-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .analytics-kpis { grid-template-columns: 1fr; }
  .admin-card, .login-card { padding: 18px; }
}
