/* ════════════════════════════════════════════════════════════
   NextSell Admin — "Ledger Console"
   Direção criativa: console de operações financeiras de precisão.
   Charcool quente + âmbar de sinal único + numerais monoespaçados.
   Zero gradientes roxos/azuis, zero glassmorphism em cards de dados,
   zero emoji como ícone, zero Inter.
   ════════════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Neutros — charcool quente (não navy-black) */
  --bg: #0c0a08;
  --bg-elevated: #131009;
  --panel: #191511;
  --panel-2: #201b15;
  --panel-hover: #262019;
  --line: rgba(235, 225, 209, 0.08);
  --line-strong: rgba(235, 225, 209, 0.14);

  --text: #f3eee4;
  --text-secondary: #d8cfbe;
  --muted: #9b917f;

  /* Sinal único — âmbar (phosphor de indicador de missão) */
  --amber: #f2a03c;
  --amber-strong: #ffb45c;
  --amber-dim: rgba(242, 160, 60, 0.14);

  /* Status — verdes/vermelhos calibrados p/ contraste AA */
  --green: #7ddb9b;
  --green-dim: rgba(125, 219, 155, 0.13);
  --yellow: #f3c969;
  --yellow-dim: rgba(243, 201, 105, 0.13);
  --red: #ff8f87;
  --red-dim: rgba(255, 143, 135, 0.13);
  --cyan: #6cc8c0;

  /* Tipografia */
  --font-display: "Space Grotesk", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Escala de raios — regra documentada:
     botões = pill · cards = 10px · inputs = 8px */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Sombras — matizadas ao fundo quente, nunca pretas puras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 28px 70px -20px rgba(0, 0, 0, 0.7);
  --shadow-amber: 0 0 0 1px var(--amber-dim), 0 8px 24px -10px rgba(242, 160, 60, 0.25);

  --sidebar-w: 276px;
  --transition: 0.22s cubic-bezier(0.32, 0.72, 0, 1);

  font-family: var(--font-display);
  font-feature-settings: "ss01", "cv11";
}

/* ── Base ──────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}

html {
  scrollbar-color: var(--line-strong) transparent;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 90% 60% at 115% -12%, rgba(242, 160, 60, 0.07), transparent 52%),
    radial-gradient(ellipse 70% 45% at -20% 110%, rgba(108, 200, 192, 0.04), transparent 55%),
    linear-gradient(180deg, #0b0907 0%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
}

::selection {
  background: var(--amber-dim);
  color: var(--amber-strong);
}

/* Fundo de textura de "ledger" — linhas de grade sutis, puramente decorativo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
}

/* Grão de filme — overlay fixo, pointer-events-none, GPU-safe */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ── Resources Grid ───────────────────────────────────────────── */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  padding: 4px 0;
}

/* Grade assimétrica e intencional — cada recurso ocupa largura própria */
.resource-card {
  grid-column: span 3;
  position: relative;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 26px 24px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
  display: block;
  overflow: hidden;
  isolation: isolate;
}

.resource-card:nth-child(4n+1),
.resource-card:nth-child(4n+4) {
  grid-column: span 3;
}

.resource-card:nth-child(4n+2) {
  grid-column: span 3;
}

/* Barra de sinal — seção de destaque no recurso primário */
.resource-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 120% at 100% 0%, var(--amber-dim), transparent 55%);
  opacity: 0;
  transition: opacity var(--transition);
}

.resource-card::after {
  content: "";
  position: absolute;
  left: 26px;
  bottom: 0;
  width: 44px;
  height: 2px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition) cubic-bezier(0.32, 0.72, 0, 1);
}

.resource-card:hover {
  border-color: rgba(242, 160, 60, 0.35);
  transform: translateY(-3px);
  box-shadow: var(--shadow-amber);
}

.resource-card:hover::before { opacity: 1; }
.resource-card:hover::after { transform: scaleX(1); }

