:root {
  color-scheme: dark;
  --bg: #090b0f;
  --bg-2: #11141a;
  --panel: #fafafa;
  --panel-soft: rgba(35, 41, 51, 0.5);
  --panel-line: rgba(255, 255, 255, 0.08);
  --ink: #FFFFFF;
  --muted: #a3adb8;
  --white: #ffffff;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --red: #f04438;
  --red-2: #f87171;
  --teal: #10b981;
  --teal-2: #34d399;
  --gold: #f59e0b;
  --blue: #3b82f6;
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 24px 50px -16px rgba(0, 0, 0, 0.5);
  --shadow-light: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --font:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial,
    sans-serif;
  --font-title: "Plus Jakarta Sans", var(--font);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(
      circle at 15% 10%,
      rgba(16, 185, 129, 0.05),
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 90%,
      rgba(59, 130, 246, 0.04),
      transparent 45%
    );
  background-attachment: fixed;
  color: var(--white);
  font-family: var(--font);
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(27, 32, 38, 0.09);
  font-size: 12px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px;
  border-right: 1px solid var(--line);
  background: rgba(18, 22, 31, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand.compact {
  padding-bottom: 0;
  border-bottom: 0;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(181, 135, 48, 0.45);
  border-radius: var(--radius);
  background: #211e19;
  color: var(--gold);
  font-size: 14px;
  font-weight: 850;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
}

.brand p,
.sidebar-meta p,
.eyebrow,
.small,
.table-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 6px;
  margin: 22px 0;
}

.nav-button,
.quick-button,
.icon-button,
.primary-button,
.ghost-button,
.danger-button,
.chip-button,
.segmented button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: inherit;
  background: transparent;
  transition: 160ms ease;
}

.nav-button {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  color: #d9dde0;
  text-align: left;
}

.nav-button svg,
.quick-button svg,
.icon-button svg,
.primary-button svg,
.ghost-button svg,
.danger-button svg,
.chip-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.nav-button:hover,
.nav-button.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.nav-button.active {
  color: var(--white);
}

.nav-count {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-meta {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sync-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(66, 183, 168, 0.24);
  border-radius: var(--radius);
  background: rgba(27, 128, 122, 0.09);
}

.user-card {
  border-color: rgba(181, 135, 48, 0.28);
  background: rgba(181, 135, 48, 0.08);
}

.logout-button {
  width: 100%;
}

.sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #d4e7e3;
  font-size: 13px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(
      circle at 15% 10%,
      rgba(16, 185, 129, 0.08),
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 90%,
      rgba(59, 130, 246, 0.06),
      transparent 45%
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size:
    100% 100%,
    100% 100%,
    48px 48px,
    48px 48px;
}

.auth-card {
  display: grid;
  gap: 22px;
  width: min(100%, 520px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 27, 32, 0.96);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 5px 0 0;
  font-size: 30px;
  line-height: 1.1;
}

.auth-copy {
  max-width: 430px;
  color: #a9b1b6;
  font-size: 14px;
  line-height: 1.45;
}

.auth-card input {
  color: var(--white);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid rgba(200, 77, 85, 0.4);
  border-radius: var(--radius-sm);
  color: #ffd9dc;
  background: rgba(158, 47, 53, 0.18);
  font-size: 13px;
}

.discord-login-panel,
.dev-login {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.discord-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  border: 1px solid rgba(66, 183, 168, 0.5);
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--teal);
  font-weight: 850;
  text-decoration: none;
}

.discord-button:hover {
  background: #136b65;
}

.discord-button.disabled {
  cursor: not-allowed;
  border-color: var(--line);
  color: #adb5ba;
  background: rgba(255, 255, 255, 0.08);
}

.discord-button svg {
  width: 18px;
  height: 18px;
}

.discord-status {
  display: grid;
  gap: 7px;
}

.discord-status p {
  margin: 0;
  color: #a9b1b6;
  font-size: 13px;
  line-height: 1.45;
}

