:root {
  --bg-deep: #0a0b0f;
  --bg-graphite: #12141c;
  --bg-card: #161922;
  --bg-elevated: #1c2030;
  --text-primary: #f4f6fb;
  --text-muted: #8b93a7;
  --accent-electric: #00d4ff;
  --accent-cyan: #22f2c3;
  --accent-green: #3dff9a;
  --accent-danger: #ff4d6d;
  --accent-warning: #ffb020;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font-display: "Segoe UI", system-ui, -apple-system, sans-serif;
  --sidebar-width: 260px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(0, 212, 255, 0.12), transparent),
    radial-gradient(900px 500px at 90% 0%, rgba(61, 255, 154, 0.08), transparent),
    var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-display);
  line-height: 1.5;
}

a {
  color: var(--accent-electric);
  text-decoration: none;
}

a:hover {
  color: var(--accent-cyan);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  background: linear-gradient(180deg, #0e1018 0%, #0a0b0f 100%);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

.sidebar .nav-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
  margin-right: -0.25rem;
}

.sidebar .nav-list::-webkit-scrollbar {
  width: 6px;
}

.sidebar .nav-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.sidebar-logout {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.35));
}

.brand-logo--auth {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto 0.75rem;
}

.auth-brand {
  text-align: center;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
}

.brand-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.money-field {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.money-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.money-field .money-input {
  border-radius: 0 8px 8px 0;
  flex: 1;
  font-variant-numeric: tabular-nums;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: var(--text-muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(0, 212, 255, 0.08);
  color: var(--text-primary);
}

.nav-link.is-active {
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.25);
}

.main {
  padding: 1.5rem 1.75rem 2.5rem;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.card-financial {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(61, 255, 154, 0.06)), var(--bg-elevated);
  position: relative;
  overflow: hidden;
}

.card-financial::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.25), transparent 70%);
  pointer-events: none;
}

.balance-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.balance-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.35rem 0 0.75rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-electric), #0099cc);
  color: #041018;
  box-shadow: 0 12px 30px rgba(0, 212, 255, 0.25);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-input,
.form-select,
select.form-input {
  width: 100%;
  background-color: var(--bg-elevated);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 0.75rem 0.85rem;
  font: inherit;
}

.form-select option,
select option,
select optgroup {
  background-color: #1c2030;
  color: #f4f6fb;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: rgba(0, 212, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-pending { background: rgba(255, 176, 32, 0.15); color: var(--accent-warning); }
.badge-review { background: rgba(0, 212, 255, 0.15); color: var(--accent-electric); }
.badge-approved { background: rgba(61, 255, 154, 0.15); color: var(--accent-green); }
.badge-rejected { background: rgba(255, 77, 109, 0.15); color: var(--accent-danger); }
.badge-muted { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

.alert {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.alert-success { background: rgba(61, 255, 154, 0.08); border-color: rgba(61, 255, 154, 0.25); }
.alert-error { background: rgba(255, 77, 109, 0.08); border-color: rgba(255, 77, 109, 0.25); }

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.table th,
.table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  min-height: 14px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(440px, 100%);
}

.marketing-hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.marketing-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0 0 0.75rem;
}

.marketing-hero p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), 86vw);
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 40;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
  }

  /* Menu inteiro rola no mobile (Sair fica acessível em telas baixas) */
  .sidebar .nav-list {
    flex: 0 0 auto;
    min-height: auto;
    overflow-y: visible;
  }

  .sidebar-logout {
    margin-top: 1rem;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
    border: none;
    padding: 0;
    cursor: pointer;
  }

  .sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
