:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1e263a;
  --border: #2a3348;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #4f8cff;
  --green: #35c37a;
  --yellow: #e0a638;
  --red: #e0555a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar nav a {
  margin-right: 18px;
  color: var(--muted);
  font-weight: 500;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }

.topbar .user { color: var(--muted); font-size: 13px; }
.topbar .user form { display: inline; margin-left: 10px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.stat .n { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; margin-top: 4px; text-transform: uppercase; letter-spacing: .03em; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.badge.pending { background: #2a3348; color: var(--muted); }
.badge.scheduled { background: #1c3a5c; color: #7fb4ff; }
.badge.drafting { background: #4a3a1c; color: var(--yellow); }
.badge.content_generated { background: #2a2f4a; color: #a99bff; }
.badge.drafted { background: #1c3a2e; color: var(--green); }
.badge.approved { background: #1c3a5c; color: #7fb4ff; }
.badge.published { background: #16321f; color: var(--green); }
.badge.failed { background: #3a1c1e; color: var(--red); }
.badge.rejected { background: #3a1c1e; color: var(--red); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--green); }
.dot.error { background: var(--red); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--red); }
.btn.small { padding: 4px 10px; font-size: 12px; }

form.inline { display: inline; }

input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
}

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }

.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card { width: 340px; }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card p.muted { margin-top: 0; margin-bottom: 20px; }

.error-box {
  background: #3a1c1e;
  color: #ffb3b5;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
.success-box {
  background: #16321f;
  color: #a7f0c0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

pre.markdown-preview {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  max-height: 500px;
  overflow-y: auto;
  font-size: 13px;
}

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px 0; }

.media-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.log-detail { margin-top: 2px; }
.log-detail-body { margin-top: 10px; max-width: 720px; }
.log-section { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.log-call { margin: 8px 0 12px; padding: 8px 10px; background: var(--panel-2); border-radius: 6px; border: 1px solid var(--border); }
.log-pre { max-height: 320px; font-size: 12px; margin-top: 6px; }
.log-file-list { margin: 6px 0 0; padding-left: 18px; }
.log-file-list li { margin-bottom: 4px; word-break: break-all; }
