:root {
  --bg: #eff7eb;
  --panel: #ffffff;
  --soft: #dff1d8;
  --text: #183a23;
  --muted: #607764;
  --line: rgba(24, 58, 35, .14);
  --accent: #72ce54;
  --danger: #c8473b;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
.admin-header { min-height: 78px; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.admin-header img { width: 190px; height: auto; max-height: 64px; object-fit: contain; display: block; }
.header-actions, .toolbar-actions, .status-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
main { max-width: 1500px; margin: 0 auto; padding: 24px; }
.login-panel { max-width: 680px; margin: 11vh auto; padding: 48px; background: var(--panel); border: 1px solid var(--line); }
.login-panel h1, .editor-toolbar h1, .sidebar-heading h2 { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; }
.login-panel h1 { font-size: 58px; }
.login-panel p { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
#admin-app { display: grid; grid-template-columns: 300px minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.item-sidebar, .editor, .preview-panel { background: var(--panel); border: 1px solid var(--line); }
.item-sidebar, .preview-panel { position: sticky; top: 102px; }
.item-sidebar { max-height: calc(100vh - 126px); overflow-y: auto; }
.global-theme-manager { padding: 18px; border-bottom: 1px solid var(--line); }
.global-theme-manager h2 { margin: 6px 0; font-family: var(--serif); font-weight: 400; }
.global-theme-manager p { color: var(--muted); font-size: 12px; line-height: 1.45; }
.global-theme-options { display: grid; gap: 7px; margin: 14px 0; }
.sidebar-heading, .collection-manager-heading { padding: 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.collection-manager-heading { gap: 10px; }
.collection-manager-heading h2 { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; }
.item-list { padding: 12px; display: grid; gap: 8px; }
.item-entry { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg); padding: 12px; cursor: pointer; }
.item-entry.active { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.item-entry strong { display: block; }
.item-entry small { color: var(--muted); }
.editor-toolbar { padding: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 1px solid var(--line); }
form { padding: 18px; display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
small { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
input, textarea, select { width: 100%; border: 1px solid var(--line); background: #fbfff9; color: var(--text); padding: 11px 12px; font: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
fieldset, details { border: 1px solid var(--line); padding: 16px; background: #fbfff9; }
legend, summary { color: var(--text); font-weight: 800; cursor: pointer; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.item-collection-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.collection-manager { padding: 12px; display: grid; gap: 9px; }
.collection-entry { padding: 10px; display: grid; gap: 8px; border: 1px solid var(--line); background: var(--bg); }
.collection-entry input[type="text"] { padding: 8px; background: var(--panel); }
.collection-entry-actions { display: flex; align-items: center; gap: 5px; }
.collection-entry-actions button { padding: 6px 8px; }
.collection-entry .check-control { margin-right: auto; font-size: 11px; }
.collection-empty { margin: 0; color: var(--muted); font-size: 12px; }
.theme-choice { display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); background: var(--panel); text-transform: none; letter-spacing: 0; font-size: 13px; }
.theme-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); }
.image-controls { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: start; }
#main-preview { width: 130px; height: 160px; object-fit: contain; border: 1px solid var(--line); background: #fff; }
.check-control { display: flex; grid-auto-flow: column; justify-content: start; align-items: center; gap: 9px; color: var(--text); text-transform: none; letter-spacing: 0; }
.check-control input { width: auto; }
button, .quiet-button, .primary-button, .danger-button { border: 1px solid var(--line); padding: 10px 13px; background: transparent; color: var(--text); text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 800; }
.primary-button { background: var(--text); color: #fff; border-color: var(--text); }
.quiet-button:hover, .icon-button:hover { background: var(--soft); }
.danger-button { color: var(--danger); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--soft); font-size: 22px; cursor: pointer; }
.new-collection-button { flex: 0 0 auto; border: 1px solid var(--line); padding: 8px 9px; background: var(--soft); color: var(--text); font-size: 10px; font-weight: 800; cursor: pointer; }
.message { min-height: 21px; margin: 0; padding: 0 18px; color: var(--muted); }
.message.error { color: var(--danger); }
.preview-panel { padding: 18px; }
#editor-preview { margin-top: 16px; display: grid; gap: 12px; }
#editor-preview img { width: 100%; max-height: 250px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
#editor-preview h3 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 400; }
#editor-preview p, #editor-preview pre { color: var(--muted); white-space: pre-wrap; font-size: 12px; }
@media (max-width: 1100px) {
  #admin-app { grid-template-columns: 1fr; }
  .item-sidebar, .preview-panel { position: static; max-height: none; }
}
@media (max-width: 720px) {
  main { padding: 12px; }
  .form-grid, .theme-options, .item-collection-options, .image-controls { grid-template-columns: 1fr; }
  .admin-header { align-items: flex-start; flex-direction: column; }
}
