/* SEO Content Engine — folha única, servida pelo próprio painel (CSP sem CDN). */

:root {
  color-scheme: light dark;

  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #fbfbfc;
  --border:    #e3e5ea;
  --border-strong: #cdd1d9;

  --text:      #14161a;
  --text-2:    #5b626e;
  --text-3:    #868d99;

  --accent:    #2f5fe0;
  --accent-ink:#ffffff;
  --accent-soft:#eaf0ff;

  --ok:        #14794a;
  --ok-soft:   #e3f5ec;
  --warn:      #8a5a00;
  --warn-soft: #fdf1da;
  --danger:    #b3261e;
  --danger-soft:#fdeceb;
  --info:      #1f5f78;
  --info-soft: #e4f2f7;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20,22,26,.06), 0 1px 3px rgba(20,22,26,.04);
  --shadow-lg: 0 4px 16px rgba(20,22,26,.10);

  --sidebar-w: 236px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1114;
    --surface:   #171a1f;
    --surface-2: #1c2026;
    --border:    #272c34;
    --border-strong: #39404a;
    --text:      #e9ebee;
    --text-2:    #a3aab6;
    --text-3:    #7b828e;
    --accent:    #6d93f5;
    --accent-ink:#0f1114;
    --accent-soft:#1c2740;
    --ok:        #5ed3a0;  --ok-soft:   #13291f;
    --warn:      #e3b264;  --warn-soft: #2b2113;
    --danger:    #f08a83;  --danger-soft:#2e1614;
    --info:      #7fc4de;  --info-soft: #132630;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-name {
  font-size: 13px; font-weight: 650; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px;
}
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); flex: 0 0 8px;
}
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 12px 8px 6px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  margin-bottom: 1px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav svg { width: 16px; height: 16px; flex: 0 0 16px; stroke-width: 1.7; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.sidebar-foot form { margin-top: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 16px; font-weight: 640; margin: 0; letter-spacing: -.01em; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.content { padding: 22px 24px 48px; max-width: 1240px; width: 100%; }

.menu-toggle { display: none; }

/* -------------------------------------------------------------- componentes */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 { margin: 0; font-size: 13.5px; font-weight: 640; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.split { grid-template-columns: 1.55fr 1fr; align-items: start; }

.stat { padding: 14px 16px; }
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 600;
}
.stat-value { font-size: 26px; font-weight: 660; letter-spacing: -.02em; margin-top: 3px; line-height: 1.1; }
.stat-note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat-value.muted { color: var(--text-3); font-weight: 500; font-size: 15px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-ok      { background: var(--ok-soft);     color: var(--ok); }
.badge-warn    { background: var(--warn-soft);   color: var(--warn); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft);   color: var(--info); }
.badge-neutral { background: var(--surface-2);   color: var(--text-2); border: 1px solid var(--border); }
.badge-accent  { background: var(--accent-soft); color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 600; padding: 9px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.empty { padding: 34px 20px; text-align: center; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }

/* formulários */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 78px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert {
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 16px; border: 1px solid transparent;
}
.alert-error   { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.alert-ok      { background: var(--ok-soft);     color: var(--ok); }
.alert-info    { background: var(--info-soft);   color: var(--info); }
.alert-warn    { background: var(--warn-soft);   color: var(--warn); }

/* ------------------------------------------------------------------- login */

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: var(--bg);
}
.login-box { width: 100%; max-width: 372px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .mark {
  width: 40px; height: 40px; border-radius: 11px; margin: 0 auto 12px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.login-brand h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: -.02em; }
.login-brand p { font-size: 13px; color: var(--text-3); margin: 3px 0 0; }
.login-box .card-body { padding: 22px; }
.login-box .btn { width: 100%; margin-top: 4px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--text-3); margin-top: 16px; }

/* --------------------------------------------------------------- execução */

.steps { list-style: none; margin: 0; padding: 0; }
.step {
  display: flex; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: 0; }
.step-icon {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  margin-top: 1px;
}
.step-pending { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.step-running { background: var(--accent-soft); color: var(--accent); }
.step-ok      { background: var(--ok-soft);     color: var(--ok); }
.step-failed  { background: var(--danger-soft); color: var(--danger); }
.step-skipped { background: var(--surface-2);   color: var(--text-3); }
.step-main { min-width: 0; flex: 1; }
.step-label { font-weight: 570; font-size: 13.5px; }
.step[data-status="PENDING"] .step-label { color: var(--text-3); font-weight: 500; }
.step-msg { font-size: 12.5px; color: var(--text-2); margin-top: 1px; word-wrap: break-word; }
.step-time { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

details.tech { margin-top: 7px; }
details.tech summary {
  cursor: pointer; font-size: 12px; color: var(--text-3);
  list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
details.tech summary::-webkit-details-marker { display: none; }
details.tech summary::before { content: "▸"; font-size: 10px; }
details.tech[open] summary::before { content: "▾"; }
details.tech pre {
  margin: 8px 0 0; padding: 11px 13px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  overflow-x: auto; max-height: 340px; white-space: pre-wrap; word-break: break-word;
  color: var(--text-2);
}

.progress-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; border-bottom: 1px solid var(--border);
}
.progress-bar {
  flex: 1; height: 5px; background: var(--border); border-radius: 100px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width .4s ease; }
.progress-pct { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* --------------------------------------------------------------- artigo */

.article-body { max-width: 68ch; font-size: 14.5px; line-height: 1.72; }
.article-body h2 { font-size: 17px; margin: 28px 0 8px; font-weight: 640; letter-spacing: -.01em; }
.article-body h3 { font-size: 14.5px; margin: 20px 0 6px; font-weight: 640; }
.article-body p { margin: 0 0 14px; }
.article-body ul, .article-body ol { margin: 0 0 14px; padding-left: 22px; }
.article-body li { margin-bottom: 5px; }
.article-body .note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 11px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 14px;
}
.article-body table { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.standfirst { font-size: 15px; font-weight: 550; color: var(--text); margin: 0 0 18px; line-height: 1.6; }

.meta-list { display: grid; gap: 0; font-size: 13px; }
.meta-list > div {
  display: grid; grid-template-columns: 148px 1fr; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.meta-list > div:last-child { border-bottom: 0; }
.meta-list dt, .meta-list .k { color: var(--text-3); font-size: 12.5px; }
.meta-list .v { word-break: break-word; }
.meta-list .v.mono { font-family: var(--mono); font-size: 12px; }

/* -------------------------------------------------------------- calendário */

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--surface-2); padding: 7px 8px; font-size: 11px; font-weight: 600; color: var(--text-3); text-align: center; text-transform: uppercase; letter-spacing: .05em; }
.cal-day { background: var(--surface); min-height: 92px; padding: 6px 7px; }
.cal-day.out { background: var(--surface-2); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { font-size: 12px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-day.today .cal-num { color: var(--accent); }
.cal-item {
  font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-pub  { background: var(--ok-soft);     color: var(--ok); }
.cal-sch  { background: var(--accent-soft); color: var(--accent); }
.cal-fail { background: var(--danger-soft); color: var(--danger); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ------------------------------------------------------------------ misc */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 148px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; display: block; }
.stack { display: grid; gap: 14px; }
.row-between { display: flex; align-items: center; gap: 12px; }
.row-between .spacer { margin-left: auto; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.activity li:last-child { border-bottom: 0; }
.activity .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: 0 0 7px; }
.activity .when { margin-left: auto; font-size: 11.5px; color: var(--text-3); white-space: nowrap; padding-left: 8px; }

/* ------------------------------------------------------------- responsivo */

@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.split  { grid-template-columns: 1fr; }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 30; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20;
  }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .meta-list > div { grid-template-columns: 1fr; gap: 2px; }
  .cal-day { min-height: 62px; }
  .cal-item { font-size: 10px; }
  .truncate { max-width: 200px; }
}

@media print { .sidebar, .topbar-actions, .btn { display: none; } }
