:root {
  --bg: #f6f1e8;
  --card: #fffaf2;
  --line: #d9cdbf;
  --text: #2b241f;
  --muted: #6d6258;
  --accent: #8c5a2b;
  --accent-dark: #6e431d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top right, rgba(140, 90, 43, 0.10), transparent 24%),
    linear-gradient(180deg, #f9f4eb 0%, var(--bg) 100%);
  color: var(--text);
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 2rem;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(58, 37, 15, 0.06);
  margin-bottom: 20px;
}

.narrow {
  max-width: 460px;
}

.stack {
  display: grid;
  gap: 14px;
}

label span {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.muted {
  color: var(--muted);
}

.alert {
  background: #f9dfdf;
  color: #7f2020;
  border: 1px solid #e5b5b5;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.9rem;
  color: var(--muted);
}

.simple-list {
  margin: 0;
  padding-left: 20px;
}

.meta {
  display: grid;
  gap: 10px;
  margin: 0;
}

.meta div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

.meta dt {
  color: var(--muted);
}

.meta dd {
  margin: 0;
}

.backlink {
  color: var(--accent);
  text-decoration: none;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.edit-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.edit-search {
  flex: 1;
}

.edit-counter {
  min-width: 180px;
  text-align: right;
  margin: 0;
}

.edit-list {
  display: grid;
  gap: 14px;
}

.edit-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.edit-row-message {
  grid-template-columns: 70px 240px 1fr;
}

.edit-row-prayer {
  grid-template-columns: 70px 220px 1fr 1fr;
}

.edit-row.changed-row {
  border-color: #c48a52;
  background: #fff4e6;
}

.edit-row.hidden-row {
  display: none;
}

.edit-cell {
  display: grid;
  gap: 6px;
}

.edit-cell-no {
  align-content: start;
}

.edit-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.edit-no {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.preview-image {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  margin-bottom: 16px;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .edit-toolbar,
  .edit-row-message,
  .edit-row-prayer {
    grid-template-columns: 1fr;
  }

  .edit-counter {
    text-align: left;
  }
}