.dev-login {
  border-style: dashed;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.login-chip {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.login-chip:hover {
  border-color: rgba(181, 135, 48, 0.55);
}

.login-chip span {
  color: #a9b1b6;
  font-size: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 22, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 25px;
  line-height: 1.15;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.content {
  display: grid;
  gap: 18px;
  padding: 22px 24px 34px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(310px, 0.75fr);
  gap: 18px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(244, 240, 232, 0.96);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.panel.dark {
  background: rgba(23, 27, 32, 0.96);
  color: var(--white);
}

.panel-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--panel-line);
}

.panel.dark .panel-header {
  border-bottom-color: var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.panel-body {
  padding: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.metric .value {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  font-weight: 850;
  line-height: 1;
}

.metric .trend {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 12px;
  padding: 3px 8px;
  border-radius: 8px;
  color: #0f5b55;
  background: rgba(27, 128, 122, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.unit-card {
  display: grid;
  gap: 12px;
  min-height: 170px;
  padding: 15px;
  border: 1px solid var(--panel-line);
  border-left: 4px solid var(--unit-color, var(--teal));
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
  color: var(--ink);
  text-align: left;
}

.unit-card:hover,
.unit-card.selected {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: var(--shadow-hover);
  background: rgba(0, 0, 0, 0.4);
}

.unit-card h4,
.detail-title h4 {
  margin: 0;
  font-size: 16px;
}

.unit-card p,
.detail-title p,
.activity p,
.timeline p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.unit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill,
  .status,
  .tag {
    display: inline-flex;

  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.pill {
  padding: 4px 8px;
  color: #15322f;
  background: rgba(27, 128, 122, 0.13);
}

.pill.gold {
  color: #4d3510;
  background: rgba(181, 135, 48, 0.18);
}

.pill.red {
  color: #6b181e;
  background: rgba(158, 47, 53, 0.14);
}

.status {
  padding: 4px 9px;
  color: #123d39;
  background: rgba(66, 183, 168, 0.17);
}

.status.alerta,
.status.suspenso,
.status.reprovado,
.status.exonerado,
.status.bloqueado {
  color: #7c2229;
  background: rgba(158, 47, 53, 0.15);
}

.status.andamento,
.status.treinamento,
.status.pendente {
  color: #624313;
  background: rgba(181, 135, 48, 0.18);
}

.status.alta,
.status.critica {
  color: #7c2229;
  background: rgba(158, 47, 53, 0.15);
}

.status.media,
.status.aberta {
  color: #624313;
  background: rgba(181, 135, 48, 0.18);
}

.status.baixa,
.status.resolvida,
.status.feito,
.status.cumprido,
.status.apresentado,
.status.encerrado {
  color: #123d39;
  background: rgba(66, 183, 168, 0.17);
}

.status.arquivada,
.status.cancelado,
.status.expirado {
  color: #4d5156;
  background: rgba(27, 32, 38, 0.08);
}

.status.custodia {
  color: #624313;
  background: rgba(181, 135, 48, 0.18);
}

.tag {
  padding: 4px 8px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 8px;
  background: rgba(27, 32, 38, 0.1);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--unit-color, var(--teal));
}

.detail-stack,
.form-grid,
.timeline,
.activity-list,
.rank-list,
.checklist,
.module-stack {
  display: grid;
  gap: 12px;
}

.detail-title {
  display: grid;
  gap: 6px;
}

.detail-badge {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.detail-badge .letter {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--unit-color, var(--teal));
  color: #fff;
  font-weight: 900;
}

.activity,
.timeline-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.production-group,
.production-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.production-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.production-item.done {
  border-color: rgba(66, 183, 168, 0.42);
  background: rgba(66, 183, 168, 0.08);
}

.production-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.permission-matrix table {
  min-width: 760px;
}

.tablet-shell {
  display: grid;
  gap: 16px;
}

.tablet-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  background: #101820;
  color: var(--white);
  box-shadow: var(--shadow);
}

.tablet-top h3 {
  margin: 0;
  font-size: 24px;
}

.tablet-search input {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.tablet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
}

.activity strong,
.timeline strong {
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--panel-line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: #656061;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.panel.dark th,
.panel.dark td {
  border-bottom-color: var(--line);
}

.panel.dark th {
  color: #9ca4a9;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.toolbar,
.inline-actions,
.split-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.unit-card > .split-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.unit-card > .split-row .pill {
  min-height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.command-unit {
  cursor: default;
}

.toolbar {
  justify-content: space-between;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.4);
  padding: 9px 10px;
  outline: none;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.document-preview {
  min-height: 320px;
  font-family: Consolas, SFMono-Regular, Menlo, monospace;
  line-height: 1.45;
}

.log-block {
  overflow-x: auto;
  max-height: 180px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: #dce5e7;
  background: rgba(0, 0, 0, 0.22);
  font-family: Consolas, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(27, 128, 122, 0.75);
  box-shadow: 0 0 0 3px rgba(27, 128, 122, 0.14);
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.primary-button,
.ghost-button,
.danger-button,
.quick-button,
.icon-button,
.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  font-weight: 800;
}

.primary-button {
  border-color: rgba(27, 128, 122, 0.52);
  color: #fff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
  border-color: transparent;
}

.ghost-button,
.chip-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.panel .ghost-button,
.panel .chip-button {
  border-color: var(--panel-line);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.4);
}

.ghost-button:hover,
.chip-button:hover,
.chip-button.active {
  border-color: rgba(181, 135, 48, 0.55);
}

.danger-button {
  border-color: rgba(158, 47, 53, 0.36);
  color: #fff;
  background: var(--red);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.quick-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.07);
}

.quick-button:hover {
  border-color: rgba(66, 183, 168, 0.5);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.segmented button {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--ink);
  font-weight: 800;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.exam-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
}

.exam-list {
  display: grid;
  gap: 8px;
  align-self: start;
}

.exam-option {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.4);
  text-align: left;
}

.exam-option.active {
  border-color: rgba(27, 128, 122, 0.5);
  background: rgba(27, 128, 122, 0.09);
}

.question {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.exam-bank-card,
.question-bank,
.question-list,
.criteria-list {
  display: grid;
  gap: 12px;
}

.question-bank {
  padding-top: 12px;
  border-top: 1px solid var(--panel-line);
}

.question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.question h4 {
  margin: 0;
  font-size: 14px;
}

.answers {
  display: grid;
  gap: 7px;
}

.answers label,
.checklist label {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.answers input,
.checklist input {
  width: 16px;
  min-height: 16px;
  margin-top: 2px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 360px;
  padding: 13px 15px;
  border: 1px solid rgba(66, 183, 168, 0.45);
  border-radius: var(--radius);
  color: #e9fffb;
  background: #173330;
  box-shadow: var(--shadow);
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--panel-line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.kanban-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.kanban-column h4 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
}

.case-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.case-card h5 {
  margin: 0;
  font-size: 14px;
}

.case-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.attachment-list,
.attachment-upload {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.attachment-item p {
  margin: 2px 0 0;
}

.attachment-upload {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 1fr) auto;
  padding-top: 8px;
  border-top: 1px solid var(--panel-line);
}

.attachment-upload input {
  min-width: 0;
}

.investigation-workspace {
  display: grid;
  gap: 18px;
}

.investigation-full-panel {
  min-height: calc(100vh - 148px);
}

.investigation-full-header h3 {
  overflow-wrap: anywhere;
}

.investigation-detail {
  display: grid;
  gap: 14px;
}

.investigation-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.wide-card-action {
  width: 100%;
}

.investigation-detail .access-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.empty-state.compact {
  min-height: 86px;
}

.note-item {
  grid-template-columns: 1fr;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.evidence-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
}

.evidence-preview {
  display: grid;
  min-height: 180px;
  aspect-ratio: 16 / 10;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--panel-line);
  background: #05070a;
}

.evidence-preview img,
.evidence-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.evidence-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
}

.evidence-info strong {
  display: block;
  overflow-wrap: anywhere;
}

.evidence-info p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.evidence-note {
  color: #d4dce2 !important;
}

.file-preview {
  display: grid;
  gap: 8px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.file-preview svg {
  width: 34px;
  height: 34px;
}

.upload-picker {
  position: relative;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 12px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  color: #dce5e7;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.upload-picker span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.upload-picker svg {
  width: 17px;
  height: 17px;
}

.upload-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.rank-pos {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

.rank-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.rank-row small {
  color: var(--muted);
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.access-stat {
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.access-stat strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.access-stat span {
  color: var(--muted);
  font-size: 12px;
}

.identity-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.identity-card h4 {
  margin: 2px 0 0;
  font-size: 16px;
}

.profile-hero {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}

.profile-hero h3 {
  margin: 0 0 5px;
  font-size: 21px;
}

.profile-hero p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.profile-avatar,
.mini-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(27, 32, 38, 0.08);
}

.profile-avatar {
  width: 82px;
  height: 82px;
}

.profile-avatar img,
.mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-avatar {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

.user-cell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.role-token {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  color: #354047;
  background: rgba(0, 0, 0, 0.4);
  font-family: Consolas, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.role-token.matched {
  border-color: rgba(27, 128, 122, 0.5);
  color: #0d4e48;
  background: rgba(27, 128, 122, 0.14);
  font-weight: 800;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.permission-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.permission-item.enabled {
  border-color: rgba(66, 183, 168, 0.28);
  background: rgba(27, 128, 122, 0.09);
}

.permission-item p {
  margin: 0;
  color: #a9b1b6;
  font-size: 12px;
  line-height: 1.45;
}

.permission-item code {
  justify-self: start;
  color: #d9e7e4;
  background: rgba(255, 255, 255, 0.08);
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-entry {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.audit-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--blue);
}

.audit-icon svg {
  width: 18px;
  height: 18px;
}

.audit-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.audit-content p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.audit-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.audit-details span {
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  color: #3f474c;
  background: rgba(0, 0, 0, 0.4);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.role-table {
  min-width: 840px;
}

.role-table code {
  background: rgba(27, 32, 38, 0.08);
}

.role-emoji {
  width: 72px;
  font-size: 20px;
  text-align: center;
}

.module-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.permission-gate {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 118px;
  padding: 14px;
  border: 1px dashed rgba(181, 135, 48, 0.45);
  border-radius: var(--radius);
  background: rgba(181, 135, 48, 0.08);
}

.permission-gate p {
  margin: 5px 0 0;
  color: #a9b1b6;
  font-size: 13px;
  line-height: 1.45;
}

.module-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--red);
}

.module-card h4 {
  margin: 0;
  font-size: 14px;
}

.module-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .content-grid,
  .exam-shell,
  .tablet-grid,
  .tablet-top,
  .investigation-detail-grid {
    grid-template-columns: 1fr;
  }

  .metrics,
  .unit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .access-grid,
  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .investigation-detail .access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 9999;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .nav {
    grid-template-columns: 1fr;
  }
  .topbar {
    position: static;
    grid-template-columns: auto 1fr;
    gap: 16px;
  }
  .mobile-menu-toggle { display: inline-flex !important; }
}

@media (max-width: 600px){
  .metrics,
  .unit-grid,
  .form-grid,
  .kanban,
  .question-row,
  .attachment-item,
  .attachment-upload,
  .access-grid,
  .permission-grid,
  .investigation-detail .access-grid,
  .evidence-info {
    grid-template-columns: 1fr;
  }

  .investigation-full-panel {
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    position: fixed !important;
    z-index: 9999 !important;
    width: 280px !important;
    height: 100vh !important;
    transform: translateX(-100%) !important;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5) !important;
    transition: transform 0.3s ease !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
  }
  .nav {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .topbar {
    position: sticky !important;
    grid-template-columns: auto 1fr auto !important;
    padding: 10px 20px !important;
  }
  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--white);
    padding: 8px;
    border-radius: 8px;
  }
  .mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.1);
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    position: fixed !important;
    z-index: 9999 !important;
    width: 280px !important;
    height: 100vh !important;
    transform: translateX(-100%) !important;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5) !important;
    transition: transform 0.3s ease !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
  }
  .nav {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .topbar {
    position: sticky !important;
    grid-template-columns: auto 1fr auto !important;
    padding: 10px 20px !important;
  }
  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--white);
    padding: 8px;
    border-radius: 8px;
  }
  .mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.1);
  }
}

/* Premium Glassmorphism */
.panel, .metric, .unit-card, .auth-card, .case-card, .kanban-column, .activity, .timeline-item {
  background: var(--panel) !important;
  border: 1px solid var(--panel-line) !important;
  color: var(--white) !important;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.unit-card:hover, .metric:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 32px rgba(0,0,0,0.5) !important;
}

h1, h2, h3, h4, h5, .value {
  color: #fff !important;
}


/* ========================================================================= 
   ULTIMATE POLISH: HYPER-MODERN GLASSMORPHISM & NEUMORPHISM (LINEAR/VERCEL)
   ========================================================================= */

:root {
  --bg: #030407 !important;
  --bg-2: #0A0D15 !important;
  --panel: rgba(14, 18, 28, 0.65) !important;
  --panel-hover: rgba(22, 28, 42, 0.8) !important;
  --panel-line: rgba(255, 255, 255, 0.08) !important;
  --panel-line-hover: rgba(255, 255, 255, 0.15) !important;
  --white: #FFFFFF !important;
  --muted: #94A3B8 !important;
  --teal: #10B981 !important;
  --gold: #F59E0B !important;
  --red: #EF4444 !important;
  --blue: #3B82F6 !important;
  
  --shadow-sm: 0 4px 12px -2px rgba(0, 0, 0, 0.5) !important;
  --shadow-md: 0 12px 32px -4px rgba(0, 0, 0, 0.6) !important;
  --shadow-lg: 0 24px 64px -8px rgba(0, 0, 0, 0.7) !important;
  
  --radius-sm: 8px !important;
  --radius-md: 14px !important;
  --radius-lg: 20px !important;
  --radius-xl: 28px !important;
}

/* 1. Immersive Ambient Background */
body {
  background: var(--bg) !important;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(16, 185, 129, 0.08), transparent 30vw),
    radial-gradient(circle at 85% 90%, rgba(59, 130, 246, 0.06), transparent 30vw),
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px) !important;
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px !important;
  background-attachment: fixed !important;
  color: var(--white) !important;
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif !important;
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 2. Glassmorphism Panels (Exquisite Depth and Lighting) */
.panel, .metric, .unit-card, .auth-card, .case-card, .kanban-column, .timeline-item, .activity {
  background: var(--panel) !important;
  border: 1px solid var(--panel-line) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.06),
    inset 0 -1px 1px rgba(0, 0, 0, 0.4),
    var(--shadow-md) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  position: relative;
  overflow: hidden;
}

