/* ==========================================================================
   CriacaoPosts — tema padrão do app (adotado do MarcaOS a pedido do usuário:
   tema claro profissional, self-contained, sem libs externas).
   Toda página deve dar <link rel="stylesheet" href="/static/css/theme.css">
   e usar estas classes em vez de reinventar sidebar/cards/botões por página
   — é exatamente essa duplicação (cada página com seu próprio <style>) que
   causava as inconsistências de cor/menu reportadas.
   ========================================================================== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e8ed;
  --border-strong: #d3d8e0;
  --text: #16181d;
  --text-2: #5c6470;
  --text-3: #9aa2ae;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-tint: #eef0fe;
  --accent-border: #c7cbfa;
  --green: #157f3d;
  --green-tint: #e7f5ec;
  --red: #d13212;
  --red-tint: #fdeeea;
  --amber: #b45309;
  --amber-tint: #fdf4e3;
  --blue: #1d63d8;
  --blue-tint: #e9f1fc;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --font: "Inter", -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* --- layout --- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  transition: width .2s ease;
  z-index: 20;
}
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.content {
  padding: 32px 36px 60px;
  max-width: 1080px;
  width: 100%;
  min-width: 0;
}

/* --- sidebar --- */
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 10px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; flex-shrink: 0;
}
.brand-mark .icon { width: 19px; height: 19px; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; color: var(--text); }
.brand-name span { color: var(--accent); }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; flex: 1; }
.nav-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 16px 11px 6px; }
.nav a, .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  border-radius: 7px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.nav a:hover, .nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active, .nav-item.active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.nav a .icon, .nav-item .icon { width: 17px; height: 17px; opacity: 0.85; font-size: 16px; text-align: center; }
.sidebar-footer { margin-top: auto; padding: 10px 11px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.live-indicator { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.live-indicator .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.live-indicator.on .dot { background: var(--green); }
.live-indicator.on { color: var(--green); }

/* --- topbar (páginas que precisam, ex.: ações no canto direito) --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- blocos comuns --- */
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 5px; color: var(--text); }
.page-sub { color: var(--text-2); margin-bottom: 28px; max-width: 640px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin: 30px 0 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card h3 .icon { color: var(--text-3); }
.card .hint, .card .sub { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .content { padding: 24px 18px 60px; } }

.loading { color: var(--text-3); padding: 48px 0; text-align: center; }
.empty {
  color: var(--text-3); text-align: center; padding: 40px 16px; font-size: 14px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* --- callouts --- */
.callout {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 8px; padding: 12px 14px; font-size: 13px;
  margin: 10px 0;
}
.callout .icon { width: 16px; height: 16px; margin-top: 1px; }
.callout.info { background: var(--blue-tint); color: var(--blue); }
.callout.warn { background: var(--amber-tint); color: var(--amber); }
.callout.ok { background: var(--green-tint); color: var(--green); }

/* --- formulários --- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 14px 0 5px; text-transform: none; letter-spacing: normal; }
input[type="text"], input[type="number"], input[type="datetime-local"], input:not([type]), textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.btn, .btn-generate, .btn-sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.12s;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}
.btn .icon { width: 15px; height: 15px; }
.btn:hover, .btn-generate:hover { background: var(--accent-hover); }
.btn:disabled, .btn-generate:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary, .btn-sec { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn.secondary:hover, .btn-sec:hover { background: var(--surface-2); border-color: var(--accent-border); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--red-tint); border-color: var(--red); }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* --- status pills --- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.pill.completed, .pill.succeeded { background: var(--green-tint); color: var(--green); }
.pill.running { background: var(--blue-tint); color: var(--blue); }
.pill.queued { background: var(--amber-tint); color: var(--amber); }
.pill.failed { background: var(--red-tint); color: var(--red); }
.pill.unknown { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }

/* --- stat cards --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat .value { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; color: var(--text); }
.stat .label2 { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* --- toast --- */
.toast-container { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 9000; }
.toast {
  background: var(--text);
  color: #fff;
  border-radius: 9px;
  padding: 12px 18px;
  font-size: 13.5px;
  max-width: 380px;
  box-shadow: 0 10px 32px rgba(16, 24, 40, 0.28);
  display: flex; align-items: center; gap: 9px;
}

/* --- score (análise de perfil) --- */
.score-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.score-circle {
  width: 88px; height: 88px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; border: 5px solid var(--border);
}
.score-circle.ok { border-color: var(--green); color: var(--green); }
.score-circle.warn { border-color: var(--amber); color: var(--amber); }
.score-circle.bad { border-color: var(--red); color: var(--red); }
.score-bars { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.score-bar-row { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.score-bar-track { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.score-bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }

/* --- responsivo: sidebar e layout adaptável para notebooks e telas menores --- */
@media(max-width: 1100px) {
  :root { --sidebar-w: 200px; }
  .content { padding: 20px; }
  .topbar { padding: 12px 18px; }
}
@media(max-width: 880px) {
  :root { --sidebar-w: 64px; }
  .nav-label, .sidebar-footer, .brand-name, .brand-sub { display: none; }
  .nav a, .nav-item { justify-content: center; padding: 10px 0; font-size: 0; gap: 0; }
  .nav a .icon, .nav-item .icon { font-size: 18px; }
  .content { padding: 16px; }
}
