/* Cockpit De Fato — design system do portal (minimalista premium). Sem fontes externas. */

:root {
  --bg: #FFFFFF;
  --bg-soft: #FAFAF9;
  --bg-sunk: #F4F4F2;
  --ink: #0A0A0A;
  --ink-2: #3D3D3D;
  --ink-3: #6B6B6B;
  --ink-4: #9A9A9A;
  --line: #EAEAEA;
  --line-2: #DCDCDA;
  --accent: #02CD9F;
  --accent-text: #04AF88;
  --accent-deep: #00694F;
  --accent-wash: rgba(2, 205, 159, .10);
  --urgent: #E5484D;
  --urgent-wash: rgba(229, 72, 77, .09);
  --review: #F5A623;
  --review-ink: #8A5A00;
  --review-wash: rgba(245, 166, 35, .13);
  --on-ink: #FFFFFF;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --pill: 999px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;

  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", Times, serif;

  --shadow-1: 0 1px 2px rgba(10, 10, 10, .04), 0 1px 1px rgba(10, 10, 10, .03);
  --shadow-2: 0 12px 40px rgba(10, 10, 10, .12), 0 2px 6px rgba(10, 10, 10, .05);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-text);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E0D;
    --bg-soft: #151514;
    --bg-sunk: #1B1B1A;
    --ink: #F2F2F0;
    --ink-2: #CFCFCB;
    --ink-3: #A0A09B;
    --ink-4: #75756F;
    --line: #262624;
    --line-2: #33332F;
    --accent-text: #2BD9AE;
    --accent-deep: #6FE8C8;
    --accent-wash: rgba(2, 205, 159, .14);
    --review-ink: #F5C46B;
    --on-ink: #0A0A0A;
    --shadow-2: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--ui);
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.has-modal { overflow: hidden; }
a { color: var(--accent-deep); text-underline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
[hidden] { display: none !important; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--on-ink); padding: 8px 14px; border-radius: var(--pill); z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.grow { flex: 1; }
.center { text-align: center; }
.txt-urgent { color: var(--urgent); }
.hint { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: var(--s1); line-height: 1.45; }
.lg-only { display: inline; }
@media (max-width: 640px) { .lg-only { display: none; } }

/* ------------------------------------------------------------ marca */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: #0A0A0A; color: #fff; font: 700 12.5px/1 var(--ui); letter-spacing: -0.02em; padding-right: 4px;
}
.brand-mark i { position: absolute; right: 5px; bottom: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.brand-lg { font-size: 19px; }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 16px; }
.brand-lg .brand-mark i { width: 5px; height: 5px; right: 6px; bottom: 12px; }
.brand-lg b { font-weight: 700; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .brand-mark { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ------------------------------------------------------------ botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: var(--pill); border: 1px solid transparent;
  font-weight: 550; font-size: 14px; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover:not(:disabled) { background: var(--ink-2); }
.btn-ghost { background: var(--bg); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-4); }
.btn-danger { background: var(--urgent); color: #fff; }
.btn-danger-ghost { background: var(--bg); color: var(--urgent); border-color: var(--line-2); box-shadow: var(--shadow-1); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; height: 44px; }
.btn .plus { font-size: 18px; font-weight: 400; margin-top: -2px; }
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }
.icon-btn { width: 32px; height: 32px; border: 0; background: none; border-radius: var(--pill); font-size: 20px; line-height: 1; color: var(--ink-3); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }

.input {
  width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-4); }
.input:hover { border-color: var(--ink-4); }
.input:focus, .input:focus-visible { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-wash); border-radius: var(--r-md); }
select.input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-sm { height: 36px; font-size: 14px; padding: 0 12px; }
select.input-sm { padding-right: 32px; }
.field { display: block; margin-bottom: var(--s4); }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.req { color: var(--urgent); text-decoration: none; margin-left: 2px; }
.form-error { background: var(--urgent-wash); color: var(--urgent); padding: 10px 12px; border-radius: var(--r-md); font-size: 14px; margin: 0 0 var(--s4); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 5px 0; font-size: 14px; line-height: 1.35; }
.check input { flex: none; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--ink); }