.resource-card:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.resource-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(242, 160, 60, 0.08);
  color: var(--amber-strong);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.resource-info {
  flex: 1;
}

.resource-info h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.resource-info p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 42ch;
}

.resource-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 15px;
  font-family: var(--font-mono);
  color: var(--amber);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--transition), transform var(--transition);
}

.resource-card:hover .resource-arrow {
  opacity: 1;
  transform: translateX(0);
}

.anuncios-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.anuncio-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.anuncio-item .actions {
  display: flex;
  gap: 8px;
}

.hidden {
  display: none !important;
}

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

button {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--amber);
  color: #1a1206;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), color var(--transition);
  box-shadow: 0 2px 10px rgba(242, 160, 60, 0.25);
  min-height: 40px;
}

button:hover {
  background: var(--amber-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(242, 160, 60, 0.35);
}

button:active {
  transform: translateY(0) scale(0.99);
}

button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button.ghost {
  background: rgba(243, 238, 228, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

button.ghost:hover {
  background: rgba(243, 238, 228, 0.09);
  color: var(--text);
  border-color: rgba(243, 238, 228, 0.2);
  box-shadow: none;
  transform: translateY(-1px);
}

button.primary {
  background: var(--amber);
  color: #1a1206;
}

button.ghost-danger {
  background: transparent;
  border: 1px solid var(--red-dim);
  color: var(--red);
  box-shadow: none;
}

button.ghost-danger:hover {
  background: var(--red-dim);
  border-color: rgba(255, 143, 135, 0.4);
  color: var(--red);
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-family: var(--font-display);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(242, 160, 60, 0.5);
  background: rgba(0, 0, 0, 0.34);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23f3eee4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(235, 225, 209, 0.28);
  background-clip: content-box;
}

/* ── Login ─────────────────────────────────────────────────── */
.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}

.login-view::before {
  content: "NEXTSELL";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: clamp(90px, 24vw, 300px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: rgba(235, 225, 209, 0.03);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 20px;
  padding: 38px 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(25, 21, 17, 0.96) 0%, rgba(19, 16, 9, 0.98) 100%);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.login-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 34px;
  width: 52px;
  height: 2px;
  background: var(--amber);
}

.login-panel h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.login-panel p,
.login-panel small {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-panel small {
  font-size: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
}

.login-panel label {
  text-transform: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0;
  font-family: var(--font-mono);
}

.login-panel input {
  font-family: var(--font-mono);
}

.login-panel button[type="submit"] {
  padding: 12px;
  font-size: 14px;
  margin-top: 4px;
}

.brand-mark,
.brand span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--amber);
  color: #1a1206;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.03em;
  font-family: var(--font-display);
  box-shadow: 0 4px 18px rgba(242, 160, 60, 0.3);
  flex-shrink: 0;
}

/* ── App shell ─────────────────────────────────────────────── */
.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 16px;
  background: rgba(12, 10, 8, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 4px 16px;
}

.brand strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
}

.brand small::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px rgba(243, 201, 105, 0.5);
  flex-shrink: 0;
}

.brand small.online::before {
  background: var(--green);
  box-shadow: 0 0 8px rgba(125, 219, 155, 0.5);
}

.brand small.offline::before {
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 143, 135, 0.5);
}

