:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #183330;
  background: #f6f5f0;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 40px auto; }
.loading-note, .notice { padding: 18px; border: 1px solid #d5d9d2; background: #fff; border-radius: 12px; }
.login-panel { width: min(440px, 100%); margin: 12vh auto 0; padding: 32px; border: 1px solid #d5d9d2; background: #fff; border-radius: 16px; box-shadow: 0 18px 48px #18333012; }
.eyebrow { color: #55736b; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.7rem, 3vw, 2.4rem); }
.muted { color: #62706d; line-height: 1.55; }
.field { display: grid; gap: 7px; margin: 18px 0; }
.field label, .field-label { font-size: .9rem; font-weight: 650; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; color: #183330; background: #fff;
  border: 1px solid #cbd2cc; border-radius: 8px;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field textarea.markdown-body { min-height: 260px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid #c1845a44; border-color: #9c6844; }
.field .check-row { display: flex; align-items: center; gap: 10px; }
.field .check-row input { width: 18px; height: 18px; }
.inline-control { display: flex; gap: 8px; align-items: center; }
.inline-control input { flex: 1; min-width: 0; }
.button, .collection-button, .entry-button, .icon-button {
  border: 1px solid #b9c6bf; border-radius: 8px; background: #fff; color: #183330;
}
.button { padding: 10px 14px; font-weight: 650; }
.button:hover, .collection-button:hover, .entry-button:hover { border-color: #183330; }
.button-primary { border-color: #183330; background: #183330; color: #fff; }
.button-danger { color: #8d302b; border-color: #d7aaa5; }
.button:disabled { opacity: .55; cursor: wait; }
.login-panel .button { width: 100%; margin-top: 6px; }
.message { min-height: 1.4em; margin: 12px 0 0; color: #8d302b; }
.message.success { color: #24634d; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; padding: 18px 20px; background: #183330; color: #fff; border-radius: 12px; }
.topbar h1 { margin: 2px 0 0; font-size: 1.35rem; }
.topbar .eyebrow { color: #bdcfc5; }
.topbar .button { color: #183330; }
.workspace { display: grid; grid-template-columns: 220px 290px minmax(0, 1fr); gap: 14px; align-items: start; }
.panel { min-width: 0; padding: 17px; background: #fff; border: 1px solid #d5d9d2; border-radius: 12px; }
.panel h2 { margin: 0 0 12px; font-size: 1rem; }
.collection-list, .entry-list { display: grid; gap: 7px; }
.collection-button, .entry-button { width: 100%; padding: 10px; text-align: left; }
.collection-button.active, .entry-button.active { border-color: #183330; background: #edf2ed; }
.collection-button small, .entry-button small { display: block; margin-top: 3px; color: #6b7772; font-size: .75rem; }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-toolbar h2 { margin: 0; }
.entry-list { max-height: 65vh; overflow-y: auto; }
.editor-panel { padding: 22px; }
.editor-panel h2 { margin-bottom: 3px; font-size: 1.3rem; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.editor-actions .spacer { flex: 1; }
.separator { height: 1px; margin: 24px 0; border: 0; background: #e2e6e1; }
.upload-help { margin: 0; color: #687571; font-size: .82rem; line-height: 1.5; }
.private-files { display: grid; gap: 8px; }
.private-file { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e1e5e0; border-radius: 8px; }
.private-file a { overflow-wrap: anywhere; color: #205b52; }
.private-file .button { flex: none; padding: 6px 9px; font-size: .8rem; }
.empty-state { padding: 22px 10px; color: #687571; text-align: center; line-height: 1.5; }
.upload-path { display: block; margin-top: 8px; padding: 8px; background: #f3f5f1; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.hint { color: #687571; font-size: .82rem; line-height: 1.5; }
.form-section { margin: 24px 0 0; padding-top: 12px; border-top: 1px solid #d5d9d2; color: #183330; font-size: 1rem; }
.repeater-field { gap: 10px; }
.repeater-list { display: grid; gap: 10px; }
.repeater-row { min-width: 0; margin: 0; padding: 12px; border: 1px solid #d5d9d2; border-radius: 8px; }
.repeater-row legend { padding: 0 5px; color: #55736b; font-size: .78rem; font-weight: 700; }
.repeater-item-field { margin: 10px 0; }
.repeater-item-field textarea { min-height: 76px; }
.repeater-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.repeater-actions .button { padding: 6px 9px; font-size: .8rem; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #a5653d; outline-offset: 2px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .entries-panel { grid-column: 1; grid-row: 2; }
  .editor-panel { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 650px) {
  .app-shell { width: min(100% - 20px, 520px); margin: 18px auto; }
  .topbar { align-items: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .entries-panel, .editor-panel { grid-column: auto; grid-row: auto; }
  .entry-list { max-height: 260px; }
}