/* ------------------------------------------------------------ pills de status */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--pill); font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg-sunk); color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-publish { background: var(--accent-wash); color: var(--accent-deep); }
.pill-publish::before { background: var(--accent); }
.pill-draft { background: var(--bg-sunk); color: var(--ink-3); }
.pill-pending { background: var(--review-wash); color: var(--review-ink); }
.pill-pending::before { background: var(--review); }
.pill-future { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pill-private { background: var(--ink-2); color: var(--bg); }
.pill-local { background: transparent; color: var(--review-ink); box-shadow: inset 0 0 0 1px var(--review); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-warn { background: var(--review); }
.dot-ok { background: var(--accent); }

/* ------------------------------------------------------------ barra do app */
.app-bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.app-bar-in { max-width: 1160px; margin: 0 auto; height: 56px; padding: 0 var(--s6); display: flex; align-items: center; gap: var(--s4); }
body[data-route="post"] .app-bar, body[data-route="new"] .app-bar { display: none; }
.user-name { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.net.on { display: none; }
.net.off { font-size: 12.5px; font-weight: 600; color: var(--urgent); background: var(--urgent-wash); border-radius: var(--pill); padding: 4px 10px; }
.queue-chip { font-size: 12.5px; font-weight: 600; color: var(--review-ink); background: var(--review-wash); border-radius: var(--pill); padding: 4px 10px; text-decoration: none; white-space: nowrap; }

/* ------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s6) var(--s4); background: var(--bg-soft); }
.login-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s10) var(--s8) var(--s8); box-shadow: var(--shadow-1); }
.login-card > .muted { margin: var(--s3) 0 var(--s8); font-size: 14.5px; }
.login-foot { margin-top: var(--s6); }
@media (max-width: 480px) { .login-card { padding: var(--s8) var(--s5) var(--s6); border-radius: var(--r-lg); } }

/* ------------------------------------------------------------ lista */
.page { max-width: 1160px; margin: 0 auto; padding: var(--s8) var(--s6) var(--s16); }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); }
.list-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.list-head p { margin: 6px 0 0; }
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.list-filters { display: flex; gap: var(--s2); flex: 1; justify-content: flex-end; min-width: 0; }
.list-filters select { width: auto; flex: none; }
.list-filters input { max-width: 280px; }
.segmented { display: inline-flex; padding: 3px; background: var(--bg-sunk); border-radius: var(--pill); }
.seg { height: 30px; padding: 0 16px; border: 0; border-radius: var(--pill); background: transparent; color: var(--ink-3); font-weight: 550; font-size: 13.5px; cursor: pointer; }
.seg.active { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-1); }

.post-list { list-style: none; margin: 0; padding: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: opacity .15s; }
.post-list.loading { opacity: .55; }
.post-list > li + li { border-top: 1px solid var(--line); }
.post-row { display: flex; gap: var(--s4); align-items: center; padding: 14px var(--s5); color: inherit; text-decoration: none; }
.post-row:hover { background: var(--bg-soft); }
.post-row:focus-visible { border-radius: 0; box-shadow: inset 0 0 0 2px var(--accent-text); }
.thumb { flex: none; width: 72px; height: 48px; border-radius: var(--r-sm); object-fit: cover; background: var(--bg-sunk); }
.thumb-empty { display: grid; place-items: center; font: 700 12px var(--ui); color: var(--ink-4); letter-spacing: .02em; }
.post-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.post-title { font-weight: 600; font-size: 15.5px; line-height: 1.35; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.local-flag { font-size: 12px; font-weight: 600; color: var(--review-ink); }
.local-flag::before { content: "● "; color: var(--review); }
.local-flag.conflict { color: var(--urgent); }
.local-flag.conflict::before { color: var(--urgent); }
.list-loading, .post-list .empty { padding: var(--s10) var(--s5); text-align: center; color: var(--ink-3); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s5); }
.pager:has(> span:only-child) { justify-content: center; }
.notice { background: var(--review-wash); color: var(--review-ink); border-radius: var(--r-md); padding: 10px 14px; font-size: 14px; margin: 0 0 var(--s4); }

.local-box { background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--review); border-radius: var(--r-md); padding: var(--s4) var(--s5); margin-bottom: var(--s6); }
.local-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.local-list { margin: var(--s2) 0 0; padding: 0 0 0 18px; font-size: 14px; }
.local-list li { padding: 3px 0; }
.local-list a { color: var(--ink); font-weight: 550; }

