:root {
  --bg: #0f0f15;
  --side: #12121a;
  --surface: #181824;
  --surface2: #21212e;
  --white: #ffffff;
  --muted: #c4c4d0;
  --line: rgba(255,255,255,.10);
  --purple: #3b00b9;
  --pink: #fe03b0;
  --citric: #a7ff00;
  --warn: #ffcc44;
  --danger: #ff5577;
  --good: #62e59d;
  --shadow: 0 18px 50px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  color: var(--white);
  background:
    radial-gradient(circle at 8% 0%, rgba(254,3,176,.14), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(59,0,185,.26), transparent 34%),
    var(--bg);
}

a { color: inherit; }
a:hover { color: inherit; text-decoration: none; }

.bd-public .navbar,
.login-page .navbar {
  background: rgba(9,9,14,.84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  font-weight: 900;
  box-shadow: 0 16px 38px rgba(254,3,176,.22);
}

.brand strong { display: block; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.hero {
  padding: 48px 0 34px;
}

.hero-shell,
.public-card,
.card-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(59,0,185,.22), rgba(254,3,176,.08)), rgba(255,255,255,.045);
  box-shadow: var(--shadow);
}

.hero-shell { padding: 30px; overflow: hidden; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(167,255,0,.30);
  background: rgba(167,255,0,.08);
  color: #eaffbf;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.hero h1 {
  margin: 16px 0 16px;
  font-size: clamp(38px, 7vw, 76px);
  line-height: .96;
  letter-spacing: -.05em;
}

.hero p,
.text-muted-soft {
  color: var(--muted);
  line-height: 1.65;
}

.btn-brand {
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  font-weight: 800;
  box-shadow: 0 16px 40px rgba(254,3,176,.18);
}

.btn-citric {
  border: 0;
  border-radius: 14px;
  color: #111116;
  background: var(--citric);
  font-weight: 800;
}

.metric {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.06);
}

.metric strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.metric span { display: block; color: var(--muted); margin-top: 8px; }

.public-section { padding: 38px 0; }
.public-card { padding: 22px; min-height: 100%; }
.public-card h3 { font-size: 20px; }
.public-card p { color: var(--muted); margin-bottom: 0; }

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0,1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: rgba(14,14,21,.90);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.sidebar .brand {
  padding: 6px 4px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.nav-title {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 850;
  margin: 16px 4px 10px;
}

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

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: #f6f6fb;
  font-size: 14px;
  font-weight: 780;
}

.side-nav a:hover,
.side-nav a.active {
  border-color: rgba(167,255,0,.20);
  background: linear-gradient(135deg, rgba(59,0,185,.66), rgba(254,3,176,.15));
}

.side-nav span {
  width: 27px;
  height: 27px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
}

.sidebar-note {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(167,255,0,.22);
  background: rgba(167,255,0,.07);
}

.sidebar-note strong { display: block; color: #eaffbf; font-size: 14px; margin-bottom: 6px; }
.sidebar-note p { margin: 0; color: #e8f8c6; opacity: .9; font-size: 12.5px; line-height: 1.45; }

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.04;
  letter-spacing: -.04em;
}

.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.06); font-size: 13px; color: var(--muted); }

.card-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.card-panel h2,
.card-panel h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.table {
  color: #fff;
}

.table thead th {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.table td { border-top: 1px solid var(--line); vertical-align: middle; }

.form-control,
.custom-select {
  color: #fff;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.form-control:focus,
.custom-select:focus {
  color: #fff;
  background: rgba(255,255,255,.10);
  border-color: rgba(167,255,0,.42);
  box-shadow: 0 0 0 .2rem rgba(167,255,0,.10);
}

.form-control::placeholder { color: rgba(255,255,255,.45); }

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

.kanban-col {
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.045);
}

.kanban-col h3 {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.job-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  margin-top: 10px;
}

.job-card strong { display: block; }
.job-card small { color: var(--muted); }

.code-block {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.24);
  color: #eaffbf;
  white-space: pre-wrap;
  word-break: break-word;
}