/* Internal Glow */
.panel::before, .metric::before, .unit-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.panel:hover, .metric:hover, .unit-card:hover, .case-card:hover {
  transform: translateY(-4px) scale(1.005) !important;
  background: var(--panel-hover) !important;
  border-color: var(--panel-line-hover) !important;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    0 0 32px rgba(255, 255, 255, 0.03),
    var(--shadow-lg) !important;
}

/* 3. Typography & Gradients */
h1, h2, h3, .value, .brand h1 {
  background: linear-gradient(180deg, #FFFFFF 0%, #A1A1AA 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  text-shadow: 0 2px 20px rgba(255,255,255,0.05);
}

p, span, label {
  color: var(--muted) !important;
  line-height: 1.6;
}

.unit-card h4 {
  background: none !important;
  -webkit-text-fill-color: initial !important;
  color: #fff !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  margin-bottom: 4px !important;
}

/* 4. Elegant Sidebar */
.sidebar {
  background: rgba(5, 7, 12, 0.8) !important;
  border-right: 1px solid var(--panel-line) !important;
  box-shadow: 1px 0 24px rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(40px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
}

.nav-button {
  border-radius: var(--radius-sm) !important;
  color: var(--muted) !important;
  transition: all 0.2s ease !important;
  padding: 12px 16px !important;
  font-weight: 600 !important;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--white) !important;
  transform: translateX(4px) !important;
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--white) !important;
  box-shadow: inset 3px 0 0 var(--teal) !important;
}

/* 5. Stunning Pills & Tags */
.pill, .status, .tag {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #34D399 !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
  padding: 6px 12px !important;
  border-radius: 8px !important; /* Soft squares */
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.1) !important;
  backdrop-filter: blur(8px) !important;
}

.pill.red, .status.alerta, .status.suspenso, .status.reprovado, .status.exonerado, .status.bloqueado {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #F87171 !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.1) !important;
}

.pill.gold, .status.andamento, .status.treinamento, .status.pendente {
  background: rgba(245, 158, 11, 0.1) !important;
  color: #FBBF24 !important;
  border-color: rgba(245, 158, 11, 0.2) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1) !important;
}

/* 6. Perfect Primary Buttons */
.primary-button, .discord-button {
  background: linear-gradient(180deg, #34D399 0%, #10B981 100%) !important;
  color: #022C22 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 
    inset 0 1px 1px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(16, 185, 129, 0.3) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 800 !important;
  padding: 10px 20px !important;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.primary-button:hover, .discord-button:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 
    inset 0 1px 1px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(16, 185, 129, 0.4) !important;
  background: linear-gradient(180deg, #6EE7B7 0%, #34D399 100%) !important;
}

/* 7. Forms and Inputs */
input, textarea, select {
  background: rgba(0, 0, 0, 0.2) !important;
  border: 1px solid var(--panel-line) !important;
  color: #fff !important;
  border-radius: var(--radius-sm) !important;
  padding: 12px 14px !important;
  transition: all 0.2s ease !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

input:focus, textarea:focus, select:focus {
  outline: none !important;
  border-color: var(--teal) !important;
  background: rgba(0, 0, 0, 0.4) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2), inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* 8. Invisible Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
  background: rgba(255, 255, 255, 0.1); 
  border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* 9. Correcting Unit Cards alignment so text wraps correctly */
.unit-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 12px !important;
}
.unit-card .split-row {
  display: flex !important;
  width: 100% !important;
  justify-content: space-between !important;
  align-items: center !important;
}
.unit-card p {
  white-space: normal !important;
  text-wrap: wrap !important;
}

/* 10. Ultimate Profile / User Card */
.sidebar-meta {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  padding-top: 24px !important;
  border-top: 1px solid var(--panel-line) !important;
  margin-top: 16px !important;
}

.sync-card.user-card {
  padding: 16px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  transition: all 0.2s ease !important;
}

.sync-card.user-card:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.sync-card.user-card .sync-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 8px !important;
}

.sync-card.user-card strong {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: var(--white) !important;
  word-break: break-all !important;
  line-height: 1.2 !important;
}

.sync-card.user-card p {
  font-size: 0.75rem !important;
  color: var(--muted) !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  word-break: break-all !important;
}

.logout-button {
  width: 100% !important;
  padding: 10px !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  font-size: 0.85rem !important;
}

.logout-button:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #FFF !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2) !important;
}

.logout-button svg {
  width: 16px !important;
  height: 16px !important;
}

/* Other tiny sync-cards (server status, etc) */
.sync-card:not(.user-card) {
  padding: 12px !important;
  background: transparent !important;
  border: 1px solid var(--panel-line) !important;
  border-radius: var(--radius-md) !important;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.sync-card:not(.user-card):hover {
  opacity: 1;
}

/* 10. Ultimate Profile / User Card */
.sidebar-meta {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  padding-top: 24px !important;
  border-top: 1px solid var(--panel-line) !important;
  margin-top: 16px !important;
}

.sync-card.user-card {
  padding: 16px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  transition: all 0.2s ease !important;
}

.sync-card.user-card:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.sync-card.user-card .sync-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 8px !important;
}

.sync-card.user-card strong {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: var(--white) !important;
  word-break: break-all !important;
  line-height: 1.2 !important;
}

.sync-card.user-card p {
  font-size: 0.75rem !important;
  color: var(--muted) !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  word-break: break-all !important;
}

.logout-button {
  width: 100% !important;
  padding: 10px !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  font-size: 0.85rem !important;
}

.logout-button:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #FFF !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2) !important;
}

.logout-button svg {
  width: 16px !important;
  height: 16px !important;
}

/* Other tiny sync-cards (server status, etc) */
.sync-card:not(.user-card) {
  padding: 12px !important;
  background: transparent !important;
  border: 1px solid var(--panel-line) !important;
  border-radius: var(--radius-md) !important;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.sync-card:not(.user-card):hover {
  opacity: 1;
}

/* 11. Ultimate Layout & Space Utilization */
.main {
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  overflow-x: hidden !important;
}

.content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 32px;
  gap: 24px;
}

/* Allow kanban, tables, or main grids to fill remaining height if needed */
.dashboard-grid, .content-grid, .kanban {
  flex: 1 !important;
}

/* Fix panel borders that were too bright/greenish */
.panel, .metric, .unit-card, .auth-card, .case-card, .kanban-column, .timeline-item, .activity {
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.6) !important;
  background: rgba(14, 18, 28, 0.45) !important;
}

/* Tables and Panels expand correctly */
.panel {
  display: flex !important;
  flex-direction: column !important;
}
.panel table {
  width: 100% !important;
}

