:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #222323;
  background: #f3f1eb;
  --ink: #171818;
  --paper: #fffdfa;
  --line: #dedad0;
  --muted: #655f56;
  --accent: #a33a29;
  --heading: "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 2.5vw, 56px);
}

* { box-sizing: border-box; }
body { margin: 0; }
.hide { display: none !important; }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #c26835; outline-offset: 3px; }

.top {
  min-height: 76px;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--ink);
  color: white;
  border-bottom: 3px solid var(--accent);
}
.brand, .brand strong, #identity { display: flex; align-items: center; gap: 12px; }
.brand strong { font: 800 19px var(--heading); letter-spacing: .1em; }
.brand img { object-fit: contain; border-radius: 50%; background: #000; }
.brand-caption { color: #d6cfc2; font-size: .82rem; border-left: 1px solid #6b645b; padding-left: 12px; }
#identity { min-width: 0; flex-wrap: wrap; justify-content: end; font-size: .86rem; overflow-wrap: anywhere; }
main { padding: clamp(16px, 3vh, 36px) var(--gutter); }

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: stretch;
  max-width: 1060px;
  margin: clamp(0px, 5vh, 60px) auto;
  border: 1px solid var(--line);
  background: var(--paper);
}
.login-intro, .dashboard-hero {
  background: linear-gradient(130deg, #161717 38%, #3c2520);
  color: #fff9ed;
  padding: clamp(32px, 6vw, 88px);
  border-bottom: 4px solid var(--accent);
}
.eyebrow { font-size: .77rem; letter-spacing: .16em; font-weight: 800; color: #e9b29d; }
h1, h2, h3 { font-family: var(--heading); }
h1 { font-size: clamp(2.2rem, 5vw, 5rem); line-height: .98; letter-spacing: -.06em; margin: 14px 0 22px; }
.section-title { font-size: clamp(1.65rem, 3vw, 2.2rem); letter-spacing: -.025em; margin: 0 0 18px; }
.dictionary-nav { margin-bottom: 16px; }
.location-lines { list-style: none; padding: 0; margin: 0; }
.location-lines li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  overflow-wrap: anywhere;
}
.location-lines strong { color: var(--muted); font-size: .8em; }
.location-actions { margin-inline-start: auto; }
.location-blocked { color: #ffae99; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 38px; padding: 7px; }
.museum-filter { display: flex; align-items: flex-start; gap: 8px; }
.museum-filter label { min-width: 0; flex: 1; }
.museum-filter .icon-button { margin-top: 25px; }
.signed-in .location-editor { width: min(740px, 94vw); }
.signed-in .location-drawing { width: min(900px, 94vw); }
.location-drawing-image { display: block; max-width: 100%; max-height: 58vh; margin: 0 auto; object-fit: contain; }
.drawing-stage { display: table; max-width: 100%; margin: 0 auto; position: relative; }
.drawing-zones { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.drawing-zone { fill: #32cfff59; stroke: #32cfff; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: auto; cursor: context-menu; }
.drawing-zone.is-selected, .drawing-zone:is(:hover, :focus-visible) { fill: #32cfff89; stroke: #d4f8ff; stroke-width: 3; outline: none; }
.drawing-replacement { margin: 12px 0; }
.drawing-replacement summary { cursor: pointer; }
.drawing-stage.is-drawing .drawing-zones { pointer-events: auto; cursor: crosshair; touch-action: none; }
.drawing-stage.is-drawing .drawing-zone { pointer-events: none; }
.drawing-zone-draft { fill: #ffe57b35; stroke: #ffe57b; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.drawing-point { fill: #ffe57b; pointer-events: none; }
.drawing-controls, .drawing-zone-list:not(:empty) { margin-bottom: 10px; }
.drawing-context { position: absolute; z-index: 1; display: grid; gap: 6px; max-width: min(260px, 100%); padding: 10px; background: #171818; border: 1px solid #666; }
.location-drawing [hidden] { display: none !important; }
.signed-in .exhibit-editor, .signed-in .location-drawing { max-height: 94vh; }
.location-qr { max-width: 560px; margin-inline: auto; text-align: center; overflow-wrap: anywhere; }
.location-qr img { max-width: 100%; height: auto; }
.signed-in .qr-preview { width: min(340px, 94vw); padding: 18px; text-align: center; overflow-wrap: anywhere; }
.qr-preview h2 { margin: 0; }
.qr-preview img { max-width: 100%; height: auto; }
.qr-preview form { margin-top: 12px; }
.exhibit-toolbar { margin-bottom: 14px; }
.exhibit-filters { border-block: 1px solid var(--line); padding: 10px 0; margin-bottom: 14px; }
.exhibit-filters summary { cursor: pointer; font-weight: 650; overflow-wrap: anywhere; }
.exhibit-filters summary span { font-weight: 400; color: var(--muted); }
.exhibit-filters[open] > .grid { margin-top: 12px; }
#locationFilters { grid-column: 1 / -1; }
.exhibit-list td { vertical-align: middle; }
.exhibit-list tr:has(input:checked) { background: #ffffff0b; }
.exhibit-thumbnail { display: block; object-fit: cover; border-radius: 4px; background: var(--line); }
.exhibit-thumbnail-button { padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: zoom-in; }
.exhibit-photo-preview { max-height: 94vh; }
.exhibit-photo-full { display: block; max-width: 100%; max-height: 72vh; object-fit: contain; margin: 0 auto 14px; }
.exhibit-photo-preview [hidden] { display: none; }
.qr-search [hidden] { display: none; }
.qr-search video { display: block; width: min(100%, 720px); max-height: 58dvh; background: #000; object-fit: contain; }
.exhibit-pages { margin-top: 14px; }
.exhibit-pages[hidden] { display: none; }
.signed-in .exhibit-editor { width: min(1050px, 94vw); }
.exhibit-file-field [hidden], #tagForm [hidden] { display: none; }
.exhibit-file-field p { margin: .35rem 0; }
.exhibit-tag-options { margin: 1rem 0; }
.exhibit-tag-options [data-tag-options] { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.exhibit-tag-options label { display: flex; align-items: center; gap: .3rem; }
.signed-in .exhibit-assignment { width: min(570px, 94vw); }
.exhibit-open { text-align: left; }
.rich-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.rich-toolbar select { margin-bottom: 0; padding: 6px; }
.rich-toolbar .btn { min-width: 32px; padding: 6px 8px; }
.rich-editor {
  min-height: 190px;
  border: 1px solid #666;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 10px;
  background: #181818;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.exhibit-description, .exhibit-description-section { overflow-wrap: anywhere; }
.exhibit-description.plain { white-space: pre-wrap; }
.exhibit-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.exhibit-gallery > div { display: grid; gap: 4px; justify-items: start; }
.exhibit-gallery img { display: block; object-fit: cover; border-radius: 4px; }
.exhibit-save-error { color: #ffae99; }
.exhibit-save-error:empty { display: none; }
.exhibit-toolbar .btn:disabled, .exhibit-pages .btn:disabled { opacity: .55; cursor: default; }
.login-intro h1 { max-width: 10ch; }
.login-intro p:last-child { max-width: 32ch; color: #e6dcd0; line-height: 1.6; }
.login-layout .login-card { border: 0; margin: 0; align-self: center; padding: clamp(24px, 4vw, 62px); }
.login-card .btn { width: 100%; margin-top: 10px; }

#panel { display: grid; grid-template-columns: clamp(210px, 17vw, 288px) minmax(0, 1fr); gap: clamp(16px, 2vw, 36px); align-items: start; }
#nav { display: grid; gap: 4px; background: var(--ink); padding: 12px; }
#nav button { text-align: left; background: transparent; color: #e8e1d7; font-weight: 600; }
#nav button:hover { background: #34302b; }
#nav button.active { background: var(--accent); color: white; }
#nav #administrationMenu summary { display: block; background: transparent; color: #e8e1d7; cursor: pointer; font-weight: 600; }
#nav #administrationMenu summary::before { content: '▸'; margin-right: 8px; }
#nav #administrationMenu[open] summary::before { content: '▾'; }
#nav #administrationMenu summary::-webkit-details-marker { display: none; }
#nav #administrationMenu summary:hover, #nav #administrationMenu summary:focus-visible {
  border-color: #78493d;
  box-shadow: 0 0 8px #d4866e40;
}
.admin-submenu { display: grid; margin: 4px 0 0 12px; padding-left: 8px; border-left: 1px solid var(--line); }
#view { min-width: 0; }
.dashboard-hero { padding: clamp(20px, 4vh, 48px) clamp(20px, 3vw, 60px); overflow-wrap: anywhere; }
.dashboard-hero h1 { font-size: clamp(2rem, 5vw, 4.3rem); }
.dashboard-hero p:last-child { margin-bottom: 0; }

.card { background: var(--paper); border: 1px solid var(--line); padding: clamp(16px, 2.6vw, 30px); margin: 0 0 15px; }
.card .card { margin-top: 18px; }
.card h2 { margin: 0 0 16px; letter-spacing: -.025em; }
.row > h2 { margin: 0; }
.row + div { margin-top: 12px; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin: 6px 0 13px;
  border: 1px solid #bfb8aa;
  border-radius: 4px;
  color: inherit;
  background: white;
}
label { display: block; font-weight: 650; font-size: .875rem; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(.9); }
.btn.alt { background: #eae5db; color: #302820; }
.btn.danger { background: #8d2631; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.grid > * { min-width: 0; }
#setup, #loading { max-width: 1060px; margin-inline: auto; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.muted, small { color: var(--muted); font-size: .86rem; }
.warning, .notice, .error { padding: 12px 14px; border-left: 3px solid; }
.warning { color: #724509; background: #f9eccc; }
.notice { color: #23543e; background: #e6f0e6; }
.error { color: #82252c; background: #f8e6e7; }
#message:empty { display: none; }
#message { margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: 11px 9px; border-bottom: 1px solid var(--line); font-size: .85rem; }
th { background: #ece8de; }
td, th { overflow-wrap: anywhere; }

.signed-in {
  display: grid;
  grid-template-rows: auto 1fr;
  color-scheme: dark;
  color: #f6f3ef;
  background: #000;
  min-height: 100vh;
  min-height: 100dvh;
  --ink: #000;
  --paper: #101010;
  --line: #363636;
  --muted: #c4c0ba;
}
.sign-in {
  color-scheme: dark;
  background: #000;
  color: #f6f3ef;
  min-height: 100vh;
  --ink: #000;
  --paper: #101010;
  --line: #363636;
  --muted: #c4c0ba;
}
.sign-in .login-intro { background: #000; }
.sign-in .login-card input {
  background: #181818;
  border-color: #666;
}
.user-avatar { border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
#identity .user-avatar { width: 28px; height: 28px; }
.user-museum-choices { min-width: 0; border: 1px solid var(--line); margin: 0 0 14px; padding: 12px; }
.user-museum-choices legend { padding-inline: 6px; font-weight: 650; }
.user-museum-choices label { overflow-wrap: anywhere; }
.location-museum-picker { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.location-museum-picker label { flex: 1 1 220px; min-width: 0; }
.location-museum-picker select { margin-bottom: 0; }
#activeLocationMuseum:empty { display: none; }
#activeLocationMuseum { color: var(--muted); }
.signed-in .location-museum-picker + p { margin-top: 14px; }
.signed-in .top { min-height: 46px; padding: 5px 16px; border-bottom-width: 1px; }
#mobileMenuToggle { display: none; }
.signed-in .brand strong { font-size: .9rem; }
.signed-in .brand img { width: 32px; height: 32px; }
.signed-in .brand-caption, .signed-in #identity { font-size: .75rem; }
.signed-in #identity .btn { padding: 4px 9px; }
.signed-in main { display: grid; grid-template-rows: auto 1fr; min-width: 0; padding: 0; }
.signed-in #message { margin: 12px var(--gutter) 0; }
.signed-in #panel { grid-row: 2; gap: 0; align-items: stretch; }
.signed-in #view { padding: clamp(16px, 3vh, 36px) var(--gutter); }
.signed-in #nav { align-content: start; border-right: 1px solid var(--line); }
.signed-in #nav button:is(:hover, :focus-visible) {
  border-color: #78493d;
  box-shadow: 0 0 8px #d4866e40;
  filter: none;
}
.signed-in #nav button.active { background: var(--accent); }
.signed-in a:not(.btn) { color: #ffae99; }
.signed-in .btn.alt { background: #2b2b2b; color: #f6f3ef; }
.signed-in input:not([type=checkbox]):not([type=radio]),
.signed-in select, .signed-in textarea {
  background: #181818;
  border-color: #666;
}
.signed-in th { background: #202020; }
.signed-in dialog {
  max-width: min(900px, 94vw);
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(16px, 3vw, 32px);
}
.signed-in dialog::backdrop { background: #000b; }
.signed-in dialog td:not(:first-child) { text-align: center; }
.signed-in .dashboard-hero {
  display: grid;
  justify-items: center;
  align-content: start;
  text-align: center;
  min-height: 280px;
  min-height: min(320px, 55dvh);
  background: #000 url("/logendorf-logo.jpg") center calc(50% + 60px) /
    min(75%, clamp(170px, 34vh, 448px)) auto no-repeat;
  border: 1px solid var(--line);
}
.signed-in .dashboard-hero h1 { font-size: clamp(1.6rem, 3vw, 3rem); margin: 6px 0 12px; }
.signed-in .dashboard-hero p { margin: 0; }
.signed-in #view:has(> .dashboard-hero) { display: grid; }
.dashboard-appearance-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  margin: 16px 0;
  border: 1px solid var(--line);
  background: #000 url("/logendorf-logo.jpg") center / auto 85% no-repeat;
  color: #fff;
}
.dashboard-hero, .dashboard-appearance-preview { --dashboard-color: #000; --dashboard-ink: #fff; }
:is(.dashboard-hero, .dashboard-appearance-preview)[data-color=white] {
  --dashboard-color: #fff;
  --dashboard-ink: #171818;
}
:is(.dashboard-hero, .dashboard-appearance-preview)[data-color=cream] {
  --dashboard-color: #f4ead8;
  --dashboard-ink: #28231e;
}
.signed-in .dashboard-hero[data-mode=color], .dashboard-appearance-preview[data-mode=color] {
  background: var(--dashboard-color);
  color: var(--dashboard-ink);
}
.signed-in .dashboard-hero[data-mode=image], .dashboard-appearance-preview[data-mode=image] {
  background: var(--dashboard-color) var(--dashboard-image, none) center / cover no-repeat;
  color: #fff;
}
@media (orientation: portrait) {
  .signed-in .dashboard-hero[data-mode=image] { background-size: contain; }
}
.dashboard-hero[data-mode=color][data-color]:not([data-color=black]) .eyebrow { color: #6f3025; }
.dashboard-hero[data-mode=image] .dashboard-greeting, .dashboard-appearance-preview:not([data-mode=color]) span {
  background: #000b;
  border-radius: 6px;
  padding: 12px 20px;
}
.dashboard-museum-picker {
  max-width: min(100%, 320px);
  background: #000b;
  color: #fff;
  padding: 8px 12px 0;
  border-radius: 6px;
  margin-bottom: 12px;
}

@media (max-width: 950px) {
  #panel { grid-template-columns: minmax(0, 1fr); }
  .signed-in #panel { grid-template-rows: auto auto minmax(0, 1fr); }
  #mobileMenuToggle {
    display: block;
    grid-row: 1;
    justify-self: stretch;
    min-height: 44px;
    margin: 6px var(--gutter);
    text-align: left;
  }
  #mobileMenuToggle::after { content: '▾'; float: inline-end; }
  #mobileMenuToggle[aria-expanded=true]::after { content: '▴'; }
  .signed-in #nav { border-right: 0; border-bottom: 1px solid var(--line); }
  #nav { grid-row: 2; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 4px; padding: 8px var(--gutter); }
  #nav:not(.mobile-open) { display: none; }
  #nav button, #nav summary { min-height: 44px; padding: 9px; font-size: .92rem; }
  .signed-in #view { grid-row: 3; padding: 14px var(--gutter); }
}
@media (max-height: 680px) {
  .top { min-height: 58px; padding-block: 6px; }
  .login-layout { margin-block: 0; }
  .login-intro { padding-block: 26px; }
}
@media (max-width: 620px) {
  :root { --gutter: 12px; }
  .brand-caption { display: none; }
  .signed-in .top { flex-wrap: wrap; gap: 4px 10px; padding: 6px var(--gutter); }
  .signed-in #identity { flex: 1 1 200px; gap: 4px 8px; }
  .login-layout { grid-template-columns: minmax(0, 1fr); margin-block: 0; }
  .login-intro { padding: 22px; }
  .login-intro h1 { font-size: clamp(2.2rem, 11vw, 3.4rem); }
  .login-layout .login-card { padding: 20px; }
  .card { overflow-wrap: anywhere; }
  .signed-in .card { padding: 12px; }
  .signed-in dialog { max-width: 96vw; max-height: 94dvh; padding: 14px; }
  .signed-in .rich-editor { min-height: 135px; }
  .signed-in .dashboard-hero { padding: 12px; }
  .signed-in .dashboard-hero h1 { font-size: clamp(1rem, 4.5vw, 1.6rem); }
  .location-actions { margin-inline-start: 0; }
}
@media (max-width: 700px) {
  .exhibit-list, .exhibit-list tbody { display: block; }
  .exhibit-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .exhibit-list tbody tr {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    grid-template-areas: "photo title select" "photo inventory inventory"
      "id location location" "public qr qr";
    align-items: start;
    gap: 8px 12px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .exhibit-list td { border: 0; min-width: 0; padding: 0; }
  .exhibit-list td[data-label]::before {
    display: block;
    color: var(--muted);
    font-size: .75rem;
    content: attr(data-label);
  }
  .exhibit-list [data-cell=select] { grid-area: select; }
  .exhibit-list [data-cell=select] input { width: 22px; height: 22px; margin: 6px; }
  .exhibit-list [data-cell=photo] { grid-area: photo; align-self: center; }
  .exhibit-list [data-cell=id] { grid-area: id; }
  .exhibit-list [data-cell=inventory] { grid-area: inventory; }
  .exhibit-list [data-cell=title] { grid-area: title; }
  .exhibit-list [data-cell=title] button { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
  .exhibit-list [data-cell=location] { grid-area: location; }
  .exhibit-list [data-cell=public] { grid-area: public; }
  .exhibit-list [data-cell=qr] { grid-area: qr; }
}
@media (max-width: 950px), (pointer: coarse) {
  :is(.signed-in, .sign-in) :is(.btn, input:not([type=checkbox], [type=radio], [type=hidden]), select) { min-height: 44px; }
  :is(.signed-in, .sign-in) :is(input:not([type=checkbox], [type=radio]), select, textarea) { font-size: 16px; }
  .signed-in #identity .btn { padding-inline: 10px; }
  .exhibit-filters summary { min-height: 44px; align-content: center; }
}

.signed-in :is(h1, h2, h3, h4, h5, h6, th, #nav button, #nav summary, .exhibit-filters summary) {
  white-space: nowrap;
}
.signed-in :is(#view, #nav, dialog, .table-scroll) {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #7775 transparent;
}
.signed-in :is(#view, #nav, dialog, .table-scroll):is(:hover, :focus-within) {
  scrollbar-color: #9999 transparent;
}
.horizontal-edge[hidden] { display: none; }
.horizontal-edge {
  position: fixed;
  inset-block: 0;
  z-index: 5;
  width: 16px;
  padding: 0;
  border: 0;
  background: #303030e8;
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.horizontal-edge:is(:hover, :focus-visible) { opacity: 1; }
.horizontal-edge-left { inset-inline-start: 0; }
.horizontal-edge-right { inset-inline-end: 0; }
@media (hover: none) {
  .horizontal-edge { display: none; }
}
[data-database] dd { margin: 0 0 .6rem; overflow-wrap: anywhere; }
[data-database] [data-db-file] { margin-top: .35rem; }