@media (max-width: 720px) {
  .page { padding: var(--s5) var(--s4) var(--s12); }
  .app-bar-in { padding: 0 var(--s4); gap: var(--s3); }
  .list-head h1 { font-size: 25px; }
  .list-tools { flex-direction: column; align-items: stretch; }
  .segmented { align-self: flex-start; }
  .list-filters { justify-content: stretch; }
  .list-filters select { flex: none; max-width: 46%; }
  .list-filters input { max-width: none; flex: 1; min-width: 0; }
  .post-row { padding: 12px var(--s4); gap: var(--s3); align-items: flex-start; }
  .thumb { width: 64px; height: 44px; }
  .post-title { font-size: 15px; }
}

/* ------------------------------------------------------------ editor */
.ed-loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink-3); }
.editor { min-height: 100vh; background: var(--bg-soft); }
.ed-bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.ed-bar-in { max-width: 1160px; margin: 0 auto; height: 56px; padding: 0 var(--s6); display: flex; align-items: center; gap: var(--s3); }
.back { color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 550; padding: 6px 10px 6px 0; white-space: nowrap; }
.back:hover { color: var(--ink); }
.save-state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); min-width: 0; padding-left: var(--s3); border-left: 1px solid var(--line); }
.st-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); flex: none; }
.st-clean .st-dot { background: var(--accent); }
.st-dirty .st-dot, .st-new .st-dot, .st-queued .st-dot { background: var(--ink-4); }
.st-saving .st-dot, .st-publishing .st-dot { background: var(--accent); animation: pulse .9s infinite; }
.st-offline, .st-retry { color: var(--review-ink); }
.st-offline .st-dot, .st-retry .st-dot { background: var(--review); }
.st-error, .st-conflict { color: var(--urgent); }
.st-error .st-dot, .st-conflict .st-dot { background: var(--urgent); }

.ed-grid { max-width: 1160px; margin: 0 auto; padding: var(--s8) var(--s6) var(--s16); display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s10); align-items: start; }
.ed-main { min-width: 0; }
.ed-paper { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s10) var(--s12) var(--s6); }

[data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--ink-4); pointer-events: none; }
.ed-title { font: 700 34px/1.18 var(--ui); letter-spacing: -0.028em; margin: 0 0 var(--s3); outline: none; word-break: break-word; }
.ed-standfirst { font: 400 19px/1.5 var(--ui); color: var(--ink-3); margin: 0 0 var(--s6); outline: none; word-break: break-word; }
.ed-title:focus-visible, .ed-standfirst:focus-visible, .ed-body:focus-visible { box-shadow: none; }

.featured { margin: 0 0 var(--s6); }
.featured-empty { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; height: 96px; border: 1.5px dashed var(--line-2); border-radius: var(--r-md); background: var(--bg-soft); color: var(--ink-3); font-weight: 550; cursor: pointer; transition: border-color .15s, color .15s; }
.featured-empty:hover { border-color: var(--ink-4); color: var(--ink); }
.featured-fig { margin: 0; }
.featured-fig img, .featured-ph { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-md); background: var(--bg-sunk); }
.featured-ph { display: grid; place-items: center; color: var(--ink-4); }
.featured-fig figcaption { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s2); }
.featured-fig figcaption > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.featured-actions { display: flex; gap: var(--s2); flex: none; }

.body-wrap { position: relative; border-top: 1px solid var(--line); }
.toolbar { position: sticky; top: 56px; z-index: 10; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: var(--s2) 0; margin-bottom: var(--s4); background: var(--bg); border-bottom: 1px solid var(--line); }
.tb-btn { min-width: 36px; height: 36px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); cursor: pointer; font-size: 14px; font-weight: 600; }
.tb-btn:hover { background: var(--bg-sunk); color: var(--ink); }
.tb-btn.on { background: var(--ink); color: var(--on-ink); }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.tb-photo { display: inline-flex; align-items: center; gap: 4px; }

