:root {
  --bg: #07111f;
  --bg2: #0b1628;
  --panel: rgba(255,255,255,.075);
  --panel-solid: #111c30;
  --panel-soft: #0e192b;
  --card: rgba(255,255,255,.095);
  --border: rgba(171,190,220,.18);
  --border-strong: rgba(171,190,220,.32);
  --text: #f4f8ff;
  --muted: #9dafc8;
  --muted2: #7587a3;
  --primary: #3c7dff;
  --primary2: #76a8ff;
  --cyan: #63d7ff;
  --danger: #ff6274;
  --success: #35d39d;
  --warning: #ffd166;
  --field: rgba(4,11,22,.78);
  --shadow: 0 22px 80px rgba(0,0,0,.38);
  --radius-xl: 26px;
  --radius: 18px;
  --radius-sm: 13px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% -5%, rgba(60,125,255,.28), transparent 32rem),
    radial-gradient(circle at 90% 5%, rgba(99,215,255,.12), transparent 30rem),
    linear-gradient(180deg, var(--bg), #060b13 68%);
  color: var(--text);
}
a { color: inherit; }
code { color: #d9e5ff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 2px 6px; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(460px, 100%);
  background: rgba(17,28,48,.88);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.brand-mark, .brand-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  font-weight: 950;
  color: white;
  letter-spacing: -.04em;
  box-shadow: 0 16px 42px rgba(60,125,255,.35);
}
.login-brand h1 { margin: 0; font-size: 24px; }
.login-brand p, .login-help { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.login-form { display: grid; gap: 16px; }
.login-form label, .field { display: grid; gap: 8px; }
.login-form span, .field label, .field-title { color: #dfe9fb; font-size: 13px; font-weight: 800; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: rgba(118,168,255,.78); box-shadow: 0 0 0 4px rgba(60,125,255,.15); background: rgba(4,11,22,.92); }

.primary-btn, .login-form button {
  border-radius: 14px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: white;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(60,125,255,.28);
}
.primary-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ghost-btn {
  border-radius: 13px;
  padding: 10px 13px;
  color: #e9f0ff;
  background: rgba(255,255,255,.075);
  border: 1px solid var(--border);
}
.danger-btn {
  border-radius: 13px;
  padding: 10px 13px;
  background: rgba(255,98,116,.12);
  color: #ffc1c8;
  border: 1px solid rgba(255,98,116,.36);
  font-weight: 900;
}
.small-btn { padding: 8px 10px; font-size: 12px; }

.alert, .status {
  padding: 13px 15px;
  border-radius: 15px;
  margin-bottom: 16px;
  border: 1px solid;
  box-shadow: 0 16px 35px rgba(0,0,0,.20);
}
.alert-error, .status.error { border-color: rgba(255,98,116,.45); background: rgba(255,98,116,.12); color: #ffd6db; }
.status.success { border-color: rgba(53,211,157,.45); background: rgba(53,211,157,.11); color: #cdffe9; }
.status { position: sticky; top: 82px; z-index: 9; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: rgba(7,17,31,.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand-area { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.topbar span { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-pill {
  padding: 9px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.logout-link {
  text-decoration: none;
  color: #dce7ff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255,255,255,.05);
  font-weight: 800;
  font-size: 13px;
}

.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  overflow: auto;
  border-right: 1px solid var(--border);
  background: rgba(8,16,30,.62);
  padding: 18px;
}
.sidebar-block { display: grid; gap: 8px; margin-bottom: 18px; }
.sidebar-title {
  color: #eef4ff;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 5px 0 8px;
}
.nav-btn {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 13px 14px;
  color: #d8e5f9;
  background: transparent;
  border: 1px solid transparent;
}
.nav-btn span { font-weight: 950; }
.nav-btn small { color: var(--muted2); font-size: 12px; }
.nav-btn.active, .nav-btn:hover { background: rgba(60,125,255,.13); border-color: rgba(118,168,255,.28); color: white; }
.section-nav { display: grid; gap: 5px; }
.section-nav button {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 9px 10px;
  color: #b8c8df;
  background: rgba(255,255,255,.035);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
}
.section-nav button:hover { color: white; border-color: var(--border); background: rgba(255,255,255,.07); }
.note { margin-top: 18px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.045); }
.note p { color: var(--muted); font-size: 13px; line-height: 1.45; margin-bottom: 0; }

.workspace { padding: 26px; min-width: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 24px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(60,125,255,.18), rgba(99,215,255,.055)),
    rgba(255,255,255,.055);
  box-shadow: 0 18px 70px rgba(0,0,0,.25);
}
.hero-panel.compact { align-items: center; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-weight: 950;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.hero-panel h1 { margin: 0; max-width: 820px; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.055em; line-height: 1.02; }
.hero-panel p:not(.eyebrow) { max-width: 760px; margin: 12px 0 0; color: #b9c7dd; line-height: 1.55; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stat-chip {
  min-width: 116px;
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.075);
  border: 1px solid var(--border);
}
.stat-chip strong { display: block; font-size: 22px; letter-spacing: -.04em; }
.stat-chip span { color: var(--muted); font-size: 12px; font-weight: 800; }
.toolbar-card {
  position: sticky;
  top: 88px;
  z-index: 8;
  display: flex;
  align-items: end;
  gap: 14px;
  justify-content: space-between;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(11,22,40,.86);
  backdrop-filter: blur(12px);
}
.search-wrap { flex: 1; display: grid; gap: 7px; }
.search-wrap span { color: #dfe9fb; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }

.editor-stack { display: grid; gap: 16px; }
.section-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: rgba(255,255,255,.055);
  box-shadow: 0 16px 55px rgba(0,0,0,.18);
  scroll-margin-top: 160px;
}
.section-box.is-filtered-out { display: none; }
.section-box > summary {
  list-style: none;
  padding: 18px 20px;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}
.section-box > summary::-webkit-details-marker { display: none; }
.summary-main { display: grid; gap: 8px; min-width: 0; }
.summary-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.summary-title-row h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.section-tag { color: #dce8ff; background: rgba(60,125,255,.14); border: 1px solid rgba(118,168,255,.25); border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 900; }
.summary-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.summary-right { display: flex; align-items: center; gap: 8px; }
.count-pill { border: 1px solid var(--border); background: rgba(255,255,255,.06); color: #d7e5fb; border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.chevron { width: 36px; height: 36px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.065); color: var(--muted); font-weight: 950; }
.section-box[open] .chevron { color: white; background: rgba(60,125,255,.18); }
.section-box[open] .chevron::before { content: '–'; }
.section-box:not([open]) .chevron::before { content: '+'; }
.fields { padding: 0 18px 18px; display: grid; gap: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-card {
  border: 1px solid rgba(171,190,220,.15);
  border-radius: 18px;
  padding: 14px;
  background: rgba(4,11,22,.34);
  display: grid;
  gap: 10px;
}
.field-card.wide { grid-column: 1 / -1; }
.field-card.is-hidden, .group-box.is-hidden { display: none; }
.field-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.field-head label { color: #eef5ff; font-size: 13px; font-weight: 950; }
.path-pill { color: var(--muted2); border: 1px solid rgba(171,190,220,.13); background: rgba(255,255,255,.045); border-radius: 999px; padding: 4px 7px; font-size: 10px; font-weight: 800; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-note { margin: -2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.group-box {
  grid-column: 1 / -1;
  border: 1px solid rgba(171,190,220,.16);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255,255,255,.035);
  display: grid;
  gap: 12px;
}
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-head strong { color: #f2f7ff; font-size: 14px; }
.group-head span { color: var(--muted2); font-size: 11px; font-weight: 900; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); border-radius: 999px; padding: 4px 8px; }
.sub-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.image-field-grid { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 12px; align-items: stretch; }
.image-preview-card {
  border: 1px solid rgba(171,190,220,.15);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  overflow: hidden;
  min-height: 112px;
  display: grid;
  grid-template-rows: 1fr auto;
}
.image-preview-card img { width: 100%; height: 112px; object-fit: cover; display: block; background: rgba(255,255,255,.05); }
.image-preview-actions { display: flex; gap: 6px; padding: 7px; border-top: 1px solid rgba(255,255,255,.08); }
.image-preview-actions a, .image-preview-actions button {
  flex: 1;
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  padding: 7px 8px;
  color: #dfeaff;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 11px;
  font-weight: 900;
}
.resolved-url { color: var(--muted2); font-size: 11px; overflow-wrap: anywhere; }
.empty-preview { height: 112px; display: grid; place-items: center; color: var(--muted2); font-size: 12px; padding: 12px; text-align: center; }

.news-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.news-list {
  position: sticky;
  top: 88px;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255,255,255,.055);
  box-shadow: 0 16px 50px rgba(0,0,0,.18);
}
.news-list-head { padding: 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.045); }
.news-list-head strong { display: block; font-size: 15px; }
.news-list-head span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.news-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  text-align: left;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 12px;
  color: var(--text);
}
.news-item:last-child { border-bottom: 0; }
.news-item:hover, .news-item.active { background: rgba(60,125,255,.14); }
.news-thumb { width: 76px; height: 58px; border-radius: 13px; object-fit: cover; background: rgba(255,255,255,.065); border: 1px solid rgba(255,255,255,.08); }
.news-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.news-item span { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; line-height: 1.35; }
.news-form {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255,255,255,.055);
  padding: 18px;
  display: grid;
  gap: 16px;
  box-shadow: 0 16px 50px rgba(0,0,0,.16);
}
.news-form-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.news-form-title h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.news-form-title p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.news-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.slide-box { border: 1px solid rgba(171,190,220,.15); border-radius: 20px; padding: 14px; display: grid; gap: 12px; background: rgba(4,11,22,.34); }
.slide-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.slide-head strong { font-size: 14px; }
.slide-image-row { display: grid; grid-template-columns: minmax(0,1fr) 140px; gap: 12px; align-items: end; }
.slide-preview { width: 140px; height: 88px; border-radius: 14px; object-fit: cover; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
#jsonEditor { min-height: 70vh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; top: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sections-shortcut { display: none; }
  .news-layout { grid-template-columns: 1fr; }
  .news-list { position: relative; top: auto; }
}
@media (max-width: 780px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 14px; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .workspace { padding: 16px; }
  .hero-panel, .toolbar-card { flex-direction: column; align-items: stretch; }
  .field-grid, .sub-fields, .grid-2, .grid-3, .image-field-grid, .slide-image-row { grid-template-columns: 1fr; }
  .field-card.wide { grid-column: auto; }
  .summary-right { flex-wrap: wrap; justify-content: flex-start; }
  .section-box > summary { grid-template-columns: 1fr; }
  .path-pill { max-width: 100%; }
}

/* v6: produção, manutenção, segmentos, backup e checagem */
.backup-note .backup-actions { margin-top: 12px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backup-actions.inline { margin-top: 14px; }

.boolean-field { grid-column: 1 / -1; }
.switch-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas: "input switch title" ". . desc";
  align-items: center;
  gap: 6px 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  cursor: pointer;
}
.switch-row input { grid-area: input; width: 18px; height: 18px; accent-color: var(--primary); }
.switch-ui {
  grid-area: switch;
  width: 48px;
  height: 27px;
  border-radius: 999px;
  background: rgba(255,98,116,.28);
  border: 1px solid rgba(255,255,255,.16);
  position: relative;
  transition: .18s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: white;
  top: 2px;
  left: 3px;
  transition: .18s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,.24);
}
.switch-row input:checked + .switch-ui { background: rgba(53,211,157,.46); border-color: rgba(53,211,157,.60); }
.switch-row input:checked + .switch-ui::after { transform: translateX(20px); }
.switch-row strong { grid-area: title; font-size: 14px; }
.switch-row small { grid-area: desc; grid-column: 3 / 4; color: var(--muted); }

.segment-manager { grid-column: 1 / -1; }
.segment-head { align-items: center; }
.segment-list { display: grid; gap: 10px; margin-top: 12px; }
.segment-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(255,255,255,.04);
}
.segment-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #dce8ff;
  background: rgba(60,125,255,.16);
  border: 1px solid rgba(118,168,255,.24);
  font-weight: 900;
  font-size: 12px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.config-card, .checks-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,.06);
  box-shadow: 0 16px 50px rgba(0,0,0,.20);
  padding: 20px;
}
.config-card h2 { margin: 0 0 8px; letter-spacing: -.03em; }
.config-card p { color: var(--muted); line-height: 1.55; margin: 0 0 12px; }
.config-card pre {
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.24);
  border: 1px solid var(--border);
  color: #dce8ff;
}
.checks-panel { display: grid; gap: 10px; }
.checks-head, .check-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.045);
}
.checks-head strong, .check-row strong { display: block; }
.checks-head span, .check-row span { color: var(--muted); font-size: 13px; }
.check-row.ok { border-color: rgba(53,211,157,.32); background: rgba(53,211,157,.075); }
.check-row.warn { border-color: rgba(255,209,102,.32); background: rgba(255,209,102,.07); }
.check-row.error { border-color: rgba(255,98,116,.32); background: rgba(255,98,116,.08); }
.check-row.pending { border-color: rgba(118,168,255,.32); background: rgba(60,125,255,.08); }

@media (max-width: 980px) {
  .config-grid { grid-template-columns: 1fr; }
  .segment-row { grid-template-columns: 32px minmax(0, 1fr); }
  .segment-row .danger-btn { grid-column: 2 / 3; justify-self: start; }
}
