/* Star Tracking - design compartilhado entre dashboard, cliques e login. */

:root {
  color-scheme: light;
  --navy: #06294e;
  --navy-2: #0c3d75;
  --navy-3: #0f4a8f;
  --ink: #0d1b2e;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e3e8f2;
  --line-soft: #edf1f8;
  --bg: #eef1f8;
  --card: #ffffff;
  --lime: #b5d800;
  --lime-dark: #7f9600;
  --lime-soft: #f1f8d6;
  --blue-soft: #e9f0fe;
  --blue-ink: #1a56b0;
  --amber-soft: #fef3e2;
  --amber-ink: #9a5b00;
  --danger: #d92d20;
  --danger-soft: #fdeeed;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 1px 2px rgba(13, 27, 46, .04), 0 8px 24px -12px rgba(13, 27, 46, .12);
  --shadow-pop: 0 12px 32px -12px rgba(6, 41, 78, .28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3, h4, p { margin: 0; }

.wrap {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- topbar ---------- */

.topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 62%, var(--navy-3) 100%);
  color: #fff;
  padding: 20px 0;
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(420px 220px at 88% -30%, rgba(181, 216, 0, .28), transparent 70%),
    radial-gradient(320px 200px at 102% 120%, rgba(181, 216, 0, .18), transparent 70%);
  pointer-events: none;
}

.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  height: 34px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.brand-text .eyebrow {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--lime);
  font-weight: 700;
}

.brand-text h1 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.brand-text .sub {
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  padding: 5px 14px 5px 5px;
  font-size: 13px;
  color: #fff;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
  transition: background .15s ease, border-color .15s ease;
}

.btn-logout:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .5); }

.crumbs {
  position: relative;
  display: flex;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
}

.crumbs a {
  text-decoration: none;
  color: rgba(255, 255, 255, .68);
  padding: 6px 12px;
  border-radius: 999px;
}

.crumbs a.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-weight: 700;
}

.crumbs a:hover { color: #fff; }

/* ---------- layout ---------- */

main { padding: 26px 0 60px; }

.section { margin-top: 22px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 16px;
  font-weight: 800;
}

.panel-head .hint {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
}

.panel-head .action {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--blue-ink);
  text-decoration: none;
  white-space: nowrap;
}

.two-col {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
}

/* ---------- filter card ---------- */

.filter-card { margin-bottom: 18px; }

.filter-grid {
  display: grid;
  grid-template-columns: 1.3fr .9fr .9fr .9fr 1.3fr auto;
  gap: 10px;
  align-items: end;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

select, input[type=text], input[type=search], input[type=date], input[type=password] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: #fbfcfe;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--navy-3);
  box-shadow: 0 0 0 3px rgba(15, 74, 143, .12);
}

.range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  background: var(--lime);
  color: var(--navy);
  font-weight: 800;
  font-size: 13.5px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover { background: #a3c400; }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover { background: #f6f8fc; }

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

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

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 999px; }

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chip-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.chip:hover { border-color: var(--navy-3); color: var(--ink); }

.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.range-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.range-note strong { color: var(--ink); }

/* ---------- KPI cards ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--lime-soft);
  color: var(--lime-dark);
}

.kpi-icon.blue { background: var(--blue-soft); color: var(--blue-ink); }
.kpi-icon.navy { background: rgba(6, 41, 78, .08); color: var(--navy); }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber-ink); }

.kpi-icon svg { width: 17px; height: 17px; }

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 12px;
  letter-spacing: -.01em;
}

.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.kpi-note { color: var(--muted-2); font-size: 12px; }

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.delta.up { color: #17843b; background: #e7f7ec; }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.neutral { color: var(--muted); background: var(--line-soft); }

.kpi-spark {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 46%;
  height: 40px;
  opacity: .5;
}

/* ---------- trend chart ---------- */

.chart-legend {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 8px;
}

.chart-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 6px;
}

.dot.open { background: var(--lime-dark); }
.dot.click { background: var(--navy); }
.dot.both { background: var(--navy); }
.dot.openonly { background: var(--lime); }
.dot.clickonly { background: var(--blue-ink); }