.prose { font: 400 19px/1.7 var(--serif); color: var(--ink); }
.ed-body { min-height: 360px; outline: none; word-break: break-word; padding-bottom: var(--s6); }
.ed-body.is-empty::before { content: attr(data-placeholder); position: absolute; color: var(--ink-4); pointer-events: none; }
.prose p { margin: 0 0 1em; }
.prose h2 { font: 700 24px/1.3 var(--ui); letter-spacing: -0.015em; margin: 1.6em 0 .6em; }
.prose h3 { font: 700 20px/1.35 var(--ui); margin: 1.4em 0 .5em; }
.prose h4 { font: 700 17px/1.4 var(--ui); margin: 1.2em 0 .5em; }
.prose blockquote { margin: 1.4em 0; padding: 2px 0 2px 22px; border-left: 3px solid var(--accent); color: var(--ink-2); font-style: italic; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose a { color: var(--accent-deep); text-decoration: underline; text-decoration-color: var(--accent); }
.prose figure { margin: 1.6em 0; padding: 0; cursor: pointer; border-radius: var(--r-md); }
.prose figure img { display: block; width: 100%; height: auto; border-radius: var(--r-md); background: var(--bg-sunk); }
.prose figure img.img-blocked { min-height: 120px; }
.prose figcaption { font: 400 13.5px/1.45 var(--ui); color: var(--ink-3); margin-top: var(--s2); }
.prose figcaption .dm-cred { color: var(--ink-4); }
.prose figure.is-selected { box-shadow: 0 0 0 3px var(--accent-text); }
.prose .dm-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s2); margin: 1.6em 0; padding: var(--s2); border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.prose .dm-gallery figure { margin: 0; }
.fig-tools { position: absolute; right: 12px; z-index: 5; }
.ed-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: var(--s3); }

.banners:empty { display: none; }
.banners { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.banner { display: flex; align-items: center; gap: var(--s3); padding: 10px 10px 10px 16px; border-radius: var(--r-md); font-size: 14px; border: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.banner-text { flex: 1 1 260px; }
.banner-actions { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.banner-warn { background: var(--review-wash); border-color: transparent; color: var(--review-ink); }
.banner-info { background: var(--accent-wash); border-color: transparent; color: var(--accent-deep); }
.presence { margin-bottom: var(--s3); }
.avatars { display: inline-flex; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-deep); color: #fff; font-size: 11px; font-weight: 700; border: 2px solid var(--bg); margin-left: -6px; }
.avatar:first-child { margin-left: 0; }

/* barra lateral */
.ed-side { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 2px; display: grid; gap: var(--s3); scrollbar-width: thin; }
.side-sec { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4) var(--s5); }
.side-title { font: 650 11.5px/1 var(--ui); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 2px 0 var(--s3); }
.side-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.side-row + .side-row { margin-top: var(--s2); }
.side-status .hint { margin-top: var(--s2); }
.slug-field { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--bg); overflow: hidden; }
.slug-field:focus-within { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-wash); }
.slug-prefix { padding: 0 2px 0 12px; color: var(--ink-4); font-size: 14px; }
.slug-field .input { border: 0; box-shadow: none; padding-left: 2px; }
.tree-wrap { max-height: 260px; overflow: auto; margin: -4px 0; scrollbar-width: thin; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree.sub { padding-left: 26px; }
.tag-field { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 40px; z-index: 30; list-style: none; margin: 0; padding: 4px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-2); }
.suggest li { padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; }
.suggest li:hover, .suggest li.active { background: var(--bg-sunk); }
.checklist { list-style: none; margin: -4px 0 0; padding: 0; }
.gate-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.gate-list li { position: relative; padding: 8px 10px 8px 28px; background: var(--urgent-wash); color: var(--urgent); border-radius: var(--r-sm); font-size: 13.5px; line-height: 1.4; }
.gate-list li::before { content: "!"; position: absolute; left: 10px; top: 8px; font-weight: 800; }
.gate-ok { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--accent-deep); font-weight: 600; font-size: 14px; }
.copies { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.copies li { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.copy-title { font-weight: 550; }
.copy-actions { display: flex; gap: var(--s3); }

@media (max-width: 960px) {
  .ed-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s4); padding: var(--s4) var(--s4) var(--s16); }
  .ed-side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
  .ed-bar-in { padding: 0 var(--s4); gap: var(--s2); }
  .save-state { padding-left: var(--s2); font-size: 12.5px; }
  .ed-grid { padding: 0 0 var(--s16); }
  .ed-paper { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); padding: var(--s6) var(--s4) var(--s4); }
  .banners { margin-top: var(--s3); }
  .presence:first-child, .banners:empty + .presence { margin-top: var(--s3); }
  .featured-fig figcaption { flex-wrap: wrap; }
  .featured-fig figcaption > span:first-child { flex: 1 1 100%; }
  .banners, .presence { margin-left: var(--s3); margin-right: var(--s3); }
  .ed-side { padding: 0 var(--s3); }
  .ed-title { font-size: 26px; }
  .ed-standfirst { font-size: 17px; }
  .prose { font-size: 18px; }
  .toolbar { margin-left: calc(-1 * var(--s4)); margin-right: calc(-1 * var(--s4)); padding: var(--s1) var(--s2); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tb-sep { margin: 0 2px; }
  .ed-bar .btn-sm { padding: 0 12px; }
}

