:root {
  color-scheme: dark;
  --bg: #07110e;
  --panel: rgba(16, 31, 26, 0.86);
  --panel-strong: #10221c;
  --border: rgba(190, 233, 216, 0.12);
  --text: #f4faf7;
  --muted: #92a9a0;
  --green: #5ee0a0;
  --green-dark: #1b9f68;
  --blue: #76a9ff;
  --amber: #ffc768;
  --violet: #b29aff;
  --danger: #ff8d8d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 5% 0%, rgba(56, 170, 119, 0.12), transparent 34rem),
    linear-gradient(145deg, #07110e 0%, #091713 48%, #08100e 100%);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button { cursor: pointer; }

[hidden] { display: none !important; }

.ambient {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.1;
}

.ambient-one { top: -16rem; right: -8rem; background: #63efad; }
.ambient-two { bottom: -20rem; left: -8rem; background: #5d7fff; }

main { position: relative; z-index: 1; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(18, 38, 31, 0.98), rgba(10, 23, 19, 0.96));
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 24px;
  place-items: center;
  border-radius: 16px;
  color: #062116;
  background: var(--green);
  font-weight: 900;
  letter-spacing: -0.05em;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 4vw, 38px); line-height: 1.1; letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -0.02em; }
.muted { color: var(--muted); }

form { margin-top: 28px; }
label { display: block; margin-bottom: 8px; color: #cbd9d3; font-size: 13px; font-weight: 700; }
input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: rgba(2, 10, 7, 0.55);
}
input:focus { border-color: rgba(94, 224, 160, 0.62); box-shadow: 0 0 0 3px rgba(94, 224, 160, 0.1); }
form button {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  color: #042016;
  background: var(--green);
  font-weight: 850;
}
.form-error { min-height: 21px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }

.dashboard { width: min(1540px, calc(100% - 48px)); margin: 0 auto; padding: 32px 0 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar h1 { margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(9, 23, 18, 0.7);
  font-size: 12px;
  font-weight: 700;
}
.connection i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(255, 199, 104, 0.1); }
.connection.online { color: #baf4d6; }
.connection.online i { background: var(--green); box-shadow: 0 0 0 4px rgba(94, 224, 160, 0.1); }
.button-secondary { padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px; color: #d7e2dd; background: transparent; }
.button-secondary:hover { background: rgba(255, 255, 255, 0.04); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric {
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(18, 37, 31, 0.88), rgba(11, 25, 20, 0.82));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}
.metric-icon { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--blue); background: rgba(118, 169, 255, 0.1); font-size: 13px; font-weight: 900; }
.metric-online .metric-icon, .metric-revenue .metric-icon { color: var(--green); background: rgba(94, 224, 160, 0.1); }
.metric strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: clamp(21px, 2vw, 30px); line-height: 1.05; letter-spacing: -0.04em; white-space: nowrap; }
.metric span:last-child { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }
.metric-revenue { grid-column: span 1; }
.metric-revenue strong { font-size: clamp(18px, 1.5vw, 25px); }

.daily-funnel {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(14, 34, 27, 0.95), rgba(9, 24, 19, 0.88));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.12);
}
.daily-funnel-heading h2 { font-size: 17px; }
.funnel-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.funnel-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 16px;
  border-left: 1px solid var(--border);
}
.funnel-icon {
  display: grid;
  flex: 0 0 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: rgba(118, 169, 255, 0.1);
  font-size: 12px;
  font-weight: 900;
}
.funnel-step-sale .funnel-icon, .funnel-step-rate .funnel-icon {
  color: var(--green);
  background: rgba(94, 224, 160, 0.1);
}
.funnel-step strong {
  display: block;
  overflow: hidden;
  font-size: clamp(19px, 1.6vw, 25px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.funnel-step span:last-child { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(340px, 0.75fr); gap: 16px; }
.panel { min-height: 520px; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.14); backdrop-filter: blur(18px); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.panel-heading .muted { font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 14px; color: #7f978e; background: rgba(3, 13, 9, 0.24); font-size: 10px; letter-spacing: 0.1em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 15px 14px; border-top: 1px solid rgba(190, 233, 216, 0.07); color: #dce9e3; font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.stage { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; background: rgba(118, 169, 255, 0.1); color: #aac9ff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stage-carrinho { color: var(--amber); background: rgba(255, 199, 104, 0.1); }
.stage-checkout { color: var(--violet); background: rgba(178, 154, 255, 0.11); }
.stage-produto { color: var(--green); background: rgba(94, 224, 160, 0.1); }
.primary-cell { display: block; max-width: 340px; overflow: hidden; color: #eff8f4; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.secondary-cell { display: block; max-width: 340px; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.events-feed { max-height: 660px; overflow-y: auto; }
.event { display: grid; grid-template-columns: 38px 1fr auto; gap: 11px; padding: 15px 18px; border-bottom: 1px solid rgba(190, 233, 216, 0.07); }
.event-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--blue); background: rgba(118, 169, 255, 0.1); font-size: 14px; font-weight: 900; }
.event-purchase { background: linear-gradient(90deg, rgba(94, 224, 160, 0.08), transparent); }
.event-purchase .event-icon { color: var(--green); background: rgba(94, 224, 160, 0.14); }
.event strong { display: block; color: #eaf4ef; font-size: 13px; }
.event p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.event time { color: #6f857c; font-size: 10px; white-space: nowrap; }
.event-total { display: block; margin-top: 4px; color: var(--green); font-size: 12px; font-weight: 850; }

.empty-state { display: grid; min-height: 400px; place-items: center; align-content: center; padding: 32px; text-align: center; }
.empty-state span { color: #4d6a5e; font-size: 34px; }
.empty-state strong { margin-top: 10px; color: #c4d4cd; }
.empty-state p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.empty-state.compact { min-height: 350px; }
footer { padding: 18px 4px 0; color: #5f776d; font-size: 11px; text-align: center; }

@media (max-width: 1200px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .daily-funnel { grid-template-columns: 1fr; }
  .daily-funnel-heading { padding-bottom: 2px; }
  .funnel-step:first-child { border-left: 0; }
  .content-grid { grid-template-columns: 1fr; }
  .feed-panel { min-height: 420px; }
}

@media (max-width: 680px) {
  .dashboard { width: min(100% - 24px, 1540px); padding-top: 20px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { align-items: flex-end; flex-direction: column-reverse; }
  .connection { padding: 7px 9px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 98px; padding: 14px; }
  .metric-icon { display: none; }
  .daily-funnel { padding: 17px; }
  .funnel-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 0; }
  .funnel-step { padding: 7px 10px; }
  .funnel-step:nth-child(odd) { border-left: 0; }
  .funnel-step:last-child { grid-column: 1 / -1; }
  .panel { min-height: 420px; }
  .panel-heading { padding: 17px; }
  .login-card { padding: 30px 24px; }
}