.table code {
  color: #eaffbf;
  white-space: normal;
  word-break: break-all;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.empty-state strong { color: #fff; }

.bd-alert {
  border-radius: 16px;
  border: 0;
}

.login-card {
  max-width: 440px;
  margin: 7vh auto;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .side-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kanban { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero-shell { padding: 22px; border-radius: 22px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .side-nav { grid-template-columns: 1fr; }
}

/* UX V3 - Menu lateral mais intuitivo */
.side-nav-group {
  margin: 18px 4px 8px;
  color: rgba(196,196,208,.78);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
}

.side-nav a {
  min-height: 54px;
  align-items: center;
}

.side-nav .nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  flex: 0 0 auto;
}

.side-nav .nav-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.side-nav .nav-copy strong {
  font-size: 13.5px;
  line-height: 1.1;
}

.side-nav .nav-copy small {
  color: rgba(196,196,208,.72);
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 600;
}

.side-nav a.active .nav-copy small,
.side-nav a:hover .nav-copy small {
  color: rgba(255,255,255,.76);
}

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

  .sidebar {
    position: relative;
    height: auto;
    display: block;
    padding: 12px;
  }

  .sidebar .brand {
    margin-bottom: 10px;
    padding-bottom: 12px;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .side-nav-group,
  .sidebar-note {
    display: none;
  }

  .side-nav a {
    min-width: 150px;
  }

  .main {
    padding: 14px;
  }
}

/* UX V5 - Sidebar retrátil e menu mais claro */
.sidebar-toggle {
  width: 100%;
  min-height: 38px;
  margin: 0 0 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.sidebar-toggle span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
}

@media (min-width: 981px) {
  .sidebar-toggle {
    display: flex;
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 92px minmax(0,1fr);
  }

  body.sidebar-collapsed .sidebar {
    padding: 16px 12px;
    overflow: visible;
  }

  body.sidebar-collapsed .sidebar .brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  body.sidebar-collapsed .sidebar .brand > span:not(.brand-mark) {
    display: none;
  }

  body.sidebar-collapsed .side-nav-group,
  body.sidebar-collapsed .sidebar-note {
    display: none;
  }

  body.sidebar-collapsed .side-nav {
    gap: 10px;
  }

  body.sidebar-collapsed .side-nav a {
    justify-content: center;
    padding: 11px;
    min-height: 52px;
    position: relative;
  }

  body.sidebar-collapsed .side-nav .nav-copy {
    display: none;
  }

  body.sidebar-collapsed .side-nav .nav-icon {
    margin: 0;
    width: 34px;
    height: 34px;
    border-radius: 13px;
  }

  body.sidebar-collapsed .side-nav a:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #181824;
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
    padding: 8px 10px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 18px 50px rgba(0,0,0,.30);
    z-index: 99999;
    font-size: 12px;
  }
}

.side-nav a {
  transition: .18s ease;
}

.side-nav a.active {
  box-shadow: inset 0 0 0 1px rgba(167,255,0,.16), 0 12px 28px rgba(59,0,185,.18);
}

.side-nav .nav-copy strong {
  letter-spacing: -.02em;
}

/* UX FIX - Menu lateral limpo, retrátil e sem bolhas no texto */
.sidebar {
  overflow-x: visible;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.sidebar-head .brand {
  flex: 1;
  min-width: 0;
  padding: 0 !important;
  margin: 0 !important;
  border-bottom: 0 !important;
}

.sidebar-head .brand-text {
  display: block;
  min-width: 0;
  background: transparent !important;
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
}

.sidebar-toggle {
  width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  flex: 0 0 38px;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  background: rgba(255,255,255,.06);
  color: #fff;
  display: grid !important;
  place-items: center;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
}

.sidebar-toggle:hover {
  background: rgba(167,255,0,.10);
  border-color: rgba(167,255,0,.26);
  color: #eaffbf;
}

.nav-title,
.side-nav-group,
.sidebar-note {
  display: none !important;
}

.side-nav {
  display: grid;
  gap: 8px;
}

/* Mata a regra antiga .side-nav span que criava bolha no texto */
.side-nav a > span {
  background: transparent !important;
}

.side-nav a {
  display: grid !important;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 16px;
}

.side-nav .nav-icon {
  width: 34px !important;
  height: 34px !important;
  border-radius: 13px !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(255,255,255,.08) !important;
  color: #fff;
  font-size: 14px;
  flex: 0 0 34px;
}

.side-nav .nav-label {
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
  display: block !important;
  place-items: unset !important;
  background: transparent !important;
  color: #f8f8ff;
  font-size: 14px;
  line-height: 1.16;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav a:hover .nav-icon,
.side-nav a.active .nav-icon {
  background: rgba(255,255,255,.12) !important;
}

.side-nav a.active {
  border-color: rgba(167,255,0,.22);
  background: linear-gradient(135deg, rgba(59,0,185,.70), rgba(254,3,176,.18));
  box-shadow: 0 12px 28px rgba(59,0,185,.20);
}

/* Menu recolhido */
@media (min-width: 981px) {
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 86px minmax(0,1fr);
  }

  body.sidebar-collapsed .sidebar {
    padding: 16px 12px;
  }

  body.sidebar-collapsed .sidebar-head {
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
  }

  body.sidebar-collapsed .sidebar-head .brand {
    justify-content: center;
  }

  body.sidebar-collapsed .sidebar-head .brand-text {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-toggle {
    width: 38px !important;
    height: 34px !important;
    min-height: 34px !important;
    transform: rotate(180deg);
  }

  body.sidebar-collapsed .side-nav a {
    display: flex !important;
    justify-content: center;
    grid-template-columns: none;
    padding: 9px;
    min-height: 52px;
    position: relative;
  }

  body.sidebar-collapsed .side-nav .nav-label {
    display: none !important;
  }

  body.sidebar-collapsed .side-nav .nav-icon {
    margin: 0;
  }

  body.sidebar-collapsed .side-nav a:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #181824;
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
    padding: 8px 10px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 18px 50px rgba(0,0,0,.30);
    z-index: 99999;
    font-size: 12px;
    font-weight: 800;
  }
}

/* Mobile: menu horizontal compacto */
@media (max-width: 980px) {
  .sidebar-head {
    padding-bottom: 12px;
    margin-bottom: 10px;
  }

  .sidebar-toggle {
    display: none !important;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
  }

  .side-nav a {
    min-width: 142px;
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .side-nav .nav-icon {
    width: 32px !important;
    height: 32px !important;
  }

  .side-nav .nav-label {
    font-size: 13px;
  }
}

/* FIX UX - Menu sempre legível em todo o sistema */
.sidebar-toggle {
  display: none !important;
}

body.sidebar-collapsed .app-shell,
.app-shell {
  grid-template-columns: 270px minmax(0,1fr) !important;
}

body.sidebar-collapsed .sidebar {
  padding: 18px !important;
  overflow: auto !important;
}

body.sidebar-collapsed .sidebar-head {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 6px 4px 16px !important;
}

body.sidebar-collapsed .sidebar-head .brand {
  justify-content: flex-start !important;
}

body.sidebar-collapsed .sidebar-head .brand-text,
body.sidebar-collapsed .side-nav .nav-label,
body.sidebar-collapsed .side-nav .nav-copy,
.sidebar-head .brand-text,
.side-nav .nav-label,
.side-nav .nav-copy {
  display: block !important;
}

body.sidebar-collapsed .side-nav a,
.side-nav a {
  display: grid !important;
  grid-template-columns: 36px minmax(0, 1fr) !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 11px !important;
  min-height: 48px !important;
  padding: 8px 10px !important;
}

body.sidebar-collapsed .side-nav .nav-icon,
.side-nav .nav-icon {
  width: 34px !important;
  height: 34px !important;
  border-radius: 13px !important;
  display: grid !important;
  place-items: center !important;
  margin: 0 !important;
  background: rgba(255,255,255,.08) !important;
}

body.sidebar-collapsed .side-nav .nav-label,
.side-nav .nav-label {
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  border-radius: 0 !important;
  color: #f8f8ff !important;
  font-size: 14px !important;
  line-height: 1.16 !important;
  font-weight: 850 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body.sidebar-collapsed .side-nav a:hover::after {
  display: none !important;
  content: none !important;
}

.side-nav a > span:not(.nav-icon) {
  background: transparent !important;
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
}

/* Remove divisões/títulos antigos se algum ainda estiver no HTML */
.nav-title,
.side-nav-group,
.sidebar-note {
  display: none !important;
}

/* FIX GLOBAL - Selects e options legíveis */
.form-control,
.custom-select,
select,
textarea,
input {
  color: #ffffff !important;
  background-color: rgba(255,255,255,.075) !important;
  border-color: rgba(255,255,255,.14) !important;
}

.form-control::placeholder,
textarea::placeholder,
input::placeholder {
  color: rgba(255,255,255,.48) !important;
}

select option,
.custom-select option {
  color: #ffffff !important;
  background-color: #21152f !important;
}

select option:checked,
.custom-select option:checked {
  background-color: #3b00b9 !important;
  color: #ffffff !important;
}

.form-control:focus,
.custom-select:focus,
select:focus,
textarea:focus,
input:focus {
  color: #ffffff !important;
  background-color: rgba(255,255,255,.10) !important;
  border-color: #a7ff00 !important;
  box-shadow: 0 0 0 .18rem rgba(167,255,0,.16) !important;
  outline: none !important;
}

label {
  color: rgba(255,255,255,.92);
}

/* FIX GLOBAL - Selects/options legíveis */
.form-control,
.custom-select,
select,
textarea,
input {
  color: #ffffff !important;
  background-color: rgba(255,255,255,.075) !important;
  border-color: rgba(255,255,255,.14) !important;
}

.form-control::placeholder,
textarea::placeholder,
input::placeholder {
  color: rgba(255,255,255,.48) !important;
}

select option,
.custom-select option {
  color: #ffffff !important;
  background-color: #21152f !important;
}

select option:checked,
.custom-select option:checked {
  background-color: #3b00b9 !important;
  color: #ffffff !important;
}

.form-control:focus,
.custom-select:focus,
select:focus,
textarea:focus,
input:focus {
  color: #ffffff !important;
  background-color: rgba(255,255,255,.10) !important;
  border-color: #a7ff00 !important;
  box-shadow: 0 0 0 .18rem rgba(167,255,0,.16) !important;
  outline: none !important;
}
