/* PrimaOS — ajustes server-side específicos do app (complementa o design styles.css). */

/* Ícone do toggle de tema: mostra o alvo do clique conforme o tema atual. */
[data-theme="dark"] .theme-when-light { display: none; }
[data-theme="light"] .theme-when-dark { display: none; }

/* Mensagens flash (alinhadas ao visual de callout/pill). */
.flash-stack { position: fixed; top: 64px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.flash {
  padding: 11px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 9px;
}
.flash.notice { border-color: var(--accent-line); color: var(--text); }
.flash.alert  { border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--text); }
.flash .ico { color: var(--accent); }
.flash.alert .ico { color: var(--red); }

/* Link de navegação sem destino ainda (placeholder de fases futuras). */
.nav-item.pending { opacity: 0.55; cursor: default; }
.nav-item.pending:hover { background: none; color: var(--text-2); }

/* Selects nativos alinhados ao visual. */
select {
  font-family: inherit; font-size: 12.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 6px 9px; outline: none;
}
select:hover { border-color: var(--border-strong); }
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Chip de projeto como checkbox (esconde o input nativo). */
.svc-chip input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.svc-chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }

/* Logs (Fase 4): toggle de wrap no terminal — por padrão as linhas quebram (.log-line pre-wrap). */
.term-body.nowrap .log-line { white-space: pre; word-break: normal; }
.term-body.nowrap { overflow-x: auto; }

/* ====================== Fase 5 — Camada Notion ====================== */

/* Textareas alinhadas ao visual dos inputs do design. */
.field textarea, textarea.field-area {
  width: 100%; background: var(--canvas); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 11px 13px; font-size: 14px; line-height: 1.6; outline: none; resize: vertical;
}
.field textarea:focus, textarea.field-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.code-area { font-family: var(--font-mono); font-size: 13px; }

/* Botão "+" de adicionar (sidebar Projects). */
.sb-add { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-3); }
.sb-add:hover { background: var(--surface-3); color: var(--text); }

/* Checklist vindo do markdown (GFM tasklist) — estilizado como o .checklist do design. */
.doc ul.checklist { list-style: none; padding-left: 2px; margin: 10px 0; }
.doc li.task { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0; }
.doc li.task input[type="checkbox"] { margin-top: 4px; width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.doc li.task.done { color: var(--text-3); text-decoration: line-through; }
.doc li.task.done::marker { content: ""; }

/* Editor de nota: textarea + preview lado a lado. */
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.editor-split textarea { min-height: 440px; }
.editor-preview { min-height: 440px; padding: 14px 16px; border: 1px dashed var(--border-muted); border-radius: var(--r-md); background: var(--surface); overflow: auto; }
@media (max-width: 940px) { .editor-split { grid-template-columns: 1fr; } }

/* Lista de notas / serviços (linhas clicáveis). */
.note-row, .service-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
  margin-bottom: 8px; text-decoration: none; color: inherit; transition: border-color 0.12s, background 0.12s;
}
.note-row:hover, .service-row:hover { border-color: var(--border-strong); background: var(--surface-3); }
.note-row .nr-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.note-row .nr-title { font-weight: 550; font-size: 14px; }
.note-row .nr-meta, .service-row .sr-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.service-row .sr-name { font-weight: 600; font-size: 14px; }

/* Grid de cards de projeto. */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

/* Estado vazio padrão. */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-state .es-ico { opacity: 0.5; margin-bottom: 10px; }
.empty-state h3 { font-size: 15px; color: var(--text-2); margin: 0 0 4px; }

/* ====================== Fase 6 — Release ====================== */

/* Revelar segredo (aba Env): célula com máscara + form de senha master inline. */
.reveal-wrap { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reveal-ui { display: inline-flex; align-items: center; gap: 8px; }
.reveal-form { display: none; align-items: center; gap: 6px; }
.reveal-input {
  width: 150px; background: var(--canvas); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 4px 8px; font-size: 12.5px; outline: none;
}
.reveal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.reveal-error { color: var(--red); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.val.revealed { color: var(--green); }
.reveal-note { font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }

/* Dashboard: itens de atividade e métricas de saúde. */
.alert-item { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border-muted); font-size: 13px; }
.alert-item:last-child { border-bottom: none; }
.alert-item .at { font-weight: 500; }
.alert-item .as { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.alert-item .when { margin-left: auto; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.card-head { display: flex; align-items: center; gap: 9px; padding: 14px 16px; border-bottom: 1px solid var(--border-muted); }
.card-head h3 { font-size: 14px; margin: 0; font-weight: 600; }
.card-pad { padding: 14px 16px; }
.health-metric .hm-val { font-size: 22px; font-weight: 650; font-family: var(--font-mono); letter-spacing: -0.5px; }
.health-metric .hm-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.health-metric .hm-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Settings: nav lateral + blocos. */
.settings-grid { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; max-width: 980px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; }
.settings-nav button, .settings-nav a {
  text-align: left; background: none; border: none; padding: 8px 12px; border-radius: var(--r-md);
  font-size: 13px; color: var(--text-3); cursor: pointer; text-decoration: none;
}
.settings-nav button:hover, .settings-nav a:hover { background: var(--surface-3); color: var(--text); }
.settings-nav .active { background: var(--accent-soft); color: var(--text); }
.setting-block { margin-bottom: 30px; }
.setting-block h3 { font-size: 15px; margin: 0 0 4px; }
.setting-block .desc { font-size: 13px; color: var(--text-3); margin: 0 0 14px; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border-muted); }
.kv-row:last-child { border-bottom: none; }
.kv-row .kl { font-size: 13px; font-weight: 500; }
.kv-row .kd { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.code-inline { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-3); padding: 2px 7px; border-radius: var(--r-sm); color: var(--text-2); }
@media (max-width: 820px) { .settings-grid { grid-template-columns: 1fr; } .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; } }

/* v1.1 · picker "Adicionar a um projeto": select dentro do .input-wrap herda o look dos inputs. */
.field .input-wrap select { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; appearance: none; cursor: pointer; }
.field .input-wrap select option { background: var(--surface); color: var(--text); }
.add-project-card { margin-bottom: 16px; border: 1px dashed var(--border-strong); }

/* ============ v1.1 · FOCO 2 — Notas estilo Notion (edição na própria página) ============ */
/* Título/ícone editáveis inline (espelham .notes-title / .notes-icon do design). */
.notes-icon-input {
  width: 54px; height: 54px; border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--border); text-align: center; font-size: 26px; color: var(--accent);
  margin-left: 8px; outline: none;
}
.notes-icon-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.notes-title-input {
  font-size: 32px; font-weight: 700; letter-spacing: -0.8px; margin: 16px 0 4px;
  border: none; background: none; color: var(--text); width: 100%; outline: none; padding: 0;
  font-family: var(--font-display);
}
.notes-title-input::placeholder { color: var(--text-faint); }

