/* Blog editor. Same look as the Site Dashboard: dark navy panels, stat cards, dense table, colour pills. */

:root {
  --bg: #0f1722;
  --panel: #16202d;
  --card: #1a2533;
  --row-alt: #18222f;
  --line: #243244;
  --text: #e7edf5;
  --muted: #8d9db2;
  --dim: #64748b;
  --link: #38bdf8;
  --teal: #1fa896;
  --teal-dark: #178a7b;
  --green: #27b376;
  --blue: #2f6db5;
  --amber: #d99a2b;
  --red: #dc4b4b;
  --purple: #a78bfa;
  --grey-pill: #3a4759;
  --font: "Source Sans 3", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
.page { max-width: 1280px; margin: 0 auto; padding: 18px; }
button { font: inherit; color: inherit; }

/* Top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--panel); padding: 14px 18px; flex-wrap: wrap; }
.topbar-left { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { font-size: 19px; font-weight: 600; }
.topbar-meta { color: var(--muted); font-size: 15px; }
.topbar-meta b { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.checked { color: var(--muted); font-size: 14px; }

.btn { border: 0; border-radius: 2px; padding: 9px 18px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 500; padding: 5px 12px; font-size: 14px; }
.btn-ghost:hover { border-color: var(--muted); }
.btn-row { background: #223043; color: var(--text); font-size: 13px; padding: 6px 14px; letter-spacing: .3px; }
.btn-row.deploy { background: var(--teal); color: #fff; }
.btn-row.launch { background: var(--blue); color: #fff; text-decoration: none; display: inline-block; }
.btn-row.launch:hover { background: #3a7fd0; }
a.pill { text-decoration: none; }
.actions-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.btn[disabled] { opacity: .38; cursor: not-allowed; }
.btn.is-busy { opacity: .6; cursor: progress; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 12px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 18px; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--link); }

/* Stat cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.card { background: var(--card); padding: 18px 20px; min-height: 118px; }
.card-label { font-size: 18px; color: var(--text); }
.card-value { font-size: 30px; font-weight: 600; margin: 4px 0 2px; }
.card-value.good { color: var(--green); }
.card-value.warn { color: var(--amber); }
.card-value.bad { color: var(--red); }
.card-sub { color: var(--muted); font-size: 14px; }

/* Panel and table */
.panel { background: var(--panel); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 6px; flex-wrap: wrap; }
.panel-title { font-size: 13px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.panel-note { color: var(--muted); font-size: 14px; margin-left: 8px; }
.panel-foot { color: var(--muted); font-size: 14px; padding: 14px 20px 18px; }
.table-wrap { overflow-x: auto; }

.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th { text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: #b9c6d6; padding: 20px 12px 14px; white-space: nowrap; }
.grid td { padding: 13px 12px; white-space: nowrap; vertical-align: middle; }
.grid th.num, .grid td.num { text-align: right; }
.grid tbody tr.site:nth-of-type(4n+3) { background: var(--row-alt); }
.grid tbody tr.site { cursor: pointer; }
.grid tbody tr.site:hover td { background: rgba(56, 189, 248, .05); }
.grid td.caret { width: 38px; color: var(--muted); padding-left: 20px; }
.grid td.caret span { display: inline-block; transition: transform .15s; }
.grid td.caret svg { display: block; fill: none; stroke: #d5dde8; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
tr.site.is-open td.caret span { transform: rotate(90deg); }
.site-name { color: var(--link); font-weight: 600; }
.site-sub { color: var(--muted); font-size: 13px; }
.grid td.sep { border-left: 2px solid #1d2937; }
.muted { color: var(--muted); }
.good { color: var(--green); }
.warn { color: var(--amber); }
.bad { color: var(--red); }

.pill { display: inline-block; min-width: 74px; text-align: center; padding: 5px 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #fff; border-radius: 2px; }
.pill.green { background: var(--green); }
.pill.teal { background: var(--teal); }
.pill.blue { background: var(--blue); }
.pill.amber { background: var(--amber); color: #1a1205; }
.pill.red { background: var(--red); }
.pill.grey { background: var(--grey-pill); color: #c9d4e2; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--purple); vertical-align: baseline; }
.dot.teal { background: var(--teal); } .dot.grey { background: var(--dim); } .dot.blue { background: #60a5fa; }


.brand-logo { height: 52px; width: auto; display: block; }
.brand-wrap { display: flex; align-items: center; gap: 14px; }
.brand-wrap .brand { padding-left: 14px; border-left: 1px solid var(--line); }
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
.btn-ghost.danger { color: #ffb4b4; border-color: #5a2a30; }
.grid td.title { white-space: normal; min-width: 260px; }
.grid td .site-sub { max-width: 60ch; }
.grid td.actions-cell { text-align: right; }
.grid td.actions-cell .btn { margin-left: 6px; }
.grid tbody tr.site:nth-of-type(4n+3) { background: none; }
.grid tbody tr.site:nth-of-type(even) { background: var(--row-alt); }

.error { background: #3b1f24; color: #ffb4b4; padding: 12px 16px; margin: 12px 0; }
.notice { background: #143326; color: #9fe3bf; padding: 12px 16px; margin: 12px 0; }
.notice a { color: #fff; font-weight: 600; }
.loading td { color: var(--muted); padding: 30px 20px; }

/* Sign in */
.login { max-width: 420px; margin: 60px auto; padding: 26px 28px 30px; }
.login form { display: grid; gap: 16px; }
.login label { display: grid; gap: 6px; color: var(--muted); font-size: 14.5px; }

input[type=text], input[type=password], textarea {
  width: 100%; background: #0f1722; border: 1px solid var(--line); color: var(--text); font: inherit; padding: 10px 12px; border-radius: 2px;
}
input:focus, textarea:focus, .editor:focus { outline: 1px solid var(--link); border-color: var(--link); }

/* Writing */
.editor-panel { margin-top: 14px; }
.editor-body { padding: 14px 20px 6px; display: grid; gap: 18px; }
.field { display: grid; gap: 7px; color: #b9c6d6; font-size: 12.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; }
.field .muted { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13.5px; }
.field input, .field textarea { font-size: 16px; font-weight: 400; letter-spacing: 0; text-transform: none; }
#post-title { font-size: 22px; font-weight: 600; padding: 12px 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; background: #1d2937; border: 1px solid var(--line); border-bottom: 0; padding: 6px; position: sticky; top: 0; z-index: 2; }
.toolbar button { background: none; border: 1px solid transparent; color: var(--text); padding: 6px 11px; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; cursor: pointer; border-radius: 2px; min-width: 34px; }
.toolbar button:hover { background: #2a3a4d; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.editor {
  min-height: 420px; background: #0f1722; color: var(--text); border: 1px solid var(--line); padding: 26px 30px;
  font: 400 17px/1.7 var(--font); letter-spacing: 0; text-transform: none; overflow-wrap: anywhere;
}
.editor:empty::before { content: "Start writing…"; color: var(--dim); }
.editor p { margin: 0 0 1em; }
.editor h2 { font: 700 26px/1.25 var(--font); margin: 1.2em 0 .5em; color: #fff; }
.editor h3 { font: 700 20px/1.3 var(--font); margin: 1.1em 0 .4em; color: #fff; }
.editor a { color: var(--link); }
.editor ul, .editor ol { margin: 0 0 1em; padding-left: 1.4em; }
.editor blockquote { margin: 0 0 1em; padding: 4px 0 4px 18px; border-left: 3px solid var(--link); color: #b9c6d6; font-style: italic; }
.editor img { max-width: 100%; height: auto; display: block; margin: 1em 0; }
.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 14px; }
.foot-actions { display: flex; gap: 10px; }

@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .page { padding: 10px; } .editor { padding: 18px 16px; } }

[hidden] { display: none !important; }
#view-list, #view-editor { margin-top: 14px; }
.editor-panel { margin-top: 0; }

/* Buttons that sit side by side in a panel's header share one size */
.panel-actions .btn { padding: 8px 18px; font-size: 15px; font-weight: 600; line-height: 1.45; letter-spacing: 0; border: 1px solid transparent; }
.panel-actions .btn-ghost { border-color: var(--line); }
.panel-actions .btn-ghost:hover { border-color: var(--muted); }

/* Summary and cover image options */
.field-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text); cursor: pointer; }
.field-head .check { margin-left: auto; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); margin: 0; }
.field textarea[readonly] { color: var(--muted); background: #131c28; cursor: default; }
.field > .muted { font-size: 13.5px; }
.cover { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.cover-thumb { width: 288px; aspect-ratio: 16 / 9; background: #0f1722; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; }
.cover-thumb span { color: var(--dim); font-size: 13.5px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.cover-choices { display: grid; gap: 10px; justify-items: start; align-content: start; }
.cover-choices .muted { max-width: 46ch; }
.pill.small { min-width: 0; padding: 2px 8px; font-size: 11px; margin-left: 8px; vertical-align: middle; }

/* Generate: while an image is being found, the spot dims and shows a small spinner; the image then fades in */
.cover-thumb { position: relative; }
.cover-thumb img { transition: opacity .3s; }
.cover-thumb.generating img { opacity: .18; }
.cover-thumb .gen-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text); font-size: 13.5px; font-weight: 500; letter-spacing: .2px; text-transform: none; z-index: 2; }
.cover-thumb .gen-spin { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(231, 237, 245, .16); border-top-color: var(--link); animation: gen-spin .8s linear infinite; }
@keyframes gen-spin { to { transform: rotate(360deg); } }
.cover-thumb img.materialize { animation: materialize .5s ease-out both; }
@keyframes materialize { from { opacity: 0; } to { opacity: 1; } }
.cover-choices .warn { color: var(--amber); }
.btn-row.launch { background: var(--blue); color: #fff; }
.btn-row.launch:hover { background: #3a7fd0; }
@media (prefers-reduced-motion: reduce) { .cover-thumb img.materialize { animation: none; } .cover-thumb .gen-spin { animation-duration: 2.4s; } }

#image-prompt { width: min(520px, 100%); font-size: 15px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.cover-choices { flex: 1 1 320px; }
#post-summary.updated { animation: summaryIn 1.2s ease-out; }
@keyframes summaryIn { from { background: #17364a; color: #cfe6ff; } to { background: #131c28; } }

/* ‹ › on the cover: other photos the assistant found */
.cover-thumb .cover-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 44px; padding: 0 0 4px; border: 0; border-radius: 2px; background: rgba(8, 14, 22, .72); color: #fff; font: 400 28px/1 var(--font); cursor: pointer; z-index: 3; }
.cover-thumb .cover-nav:hover { background: var(--teal); }
.cover-thumb .cover-nav.prev { left: 6px; }
.cover-thumb .cover-nav.next { right: 6px; }
.cover-thumb .cover-count { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 2px; background: rgba(8, 14, 22, .72); color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .3px; z-index: 3; }

/* Delete, in the list of posts */
.btn-row.danger { background: transparent; color: #e58a8a; border: 1px solid #5a2f35; margin-left: 6px; }
.btn-row.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Dialogs: questions asked in the page instead of browser pop-ups */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(6, 10, 16, .72); animation: modal-fade .12s ease-out; }
.modal { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--teal); padding: 22px 24px 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.modal h2 { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 0; text-transform: none; }
.modal p { margin: 0 0 8px; color: #b9c6d6; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.modal .modal-input { margin-top: 8px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions .btn { padding: 8px 18px; font-size: 15px; font-weight: 600; border: 1px solid transparent; }
.modal-actions .btn-ghost { border-color: var(--line); }
.modal-actions .btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c23d3d; }
.modal:has(.btn-danger) { border-top-color: var(--red); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal-wrap { animation: none; } }
