:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #25202a;
  background: #f7f5f9;
  --primary: #55247a;
  --primary-dark: #42185f;
  --border: #d9d2df;
  --muted: #655f69;
  --danger: #a41e34;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f7f5f9; }
a { color: var(--primary); }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem max(1rem, calc((100% - 1440px) / 2)); background: var(--primary); color: white; }
.brand { display: flex; align-items: center; gap: .75rem; color: white; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: .03em; }
.brand-mark { display: grid; width: 2.75rem; height: 2.75rem; flex: 0 0 auto; place-items: center; border: 1px solid white; border-radius: 999px; font-size: .8rem; }
.header-link { color: white; text-underline-offset: .25rem; }
main { max-width: 1440px; margin: 0 auto; padding: 1.5rem; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { line-height: 1.55; }
.card { border: 1px solid var(--border); border-radius: .5rem; background: white; }
.auth-card { max-width: 760px; margin: 2rem auto; padding: 2rem; }
.auth-card details { margin: 1rem 0; padding: 1rem; border: 1px solid var(--border); border-radius: .4rem; }
.auth-card summary { cursor: pointer; font-weight: 650; }
.auth-card li { margin: .5rem 0; }
.auth-form { margin-top: 1.5rem; }
.inline-control { display: flex; gap: .75rem; align-items: end; }
.inline-control input { flex: 1; }
label, legend { display: block; font-size: .9rem; font-weight: 650; }
input, select, textarea { display: block; width: 100%; margin-top: .35rem; padding: .7rem .75rem; border: 1px solid #aca3b4; border-radius: .35rem; background: white; color: #25202a; font: inherit; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #a873c5; outline-offset: 2px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.button { min-height: 2.75rem; padding: .65rem 1rem; border: 1px solid transparent; border-radius: .35rem; font: inherit; font-weight: 650; cursor: pointer; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.primary { background: var(--primary); color: white; }
.primary:hover:not(:disabled) { background: var(--primary-dark); }
.secondary { border-color: var(--border); background: white; color: #25202a; }
.secondary:hover { background: #f0ebf3; }
.danger { border-color: var(--danger); background: white; color: var(--danger); }
.danger:hover { background: #fff0f2; }
.full { width: 100%; }
.status { min-height: 1.5rem; color: var(--muted); }
.status.error { color: #8b162b; }
.status.success { color: #176335; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 1.25rem; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem; }
.draft-status { font-size: .9rem; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.list-panel { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; padding: 1rem; }
.list-heading { position: sticky; top: -1rem; z-index: 1; padding: 0 0 1rem; background: white; }
.list-heading .button { margin-top: .75rem; }
.order-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .75rem; }
.order-controls .button { min-height: 2.5rem; padding: .5rem; font-size: .85rem; }
.order-help { margin-bottom: .75rem; }
.record-list { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.record-item { position: relative; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-items: stretch; border: 1px solid transparent; border-radius: .35rem; background: transparent; }
.record-item:hover, .record-item.active { border-color: var(--border); background: #f3eef6; }
.record-item.dragging { opacity: .45; }
.record-item.drop-before::before, .record-item.drop-after::after { position: absolute; right: 0; left: 0; height: 3px; border-radius: 999px; background: var(--primary); content: ""; }
.record-item.drop-before::before { top: -.3rem; }
.record-item.drop-after::after { bottom: -.3rem; }
.drag-handle { display: grid; place-items: center; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: grab; user-select: none; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.drag-handle[draggable="false"] { cursor: not-allowed; opacity: .45; }
.record-button { width: 100%; padding: .75rem .75rem .75rem .25rem; border: 0; border-radius: .35rem; background: transparent; text-align: left; cursor: pointer; }
.record-button strong, .record-button small { display: block; }
.record-button small { margin-top: .2rem; color: var(--muted); }
.editor-panel { padding: 1.5rem; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.wide { grid-column: 1 / -1; }
.help, .muted { margin: .35rem 0 0; color: var(--muted); font-size: .85rem; font-weight: 400; }
.choice-group { margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--border); border-radius: .4rem; }
.choice-group legend { padding: 0 .35rem; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.choice-label { display: flex; align-items: start; gap: .5rem; font-weight: 400; }
.choice-label input { width: auto; margin: .2rem 0 0; }
#record-form > fieldset > label { margin-top: 1.25rem; }
.image-editor { margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--border); border-radius: .4rem; }
.image-editor > label { margin-top: 1rem; }
.image-row { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.image-row img { width: 100%; aspect-ratio: 3 / 2; border: 1px solid var(--border); border-radius: .35rem; background: #f7f5f9; object-fit: contain; }
.image-row label + .help { margin-bottom: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.editor-panel .status:not([hidden]) { margin: 1.25rem 0 0; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: .35rem; background: #f7f5f9; }
.editor-panel .status.success:not([hidden]) { border-color: #70a987; background: #eff9f2; }
.editor-panel .status.error:not([hidden]) { border-color: #c77786; background: #fff0f2; }
[hidden] { display: none !important; }
.conflicts-panel { margin-bottom: 1rem; padding: 1.25rem; }
.conflict-card { padding: 1rem 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.conflict-card p { margin: .65rem 0; }
.conflict-card summary { cursor: pointer; color: var(--primary); font-weight: 650; }
.conflict-field { margin: 1rem 0; padding: .75rem; border: 1px solid var(--border); border-radius: .35rem; }
.conflict-field legend { padding: 0 .35rem; }
.conflict-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.conflict-versions label { min-width: 0; padding: .75rem; border: 1px solid var(--border); border-radius: .35rem; cursor: pointer; }
.conflict-versions label:has(input:checked) { outline: 2px solid var(--primary); }
.conflict-versions input { display: inline-block; width: auto; margin: 0 .5rem 0 0; }
.conflict-versions pre { margin: .65rem 0 0; max-height: 16rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-weight: 400; }
.discard-draft { margin-top: 1rem; }
.record-button .record-conflict { color: var(--danger); font-weight: 650; }
.record-button .record-draft { color: var(--primary); font-weight: 650; }
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .list-panel { position: static; max-height: 440px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; }
}
@media (max-width: 620px) {
  main { padding: 1rem; }
  .site-header, .inline-control, .editor-heading { align-items: stretch; flex-direction: column; }
  .brand { font-size: .82rem; }
  .form-grid, .choices, .image-row, .conflict-versions { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .auth-card, .editor-panel { padding: 1.1rem; }
}