.sidebar-group {
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.sidebar-group label {
  text-transform: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-family: var(--font-mono);
}

.sidebar-group select {
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

nav {
  display: grid;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.nav-btn {
  width: 100%;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  box-shadow: none;
  min-height: 42px;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.nav-btn .pill {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  background: rgba(243, 238, 228, 0.05);
  border-color: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(243, 238, 228, 0.05);
  border-color: var(--line);
  transform: translateX(2px);
  box-shadow: none;
}

.nav-btn:hover .pill {
  background: var(--amber-dim);
  color: var(--amber-strong);
}

.nav-btn.active {
  color: var(--text);
  background: linear-gradient(90deg, var(--amber-dim) 0%, rgba(242, 160, 60, 0.02) 100%);
  border-color: rgba(242, 160, 60, 0.22);
  box-shadow: inset 3px 0 0 var(--amber);
}

.nav-btn.active .pill {
  background: var(--amber);
  color: #1a1206;
}

/* Visual nav sections (no DOM change) */
.nav-section {
  padding: 12px 8px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  font-family: var(--font-mono);
}

.nav-btn[data-page="sales"],
.nav-btn[data-page="payments"],
.nav-btn[data-page="config"] {
  margin-top: 6px;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

.admin-box {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(243, 238, 228, 0.03);
  border: 1px solid var(--line);
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--amber);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #1a1206;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.admin-box strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.admin-box small {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
}

.sidebar-footer .ghost {
  width: 100%;
  text-align: center;
  padding: 10px;
  font-size: 12px;
  transition: all var(--transition);
}

.sidebar-footer .ghost:hover {
  background: var(--red-dim);
  border-color: rgba(255, 143, 135, 0.3);
  color: var(--red);
}

/* ── Main area ─────────────────────────────────────────────── */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 9, 7, 0.78);
  backdrop-filter: blur(14px);
}

.page-info h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.page-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.search-box input {
  width: min(320px, 40vw);
  padding-left: 38px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.28);
}

#refreshBtn {
  white-space: nowrap;
  background: rgba(243, 238, 228, 0.05);
  border: 1px solid var(--line-strong);
  box-shadow: none;
  color: var(--text-secondary);
}

#refreshBtn:hover {
  background: rgba(243, 238, 228, 0.08);
  color: var(--text);
  box-shadow: none;
}

/* ── Content ───────────────────────────────────────────────── */
#content {
  padding: 26px 30px 48px;
  display: grid;
  gap: 20px;
  flex: 1;
}

.grid {
  display: grid;
  gap: 14px;
}

