/* Estilos do painel do autor */
body.admin { min-height: 100vh; }
.small { font-size: 13px; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.login-art {
  background: #111111; color: #FFFFFF;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px;
}
[data-theme="dark"] .login-art { background: #0E0D0C; }
.login-art img { width: 180px; height: auto; }
.login-art-name { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.login-art-date { font-size: 13px; opacity: .7; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-form h1 { font-size: 44px; }
.login-form .btn { width: 100%; }
.back-site { font-size: 14px; color: var(--muted); }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--surface) 247px, var(--line) 247px, var(--line) 248px, var(--bg) 248px); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px;
  padding: 24px 16px; border-right: 1px solid var(--line); background: var(--surface);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.side-brand img { width: 46px; height: 38px; }
.side-brand span { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: 40px; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--muted); text-align: left;
}
.side-nav button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; flex-shrink: 0; }
.side-nav button:hover { background: var(--surface-2); color: var(--ink); }
.side-nav button.active { background: var(--btn); color: var(--on-btn); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 8px 0; border-top: 1px solid var(--line); }
.side-link { font-size: 14px; color: var(--muted); text-decoration: none; }
.side-link:hover { color: var(--ink); }
.side-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.main { padding: 32px 40px 64px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 24px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 40px; margin-bottom: 6px; }
.topbar h1 em { font-style: normal; color: var(--accent); }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card h2, .card-title { font-size: 24px; }
.card-title { margin-bottom: 20px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-family: var(--display); font-size: 44px; font-weight: 600; letter-spacing: -1.5px; line-height: 1; }
.stat-label { font-size: 13px; color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }

/* Linhas de lista */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.row-text { font-size: 14px; color: var(--muted); line-height: 1.5; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.published { background: var(--ok-soft); color: var(--ok); }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.rows .empty { margin-top: 12px; }

/* ---------- Editor ---------- */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 20px; padding: 32px; }
.title-input {
  border: 0 !important; border-bottom: 1px solid var(--field) !important; border-radius: 0 !important; box-shadow: none !important;
  background: transparent !important; padding: 4px 0 14px !important;
  font-family: var(--display); font-weight: 500; letter-spacing: -1px; font-size: 38px; line-height: 1.15; min-height: 0; resize: none; overflow: hidden;
}
.title-input:focus { border-bottom-color: var(--ink) !important; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px;
  border: 1px solid var(--field); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2);
}
.toolbar button {
  min-width: 36px; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 3px;
  background: transparent; cursor: pointer; font-size: 13px; color: var(--ink);
}
.toolbar button:hover { background: var(--bg); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rich-editor {
  min-height: 380px; padding: 20px 22px; border: 1px solid var(--field); border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface); outline: none; font-size: 17px; line-height: 1.8; overflow-wrap: anywhere;
}
.rich-editor:focus { border-color: var(--ink); }
.rich-editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-editor h2 { font-size: 28px; margin: 1em 0 .4em; }
.rich-editor h3 { font-size: 22px; margin: 1em 0 .4em; }
.rich-editor p { margin: 0 0 1em; }
.rich-editor blockquote { margin: 1em 0; padding-left: 16px; border-left: 3px solid var(--ink); font-family: var(--display); font-size: 20px; }
.rich-editor img { margin: 1em 0; }
.rich-editor a { color: var(--ink); }

.editor-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.editor-side .card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.side-title { font-size: 22px !important; }
.editor-side .status:empty { display: none; }
.publish-actions { display: flex; flex-direction: column; gap: 8px; }
.publish-actions .btn { width: 100%; }
.editor-side .btn.ghost { align-self: flex-start; padding-left: 0; }
.cover-drop {
  display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer;
  min-height: 150px; border: 1px dashed var(--field); border-radius: var(--radius); background: var(--bg); overflow: hidden;
  color: var(--muted);
}
.cover-drop:hover { border-color: var(--ink); color: var(--ink); }
#coverEmpty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; padding: 16px; }
#coverEmpty small { font-size: 12px; }
#coverPreview { width: 100%; height: 170px; object-fit: cover; }

/* ---------- Lista de artigos ---------- */
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.list-tools input { max-width: 280px; }
.tabs { display: flex; gap: 4px; }
.tab { min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 999px; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted); }
.tab:hover { color: var(--ink); }
.tab.active { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.post-thumb { width: 64px; height: 48px; object-fit: cover; flex-shrink: 0; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-family: var(--display); color: var(--ink); font-size: 22px; }
.row-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* ---------- Formulários simples ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-card { max-width: 760px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Aviso rápido */
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 360px;
  padding: 14px 18px; border-radius: var(--radius); background: var(--ink); color: var(--bg);
  font-size: 14px; box-shadow: var(--shadow);
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 32px 16px; gap: 10px; }
  .login-art img { width: 110px; }
  .app { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .sidebar { position: static; height: auto; padding: 12px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .side-nav button { width: auto; white-space: nowrap; }
  .side-foot { flex-direction: row; justify-content: space-between; align-items: center; padding-top: 12px; }
  .main { padding: 20px 16px 48px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar h1 { font-size: 30px; }
  .editor-main { padding: 20px; }
  .title-input { font-size: 28px; }
  .row { flex-direction: column; align-items: stretch; }
  .row-title { white-space: normal; }
  .list-tools input { max-width: none; }
}

/* ---------- Verificação em 2 etapas ---------- */
.login-form.wide { max-width: 520px; }
.code-input { font-family: var(--display); font-size: 30px !important; font-weight: 600; letter-spacing: .35em; text-align: center; min-height: 60px !important; }
.enroll-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 18px; }
.enroll-steps li { counter-increment: step; position: relative; padding-left: 44px; display: flex; flex-direction: column; gap: 8px; }
.enroll-steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--btn); color: var(--on-btn); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
}
.enroll-steps strong { font-size: 15px; }
.enroll-steps span { font-size: 14px; color: var(--muted); }
.qr-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.qr-box img { width: 160px; height: 160px; background: #FFF; border-radius: 10px; padding: 6px; }
.secret { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; flex: 1; min-width: 180px; }
.secret code { font-size: 13px; word-break: break-all; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.secure-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ok); font-weight: 500; }
.secure-note svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; flex-shrink: 0; }

/* ---------- Comentários no painel ---------- */
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #FFF; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.side-nav button.active .nav-count { background: var(--on-btn); color: var(--btn); }
.stars { color: #E2A400; letter-spacing: 1px; }
.stars .off { color: var(--field); }
.ink { color: var(--ink); }
.comment-row .row-text { white-space: normal; }
.comment-row.is-hidden .row-main { opacity: .6; }
#view-comments .muted.small { margin: 4px 0 8px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.overview-grid > .card:last-child { grid-column: 1 / -1; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Áudio do artigo no editor */
.audio-preview { width: 100%; height: 40px; }
.editor-side label.btn { align-self: flex-start; }
