@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap");

:root {
  --bg: #f3f4f6;
  --bg-white: #ffffff;
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-soft: #fee2e2;
  --panel-dark: #0b101c;
  --panel-dark-2: #121826;
  --err: #b91c1c;
  --ok: #15803d;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 8px 24px rgba(17, 24, 39, 0.06);
  --radius: 12px;
  --font-display: "Outfit", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— App shell (pós-login) —— */
.app-body { background: var(--bg); min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--bg-white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar-brand img {
  height: 40px;
  width: auto;
  display: block;
  background: #0b101c;
  border-radius: 8px;
  padding: 4px 10px;
}
.topbar-brand span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.topbar-user .btn-link {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-white);
}
.topbar-user .btn-link:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-head {
  margin-bottom: 1.25rem;
  animation: rise 0.45s ease-out both;
}
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin: 0 0 0.35rem;
  color: var(--ink);
}
.page-head p {
  margin: 0;
  color: var(--muted);
  max-width: 40rem;
}

.grid-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease-out both;
}
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card span {
  display: block;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}
.stat-card small {
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.panel-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.panel {
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease-out both;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}
.panel p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }

.err { color: var(--err); font-size: 0.95rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* —— Login (split OnSign-style) —— */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  background: var(--panel-dark);
  padding: 0;
}

.login-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.75rem 1.75rem 1.5rem;
  background: linear-gradient(180deg, var(--panel-dark) 0%, var(--panel-dark-2) 100%);
  color: #e5e7eb;
  animation: rise 0.5s ease-out both;
}

.login-logo {
  height: 52px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  object-position: left center;
}

.login-kicker {
  margin: 1.25rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: 600;
}

.login-card {
  margin: 2rem 0;
  padding: 1.35rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0 0 1.15rem;
  color: #fff;
}

.login-side form { display: grid; gap: 0.9rem; }
.login-side label {
  display: grid;
  gap: 0.35rem;
  color: #9ca3af;
  font-size: 0.86rem;
  font-weight: 500;
}
.login-side input {
  font: inherit;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}
.login-side input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}
.login-side .btn-primary {
  margin-top: 0.25rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.login-side .btn-primary:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.login-foot {
  font-size: 0.8rem;
  color: #6b7280;
}

.login-hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  animation: fadein 0.7s ease-out both;
}
.login-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 16, 28, 0.55) 0%, rgba(11, 16, 28, 0.2) 40%, rgba(11, 16, 28, 0.35) 100%),
    linear-gradient(180deg, rgba(11, 16, 28, 0.15) 0%, rgba(11, 16, 28, 0.55) 100%);
}
.login-hero-content {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2.5rem;
  color: #fff;
}
.login-badge {
  align-self: flex-start;
  margin-bottom: auto;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}
.login-hero-content h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.75rem;
  max-width: 14ch;
}
.login-hero-content h2 em {
  font-style: normal;
  color: #fca5a5;
}
.login-hero-content p {
  margin: 0;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.02rem;
  line-height: 1.5;
}

/* install reuses login-side look */
.install-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--panel-dark);
}
.install-panel {
  width: min(100%, 400px);
  color: #e5e7eb;
}
.install-panel .login-logo { margin-bottom: 1rem; }
.install-panel form { display: grid; gap: 0.9rem; margin-top: 1rem; }
.install-panel label {
  display: grid; gap: 0.35rem; color: #9ca3af; font-size: 0.86rem;
}
.install-panel input {
  font: inherit; color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}
.install-panel .btn-primary {
  font: inherit; font-weight: 700; color: #fff;
  background: var(--red); border: 0; border-radius: 8px;
  padding: 0.85rem 1rem; cursor: pointer;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 960px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .panel-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-hero {
    min-height: 42vh;
    order: -1;
  }
  .login-hero-content {
    min-height: 42vh;
    padding: 1.5rem;
  }
  .login-hero-content h2 { font-size: 1.75rem; }
}

@media (max-width: 520px) {
  .grid-stats { grid-template-columns: 1fr; }
  .topbar-brand span { display: none; }
  .shell { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .login-side, .login-hero, .stat-card, .panel, .page-head, .btn-primary {
    animation: none !important;
    transition: none !important;
  }
}
