:root {
  color-scheme: dark;
  --bg: #06171d;
  --surface: #0d222a;
  --surface-2: #142c38;
  --surface-3: #193544;
  --text: #f4fbfc;
  --muted: #9eb8c1;
  --border: #244550;
  --primary: #39bcc8;
  --primary-strong: #66d3dc;
  --primary-soft: #113b43;
  --success: #4fd09a;
  --warning: #f0b84b;
  --danger: #ff7b87;
  --shadow: 0 20px 50px rgba(0, 0, 0, .28);
  --radius: 20px;
  --sidebar-width: 264px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef6f8;
  --surface: #ffffff;
  --surface-2: #f4f9fa;
  --surface-3: #e9f4f6;
  --text: #132a35;
  --muted: #627882;
  --border: #d6e5e9;
  --primary: #087f8c;
  --primary-strong: #05636d;
  --primary-soft: #dff5f6;
  --success: #168558;
  --warning: #9b6500;
  --danger: #c43d4b;
  --shadow: 0 18px 45px rgba(22, 61, 72, .11);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--primary-strong);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 19px;
  border: 0;
  border-radius: 13px;
  text-decoration: none;
  font-weight: 780;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.btn-block {
  width: 100%;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: .9rem;
  font-weight: 780;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  outline: 0;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 17%, transparent);
}

.input-with-button {
  position: relative;
}

.input-with-button input {
  padding-right: 50px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}

.input-action:hover {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.message {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-2);
}

.message[data-tipo="success"] {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, var(--border));
}

.message[data-tipo="error"] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
}

.message[data-tipo="warning"] {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: .78rem;
  font-weight: 820;
}

.badge.success {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}

.badge.warning {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
}

.badge.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
}

/* Estrutura compartilhada das telas de autenticação */
.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(430px, .88fr);
  min-height: 100vh;
}

.auth-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  padding: clamp(42px, 6.3vw, 100px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 17% 20%, rgba(111, 224, 232, .52), transparent 31%),
    linear-gradient(140deg, #063f4d, #087f8c 58%, #37bdc8);
}

.auth-hero::before,
.auth-hero::after {
  content: "";
  position: absolute;
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
}

.auth-hero::before {
  top: -120px;
  right: -80px;
  width: 430px;
  height: 430px;
}

.auth-hero::after {
  bottom: -95px;
  left: -75px;
  width: 270px;
  height: 270px;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 650px;
}

.hero-logo {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 54px;
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 850;
}

.hero-logo-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .19);
}

.hero-content h1 {
  max-width: 650px;
  margin: 0 0 20px;
  font-size: clamp(2.55rem, 5.2vw, 4.9rem);
  line-height: .99;
  letter-spacing: -.035em;
}

.hero-content > p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, .86);
  font-size: 1.08rem;
  line-height: 1.65;
}

.auth-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 60px 28px;
  background: var(--bg);
}

.auth-card {
  width: min(100%, 570px);
  padding: clamp(28px, 4vw, 48px);
}

.auth-card h2 {
  margin: 8px 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.auth-card > p {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-link {
  margin-top: 22px;
  color: var(--muted);
  text-align: center;
}

.auth-link a {
  color: var(--primary-strong);
  font-weight: 820;
}

/* Estrutura compartilhada do painel */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 8px 26px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  font-size: 1.25rem;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.18rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .74rem;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav a,
.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  text-decoration: none;
  font-weight: 720;
}

.nav a:hover,
.nav button:hover,
.nav a.active {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.sidebar-footer {
  margin-top: auto;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 34px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  padding-right: 54px;
}

.page-header h1 {
  margin: 7px 0 6px;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 980px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    align-items: center;
    min-height: 370px;
    padding: 48px 30px;
  }

  .hero-logo {
    margin-bottom: 30px;
  }

  .hero-content h1 {
    max-width: 760px;
    font-size: clamp(2.4rem, 8vw, 4.1rem);
  }

  .auth-panel {
    padding: 30px 18px 58px;
  }
}

@media (max-width: 760px) {
  :root {
    --sidebar-width: 0px;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .sidebar {
    inset: auto 0 0;
    width: 100%;
    height: 72px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    border-right: 0;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
  }

  .nav a,
  .nav button {
    min-height: 55px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    font-size: .68rem;
    text-align: center;
  }

  .nav a i,
  .nav button i {
    font-size: 1.14rem;
  }

  .main {
    margin-left: 0;
    padding: 24px 16px 94px;
  }

  .page-header {
    padding-right: 48px;
  }
}