/* ------------------------------------------------------------ modal */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: var(--s4); animation: fade .15s ease; }
.modal-wrap.out { opacity: 0; transition: opacity .15s; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 10, .42); }
.modal { position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-2); animation: rise .18s ease; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 940px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s5) 0 var(--s6); }
.modal-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.modal-body { padding: var(--s4) var(--s6); overflow: auto; font-size: 15px; }
.modal-body p { margin: 0 0 var(--s3); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s4) var(--s6) var(--s5); border-top: 1px solid var(--line); flex-wrap: wrap; }
.reasons { margin: 0 0 var(--s3); padding-left: 20px; color: var(--urgent); }
.reasons li { margin: 4px 0; }
.choices { margin: 0; padding-left: 18px; color: var(--ink-2); }
.choices li { margin: 8px 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 640px) {
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal, .modal-lg, .modal-sm { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 94vh; max-height: 94dvh; }
  .modal-actions { padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom)); }
  .modal-actions .btn { flex: 1; }
  .modal-body { padding: var(--s4) var(--s5); }
  .modal-head { padding-left: var(--s5); }
}

/* seletor de fotos */
.mp { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s6); }
.mp-left { min-width: 0; }
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.tab { border: 0; background: none; padding: 8px 0 10px; color: var(--ink-3); font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.mp-pane > .input { margin-bottom: var(--s3); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--s2); min-height: 120px; }
.media-tile { padding: 0; border: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-sunk); aspect-ratio: 3 / 2; cursor: pointer; position: relative; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.media-tile:hover img { transform: scale(1.03); }
.media-tile.sel { box-shadow: 0 0 0 3px var(--accent-text); }
.media-tile.sel::after { content: "✓"; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #0A0A0A; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.media-loading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-3); padding: var(--s8); }
.mp-pane .center { margin-top: var(--s4); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 180px; padding: var(--s6); border: 1.5px dashed var(--line-2); border-radius: var(--r-md); background: var(--bg-soft); cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--accent-text); background: var(--accent-wash); }
#mp-file:focus-visible + .dropzone { box-shadow: var(--focus); }
.mp-preview { aspect-ratio: 3 / 2; border-radius: var(--r-md); background: var(--bg-sunk); overflow: hidden; margin-bottom: var(--s4); display: grid; place-items: center; }
.mp-preview img { width: 100%; height: 100%; object-fit: contain; }
.mp-featured .mp-preview { margin-bottom: var(--s3); }
.progress { height: 6px; border-radius: var(--pill); background: var(--bg-sunk); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
@media (max-width: 760px) {
  .mp { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .mp-fields { order: 2; }
  .mp-preview { aspect-ratio: 16 / 9; max-height: 200px; }
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dropzone { min-height: 140px; }
}

/* ------------------------------------------------------------ avisos */
.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: #0A0A0A; color: #fff; padding: 11px 18px; border-radius: var(--pill); font-size: 14px; box-shadow: var(--shadow-2); animation: rise .2s ease; transition: opacity .25s, transform .25s; text-align: center; }
.toast a { color: var(--accent); }
.toast-ok::before { content: "● "; color: var(--accent); }
.toast-warn::before { content: "● "; color: var(--review); }
.toast-error { background: var(--urgent); }
.toast.out { opacity: 0; transform: translateY(6px); }
@media (max-width: 640px) { .toast { border-radius: var(--r-md); } }

.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { margin-top: var(--s10); text-align: center; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* avisos não cobrem os botões do modal */
body.has-modal .toasts { bottom: auto; top: calc(16px + env(safe-area-inset-top)); }
@media (max-width: 640px) {
  .modal-actions .btn { height: 44px; min-width: 40%; }
}
