:root {
  color-scheme: dark;
  /* Tema escuro alinhado aos tokens canonicos da Aurora (--nice-*). */
  --bg: #0d1219;          /* fundo geral */
  --bg-elev: #0a0f16;     /* topbar/sidebar (um passo mais escura) */
  --ink: #e8ecf4;         /* texto primario */
  --muted: #8b94a7;       /* texto secundario/labels */
  --line: #232b3b;        /* bordas padrao */
  --line-strong: #324059; /* borda de foco/enfase */
  --panel: #121826;       /* cartoes, inputs, tabelas */
  --hover: #1a2234;       /* hover de item/linha */
  --brand: #8b7cf7;       /* accent (ativo, links) */
  --brand-ink: #0b1020;   /* texto sobre o accent */
  --brand-2: #f0b760;     /* secundario/planejado (ambar) */
  --soft: #161329;        /* fundo suave de blocos accent */
  --warn: #2a2014;        /* fundo de aviso escuro */
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 560px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.stats {
  min-width: 132px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: right;
}

.stats span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.stats small {
  color: var(--muted);
}

.logout {
  display: inline-block;
  margin-top: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(340px, 1fr);
  min-height: calc(100vh - 96px);
}

.sidebar,
.workspace,
.panel {
  padding: 20px;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
}

.search span,
.field label,
.output-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

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

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 116px;
  padding: 11px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 124, 247, 0.22);
}

.category-nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.category-nav button,
.tool-card,
.actions button,
.toolbar button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.category-nav button:hover,
.toolbar button:hover,
.actions button:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.category-nav button {
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
}

.category-nav button.active {
  border-color: var(--brand);
  background: var(--soft);
  font-weight: 800;
}

.workspace {
  overflow: auto;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.toolbar button,
.actions button {
  min-height: 38px;
  padding: 0 14px;
  font-weight: 800;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.tool-card {
  min-height: 116px;
  padding: 13px;
  text-align: left;
}

.tool-card:hover,
.tool-card.active {
  border-color: var(--brand);
  background: var(--soft);
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.tool-card .mini {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
}

.dot.planned {
  background: var(--brand-2);
}

.panel {
  background: var(--panel);
  overflow: auto;
}

/* Drawer deslizante: a ferramenta abre por cima, em vez de ocupar uma coluna fixa. */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(460px, 100vw);
  height: 100vh;
  padding: 20px;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 13, 0.55);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.drawer-backdrop.open {
  opacity: 1;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.drawer-close:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.badge.planned {
  background: var(--warn);
  color: var(--brand-2);
}

.description {
  color: var(--muted);
  line-height: 1.45;
}

.tool-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.actions {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.actions button:first-child {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
}

.output {
  min-height: 220px;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.45;
}

.preview {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: auto;
  text-align: center;
}

.preview svg,
.preview img {
  max-width: 100%;
  height: auto;
}

.preview table {
  border-collapse: collapse;
  margin: 0 auto;
  text-align: left;
}

.preview th,
.preview td {
  border: 1px solid var(--line);
  padding: 6px 10px;
}

.preview pre {
  text-align: left;
  background: var(--soft);
  padding: 12px;
  border-radius: var(--radius);
  overflow: auto;
}

.preview :is(h1, h2, h3, h4, h5, h6, p, ul, ol) {
  text-align: left;
  color: var(--ink);
}

.preview a {
  color: var(--brand);
}

.preview code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--soft);
  color: var(--ink);
  font-family: "Cascadia Code", Consolas, monospace;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 220px 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .actions {
    flex-direction: column;
  }

  .layout {
    display: block;
  }

  .sidebar {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .drawer {
    width: 100vw;
    border-left: 0;
  }
}