/* 12. Smart Collapsible Sidebar & Space Utilization */
.app-shell {
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

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

.app-shell.collapsed .sidebar {
  padding: 24px 12px !important;
  align-items: center !important;
}

.app-shell.collapsed .brand {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.app-shell.collapsed .brand > div:nth-child(2) {
  display: none !important; /* Hide brand text */
}

.app-shell.collapsed .nav-button {
  grid-template-columns: 1fr !important;
  justify-content: center !important;
  padding: 12px 0 !important;
  text-align: center !important;
}

.app-shell.collapsed .nav-button span {
  display: none !important;
}

.app-shell.collapsed .nav-count {
  display: none !important;
}

.app-shell.collapsed .sidebar-meta {
  display: none !important; /* Hide the whole profile section when collapsed to save space */
}

/* Expand button */
.collapse-toggle {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  right: -14px;
  top: 32px;
  backdrop-filter: blur(8px);
  z-index: 100;
  transition: all 0.2s ease;
}

.collapse-toggle:hover {
  background: var(--teal);
  color: #000;
  border-color: var(--teal);
  transform: scale(1.1);
}

.app-shell.collapsed .collapse-toggle {
  right: -14px;
  transform: rotate(180deg);
}

.app-shell.collapsed .collapse-toggle:hover {
  transform: rotate(180deg) scale(1.1);
}

/* Make sure mobile overrides this correctly */
@media (max-width: 900px) {
  .app-shell.collapsed {
    grid-template-columns: 1fr !important; /* mobile ignores collapsed grid */
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block !important;
    min-height: 100vh !important;
  }

  .main {
    min-height: 100vh !important;
  }
}

/* ========================================================================= 
   SUPREME FIX: 100% PERFECT SIDEBAR & LAYOUT
   ========================================================================= */

/* 1. Sidebar Flex Container */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  max-height: 100vh !important;
  position: sticky !important;
  top: 0 !important;
  overflow: visible !important;
  padding: 24px 16px !important;
  box-sizing: border-box !important;
}

/* 2. Nav Menu - Scrollable Area */
.nav {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin: 24px 0 16px 0 !important;
  padding-right: 8px !important;
}

/* Fix Scrollbars inside Nav */
.nav::-webkit-scrollbar {
  width: 4px !important;
}
.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 4px !important;
}

/* 3. Perfect Nav Buttons */
.nav-button {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  padding: 10px 14px !important;
  gap: 12px !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
}

.nav-button svg {
  flex-shrink: 0 !important;
  width: 18px !important;
  height: 18px !important;
}

.nav-button span:not(.nav-count) {
  flex: 1 !important;
  text-align: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #FFF !important;
  transform: translateX(2px) !important;
}

.nav-button.active {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #10B981 !important;
  box-shadow: none !important;
  position: relative !important;
}

.nav-button.active::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  top: 10% !important;
  height: 80% !important;
  width: 3px !important;
  background: #10B981 !important;
  border-radius: 0 4px 4px 0 !important;
}

/* 4. Collapsed Sidebar Perfection */
.app-shell.collapsed {
  grid-template-columns: 80px minmax(0, 1fr) !important;
}

.app-shell.collapsed .sidebar {
  padding: 24px 8px !important;
  align-items: center !important;
}

.app-shell.collapsed .nav {
  margin: 24px 0 !important;
  padding-right: 0 !important;
  align-items: center !important;
  width: 100% !important;
}

.app-shell.collapsed .nav::-webkit-scrollbar {
  width: 0px !important; /* Hide scrollbar when collapsed */
}

.app-shell.collapsed .nav-button {
  justify-content: center !important;
  padding: 12px 0 !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 12px !important;
}

.app-shell.collapsed .nav-button.active::before {
  left: -8px !important; /* Move indicator to edge of sidebar */
}

.app-shell.collapsed .brand-mark {
  width: 40px !important;
  height: 40px !important;
}

/* 5. User Profile Area (Fix Bottom Cut-off) */
.sidebar-meta {
  flex-shrink: 0 !important; /* Do not shrink! */
  margin-top: auto !important; /* Push to bottom */
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  padding-top: 16px !important;
  border-top: 1px solid var(--panel-line) !important;
}

/* Hide extra sync cards to save space, only show User Profile */
.sidebar-meta > .sync-card:not(.user-card) {
  display: none !important;
}

.sync-card.user-card {
  padding: 12px !important;
  gap: 10px !important;
}

/* Ensure the Sair button has enough height and is easily clickable */
.logout-button {
  padding: 10px !important;
  min-height: 36px !important;
}

@media (max-height: 700px) {
  .sync-card.user-card p {
    display: none !important; /* Hide long discord id on small screens */
  }
}

/* EXTRA DARK COMPONENT FIX */
.access-stat, .module-card, .detail-badge, .identity-card, .quiz-option, .question-builder, .shift-card, .log-item, input, select, textarea { background: rgba(0, 0, 0, 0.4) !important; border: 1px solid rgba(255, 255, 255, 0.05) !important; color: #ededed !important; box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2) !important; }
.access-stat:hover, .module-card:hover, input:focus, select:focus, textarea:focus { background: rgba(0, 0, 0, 0.6) !important; border-color: rgba(255, 255, 255, 0.15) !important; }
.access-stat strong, .module-card h4 { color: #fff !important; }
.access-stat span, .access-stat .eyebrow, .module-card p, .log-item .details { color: #9ba1a6 !important; }
.detail-stack > div, .split-row > div { background: rgba(0,0,0,0.2) !important; border-color: rgba(255,255,255,0.03) !important; }
select option { background: #111 !important; color: #fff !important; }

/* ABSOLUTE DARK MODE PURIFIER */
.exam-option, .exam-option.active, .question-row, .chip-button, .ghost-button, .quick-button, .segmented button, .exam-bank-card, .audit-list, .permission-gate, .question h4, .kanban-column h4, .rank-pos, .identity-card h4, .audit-icon, .checklist li, .unit-card.selected, .detail-badge, .production-item, table th, table td, .row-actions button, .question-list > div, .activity, .pill, .tag { background: rgba(0, 0, 0, 0.3) !important; border-color: rgba(255, 255, 255, 0.05) !important; color: #e5e7eb !important; box-shadow: none !important; }
.exam-option.active { background: rgba(16, 185, 129, 0.1) !important; border-color: rgba(16, 185, 129, 0.4) !important; }
.chip-button:hover, .ghost-button:hover, .exam-option:hover, .question-row:hover, .row-actions button:hover { background: rgba(0, 0, 0, 0.6) !important; border-color: rgba(255, 255, 255, 0.15) !important; }
.question-row strong, .exam-option strong, .activity strong, table th, table td { color: #fff !important; }
.question-row p, .exam-option p, .activity p { color: #a1a1aa !important; }
.chip-button, .ghost-button { color: #d1d5db !important; fill: currentColor; }

/* ULTRA GLASSMORPHISM BEAUTY FIX */
.exam-option, .question-row, .unit-card, .activity, .log-item { border-radius: 12px !important; border: 1px solid rgba(255, 255, 255, 0.05) !important; padding: 16px !important; margin-bottom: 8px !important; backdrop-filter: blur(20px) !important; transition: all 0.3s ease !important; }
.exam-option:hover, .question-row:hover, .unit-card:hover, .activity:hover, .log-item:hover { border-color: rgba(255, 255, 255, 0.15) !important; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important; background: rgba(0, 0, 0, 0.5) !important; transform: translateY(-2px) !important; }
.chip-button, .ghost-button, .quick-button, .segmented button { border-radius: 8px !important; backdrop-filter: blur(10px) !important; }
.row-actions { gap: 8px !important; }


/* =========================================
   THE MASTERPIECE UPDATE - ULTRA PREMIUM UX
   ========================================= */

/* 1. Fluid Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel, .unit-card, .activity, .exam-option, .question-row, .module-card, .identity-card, .access-stat {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.access-grid > div:nth-child(1) { animation-delay: 0.05s; }
.access-grid > div:nth-child(2) { animation-delay: 0.10s; }
.access-grid > div:nth-child(3) { animation-delay: 0.15s; }
.access-grid > div:nth-child(4) { animation-delay: 0.20s; }

/* 2. Apple/Linear style Premium Toasts */
.toast {
  background: rgba(10, 10, 10, 0.85) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5), 0 0 20px rgba(16, 185, 129, 0.15) !important;
  border-radius: 100px !important;
  padding: 12px 24px !important;
  color: #fff !important;
  font-weight: 500;
  transform: translateY(20px) scale(0.9);
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes toastIn {
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* 3. Neon Glow on Inputs (Foco) */
input:focus, select:focus, textarea:focus {
  background: rgba(0, 0, 0, 0.6) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2), inset 0 2px 10px rgba(0,0,0,0.3) !important;
  outline: none !important;
}

/* 4. Elegant Invisible Scrollbars */
::-webkit-scrollbar {
  width: 5px !important;
  height: 5px !important;
}
::-webkit-scrollbar-track {
  background: transparent !important;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

/* 5. Micro-interactions and buttons */
.primary-button, .ghost-button, .chip-button, .nav-button, .exam-option {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.primary-button:active, .ghost-button:active, .chip-button:active, .nav-button:active, .exam-option:active {
  transform: scale(0.96) !important;
}
.chip-button:hover svg, .ghost-button:hover svg {
  transform: scale(1.1) rotate(-3deg);
  transition: transform 0.2s;
}
.danger-button:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
}

/* MESH & SPOTLIGHT */
body { position: relative; background-color: var(--bg) !important; }
body::before { content: ''; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: -1; background: radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 40%), radial-gradient(circle at 85% 30%, rgba(126, 63, 152, 0.05) 0%, transparent 40%); }
.panel, .unit-card, .activity, .exam-option, .question-row, .identity-card, .module-card { position: relative; }
.panel::after, .unit-card::after, .activity::after, .exam-option::after, .question-row::after, .identity-card::after, .module-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: inherit; padding: 1px; background: radial-gradient( 600px circle at var(--mouse-x, -500px) var(--mouse-y, -500px), rgba(255, 255, 255, 0.15), transparent 40% ); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: 0; transition: opacity 0.3s ease; z-index: 10; }
.panel:hover::after, .unit-card:hover::after, .activity:hover::after, .exam-option:hover::after, .question-row:hover::after, .identity-card:hover::after, .module-card:hover::after { opacity: 1; }
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::before { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(10px) scale(0.9); opacity: 0; background: rgba(10,10,10,0.85); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 1000; visibility: hidden; }
[data-tooltip]:hover::before { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0) scale(1); }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.skeleton { position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.03) !important; border-radius: 8px; color: transparent !important; border: 1px solid rgba(255,255,255,0.02) !important; }
.skeleton * { visibility: hidden !important; }
.skeleton::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); animation: shimmer 1.5s infinite; }


/* ENDGAME STYLES */
/* AI ORB */
#ai-orb { position: fixed; bottom: 30px; left: 30px; width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--primary, #10b981), #022c22); box-shadow: 0 0 20px var(--primary-glow, rgba(16, 185, 129, 0.4)), 0 0 40px var(--primary-glow, rgba(16, 185, 129, 0.2)); cursor: pointer; z-index: 9999; animation: orbBreathe 4s infinite ease-in-out; border: 2px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(4px); transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
#ai-orb::after { content: ''; position: absolute; width: 10px; height: 10px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px #fff; animation: blink 2s infinite; }
#ai-orb:hover { transform: scale(1.1); box-shadow: 0 0 30px var(--primary-glow, rgba(16, 185, 129, 0.6)), 0 0 60px var(--primary-glow, rgba(16, 185, 129, 0.4)); }
#ai-orb.listening { animation: orbListening 0.5s infinite alternate; background: radial-gradient(circle at 30% 30%, #ef4444, #7f1d1d); box-shadow: 0 0 30px rgba(239, 68, 68, 0.6); }

@keyframes orbBreathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-10px) scale(1.05); box-shadow: 0 0 25px var(--primary-glow, rgba(16, 185, 129, 0.5)); } }
@keyframes orbListening { 0% { transform: scale(1); } 100% { transform: scale(1.2); } }
@keyframes blink { 0%, 100% { opacity: 0.8; } 50% { opacity: 0.2; } }

