:root {
  --bg: #f4f3ef;
  --card: #fff;
  --ink: #1c1d21;
  --muted: #6b6f76;
  --line: #dcd9d0;
  --accent: #2e6b3b;
  --danger: #b3261e;
  --ok: #2e7d32;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 16px;
  background: #1f2a22; color: #fff;
}
.topbar a { color: #fff; }
.topbar .brand { font-weight: 700; text-decoration: none; }
.topbar .doc-title { font-weight: 600; }
.topbar .actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.topbar nav { display: flex; gap: 12px; align-items: center; }
.topbar nav form { margin: 0; }
.topbar .muted { color: #c8ccd2; }
.status { font-size: 13px; padding: 2px 8px; border-radius: 4px; }
.status.ok { background: #e3f2e5; color: var(--ok); }
.status.bad { background: #fde7e5; color: var(--danger); font-weight: 600; }

button, .button {
  font: inherit; cursor: pointer;
  padding: 5px 12px; border-radius: 5px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  text-decoration: none; display: inline-block;
}
.topbar .button { color: var(--ink); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { padding: 2px 8px; font-size: 12px; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; }
.topbar button.link { color: #fff; }

input, select, textarea {
  font: inherit; width: 100%;
  padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; }
input:focus, textarea:focus, select:focus { outline: 2px solid #b5d3ba; border-color: var(--accent); }

.messages { list-style: none; margin: 12px 16px; padding: 0; }
.messages li { padding: 8px 12px; border-radius: 5px; background: #fff3cd; }
.messages li.error { background: #fde7e5; color: var(--danger); }

.narrow { max-width: 820px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.card h1, .card h2 { margin: 0 0 10px; font-size: 16px; display: flex; gap: 12px; align-items: center; }
.card h1 { font-size: 20px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin: 4px 0 0; grid-column: 1 / -1; }
form.inline { display: flex; gap: 8px; max-width: 420px; }
form.inline.copy { max-width: none; flex-wrap: wrap; align-items: center; }
table.list { width: 100%; border-collapse: collapse; }
table.list td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.list form { margin: 0; }
.login { max-width: 360px; margin: 40px auto; }

/* ───── Szerkesztő: űrlapok balra, előnézet jobbra ───── */
.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(0, 1.25fr);
  height: calc(100vh - 48px);
}
.forms { overflow-y: auto; padding: 16px; }
/* No scroll anchoring: htmx swaps a section by inserting the new copy before removing
   the old one, and the browser "kept its place" by scrolling down a whole section
   height every time a row was moved (↑/↓). body: the narrow layout scrolls the page. */
.forms, body.editor { overflow-anchor: none; }
.preview { border-left: 1px solid var(--line); background: #8a8f96; }
.preview iframe { width: 100%; height: 100%; border: 0; display: block; }

label { display: block; font-size: 12px; color: var(--muted); }
label > span { display: block; }
.grid-main { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.grid-main .wide { grid-column: 1 / -1; }
.grid-main .check { display: flex; gap: 6px; align-items: center; grid-column: 1 / -1; color: var(--ink); font-size: 13px; }
.with-button { display: flex; gap: 6px; }

.rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.row {
  display: grid; gap: 4px 8px; align-items: end;
  padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fbfaf7;
}
.row-tools { display: flex; gap: 3px; justify-content: flex-end; }
.row.htmx-request { opacity: .8; }

.row-today, .row-next_sunday { grid-template-columns: 90px 1fr auto; }
.row-week { grid-template-columns: 1.1fr 1fr 1fr auto; }
.row-prayer { grid-template-columns: 1fr auto; }
.row-cleaning { grid-template-columns: 110px 130px 1fr 1fr auto; }
.row-announcement { grid-template-columns: 1fr 2fr auto; }
.row-liturgy { grid-template-columns: 100px 1.4fr 1fr 82px 1fr auto; }
.row-liturgy .f-text { grid-column: 1 / -1; }
.row-liturgy .row-tools { grid-row: 1; grid-column: 6; }
.row-liturgy.is-heading { background: #edf3ed; }
.f-note_color select:has(option[value="green"]:checked) { background: #dcefd6; }
.row-liturgy.is-heading .f-note, .row-liturgy.is-heading .f-note_color, .row-liturgy.is-heading .f-value, .row-liturgy.is-heading .f-text { display: none; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  .preview { height: 80vh; border-left: 0; }
  .row { grid-template-columns: 1fr 1fr !important; }
  .row-tools, .row-liturgy .row-tools { grid-column: 1 / -1; grid-row: auto; }
}
