/* ==========================================================
   PANEL STYLES — one file, no build step.

   Deliberately plain: this is an internal tool that manages
   sites, not one of the sites.
========================================================== */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1a2a4a;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #1a56db;
  --ok-bg: #e8f5ee;
  --ok-ink: #14532d;
  --err-bg: #fdeaea;
  --err-ink: #8a1c1c;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- chrome ---------- */

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

.topbar .brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.topbar nav a { margin-left: 18px; text-decoration: none; color: var(--accent); }
.topbar nav a.muted { color: var(--muted); }

main { max-width: 940px; margin: 0 auto; padding: 28px 24px 64px; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.head-row h1 { margin-bottom: 16px; }

/* ---------- blocks ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 20px 0;
}

.card.narrow { max-width: 420px; margin: 48px auto; }
.card.danger { border-color: #f0c9c5; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.count {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 9px;
  vertical-align: middle;
}

.env { font-size: 13px; }

/* ---------- notices ---------- */

.notice { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice.error { background: var(--err-bg); color: var(--err-ink); }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--accent); }

.pill { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); }
.pill.live { background: var(--ok-bg); color: var(--ok-ink); border-color: #bfe3cd; }
.pill.draft { background: #fff6e5; color: #8a5a00; border-color: #f0dcb4; }

/* ---------- forms ---------- */

label { display: block; margin: 0 0 14px; font-size: 13px; color: var(--muted); }

input[type=text], input[type=password] {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  padding: 9px 16px;
  cursor: pointer;
}

button.small { padding: 5px 11px; font-size: 13px; font-weight: 500; }
button.danger { background: var(--danger); }
button:hover { filter: brightness(1.08); }

form.inline { display: inline; }

.row-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.row-form label { flex: 1 1 180px; margin: 0; }
.row-form button { flex: 0 0 auto; }

/* ---------- detail lists ---------- */

.details { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); font-size: 13px; }
.details dd { margin: 0; }

.urls { list-style: none; padding: 0; margin: 0; }
.urls li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.urls li:last-child { border-bottom: 0; }
.urls .muted { display: inline-block; width: 56px; font-size: 12px; text-transform: uppercase; }

.log { list-style: none; padding: 0; margin: 0; }
.log li { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log li .muted { margin-left: auto; }

@media (max-width: 620px) {
  .details { grid-template-columns: 1fr; }
  .row-form { flex-direction: column; align-items: stretch; }
}

/* ---------- generation, inspection and preview ---------- */

.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

button.secondary {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  text-transform: capitalize;
}

button.secondary.on { color: #fff; background: var(--accent); border-color: var(--accent); }

/* Rendered-length badge. Grey when it fits, red when it does not —
   the number is the point, so it is never hidden behind a tooltip. */
.len {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 6px;
}

.len.bad { color: #fff; background: var(--danger); border-color: var(--danger); }

.issues { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: var(--err-ink); }
.issues li { margin: 3px 0; }

.preview {
  display: block;
  width: 100%;
  height: 560px;
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ---------- image manager ---------- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.image-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fafbfc;
}

.image-card h3 { margin: 0 0 8px; }

.image-card img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.image-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.image-card p { margin: 6px 0 10px; }

.image-card textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}

/* ---------- run log ---------- */

.runlog {
  max-height: 240px;
  overflow-y: auto;
  margin: 10px 0 0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #cfe3ff;
  background: #10203a;
  border-radius: 8px;
  white-space: pre-wrap;
}

.pill.running { background: #fff6e5; color: #8a5a00; border-color: #f0dcb4; }
.pill.finished { background: var(--ok-bg); color: var(--ok-ink); border-color: #bfe3cd; }
.pill.crashed,
.pill.finished-with-errors { background: var(--err-bg); color: var(--err-ink); border-color: #f0c9c5; }

.notes { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: var(--muted); }
.notes li { margin: 3px 0; }
