:root {
  --navy: #203648;
  --navy-deep: #1b2d3b;
  --burgundy: #85384a;
  --gold: #d4ad70;
  --paper: #f5f0e8;
  --card: #fffdf8;
  --ink: #292522;
  --muted: #82786f;
  --line: #e5dbd0;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", "Segoe UI", sans-serif;
  --desktop-font-scale: 1;
}
* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: calc(13px * var(--desktop-font-scale, 1)); margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.admin-shell { margin: 0 auto; max-width: 1030px; padding: 0 30px 60px; }
.admin-header { align-items: center; border-bottom: 1px solid var(--line); display: flex; height: 76px; justify-content: space-between; }
.admin-brand { align-items: center; color: var(--ink); display: flex; gap: 11px; text-decoration: none; }
.admin-brand img { border: 1px solid #c59b63; border-radius: 8px; height: 43px; object-fit: cover; object-position: center 22%; width: 43px; }
.admin-brand span { display: flex; flex-direction: column; gap: 3px; }
.admin-brand strong { font-size: calc(10px * var(--desktop-font-scale, 1)); letter-spacing: 1.2px; }
.admin-brand small { color: var(--muted); font-size: calc(8px * var(--desktop-font-scale, 1)); letter-spacing: 1.4px; }
.back-to-app { color: #586574; font-size: calc(11px * var(--desktop-font-scale, 1)); text-decoration: none; }
.back-to-app:hover { color: var(--burgundy); }
.eyebrow { color: #99734e; display: block; font-size: calc(8px * var(--desktop-font-scale, 1)); font-weight: 700; letter-spacing: 1.6px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 12px 35px rgba(35,48,56,.06); margin: 90px auto 0; max-width: 405px; padding: 32px; }
.login-card h1, .welcome-row h1 { color: var(--navy); font-family: var(--serif); font-size: calc(31px * var(--desktop-font-scale, 1)); font-weight: 500; letter-spacing: -.6px; margin: 8px 0; }
.login-card > p, .welcome-row p { color: var(--muted); font-size: calc(11px * var(--desktop-font-scale, 1)); line-height: 1.7; margin: 0 0 22px; }
.login-card form { display: grid; gap: 15px; }
.login-card label, .field-label { color: #4c4a45; display: grid; font-size: calc(10px * var(--desktop-font-scale, 1)); font-weight: 600; gap: 6px; }
.login-card input, .editor-fields input, .editor-fields select, .editor-fields textarea { background: #fffdfa; border: 1px solid #ded5cb; border-radius: 5px; color: var(--ink); min-height: 39px; outline: 0; padding: 9px 10px; width: 100%; }
.login-card input:focus, .editor-fields input:focus, .editor-fields select:focus, .editor-fields textarea:focus { border-color: #aa8155; box-shadow: 0 0 0 3px rgba(170,129,85,.12); }
.topic-icon-picker { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, 38px); margin-top: 8px; max-width: 360px; width: 100%; }
.topic-icon-option { align-items: center; background: #f0e9e0; border: 1px solid #e4d8ca; border-radius: 6px; color: var(--navy); cursor: pointer; display: flex; font-size: calc(19px * var(--desktop-font-scale, 1)); height: 40px; justify-content: center; padding: 0; }
.topic-icon-option:hover, .topic-icon-option[aria-pressed="true"] { background: #ead8bb; border-color: #c59b63; }
.topic-icon-option:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }
.primary-button, .secondary-button, .signout-button { align-items: center; border: 0; border-radius: 5px; cursor: pointer; display: inline-flex; font-size: calc(10px * var(--desktop-font-scale, 1)); font-weight: 600; justify-content: center; min-height: 38px; padding: 0 14px; }
.primary-button { background: var(--navy); color: #fffaf2; gap: 15px; }
.primary-button:hover { background: #2e4a5d; }
.primary-button span { color: var(--gold); font-size: calc(14px * var(--desktop-font-scale, 1)); }
.secondary-button, .signout-button { background: #eee7df; color: #4e5961; }
.secondary-button:hover, .signout-button:hover { background: #e7dacf; }
.security-note { color: #92877c; display: block; font-size: calc(9px * var(--desktop-font-scale, 1)); margin-top: 18px; }
.login-error, .form-error, .admin-error { color: #8b3445; font-size: calc(10px * var(--desktop-font-scale, 1)); line-height: 1.6; }
.welcome-row { align-items: center; display: flex; justify-content: space-between; padding: 40px 0 23px; }
.welcome-row h1 { font-size: calc(33px * var(--desktop-font-scale, 1)); margin: 6px 0 4px; }
.welcome-row p { margin: 0; }
.signout-button { min-height: 34px; }
.content-tabs { border-bottom: 1px solid #ded4c8; display: flex; gap: 6px; margin-bottom: 17px; }
.content-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; color: #777168; cursor: pointer; font-size: calc(10px * var(--desktop-font-scale, 1)); margin-bottom: -1px; padding: 12px 13px; }
.content-tab.active { border-color: var(--burgundy); color: var(--navy); font-weight: 700; }
.content-tab span { background: #ece4da; border-radius: 10px; color: #74695e; font-size: calc(8px * var(--desktop-font-scale, 1)); margin-left: 5px; padding: 3px 6px; }
.admin-tab-panel[hidden] { display: none; }
.entries-card { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 21px; }
.todo-card { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 21px; }
.todo-heading { align-items: center; display: flex; justify-content: space-between; }
.todo-heading h2 { color: var(--navy); font-family: var(--serif); font-size: calc(23px * var(--desktop-font-scale, 1)); font-weight: 500; margin: 4px 0 0; }
.todo-card > .collection-hint { margin-bottom: 13px; }
.todo-form { align-items: end; display: grid; gap: 9px 12px; grid-template-columns: minmax(0,1fr) auto; }
.todo-form .field-label { grid-column: 1 / -1; }
.todo-form textarea { background: #fffdfa; border: 1px solid #ded5cb; border-radius: 5px; color: var(--ink); min-height: 58px; padding: 9px 10px; resize: vertical; width: 100%; }
.todo-form textarea:focus { border-color: #aa8155; box-shadow: 0 0 0 3px rgba(170,129,85,.12); outline: 0; }
.todo-form .primary-button { min-height: 42px; }
.todo-list { border-top: 1px solid #eee7df; list-style: none; margin: 15px 0 0; padding: 0; }
.todo-item { align-items: start; border-bottom: 1px solid #eee7df; display: flex; gap: 12px; justify-content: space-between; padding: 12px 2px; }
.todo-item label { align-items: start; color: #303842; display: flex; flex: 1; font-size: calc(11px * var(--desktop-font-scale, 1)); gap: 10px; line-height: 1.5; min-width: 0; }
.todo-item input { accent-color: var(--navy); flex: 0 0 auto; height: 16px; margin: 2px 0 0; width: 16px; }
.todo-item label span { overflow-wrap: anywhere; white-space: pre-wrap; }
.todo-item.completed label span { color: #92877d; text-decoration: line-through; }
.todo-delete { background: transparent; border: 0; color: #7b7168; cursor: pointer; font-size: calc(9px * var(--desktop-font-scale, 1)); padding: 3px 5px; }
.todo-delete:hover { color: var(--burgundy); text-decoration: underline; }
.todo-empty { color: #92877d; font-size: calc(11px * var(--desktop-font-scale, 1)); padding: 15px 2px; }
.todo-error { color: #8b3445; font-size: calc(10px * var(--desktop-font-scale, 1)); margin: 12px 0 0; }
.settings-card { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 24px; }
.settings-card h2 { color: var(--navy); font-family: var(--serif); font-size: calc(24px * var(--desktop-font-scale, 1)); font-weight: 500; margin: 5px 0; }
.settings-card > .collection-hint { max-width: 700px; }
.settings-status { background: #edf1e8; border-radius: 5px; color: #465a3f; font-size: calc(10px * var(--desktop-font-scale, 1)); margin: 14px 0; padding: 10px 12px; }
.settings-card form > .field-label { max-width: 620px; }
.settings-card input { margin-top: 5px; }
.settings-card a, .bible-study-note a { color: var(--burgundy); }
.settings-card .field-help, .settings-terms { color: #8f847a; display: block; font-size: calc(9px * var(--desktop-font-scale, 1)); line-height: 1.6; margin: 9px 0; }
.settings-error { color: #8b3445; font-size: calc(10px * var(--desktop-font-scale, 1)); }
.entries-header { align-items: center; display: flex; justify-content: space-between; }
.entries-header h2, .editor-heading h2 { color: var(--navy); font-family: var(--serif); font-size: calc(23px * var(--desktop-font-scale, 1)); font-weight: 500; margin: 4px 0 0; }
.add-button { min-height: 35px; }
.collection-hint { color: #8c8278; font-size: calc(10px * var(--desktop-font-scale, 1)); line-height: 1.6; margin: 10px 0 16px; }
.entries-list { border-top: 1px solid #eee7df; }
.entry-row { align-items: center; border-bottom: 1px solid #eee7df; display: flex; gap: 12px; min-height: 68px; padding: 10px 2px; }
.entry-icon { align-items: center; background: #eee4da; border-radius: 7px; color: var(--burgundy); display: flex; flex: 0 0 39px; font-family: var(--serif); font-size: calc(17px * var(--desktop-font-scale, 1)); height: 39px; justify-content: center; }
.entry-details { flex: 1; min-width: 0; }
.entry-details strong { color: #303842; display: block; font-size: calc(11px * var(--desktop-font-scale, 1)); font-weight: 600; overflow-wrap: anywhere; }
.entry-details small { color: #8d857c; display: block; font-size: calc(9px * var(--desktop-font-scale, 1)); line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.entry-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.entry-actions button { background: #f0ebe4; border: 0; border-radius: 4px; color: #53606a; cursor: pointer; font-size: calc(9px * var(--desktop-font-scale, 1)); padding: 7px 9px; }
.entry-actions button:hover { background: #e7d9cb; color: var(--burgundy); }
.empty-list { color: #92877d; font-size: calc(11px * var(--desktop-font-scale, 1)); padding: 28px 5px; text-align: center; }
.notice { background: #edf1e8; border: 1px solid #d7e0ce; border-radius: 5px; color: #465a3f; font-size: calc(10px * var(--desktop-font-scale, 1)); margin: 12px 0; padding: 9px 11px; }
.notice.error { background: #f7eae7; border-color: #eed2cc; color: #823c41; }
.editor-dialog { background: var(--paper); border: 1px solid #e4d8ca; border-radius: 10px; box-shadow: 0 20px 70px rgba(20,32,40,.2); max-height: min(88vh,850px); max-width: 580px; overflow-x: hidden; overflow-y: auto; padding: 24px; width: calc(100% - 30px); }
.editor-dialog:has(.topic-icon-picker) { max-width: 760px; }
.editor-dialog::backdrop { background: rgba(21,34,44,.55); backdrop-filter: blur(2px); }
.editor-heading { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; margin-bottom: 17px; padding-bottom: 14px; }
.close-dialog { background: transparent; border: 0; color: #656c6f; cursor: pointer; font-size: calc(24px * var(--desktop-font-scale, 1)); line-height: 1; }
.editor-fields { display: grid; gap: 13px; grid-template-columns: repeat(2, minmax(0,1fr)); min-width: 0; }
.editor-fields > * { min-width: 0; }
.editor-fields .field-full { grid-column: 1 / -1; }
.editor-fields textarea { min-height: 84px; resize: vertical; }
.editor-fields .field-help { color: #8f847a; font-size: calc(8px * var(--desktop-font-scale, 1)); font-weight: 400; }
.rich-text-field { gap: 0; }
.rich-text-toolbar { background: #eee7df; border: 1px solid #ded5cb; border-bottom: 0; border-radius: 5px 5px 0 0; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
.rich-text-toolbar button { background: #fffdfa; border: 1px solid #ded5cb; border-radius: 4px; color: #35434c; cursor: pointer; min-height: 31px; min-width: 34px; padding: 3px 8px; }
.rich-text-toolbar button:hover, .rich-text-toolbar button:focus-visible { background: #ead8bb; border-color: #c59b63; outline: 0; }
.rich-text-editor { background: #fffdfa; border: 1px solid #ded5cb; border-radius: 0 0 5px 5px; color: var(--ink); line-height: 1.6; min-height: 145px; outline: 0; overflow-wrap: anywhere; padding: 10px; white-space: pre-wrap; }
.rich-text-editor:focus { border-color: #aa8155; box-shadow: 0 0 0 3px rgba(170,129,85,.12); }
.rich-text-editor p, .rich-text-editor div, .rich-text-editor blockquote { margin: 0 0 8px; }
.rich-text-editor ul, .rich-text-editor ol { margin: 4px 0 8px; padding-left: 24px; }
.editor-actions { border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; }
.admin-error { background: #f7eae7; border: 1px solid #eed2cc; border-radius: 5px; margin-top: 18px; padding: 10px; }
.topic-delete-dialog { background: var(--paper); border: 1px solid #e4d8ca; border-radius: 10px; box-shadow: 0 20px 70px rgba(20,32,40,.2); max-height: min(88vh,850px); max-width: 720px; overflow-x: hidden; overflow-y: auto; padding: 24px; width: calc(100% - 30px); }
.topic-delete-dialog::backdrop { background: rgba(21,34,44,.55); backdrop-filter: blur(2px); }
.topic-delete-dialog > form { min-width: 0; }
.topic-delete-dialog > form > p:not(.form-error) { color: var(--muted); line-height: 1.6; }
.topic-delete-resources { display: grid; gap: 10px; margin-top: 17px; }
.topic-delete-resource { align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 12px; grid-template-columns: minmax(0,1fr) minmax(180px,.8fr); padding: 12px; }
.topic-delete-resource strong, .topic-delete-resource small { display: block; }
.topic-delete-resource small { color: var(--muted); font-size: calc(10px * var(--desktop-font-scale, 1)); margin-top: 4px; }
.topic-delete-resource select { background: #fffdfa; border: 1px solid #ded5cb; border-radius: 5px; color: var(--ink); min-height: 39px; min-width: 0; padding: 8px; width: 100%; }
.topic-delete-resource select:focus { border-color: #aa8155; box-shadow: 0 0 0 3px rgba(170,129,85,.12); outline: 0; }
.topic-delete-dialog .editor-actions .primary-button { max-width: 100%; white-space: normal; }
@media (max-width: 600px) {
  .admin-shell { padding: 0 15px 35px; }
  .admin-header { height: 64px; }
  .login-card { margin-top: 48px; padding: 22px; }
  .welcome-row { align-items: flex-start; gap: 12px; padding-top: 28px; }
  .welcome-row h1 { font-size: calc(27px * var(--desktop-font-scale, 1)); }
  .content-tabs { gap: 0; overflow-x: auto; }
  .content-tab { flex: 0 0 auto; font-size: calc(9px * var(--desktop-font-scale, 1)); padding: 11px 8px; }
  .entries-card, .todo-card, .settings-card { padding: 15px 12px; }
  .entries-header h2 { font-size: calc(20px * var(--desktop-font-scale, 1)); }
  .todo-heading h2 { font-size: calc(20px * var(--desktop-font-scale, 1)); }
  .entry-row { gap: 8px; }
  .entry-icon { flex-basis: 33px; height: 33px; }
  .entry-actions { flex-direction: column; gap: 4px; }
  .entry-actions button { padding: 5px 7px; }
  .todo-form { grid-template-columns: 1fr; }
  .todo-form .field-label { grid-column: auto; }
  .todo-form .primary-button { justify-self: end; }
  .editor-dialog { padding: 18px; }
  .editor-fields { grid-template-columns: 1fr; }
  .editor-fields .field-full { grid-column: auto; }
  .editor-dialog:has(.topic-icon-picker) { max-width: 580px; }
  .topic-delete-resource { grid-template-columns: 1fr; }
  .topic-delete-dialog .editor-actions { flex-wrap: wrap; }
}
@media (min-width: 1001px) {
  :root { --desktop-font-scale: 1.333; }
}
