/* Estilo comum do labld.online — página principal e ferramentas.
   Cores: azul do globo do LAB-LD. Tema claro por padrão; o escuro vem do sistema ou do botão (tema.js). */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1b2430;
  --muted: #5f6b79;
  --line: #dfe3e8;
  --brand: #2c4a63;
  --brand-hover: #3a5f7e;
  --brand-soft: #e8eef4;
  --on-brand: #ffffff;
  --local: #2f6b4f;
  --local-soft: #e6f1eb;
  --server: #8a5a12;
  --server-soft: #f6eedd;
  --danger: #a33a3a;
  --danger-soft: #f8e9e9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d; --surface: #171e27; --ink: #e5e9ee; --muted: #98a3b1; --line: #263140;
    --brand: #8fb3d1; --brand-hover: #a9c5dd; --brand-soft: #1c2a38; --on-brand: #11161d;
    --local: #8cc7a6; --local-soft: #18291f; --server: #e0b468; --server-soft: #2d2412;
    --danger: #e59a9a; --danger-soft: #2e1a1a;
  }
}
:root[data-theme="dark"] {
  --bg: #11161d; --surface: #171e27; --ink: #e5e9ee; --muted: #98a3b1; --line: #263140;
  --brand: #8fb3d1; --brand-hover: #a9c5dd; --brand-soft: #1c2a38; --on-brand: #11161d;
  --local: #8cc7a6; --local-soft: #18291f; --server: #e0b468; --server-soft: #2d2412;
  --danger: #e59a9a; --danger-soft: #2e1a1a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font: 15px/1.5 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .92em; }
[hidden] { display: none !important; }

/* ── Cabeçalho: marca + trilha + tema ─────────────────────────── */
.topo { background: var(--surface); border-bottom: 1px solid var(--line); }
.topo-in {
  max-width: 960px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.topo-in > img { width: 30px; height: 30px; flex: none; }
.marca { display: flex; flex-direction: column; line-height: 1.2; text-decoration: none; color: inherit; min-width: 0; }
.marca b { font-weight: 700; letter-spacing: .02em; color: var(--brand); }
.marca span { font-size: 12.5px; color: var(--muted); }
.trilha { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); min-width: 0; }
.trilha a { color: var(--brand); font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.trilha a:hover { text-decoration: underline; text-underline-offset: 3px; }
.trilha span:last-child { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tema {
  margin-left: auto; flex: none; font: inherit; font-size: 13px; color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; cursor: pointer;
}
.tema:hover { color: var(--ink); border-color: var(--muted); }
@media (max-width: 600px) { .marca span { display: none; } }

/* ── Página de ferramenta ──────────────────────────────────────── */
.container { max-width: 960px; margin: 0 auto; padding: 28px 16px 48px; }
.header { margin-bottom: 20px; }
.header h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.header p { color: var(--muted); margin-top: 2px; }

.nota {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--local);
  border-radius: 4px; padding: 10px 14px; font-size: 14px; color: var(--muted); margin-bottom: 16px;
}
.nota strong { color: var(--ink); }
.nota.atencao { border-left-color: var(--server); }

.card, .step-card, .process-section, .results-section {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: 18px 20px; margin-bottom: 16px;
}
.card.loaded, .step-card.loaded { border-left: 3px solid var(--local); }
.card h2, .step-card h2, .process-section h2, .results-section h2, .preview-section h2 {
  font-size: 16px; font-weight: 600; margin-bottom: 2px;
}
.process-section h2, .results-section h2, .preview-section h2 { margin-bottom: 12px; }
.desc { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.card code, .step-card code, .desc code {
  background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px;
}

.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.steps .step-card { margin-bottom: 0; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
.step-number {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin-bottom: 8px;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600;
}
.opcional {
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; margin-left: 6px;
  vertical-align: middle;
}

/* Envio de arquivo */
.upload-zone {
  position: relative; border: 1px dashed var(--muted); border-radius: 4px; background: var(--bg);
  padding: 22px 16px; text-align: center; cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-zone .label { font-size: 14px; color: var(--muted); }
.upload-zone .label strong { color: var(--brand); font-weight: 600; }
.upload-icon { display: none; }

.file-badge {
  display: none; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px;
  background: var(--local-soft); border-radius: 3px; padding: 6px 10px; font-size: 13.5px;
}
.file-badge.visible { display: flex; }
.file-badge .check { color: var(--local); font-weight: 700; }
.file-badge .info { color: var(--muted); }

.columns-info { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.col-chip {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12.5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px;
}
.col-chip .arrow { color: var(--brand); }

/* Campos */
.campo { display: block; margin-top: 12px; }
.campo > span { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.campo input, .campo textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px; resize: vertical;
}
.campo input:focus, .campo textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

/* Botões */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-success { background: var(--local); border-color: var(--local); color: var(--on-brand); }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); border-color: var(--local); }

/* Status, progresso, números */
.status-bar {
  display: none; align-items: center; gap: 8px; margin-top: 12px;
  padding: 8px 12px; border-radius: 3px; font-size: 14px; background: var(--bg);
}
.status-bar.visible { display: flex; }
.status-bar.success { background: var(--local-soft); color: var(--local); }
.status-bar.error { background: var(--danger-soft); color: var(--danger); }
.status-bar.warning { background: var(--server-soft); color: var(--server); }

.progress-container { display: none; margin-top: 12px; }
.progress-container.visible { display: block; }
.progress-bar-bg { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-bar-fill { height: 100%; width: 0; background: var(--brand); }
.progress-text { font-size: 13px; color: var(--muted); }

.stats-row, .stats-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat-item, .stat-card {
  flex: 1; min-width: 120px; background: var(--bg); border-radius: 4px; padding: 10px 14px;
}
.stat-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-card.success .stat-value { color: var(--local); }
.stat-card.warning .stat-value { color: var(--server); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.avisos { margin-top: 12px; }
.aviso {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 6px;
  background: var(--server-soft); border-radius: 3px; padding: 8px 12px; font-size: 13.5px; color: var(--ink);
}
.aviso strong { color: var(--server); }

.success-check { display: inline-flex; align-items: center; }
.success-check svg { width: 18px; height: 18px; }
.success-check svg circle { fill: var(--local); }
.success-check svg polyline { fill: none; stroke: var(--surface); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.spinner-inline {
  display: inline-block; width: 14px; height: 14px; vertical-align: middle;
  border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* Tabelas */
.preview-section, .results-section { display: none; }
.preview-section.visible, .results-section.visible { display: block; }
.preview-table-wrapper, .results-table-wrapper {
  overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 4px;
}
.preview-table, .results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-table th, .results-table th {
  position: sticky; top: 0; background: var(--bg); text-align: left; font-weight: 600; color: var(--muted);
  padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.preview-table td, .results-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.preview-table tr:hover td, .results-table tr:hover td { background: var(--brand-soft); }
.results-table td.highlight { color: var(--brand); font-weight: 600; }

/* ── Rodapé ────────────────────────────────────────────────────── */
footer { color: var(--muted); font-size: 13px; padding: 0 16px; }
.rod {
  max-width: 928px; margin: 0 auto; padding: 20px 0 40px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
}
.rod p { max-width: 62ch; }