/* Métricas — grade assimétrica tipo "bento": totais maiores e destaque âmbar */
.metrics {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.metrics .metric:nth-child(1) {
  grid-column: span 4;
}
.metrics .metric:nth-child(2) {
  grid-column: span 3;
}
.metrics .metric:nth-child(3) {
  grid-column: span 3;
}
.metrics .metric:nth-child(4) {
  grid-column: span 2;
}
.metrics .metric:nth-child(5) {
  grid-column: span 3;
}
.metrics .metric:nth-child(6) {
  grid-column: span 3;
}
.metrics .metric:nth-child(7) {
  grid-column: span 3;
}
.metrics .metric:nth-child(8) {
  grid-column: span 3;
}
.metrics .metric:nth-child(9) {
  grid-column: span 3;
}
.metrics .metric:nth-child(10) {
  grid-column: span 3;
}
.metrics .metric:nth-child(11) {
  grid-column: span 2;
}
.metrics .metric:nth-child(12) {
  grid-column: span 2;
}

.two {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.75fr);
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(25, 21, 17, 0.9) 0%, rgba(19, 16, 9, 0.92) 100%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(243, 238, 228, 0.03);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--line-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.modal-panel .card-header {
  padding-right: 56px;
}

.card-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.card-body {
  padding: 20px;
}

.card-body p {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.card-body p:last-child {
  margin-bottom: 0;
}

/* ── Metrics ───────────────────────────────────────────────── */
.metric {
  padding: 20px 20px 18px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 118px;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Numerais de dados sempre monoespaçados — assinatura do "console de precisão" */
.metric strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Trilho de sinal discreto à esquerda de cada métrica */
.metric::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 0;
  bottom: 18px;
  width: 2px;
  border-radius: var(--radius-pill);
  background: var(--amber);
  opacity: 0.55;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

.metric strong {
  display: block;
  margin-top: auto;
  padding-top: 12px;
  font-size: clamp(20px, 1.6vw + 10px, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ── Toolbar ───────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.toolbar label {
  min-width: 180px;
  flex: 1;
  text-transform: none;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0;
  font-family: var(--font-mono);
}

.toolbar input,
.toolbar select {
  font-size: 12px;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.22);
  position: sticky;
  top: 0;
  z-index: 1;
  font-family: var(--font-mono);
}

td {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Dados numéricos e preços em monoespaçado */
td strong,
td .mono,
td .money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover td {
  background: rgba(242, 160, 60, 0.04);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ── Status & pills ────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(243, 238, 228, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--yellow);
}

.bad {
  color: var(--red);
}

.pill-ok {
  background: var(--green-dim);
  border-color: rgba(125, 219, 155, 0.3);
  color: var(--green);
}

.pill-warn {
  background: var(--yellow-dim);
  border-color: rgba(243, 201, 105, 0.3);
  color: var(--yellow);
}

.pill-bad {
  background: var(--red-dim);
  border-color: rgba(255, 143, 135, 0.3);
  color: var(--red);
}

/* ── Actions ───────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions button {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  min-height: 32px;
  transition: all var(--transition);
}

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

/* ── Chart ─────────────────────────────────────────────────── */
.chart {
  height: 220px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 20px 4px 0;
  background:
    linear-gradient(to top, var(--line) 1px, transparent 1px) 0 0 / 100% 44px,
    transparent;
  border-radius: var(--radius-sm);
}

.bar {
  flex: 1;
  min-width: 28px;
  max-width: 64px;
  background: linear-gradient(180deg, var(--amber-strong) 0%, var(--amber) 100%);
  border-radius: var(--radius-xs) var(--radius-xs) 2px 2px;
  position: relative;
  transition: filter var(--transition), transform var(--transition);
  cursor: default;
}

.bar:hover {
  filter: brightness(1.12);
  transform: scaleY(1.02);
  transform-origin: bottom;
}

.bar span {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 4, 3, 0.72);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.22s var(--transition);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-panel {
  width: min(1020px, 100%);
  max-height: 90dvh;
  overflow: auto;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--transition);
  position: relative;
}

.modal-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: rgba(243, 238, 228, 0.07);
  border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--transition);
  z-index: 10;
}

.modal-close-x:hover {
  background: var(--amber-dim);
  border-color: rgba(242, 160, 60, 0.4);
  color: var(--amber-strong);
  transform: rotate(90deg);
}

.modal-close-x:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.modal-close-x svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(243, 238, 228, 0.015);
  text-transform: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0;
  font-family: var(--font-mono);
  transition: border-color var(--transition), background var(--transition);
}

.form-grid label:focus-within {
  border-color: rgba(242, 160, 60, 0.4);
  background: var(--amber-dim);
}

.form-grid label.full {
  padding: 14px;
}

.form-grid textarea {
  min-height: 96px;
}

.form-grid button[type="submit"] {
  position: sticky;
  bottom: 0;
  grid-column: 1 / -1;
  z-index: 2;
  padding: 13px;
  font-size: 14px;
}

.full {
  grid-column: 1 / -1;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  padding: 12px 18px;
  border: 1px solid rgba(242, 160, 60, 0.35);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-md);
  background: rgba(25, 21, 17, 0.96);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s var(--transition);
}

.toast.success { border-left-color: var(--green); border-color: rgba(125, 219, 155, 0.35); }
.toast.error { border-left-color: var(--red); border-color: rgba(255, 143, 135, 0.35); }
.toast.warning { border-left-color: var(--yellow); border-color: rgba(243, 201, 105, 0.35); }

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

/* ── Code / JSON ───────────────────────────────────────────── */
pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--line);
  color: #e5dcc9;
  font-size: 12px;
  line-height: 1.6;
  font-family: var(--font-mono);
}

#configEditor {
  min-height: 400px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