/* TACTICAL RADAR */
#tactical-radar-container { position: fixed; bottom: 30px; right: 30px; width: 150px; height: 150px; border-radius: 50%; border: 1px solid var(--primary-dark, rgba(16, 185, 129, 0.3)); background: rgba(0, 0, 0, 0.3); overflow: hidden; z-index: 9998; backdrop-filter: blur(8px); box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); pointer-events: none; }
#tactical-radar { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* THEME SWITCHER */
#theme-switcher { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(20, 20, 20, 0.6); backdrop-filter: blur(10px); display: flex; gap: 10px; padding: 6px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); z-index: 9999; box-shadow: 0 4px 15px rgba(0,0,0,0.5); cursor: pointer; transition: all 0.3s; }
#theme-switcher:hover { background: rgba(40, 40, 40, 0.8); }
.theme-btn { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; transition: transform 0.2s; border: none; }
.theme-btn:hover { transform: scale(1.3); }

/* SPIDER MODAL OVERLAY */
#spider-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
#spider-modal.active { opacity: 1; visibility: visible; }
#spider-canvas-container { position: relative; width: 400px; height: 400px; animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#spider-modal h2 { font-family: 'Plus Jakarta Sans', sans-serif; color: #fff; text-shadow: 0 2px 10px rgba(255,255,255,0.2); font-size: 2rem; margin-bottom: 20px; letter-spacing: 2px; }
.close-spider { position: absolute; top: 30px; right: 40px; color: #fff; font-size: 2rem; cursor: pointer; opacity: 0.6; transition: 0.3s; }
.close-spider:hover { opacity: 1; transform: rotate(90deg); }
@keyframes popIn { 0% { transform: scale(0.8) translateY(40px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

/* THEMES VARIABLES */
[data-theme="default"] { --primary: #10b981; --primary-dark: rgba(16, 185, 129, 0.2); --primary-glow: rgba(16, 185, 129, 0.5); --bg: #0a0a0b; }
[data-theme="cyberpunk"] { --primary: #f0f; --primary-dark: rgba(255, 0, 255, 0.2); --primary-glow: rgba(255, 0, 255, 0.5); --bg: #0a0216; }
[data-theme="matrix"] { --primary: #0f0; --primary-dark: rgba(0, 255, 0, 0.2); --primary-glow: rgba(0, 255, 0, 0.5); --bg: #000500; }
[data-theme="police"] { --primary: #3b82f6; --primary-dark: rgba(59, 130, 246, 0.2); --primary-glow: rgba(59, 130, 246, 0.5); --bg: #080f1c; }
body { transition: background-color 0.5s ease; border-color: var(--primary-dark) !important; color: var(--primary); }
* { border-color: var(--primary-dark) !important; }
.btn-primary { background: var(--primary) !important; color: #000 !important; box-shadow: 0 0 10px var(--primary-glow) !important; }



/* ENDGAME STYLES */
/* AI ORB */
#ai-orb { position: fixed; bottom: 30px; left: 30px; width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--primary, #10b981), #022c22); box-shadow: 0 0 20px var(--primary-glow, rgba(16, 185, 129, 0.4)), 0 0 40px var(--primary-glow, rgba(16, 185, 129, 0.2)); cursor: pointer; z-index: 9999; animation: orbBreathe 4s infinite ease-in-out; border: 2px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(4px); transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
#ai-orb::after { content: ''; position: absolute; width: 10px; height: 10px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px #fff; animation: blink 2s infinite; }
#ai-orb:hover { transform: scale(1.1); box-shadow: 0 0 30px var(--primary-glow, rgba(16, 185, 129, 0.6)), 0 0 60px var(--primary-glow, rgba(16, 185, 129, 0.4)); }
#ai-orb.listening { animation: orbListening 0.5s infinite alternate; background: radial-gradient(circle at 30% 30%, #ef4444, #7f1d1d); box-shadow: 0 0 30px rgba(239, 68, 68, 0.6); }

@keyframes orbBreathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-10px) scale(1.05); box-shadow: 0 0 25px var(--primary-glow, rgba(16, 185, 129, 0.5)); } }
@keyframes orbListening { 0% { transform: scale(1); } 100% { transform: scale(1.2); } }
@keyframes blink { 0%, 100% { opacity: 0.8; } 50% { opacity: 0.2; } }

/* TACTICAL RADAR */
#tactical-radar-container { position: fixed; bottom: 30px; right: 30px; width: 150px; height: 150px; border-radius: 50%; border: 1px solid var(--primary-dark, rgba(16, 185, 129, 0.3)); background: rgba(0, 0, 0, 0.3); overflow: hidden; z-index: 9998; backdrop-filter: blur(8px); box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); pointer-events: none; }
#tactical-radar { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* THEME SWITCHER */
#theme-switcher { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(20, 20, 20, 0.6); backdrop-filter: blur(10px); display: flex; gap: 10px; padding: 6px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); z-index: 9999; box-shadow: 0 4px 15px rgba(0,0,0,0.5); cursor: pointer; transition: all 0.3s; }
#theme-switcher:hover { background: rgba(40, 40, 40, 0.8); }
.theme-btn { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; transition: transform 0.2s; border: none; }
.theme-btn:hover { transform: scale(1.3); }

/* SPIDER MODAL OVERLAY */
#spider-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
#spider-modal.active { opacity: 1; visibility: visible; }
#spider-canvas-container { position: relative; width: 400px; height: 400px; animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#spider-modal h2 { font-family: 'Plus Jakarta Sans', sans-serif; color: #fff; text-shadow: 0 2px 10px rgba(255,255,255,0.2); font-size: 2rem; margin-bottom: 20px; letter-spacing: 2px; }
.close-spider { position: absolute; top: 30px; right: 40px; color: #fff; font-size: 2rem; cursor: pointer; opacity: 0.6; transition: 0.3s; }
.close-spider:hover { opacity: 1; transform: rotate(90deg); }
@keyframes popIn { 0% { transform: scale(0.8) translateY(40px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

/* THEMES VARIABLES */
[data-theme="default"] { --primary: #10b981; --primary-dark: rgba(16, 185, 129, 0.2); --primary-glow: rgba(16, 185, 129, 0.5); --bg: #0a0a0b; }
[data-theme="cyberpunk"] { --primary: #f0f; --primary-dark: rgba(255, 0, 255, 0.2); --primary-glow: rgba(255, 0, 255, 0.5); --bg: #0a0216; }
[data-theme="matrix"] { --primary: #0f0; --primary-dark: rgba(0, 255, 0, 0.2); --primary-glow: rgba(0, 255, 0, 0.5); --bg: #000500; }
[data-theme="police"] { --primary: #3b82f6; --primary-dark: rgba(59, 130, 246, 0.2); --primary-glow: rgba(59, 130, 246, 0.5); --bg: #080f1c; }
body { transition: background-color 0.5s ease; border-color: var(--primary-dark) !important; color: var(--primary); }
* { border-color: var(--primary-dark) !important; }
.btn-primary { background: var(--primary) !important; color: #000 !important; box-shadow: 0 0 10px var(--primary-glow) !important; }



/* GOD TIER STYLES */
/* 1. Glitch Effect */
.glitch-delete {
  animation: glitch-anim 0.4s cubic-bezier(.25, .46, .45, .94) both alternate;
  position: relative;
  overflow: hidden;
}
.glitch-delete::before, .glitch-delete::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 10;
  pointer-events: none;
}
.glitch-delete::before {
  background: repeating-linear-gradient(0deg, rgba(0, 255, 0, 0.15) 0px, transparent 1px, transparent 2px);
  animation: scanline 0.8s linear infinite;
}
.glitch-delete::after {
  content: '0100101010';
  color: #0f0;
  font-family: monospace;
  font-size: 20px;
  word-break: break-all;
  white-space: pre-wrap;
  opacity: 0.7;
  mix-blend-mode: overlay;
}

@keyframes glitch-anim {
  0% { transform: translate(0) skew(0deg); filter: blur(0); opacity: 1; }
  20% { transform: translate(-2px, 2px) skew(10deg); filter: blur(2px) hue-rotate(90deg); opacity: 0.8; }
  40% { transform: translate(2px, -2px) skew(-10deg); filter: blur(0); opacity: 0.9; }
  60% { transform: translate(-5px, 5px) skew(20deg); filter: blur(4px) invert(1); opacity: 0.6; }
  80% { transform: translate(5px, -5px) skew(-20deg); filter: blur(0); opacity: 0.3; }
  100% { transform: scale(0); opacity: 0; }
}

/* 2. Retina Scan HUD */
#retina-hud {
  position: absolute; top: 20px; left: 20px; width: 120px; height: 120px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 15px var(--primary-glow);
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.8);
}
#retina-hud video { width: 100%; height: 100%; object-fit: cover; filter: sepia(1) hue-rotate(90deg) contrast(2) brightness(1.5); }
#retina-hud .scanline { position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: var(--primary); box-shadow: 0 0 10px var(--primary), 0 0 20px #fff; animation: scanDown 2s ease-in-out infinite alternate; z-index: 2; }
#retina-hud .hud-overlay { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1), rgba(0,0,0,0.1) 2px, transparent 2px, transparent 4px); z-index: 1; pointer-events: none;}
#retina-hud .fallback-text { color: var(--primary); font-size: 10px; text-align: center; font-family: monospace; animation: blink 1s infinite;}

@keyframes scanDown { 0% { top: 0; } 100% { top: 100%; } }

/* 3. PiP Button */
#pip-btn { position: absolute; top: -30px; left: 50%; transform: translateX(-50%); background: var(--primary-dark); border: 1px solid var(--primary); color: var(--primary); font-size: 10px; padding: 2px 6px; border-radius: 4px; cursor: pointer; opacity: 0; transition: 0.3s; z-index: 10001;}
#tactical-radar-container:hover #pip-btn { opacity: 1; top: -25px; }

/* 4. Bio Auth Modal */
#bio-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.9); backdrop-filter: blur(20px); z-index: 100000; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: 0.3s; }
#bio-modal.active { opacity: 1; visibility: visible; }
.fingerprint-icon { font-size: 60px; color: var(--primary-dark); animation: pulseFinger 2s infinite; transition: color 0.3s; cursor: pointer;}
.fingerprint-icon.scanning { color: var(--primary); animation: scanFinger 0.5s infinite alternate; text-shadow: 0 0 20px var(--primary-glow); }
.fingerprint-icon.success { color: #10b981; text-shadow: 0 0 30px #10b981; animation: none; }
.fingerprint-icon.fail { color: #ef4444; text-shadow: 0 0 30px #ef4444; animation: none; }
#bio-text { color: #fff; font-family: monospace; margin-top: 20px; font-size: 16px; letter-spacing: 2px;}

@keyframes pulseFinger { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes scanFinger { 0% { transform: translateY(-5px); } 100% { transform: translateY(5px); } }


/* 11. Ultimate Layout & Space Utilization */
.main {
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  overflow-x: hidden !important;
}

.content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 32px;
  gap: 24px;
}

/* Allow kanban, tables, or main grids to fill remaining height if needed */
.dashboard-grid, .content-grid, .kanban {
  flex: 1 !important;
}

/* Fix panel borders that were too bright/greenish */
.panel, .metric, .unit-card, .auth-card, .case-card, .kanban-column, .timeline-item, .activity {
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.6) !important;
  background: rgba(14, 18, 28, 0.45) !important;
}

/* Tables and Panels expand correctly */
.panel {
  display: flex !important;
  flex-direction: column !important;
}
.panel table {
  width: 100% !important;
}

/* =========================================================================
   ULTIMATE PERFECT UI - POLICE DASHBOARD OVERHAUL
   ========================================================================= */

/* Global Animations & Transitions */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

body {
  /* Animate background gradients slowly to give life to the app */
  animation: pulseGrad 15s infinite alternate;
}

@keyframes pulseGrad {
  0% {
    background-size: 100% 100%;
    background-position: 0% 0%;
  }
  100% {
    background-size: 110% 110%;
    background-position: 10% 10%;
  }
}

/* Glassmorphism Panels */
.panel, .metric, .unit-card, .auth-card, .case-card, .kanban-column, .timeline-item, .activity {
  background: rgba(14, 18, 28, 0.6) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.3) !important;
  border-radius: 16px !important;
  overflow: hidden;
}

.panel:hover, .metric:hover, .unit-card:hover, .case-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 16px 40px rgba(59, 130, 246, 0.1) !important;
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, .brand h1, .metric-value, .case-title {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.metric-value {
  background: linear-gradient(135deg, #ffffff 0%, #a3adb8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important;
  font-size: 2.5rem !important;
}

/* Buttons Overhaul */
button, .nav-button, .primary-button, .ghost-button, .icon-button {
  border-radius: 8px !important;
  font-weight: 600 !important;
  position: relative;
  overflow: hidden;
}

button:active {
  transform: scale(0.96) !important;
}

.primary-button {
  background: linear-gradient(135deg, var(--blue), #1e40af) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4) !important;
  color: white !important;
}

.primary-button:hover {
  background: linear-gradient(135deg, #60a5fa, var(--blue)) !important;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6) !important;
}

.danger-button {
  background: linear-gradient(135deg, var(--red), #991b1b) !important;
  box-shadow: 0 4px 14px rgba(240, 68, 56, 0.4) !important;
}

/* Sidebar Perfection */
.sidebar {
  background: rgba(8, 11, 16, 0.6) !important;
  backdrop-filter: blur(20px) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: 4px 0 24px rgba(0,0,0,0.4) !important;
}

/* Nav Items glow */
.nav-button.active {
  background: rgba(59, 130, 246, 0.15) !important;
  color: var(--blue) !important;
  border-left: 3px solid var(--blue) !important;
  border-radius: 0 8px 8px 0 !important;
}

.nav-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04) !important;
  transform: translateX(4px);
}

/* Tables Perfection */
table {
  border-collapse: separate !important;
  border-spacing: 0 8px !important;
}

tr {
  background: rgba(255, 255, 255, 0.02) !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
}

tr:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  transform: scale(1.01) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

td, th {
  padding: 16px 12px !important;
}

td:first-child, th:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}
td:last-child, th:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Awesome Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Status Badges */
.badge, .status {
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

.status.success, .status.ativo {
  background: rgba(16, 185, 129, 0.1) !important;
  color: var(--teal-2) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.status.warning, .status.pendente, .status.treinamento {
  background: rgba(245, 158, 11, 0.1) !important;
  color: var(--gold) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.status.error, .status.suspenso, .status.demitido {
  background: rgba(240, 68, 56, 0.1) !important;
  color: var(--red-2) !important;
  border: 1px solid rgba(240, 68, 56, 0.3) !important;
  box-shadow: 0 0 10px rgba(240, 68, 56, 0.2);
}

/* Modals / Bio Authentication */
#bio-modal {
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(24px) !important;
}

.fingerprint-icon {
  font-size: 80px !important;
  background: -webkit-linear-gradient(var(--blue), var(--teal-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-10px) scale(1.05); text-shadow: 0 0 40px var(--blue); }
  100% { transform: translateY(0px) scale(1); }
}

/* =========================================================================
   PERFECT LOADING & AUTH SCREENS
   ========================================================================= */

.auth-page {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100vh !important;
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.1) 0%, transparent 60%) !important;
}

.auth-card {
  padding: 40px !important;
  background: rgba(14, 18, 28, 0.8) !important;
  border-radius: 24px !important;
  box-shadow: 0 0 50px rgba(16, 185, 129, 0.15) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  animation: floatCard 4s ease-in-out infinite;
  width: 100%;
  max-width: 420px;
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.brand-mark {
  position: relative !important;
  z-index: 1;
}

.brand-mark::before {
  content: '';
  position: absolute;
  top: -4px; right: -4px; bottom: -4px; left: -4px;
  background: linear-gradient(45deg, var(--teal-2), var(--blue));
  z-index: -1;
  border-radius: 20px;
  animation: spinGlow 3s linear infinite;
  opacity: 0.6;
  filter: blur(8px);
}

@keyframes spinGlow {
  100% { filter: blur(8px) hue-rotate(360deg); transform: scale(1.02); }
}

/* Global scroll smoothing */
html {
  scroll-behavior: smooth;
}

/* Make icons glow slightly on active state */
.nav-button.active svg {
  filter: drop-shadow(0 0 4px var(--blue));
}

/* =========================================================================
   PERFECTION TOUCHES - INPUTS, TOASTS, ENHANCEMENTS
   ========================================================================= */

/* High-End Inputs */
input, select, textarea {
  background: rgba(8, 12, 18, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 2px 10px rgba(0,0,0,0.1) !important;
  font-family: var(--font) !important;
  backdrop-filter: blur(10px) !important;
}

input:focus, textarea:focus, select:focus {
  background: rgba(14, 20, 28, 0.9) !important;
  border-color: var(--blue) !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
  outline: none !important;
}

input::placeholder, textarea::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
}

/* Beautiful custom checkboxes & radios */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  padding: 0 !important;
  margin: 0 10px 0 0 !important;
  border-radius: 6px !important;
  border: 2px solid rgba(255,255,255,0.3) !important;
  background: rgba(0,0,0,0.4) !important;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

input[type="radio"] {
  border-radius: 50% !important;
}

input[type="checkbox"]:checked, input[type="radio"]:checked {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  box-shadow: 0 0 10px rgba(59,130,246,0.4) !important;
}

input[type="checkbox"]:checked::after {
  content: '';
  width: 10px;
  height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg);
  position: absolute;
  top: 4px;
}

input[type="radio"]:checked::after {
  content: '';
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  position: absolute;
}

/* Custom Dropdown select arrows */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 16px !important;
  padding-right: 40px !important;
}

/* Toast Notifications Upgrade */
.toast {
  background: rgba(18, 24, 38, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-left: 4px solid var(--teal-2) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
  border-radius: 12px !important;
  padding: 16px 24px !important;
  color: white !important;
  font-weight: 500 !important;
  animation: toastSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  z-index: 9999 !important;
}

.toast.error {
  border-left-color: var(--red) !important;
}

@keyframes toastSlideIn {
  from { transform: translateX(120%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/* Fix z-index for modals and overlays to drop them clearly in front */
.modal, #bio-modal {
  z-index: 10000 !important;
}

/* Form labels perfection */
form label {
  font-weight: 600 !important;
  font-size: 13px !important;
  color: var(--muted) !important;
  margin-bottom: 6px !important;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Make textareas scalable smoothly */
textarea {
  resize: vertical;
  min-height: 100px;
}

/* =========================================================================
   HYPER-MOTION & CINEMATIC EFFECTS - THE FINAL TOUCH
   ========================================================================= */

/* 1. Cinematic Page Transitions (Every component enters smoothly) */
@keyframes fadeInUpCinematic {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Base entry animation for all crucial container blocks */
.content, .panel, .metric, .case-card, .unit-card, .kanban-column, .activity, .identity-card, table {
  animation: fadeInUpCinematic 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

/* 2. Staggered Entry for Lists and Table Rows (Up to 10 elements) */
tr:nth-child(1), .unit-card:nth-child(1), .case-card:nth-child(1) { animation-delay: 0.05s !important; }
tr:nth-child(2), .unit-card:nth-child(2), .case-card:nth-child(2) { animation-delay: 0.10s !important; }
tr:nth-child(3), .unit-card:nth-child(3), .case-card:nth-child(3) { animation-delay: 0.15s !important; }
tr:nth-child(4), .unit-card:nth-child(4), .case-card:nth-child(4) { animation-delay: 0.20s !important; }
tr:nth-child(5), .unit-card:nth-child(5), .case-card:nth-child(5) { animation-delay: 0.25s !important; }
tr:nth-child(6), .unit-card:nth-child(6), .case-card:nth-child(6) { animation-delay: 0.30s !important; }
tr:nth-child(7), .unit-card:nth-child(7), .case-card:nth-child(7) { animation-delay: 0.35s !important; }
tr:nth-child(8), .unit-card:nth-child(8), .case-card:nth-child(8) { animation-delay: 0.40s !important; }
tr:nth-child(n+9), .unit-card:nth-child(n+9), .case-card:nth-child(n+9) { animation-delay: 0.45s !important; }

/* Hide them initially so they don't flash before animation kicks in */
tr, .unit-card, .case-card {
  opacity: 0;
}

/* 3. Ultimate Table Row interactions (Magnetic Hover) */
tr:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  transform: translateX(4px) scale(1.005) !important;
  box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.4) !important;
  border-left: 2px solid var(--blue) !important;
}

/* 4. Pulsing "Red Alert" status for high priority / active pursuits */
@keyframes highPriorityPulse {
  0% { box-shadow: 0 0 0 0 rgba(240, 68, 56, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(240, 68, 56, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 68, 56, 0); }
}

.status:contains('alta'), 
.status:contains('andamento'), 
.status.error, 
.danger-button {
  animation: highPriorityPulse 2s infinite !important;
}

/* 5. Tooltip/Avatar Hover Grow */
.badge, .status {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
.badge:hover, .status:hover {
  transform: scale(1.15) !important;
}

/* 6. Active App Header Glow (Branding) */
.brand-mark {
  transition: transform 0.3s ease, filter 0.3s ease;
}
.brand-mark:hover {
  transform: scale(1.1) rotate(5deg) !important;
  filter: brightness(1.3) drop-shadow(0 0 10px var(--gold));
}

/* 7. Super-smooth Sidemenu Sliding (Width matching content seamlessly) */
.sidebar {
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 8. Text Selection Customization (The smallest detail makes a difference) */
::selection {
  background: var(--blue) !important;
  color: #fff !important;
  text-shadow: none !important;
}

/* 9. Glowing Action Counters (Number badges in sidebars) */
.nav-count {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
  padding: 2px 8px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  box-shadow: 0 0 8px rgba(255,255,255,0.2) !important;
  transition: 0.3s ease !important;
}
.nav-button:hover .nav-count {
  background: var(--blue) !important;
  box-shadow: 0 0 14px var(--blue) !important;
  transform: scale(1.1);
}

/* 10. Modals & Popup Animations */
.modal-content, .auth-card {
  animation: modalPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes modalPopIn {
  0% { transform: scale(0.9) translateY(30px); opacity: 0; filter: blur(10px); }
  100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); }
}


/* =========================================================================
   SCREENS & MODALS BIO HACK
   ========================================================================= */

/* New Bio Scanner Styling */
.bio-scanner {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.1);
  overflow: hidden;
}

.fingerprint-icon {
  color: var(--blue);
  opacity: 0.8;
  transition: all 0.3s ease;
}

.fingerprint-icon.scanning {
  color: var(--teal-2);
  animation: pulseScan 1.5s infinite alternate;
}

.fingerprint-icon.success {
  color: #10b981;
  filter: drop-shadow(0 0 10px #10b981);
}

.fingerprint-icon.fail {
  color: #ef4444;
  filter: drop-shadow(0 0 10px #ef4444);
}

.scan-line {
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, transparent, rgba(52, 211, 153, 0.4), transparent);
  animation: none;
  opacity: 0;
}

.fingerprint-icon.scanning ~ .scan-line {
  opacity: 1;
  animation: scanSweep 1.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pulseScan {
  from { filter: drop-shadow(0 0 5px var(--teal)); transform: scale(1); }
  to { filter: drop-shadow(0 0 15px var(--teal-2)); transform: scale(1.05); }
}

@keyframes scanSweep {
  0% { top: -100%; }
  100% { top: 100%; }
}

#bio-text {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#bio-modal {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(8, 12, 18, 0.95) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  z-index: 100000 !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#bio-modal.active {
  opacity: 1;
  visibility: visible;
}


/* ENDGAME STYLES */
/* AI ORB */
#ai-orb { position: fixed; bottom: 30px; left: 30px; width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--primary, #10b981), #022c22); box-shadow: 0 0 20px var(--primary-glow, rgba(16, 185, 129, 0.4)), 0 0 40px var(--primary-glow, rgba(16, 185, 129, 0.2)); cursor: pointer; z-index: 9999; animation: orbBreathe 4s infinite ease-in-out; border: 2px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(4px); transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
#ai-orb::after { content: ''; position: absolute; width: 10px; height: 10px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px #fff; animation: blink 2s infinite; }
#ai-orb:hover { transform: scale(1.1); box-shadow: 0 0 30px var(--primary-glow, rgba(16, 185, 129, 0.6)), 0 0 60px var(--primary-glow, rgba(16, 185, 129, 0.4)); }
#ai-orb.listening { animation: orbListening 0.5s infinite alternate; background: radial-gradient(circle at 30% 30%, #ef4444, #7f1d1d); box-shadow: 0 0 30px rgba(239, 68, 68, 0.6); }

@keyframes orbBreathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-10px) scale(1.05); box-shadow: 0 0 25px var(--primary-glow, rgba(16, 185, 129, 0.5)); } }
@keyframes orbListening { 0% { transform: scale(1); } 100% { transform: scale(1.2); } }
@keyframes blink { 0%, 100% { opacity: 0.8; } 50% { opacity: 0.2; } }

/* TACTICAL RADAR */
#tactical-radar-container { position: fixed; bottom: 30px; right: 30px; width: 150px; height: 150px; border-radius: 50%; border: 1px solid var(--primary-dark, rgba(16, 185, 129, 0.3)); background: rgba(0, 0, 0, 0.3); overflow: hidden; z-index: 9998; backdrop-filter: blur(8px); box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); pointer-events: none; }
#tactical-radar { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* THEME SWITCHER */
#theme-switcher { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(20, 20, 20, 0.6); backdrop-filter: blur(10px); display: flex; gap: 10px; padding: 6px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); z-index: 9999; box-shadow: 0 4px 15px rgba(0,0,0,0.5); cursor: pointer; transition: all 0.3s; }
#theme-switcher:hover { background: rgba(40, 40, 40, 0.8); }
.theme-btn { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; transition: transform 0.2s; border: none; }
.theme-btn:hover { transform: scale(1.3); }

/* SPIDER MODAL OVERLAY */
#spider-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
#spider-modal.active { opacity: 1; visibility: visible; }
#spider-canvas-container { position: relative; width: 400px; height: 400px; animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#spider-modal h2 { font-family: 'Plus Jakarta Sans', sans-serif; color: #fff; text-shadow: 0 2px 10px rgba(255,255,255,0.2); font-size: 2rem; margin-bottom: 20px; letter-spacing: 2px; }
.close-spider { position: absolute; top: 30px; right: 40px; color: #fff; font-size: 2rem; cursor: pointer; opacity: 0.6; transition: 0.3s; }
.close-spider:hover { opacity: 1; transform: rotate(90deg); }
@keyframes popIn { 0% { transform: scale(0.8) translateY(40px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

/* THEMES VARIABLES */
[data-theme="default"] { --primary: #10b981; --primary-dark: rgba(16, 185, 129, 0.2); --primary-glow: rgba(16, 185, 129, 0.5); --bg: #0a0a0b; }
[data-theme="cyberpunk"] { --primary: #f0f; --primary-dark: rgba(255, 0, 255, 0.2); --primary-glow: rgba(255, 0, 255, 0.5); --bg: #0a0216; }
[data-theme="matrix"] { --primary: #0f0; --primary-dark: rgba(0, 255, 0, 0.2); --primary-glow: rgba(0, 255, 0, 0.5); --bg: #000500; }
[data-theme="police"] { --primary: #3b82f6; --primary-dark: rgba(59, 130, 246, 0.2); --primary-glow: rgba(59, 130, 246, 0.5); --bg: #080f1c; }
body { transition: background-color 0.5s ease; border-color: var(--primary-dark) !important; color: var(--primary); }
* { border-color: var(--primary-dark) !important; }
.btn-primary { background: var(--primary) !important; color: #000 !important; box-shadow: 0 0 10px var(--primary-glow) !important; }


/* =========================================
   ULTIMATE JARVIS AI PREMIER UPGRADE (FINAL POLISH)
   ========================================= */
body {
  background-image: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
    radial-gradient(ellipse at center, rgba(16, 185, 129, 0.05) 0%, rgba(0, 0, 0, 0.85) 100%);
  background-size: 100% 4px, 100% 100%;
  background-attachment: fixed;
}

::selection {
  background: rgba(16, 185, 129, 0.5);
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.brand::after {
  content: ' [AI LINKED]';
  font-size: 0.4em;
  color: var(--teal);
  vertical-align: top;
  text-shadow: 0 0 10px var(--teal);
  animation: pulseConnection 3s infinite;
  margin-left: 6px;
  font-family: 'Consolas', monospace;
  letter-spacing: 1px;
}

#ai-orb {
  border: 2px solid rgba(16, 185, 129, 0.5) !important;
  background: radial-gradient(circle at 30% 30%, #4ade80, #064e3b 80%) !important;
  position: fixed !important;
  bottom: 25px !important;
  left: 25px !important;
  width: 65px !important;
  height: 65px !important;
  border-radius: 50% !important;
  box-shadow: 0 0 20px var(--teal), inset 0 0 15px rgba(255, 255, 255, 0.4) !important;
  z-index: 10000 !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

#ai-orb:hover {
  transform: scale(1.15) rotate(15deg) !important;
  box-shadow: 0 0 40px var(--teal), inset 0 0 30px rgba(255, 255, 255, 0.9) !important;
}

#ai-orb.listening {
  background: radial-gradient(circle at 30% 30%, #60a5fa, #1e3a8a 80%) !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 50px var(--blue), inset 0 0 20px rgba(255, 255, 255, 0.8) !important;
  animation: orbPulse 1s infinite alternate !important;
}

#tactical-radar-container {
  border: 2px solid rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.2), inset 0 0 40px rgba(0, 0, 0, 0.9) !important;
  backdrop-filter: blur(15px) !important;
  transition: all 0.5s ease-in-out !important;
}

#tactical-radar-container:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(16, 185, 129, 0.4), inset 0 0 50px rgba(0, 0, 0, 0.9) !important;
  border-color: rgba(16, 185, 129, 0.6) !important;
}

.digital-clock-container {
  border-color: rgba(16, 185, 129, 0.5) !important;
  background: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(15px) !important;
}

.digital-clock-container .clock-time {
  text-shadow: 0 0 15px var(--teal), 0 0 5px #fff !important;
  font-size: 0.95rem !important;
  letter-spacing: 2px !important;
}

.top-bar {
  background: rgba(13, 17, 23, 0.8) !important;
  backdrop-filter: saturate(150%) blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5) !important;
}

@media (max-width: 900px) {
  .app-shell {
    display: block !important;
    min-height: 100vh !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    transform: translateX(-100%) !important;
    z-index: 9999 !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .main {
    min-height: 100vh !important;
  }

  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    grid-template-columns: auto 1fr auto !important;
  }
}