/* Corpo: textarea sem moldura, auto-grow (altura via JS), sensação de página. */
.note-body-area {
  width: 100%; border: none; outline: none; background: none; resize: none; overflow: hidden;
  font-size: 15px; line-height: 1.75; color: var(--text); min-height: 260px; padding: 0;
}
.note-body-area::placeholder { color: var(--text-faint); }

/* Toolbar + menu "/" (só inserem markdown — nenhum render no cliente). */
.md-toolwrap { position: relative; }
.md-toolbar { display: flex; align-items: center; gap: 4px; margin: 2px 0 12px; flex-wrap: wrap; }
.md-tb {
  min-width: 30px; height: 28px; padding: 0 7px; display: inline-grid; place-items: center;
  border: 1px solid var(--border-muted); background: var(--surface); border-radius: 7px;
  color: var(--text-2); font-size: 13px; cursor: pointer;
}
.md-tb:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-3); }
.md-tb-hint { font-size: 11.5px; color: var(--text-faint); margin-left: 6px; }
.slash-menu {
  position: absolute; top: 100%; left: 0; z-index: 40; margin-top: 4px; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-md, 0 10px 28px rgba(0,0,0,0.22)); padding: 5px;
}
.slash-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); padding: 5px 8px; }
.slash-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: none;
  background: none; padding: 7px 8px; border-radius: 6px; color: var(--text-2); font-size: 13px; cursor: pointer;
}
.slash-item:hover { background: var(--surface-3); color: var(--text); }
.slash-item span { width: 24px; text-align: center; color: var(--text-3); }

/* Indicador de autosave. */
.save-status { font-size: 11.5px; color: var(--text-3); padding: 3px 10px; border-radius: 999px; background: var(--surface-3); display: inline-flex; align-items: center; }
.save-status[data-state="saving"] { color: var(--accent); }
.save-status[data-state="saved"]  { color: var(--green, #3fb950); }
.save-status[data-state="unsaved"], .save-status[data-state="error"] { color: var(--red, #f85149); }
.btn.ghost.active { color: var(--accent); background: var(--accent-soft); }

/* Filtros do índice de notas. */
.notes-filters { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.notes-filters .nf-ico { color: var(--text-3); }
.notes-filters select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 7px 10px; font-size: 13px; color: var(--text); outline: none; cursor: pointer;
}
.notes-filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nr-pin { color: var(--accent); margin-right: 5px; display: inline-flex; vertical-align: -1px; }

kbd {
  font-family: var(--font-mono); font-size: 11px; background: var(--surface-3);
  border: 1px solid var(--border-muted); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 5px; color: var(--text-2);
}

/* v1.1 · paginação (audit log). */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0 4px; }
.pager .pager-info { font-size: 12.5px; color: var(--text-3); }

/* v1.2 Cofre · reveal CSS-only — o valor secreto vive blurado; o checkbox o revela (zero JS). */
.reveal-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.reveal-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.reveal-value {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: var(--r-md);
  background: var(--surface-3); border: 1px solid var(--border-muted);
  word-break: break-all; filter: blur(6px); user-select: none; transition: filter .08s ease;
}
.reveal-toggle:checked ~ .reveal-value { filter: none; user-select: text; }
.reveal-actions { display: inline-flex; gap: 6px; }
.reveal-hide { display: none; }
.reveal-toggle:checked ~ .reveal-actions .reveal-show { display: none; }
.reveal-toggle:checked ~ .reveal-actions .reveal-hide { display: inline-flex; }
.btn.danger { color: var(--danger, #e5484d); }

/* v1.2 F3 · subcabeçalho de empresa (Workspace) na sidebar, acima dos projetos dela. */
.sb-company {
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); padding: 8px 10px 3px; margin-top: 2px;
}