/* ── Loading state ─────────────────────────────────────────── */
.card-body.muted {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.card-body.muted::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-hover) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .metrics .metric:nth-child(1) { grid-column: span 5; }
  .metrics .metric:nth-child(2),
  .metrics .metric:nth-child(3) { grid-column: span 3; }
  .metrics .metric:nth-child(4) { grid-column: span 4; }
  .metrics .metric:nth-child(5),
  .metrics .metric:nth-child(6) { grid-column: span 3; }
  .metrics .metric:nth-child(7),
  .metrics .metric:nth-child(8) { grid-column: span 3; }
  .metrics .metric:nth-child(9),
  .metrics .metric:nth-child(10) { grid-column: span 3; }
  .metrics .metric:nth-child(11),
  .metrics .metric:nth-child(12) { grid-column: span 3; }
}

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

  .sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

  nav {
    max-height: 240px;
  }

  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box input {
    width: 100%;
  }

  .two,
  .three,
  .form-grid {
    grid-template-columns: 1fr;
  }

  #content {
    padding: 16px;
  }

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

  .metrics .metric { grid-column: span 1 !important; }

  /* Recursos: grade assimétrica colapsa para 2 colunas */
  .resources-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-card { grid-column: span 1 !important; }
}

@media (max-width: 480px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }

  .resource-card:nth-child(4n+1),
  .resource-card:nth-child(4n+2),
  .resource-card:nth-child(4n+3),
  .resource-card:nth-child(4n+4) {
    grid-column: span 1;
  }
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: grid;
  place-items: center;
  padding: 48px 20px;
  text-align: center;
  gap: 12px;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 20px;
  font-family: var(--font-mono);
}

.empty-state h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 360px;
  line-height: 1.5;
}

/* ── Motion system ────────────────────────────────────────────
   Reveal on enter (via IntersectionObserver em js/reveal.js).
   Só anima transform/opacity. Anula sob prefers-reduced-motion. */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

[data-reveal].is-in {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal][data-delay="1"] { transition-delay: 0.06s; }
[data-reveal][data-delay="2"] { transition-delay: 0.12s; }
[data-reveal][data-delay="3"] { transition-delay: 0.18s; }

/* Entrada do shell do app (sidebar + topbar + content) */
.app-shell-fade {
  animation: shellIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes shellIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Estados: reduzir movimento — desliga animações, revela conteúdo */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ── Compat: modal Bootstrap legado (recursos.html) ──────────
   Mantém a estrutura modal-dialog/modal-content da página
   recursos.html integrada ao tema, sem quebrar a montagem via JS. */
.modal-dialog {
  width: min(1020px, 100%);
  max-height: 90dvh;
  overflow: auto;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--transition);
  position: relative;
}

.modal-content {
  border: 0;
  background: transparent;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.modal-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.modal-body,
.modal-footer {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.modal-footer {
  border-top: 1px solid var(--line);
  grid-auto-flow: column;
  justify-content: end;
}

.btn-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: rgba(243, 238, 228, 0.07);
  border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  font-size: 0;
  position: relative;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-close::before,
.btn-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1.5px;
  background: currentColor;
}

.btn-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.btn-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.btn-close:hover {
  background: var(--amber-dim);
  color: var(--amber-strong);
}

.form-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  display: block;
  margin-bottom: 6px;
}

.form-control,
.form-select {
  display: block;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-family: var(--font-display);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(242, 160, 60, 0.5);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.form-control-color {
  width: 56px;
  height: 40px;
  padding: 4px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23f3eee4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.mb-3 {
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  min-height: 40px;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}

.btn-primary {
  background: var(--amber);
  color: #1a1206;
  box-shadow: 0 2px 10px rgba(242, 160, 60, 0.25);
}

.btn-primary:hover {
  background: var(--amber-strong);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(243, 238, 228, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--line-strong);
}

.btn-secondary:hover {
  background: rgba(243, 238, 228, 0.09);
  color: var(--text);
}

/* ── Misc UX helpers ────────────────────────────────────────── */
.truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-muted {
  color: var(--muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 10px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 10px; }

.gap-2 { gap: 10px; }

.divider {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}
