/* =====================================================
   ESTILO GERAL DO SISTEMA DE ARTIGOS
   ===================================================== */
:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #15803d;
    --danger: #b91c1c;
    --shadow: 0 22px 70px rgba(15, 23, 42, .12);
    --radius: 24px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.card { background: var(--card); border: 1px solid rgba(148, 163, 184, .22); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 28px; }
.stack { display: grid; gap: 12px; margin-top: 18px; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.center-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(440px, 100%); }
.login-box h1 { margin: 18px 0 6px; letter-spacing: -.04em; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 850; }
.brand-mark { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); box-shadow: 0 12px 30px rgba(37,99,235,.25); }
label { display: block; font-weight: 750; margin-bottom: 7px; }
input, select, textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 13px 14px; font: inherit; color: var(--text); background: #fff; outline: none;
}
textarea { resize: vertical; min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.55; }
input:focus, select:focus, textarea:focus, .visual-editor:focus { border-color: rgba(37,99,235,.65); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.help { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.strong-help { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; padding: 10px 12px; border-radius: 14px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; background: var(--primary); color: #fff; text-decoration: none; padding: 11px 18px; font-weight: 800; cursor: pointer; line-height: 1; min-height: 42px;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 8px 12px; min-height: 34px; font-size: 13px; }
.btn.block { width: 100%; }
.alert { padding: 13px 15px; border-radius: 16px; margin-top: 16px; line-height: 1.45; }
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.admin-body { background: radial-gradient(circle at top left, #e0e7ff, transparent 36%), #f8fafc; }
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); background: rgba(248,250,252,.82); border-bottom: 1px solid rgba(148,163,184,.25); }
.topbar-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.hero-admin { padding: 38px 0 22px; }
.hero-admin h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); letter-spacing: -.06em; }
.hero-admin p { max-width: 760px; margin: 10px 0 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.full { grid-column: 1 / -1; }
.actions-line { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.editor-shell { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: #fff; }
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.editor-toolbar button, .editor-toolbar select { width: auto; min-height: 36px; border: 1px solid #cbd5e1; background: #fff; border-radius: 12px; padding: 7px 10px; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.editor-toolbar button:hover { background: #eff6ff; border-color: #93c5fd; }
.editor-toolbar .sep { width: 1px; height: 28px; background: #cbd5e1; margin: 0 3px; }
.visual-editor { min-height: 620px; padding: 26px; outline: none; background: #fff; color: #111827; font-size: 18px; line-height: 1.75; overflow-wrap: anywhere; }
.visual-editor:empty:before { content: 'Cole ou digite o texto do artigo aqui...'; color: #94a3b8; }
.visual-editor img { max-width: 100%; height: auto; border-radius: 18px; display: block; margin: 12px auto; }
.visual-editor figure { margin: 24px 0; }
.visual-editor figcaption { min-height: 18px; color: #64748b; text-align: center; font-size: 14px; }
.visual-editor table { width: 100%; border-collapse: collapse; }
.visual-editor th, .visual-editor td { border: 1px solid #cbd5e1; padding: 8px; }
.html-details { margin-top: 14px; border: 1px dashed #cbd5e1; border-radius: 16px; padding: 12px; background: #f8fafc; }
.html-details summary { font-weight: 800; cursor: pointer; }
.html-details textarea { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
.article-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.article-table th, .article-table td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article-table th { color: #475569; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.article-table tr:hover td { background: #f8fafc; }
.copy-link { display: flex; gap: 8px; }
.copy-link input { min-width: 0; font-size: 13px; padding: 9px 10px; border-radius: 12px; }
.link-cell { min-width: 270px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.empty-state { text-align: center; padding: 42px 12px; }
.empty-state h2 { margin-top: 0; }
.public-body { min-height: 100vh; }
.theme-light { background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%); color: #0f172a; }
.theme-dark { background: radial-gradient(circle at top, #334155 0%, #020617 52%); color: #e5e7eb; }
.theme-gradient-blue { background: linear-gradient(135deg, #dbeafe, #eef2ff 42%, #bfdbfe); color: #0f172a; }
.theme-gradient-sand { background: linear-gradient(135deg, #fff7ed, #fef3c7 45%, #fed7aa); color: #1f2937; }
.theme-gradient-nature { background: linear-gradient(135deg, #ecfdf5, #dcfce7 42%, #bbf7d0); color: #052e16; }
.article-container { width: min(860px, calc(100% - 28px)); margin: 0 auto; }
.public-header { padding: 18px 0; }
.public-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.article-card { margin: 12px 0 36px; background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.72); border-radius: 32px; box-shadow: 0 28px 90px rgba(15,23,42,.18); overflow: hidden; }
.theme-dark .article-card { background: rgba(15,23,42,.92); border-color: rgba(148,163,184,.24); }
.article-inner { padding: clamp(26px, 6vw, 64px); }
.article-kicker { display: inline-flex; align-items: center; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; color: var(--primary); margin-bottom: 14px; }
.article-title { margin: 0; font-size: clamp(34px, 7vw, 64px); line-height: .98; letter-spacing: -.065em; }
.article-subtitle { margin: 18px 0 0; color: #475569; font-size: clamp(18px, 3.2vw, 25px); line-height: 1.45; }
.theme-dark .article-subtitle { color: #cbd5e1; }
.article-meta { display: flex; flex-wrap: wrap; gap: 9px 16px; margin: 28px 0 0; padding-top: 18px; border-top: 1px solid rgba(148,163,184,.35); color: #64748b; font-size: 14px; }
.theme-dark .article-meta { color: #cbd5e1; }
.article-body { margin-top: 36px; font-size: clamp(18px, 2.5vw, 20px); line-height: 1.82; overflow-wrap: anywhere; }
.article-body p { margin: 0 0 1.1em; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { line-height: 1.18; letter-spacing: -.035em; margin: 1.4em 0 .55em; }
.article-body h2 { font-size: clamp(28px, 5vw, 38px); }
.article-body h3 { font-size: clamp(23px, 4vw, 30px); }
.article-body ul, .article-body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.article-body li { margin: .35em 0; }
.article-body blockquote { margin: 1.4em 0; padding: 16px 20px; border-left: 4px solid var(--primary); background: rgba(37,99,235,.08); border-radius: 0 18px 18px 0; }
.article-body img { max-width: 100%; height: auto; display: block; margin: 26px auto; border-radius: 22px; box-shadow: 0 18px 48px rgba(15,23,42,.18); }
.article-body figure { margin: 28px 0; }
.article-body figcaption { text-align: center; color: #64748b; font-size: 14px; margin-top: 8px; }
.article-body table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: .92em; }
.article-body th, .article-body td { border: 1px solid #cbd5e1; padding: 10px; }
.footer-note { text-align: center; color: rgba(100,116,139,.85); padding: 0 0 34px; font-size: 14px; }
.public-list { padding: 48px 0; }
.list-hero { text-align: center; margin-bottom: 26px; }
.list-hero h1 { margin: 0; font-size: clamp(40px, 7vw, 72px); letter-spacing: -.07em; }
.list-hero p { color: var(--muted); font-size: 18px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.article-preview-card { background: rgba(255,255,255,.92); border: 1px solid rgba(148,163,184,.25); border-radius: 26px; padding: 24px; box-shadow: 0 18px 60px rgba(15,23,42,.10); }
.article-preview-card h2 { margin: 10px 0 8px; line-height: 1.15; letter-spacing: -.04em; }
.article-preview-card p { color: var(--muted); line-height: 1.55; }
.tag { display: inline-flex; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #1d4ed8; background: #dbeafe; padding: 6px 10px; border-radius: 999px; }
@media (max-width: 760px) {
    .wrap { width: min(100% - 22px, 1180px); }
    .card-pad { padding: 18px; }
    .topbar-inner { align-items: flex-start; flex-direction: column; padding: 12px 0; }
    .nav-actions { justify-content: flex-start; width: 100%; }
    .nav-actions .btn { flex: 1 1 auto; }
    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .hero-admin { padding: 28px 0 16px; }
    .hero-admin p { font-size: 16px; }
    .editor-toolbar { align-items: stretch; }
    .editor-toolbar button, .editor-toolbar select { flex: 1 1 auto; }
    .editor-toolbar .sep { display: none; }
    .visual-editor { min-height: 520px; padding: 18px; font-size: 17px; }
    .copy-link { flex-direction: column; }
    .article-container { width: min(100% - 20px, 860px); }
    .article-card { border-radius: 24px; }
    .article-inner { padding: 24px 18px; }
    .article-body { line-height: 1.72; }
    .public-actions .btn { flex: 1 1 auto; }
}
@media print {
    @page { margin: 15mm 14mm; }
    body { background: #fff !important; color: #000 !important; }
    .no-print { display: none !important; }
    .article-container { width: 100%; margin: 0; }
    .article-card { box-shadow: none !important; border: 0 !important; margin: 0; border-radius: 0; background: #fff !important; }
    .article-inner { padding: 0; }
    .article-title { font-size: 32pt; }
    .article-subtitle { font-size: 15pt; color: #333 !important; }
    .article-body { font-size: 12.5pt; line-height: 1.6; }
    .article-body img { max-height: 230mm; box-shadow: none; page-break-inside: avoid; }
    a { color: #000; text-decoration: underline; }
}

/* =====================================================
   AJUSTES DO TINYMCE
===================================================== */
.tox.tox-tinymce {
    border-radius: 16px;
    overflow: hidden;
    border-color: rgba(15, 23, 42, .14);
}
.tox .tox-edit-area__iframe {
    background: #fff;
}