.trend-svg { width: 100%; height: auto; display: block; }
.trend-axis text {
  fill: var(--muted-2);
  font-size: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.trend-grid line { stroke: var(--line-soft); stroke-width: 1; }
.trend-area { fill: rgba(181, 216, 0, .22); }
.trend-open-line { fill: none; stroke: var(--lime-dark); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.trend-click-line { fill: none; stroke: var(--navy); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.trend-dot { fill: #fff; stroke-width: 2; }

.chart-empty {
  display: grid;
  place-items: center;
  height: 220px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

/* ---------- donut ---------- */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut-figure { flex: none; }

.donut-legend {
  display: grid;
  gap: 10px;
  font-size: 13px;
}

.donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.donut-legend-row .label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}

.donut-legend-row .value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.donut-total {
  text-anchor: middle;
  font-weight: 800;
  fill: var(--ink);
}

.donut-total-label {
  text-anchor: middle;
  fill: var(--muted);
  font-size: 10.5px;
}

/* ---------- ranking bars ---------- */

.rank-list { display: grid; gap: 12px; }

.rank-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
}

.rank-pos {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted-2);
}

.rank-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy), var(--navy-3));
}

.rank-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.rank-name a { text-decoration: none; }
.rank-name a:hover { text-decoration: underline; }

.rank-value {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- quick urls ---------- */

.quick { display: grid; gap: 14px; }

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.copy-row input {
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f7f9fc;
}

.copy-feedback {
  font-size: 12px;
  color: var(--lime-dark);
  font-weight: 700;
  margin-top: 5px;
  height: 14px;
}

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: #475467;
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #f6f8fc;
  font-weight: 800;
  position: sticky;
  top: 0;
}

tbody tr:hover { background: #fafbff; }
tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
}

.pill.open { background: var(--blue-soft); color: var(--blue-ink); }
.pill.click { background: var(--lime-soft); color: var(--lime-dark); }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 26px 10px;
}

/* ---------- pager ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pages { display: flex; gap: 6px; flex-wrap: wrap; }

.pages a, .pages span {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.pages .active { background: var(--navy); border-color: var(--navy); color: #fff; }

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13.5px;
  flex-wrap: wrap;
}

/* ---------- login ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.auth-aside {
  position: relative;
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 55%, var(--navy-3) 100%);
  color: #fff;
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(480px 320px at 92% -10%, rgba(181, 216, 0, .32), transparent 65%),
    radial-gradient(420px 260px at -10% 110%, rgba(181, 216, 0, .18), transparent 65%);
}

.auth-aside > * { position: relative; }

.auth-aside img { height: 32px; filter: brightness(0) invert(1); }

.auth-copy h2 {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
  max-width: 380px;
  margin-top: 40px;
}

.auth-copy p {
  color: rgba(255, 255, 255, .72);
  font-size: 14.5px;
  margin-top: 14px;
  max-width: 360px;
  line-height: 1.55;
}

.auth-stats {
  display: flex;
  gap: 28px;
  margin-top: 44px;
}

.auth-stats div strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.auth-stats div span {
  color: rgba(255, 255, 255, .62);
  font-size: 12px;
}

.auth-foot {
  color: rgba(255, 255, 255, .5);
  font-size: 12px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
}

.auth-card {
  width: min(380px, 100%);
}

.auth-card .mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.auth-card .mobile-brand img { height: 26px; }

.auth-card h1 {
  font-size: 23px;
  font-weight: 800;
}

.auth-card p.lead {
  margin: 6px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-field { margin-bottom: 16px; }

.auth-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
}

.auth-card input {
  height: 44px;
  background: #fff;
}

.auth-submit {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--lime);
  color: var(--navy);
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease;
}

.auth-submit:hover { background: #a3c400; }

.auth-error {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-help {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--muted-2);
  text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .two-col { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-card .mobile-brand { display: flex; }
}

@media (max-width: 680px) {
  .topbar-inner { align-items: flex-start; }
  .filter-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  table { display: block; }
  .table-scroll { overflow-x: auto; }
  .summary-row { flex-direction: column; align-items: flex-start; }
}
