:root {
  --ink: #211f1c;
  --paper: #faf7f2;
  --paper-alt: #f1ece3;
  --line: #ddd4c6;
  --accent: #8a5a3b;
  --accent-dark: #6e4630;
  --muted: #857c6d;
  --danger: #a13d3d;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(33, 31, 28, 0.08);
  font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 1.5rem; margin: 0; letter-spacing: 0.01em; }
.topbar-actions { display: flex; gap: 10px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 40px; width: 40px; flex: none; }

/* ---------- Startup splash ---------- */
#splashScreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  animation: splashFadeOut 0.6s ease 2.9s forwards;
}
.splash-content { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.splash-logo {
  width: 110px;
  height: 110px;
  opacity: 0;
  animation:
    splashLogoFadeIn 0.2s ease 0.05s forwards,
    splashLogoPop 0.45s ease 1.3s;
}

/* Each stroke is "undrawn" (fully offset) and animates its dash-offset down to 0 in
   sequence — the O traces its circle, then the F's three strokes follow — rather than
   the whole mark just fading in as one flat block. */
.mark-stroke { stroke-dasharray: 1; stroke-dashoffset: 1; }
.mark-o  { animation: markDraw 0.65s ease 0.15s forwards; }
.mark-f1 { animation: markDraw 0.4s ease 0.55s forwards; }
.mark-f2 { animation: markDraw 0.3s ease 0.85s forwards; }
.mark-f3 { animation: markDraw 0.3s ease 1.0s forwards; }

.splash-wordmark {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(6px);
  animation: splashTextIn 0.5s ease 1.65s forwards;
}

@keyframes markDraw { to { stroke-dashoffset: 0; } }
@keyframes splashLogoFadeIn { to { opacity: 1; } }
@keyframes splashLogoPop {
  0% { transform: scale(1); }
  55% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes splashTextIn { to { opacity: 1; transform: translateY(0); } }
@keyframes splashFadeOut { to { opacity: 0; visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  #splashScreen, .splash-logo, .splash-wordmark, .mark-stroke { animation-duration: 0.01s !important; animation-delay: 0s !important; }
}

/* ---------- Auth gate ---------- */
#authOverlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 20px;
}
#authOverlay[hidden] { display: none; }
.auth-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.auth-logo { width: 56px; height: 56px; margin-bottom: 10px; }
.auth-title { font-size: 1.4rem; margin: 0 0 4px; }
.auth-subtitle { color: var(--muted); margin: 0 0 20px; }
#authForm { text-align: left; }
#authForm input, #authMfaForm input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.92rem;
  color: var(--ink);
  background: white;
}
#authMfaCodeInput {
  text-align: center;
  letter-spacing: 0.3em;
  font-size: 1.2rem;
}
#authHcaptcha { display: flex; justify-content: center; min-height: 1px; }
.auth-submit { width: 100%; margin-top: 16px; }
.auth-error {
  color: var(--danger);
  background: #fbeceb;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.85rem;
  margin: 12px 0 0;
}
.auth-status {
  color: var(--accent-dark);
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.85rem;
  margin: 12px 0 0;
}
.auth-toggle, .auth-forgot { font-size: 0.85rem; color: var(--muted); margin: 14px 0 0; text-align: center; }
.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}
.auth-link:hover { color: var(--accent-dark); }

.btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--paper-alt); }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper-alt); color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-small { padding: 6px 10px; font-size: 0.8rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 28px;
  background: var(--paper-alt);
  border-bottom: 1px solid var(--line);
}

.filter-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  background: white;
  color: var(--ink);
}
.filter-input.small { width: 90px; }
.search-input { flex: 1 1 220px; min-width: 180px; }

.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label { font-size: 0.78rem; color: var(--muted); margin-right: 2px; }
.dash { color: var(--muted); }

.stats-bar {
  padding: 10px 28px 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex: none;
}
.view-toggle-btn {
  border: none;
  background: white;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--line); }
.view-toggle-btn.active { background: var(--accent); color: white; }
.view-toggle-btn:hover:not(.active) { background: var(--paper-alt); }

main { padding: 20px 28px 60px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(33,31,28,0.12); }

.card-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--paper-alt) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  position: relative;
}

.card-badges { display: flex; gap: 6px; align-items: center; flex: none; }
.card-badges-overlay { position: absolute; top: 8px; right: 8px; }

.status-badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  white-space: nowrap;
}
.status-Available { background: #4f7a4f; }
.status-Sold { background: #857c6d; }
.status-No-Sale { background: #a1743d; }
.status-Reserved { background: #4a6f8a; }

.location-badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(27, 36, 48, 0.72);
}
.card-list-top .location-badge { background: var(--ink); }

.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 600; font-size: 0.98rem; margin: 0 0 4px; }
.card-meta { font-size: 0.8rem; color: var(--muted); margin: 0 0 6px; }
.card-price { font-size: 0.92rem; font-weight: 600; color: var(--accent-dark); }

/* ---------- List view ---------- */
.grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.grid.list-view .card {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}
.card-photo-sm {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 8px;
  background: var(--paper-alt) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.65rem;
  border: 1px solid var(--line);
}
.card-list-info { flex: 1; min-width: 0; }
.card-list-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-list-top .card-title { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-list-info .card-meta { margin: 3px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-list-info .card-price { margin-top: 2px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(33,31,28,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--paper);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 0; font-size: 1.2rem; }
.icon-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.icon-btn:hover { color: var(--ink); }

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label { font-size: 0.82rem; font-weight: 600; margin: 12px 0 5px; color: var(--ink); }
.field-label:first-of-type { margin-top: 0; }
.hint { font-weight: 400; color: var(--muted); }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.9rem;
  width: 100%;
  background: white;
  color: var(--ink);
  font-family: inherit;
}
textarea { resize: vertical; }

.form-row { display: flex; gap: 14px; }
.form-col { flex: 1; }

.media-row { display: flex; gap: 8px; align-items: flex-start; }
.media-row select { flex: 1; }

.media-checkboxes {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  min-height: 40px;
}
.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  cursor: pointer;
}
.checkbox-chip input { margin: 0; width: auto; }

.presentation-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 12px 0 5px;
  cursor: pointer;
}
.checkbox-row input { width: auto; margin: 0; }

.price-breakdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper-alt);
  font-size: 0.85rem;
  margin: 6px 0 4px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--muted);
}
.breakdown-row.breakdown-total {
  color: var(--ink);
  font-weight: 600;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 6px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
}
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}
.settings-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-row-name { font-weight: 600; font-size: 0.92rem; }
.settings-row-sub { font-size: 0.8rem; color: var(--muted); }
.settings-row-actions { display: flex; gap: 6px; flex: none; }

.exhibition-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.exhibition-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--paper-alt);
  border-radius: 999px;
  padding: 4px 6px 4px 10px;
  font-size: 0.78rem;
}
.exhibition-chip .exhibition-delete-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 4px;
}
.exhibition-chip .exhibition-delete-btn:hover { color: var(--danger); }
.exhibition-finish-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.74rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.exhibition-finish-label input { width: auto; margin: 0; }

.gallery-add-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.gallery-add-form input[type="text"] { flex: 1; min-width: 140px; }

.size-row { display: flex; align-items: center; gap: 8px; }
.size-row input { flex: 1; }
.size-row select { width: 90px; flex: none; }
.size-row[hidden] { display: none; }

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.photo-preview .thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
}
.photo-preview .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview .thumb .file-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.62rem;
  line-height: 1.15;
  text-align: center;
  padding: 4px;
  background: var(--paper-alt);
  overflow: hidden;
  word-break: break-word;
}
.photo-preview .thumb .file-thumb .file-icon { font-size: 1.4rem; }
.photo-preview .thumb .remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  cursor: pointer;
  line-height: 1;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

.detail-photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
}
.detail-photos img {
  height: 220px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  font-size: 0.9rem;
}
.detail-grid .full { grid-column: 1 / -1; }
.detail-label { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.detail-value { font-size: 0.95rem; }

.trail-list { display: flex; flex-direction: column; margin-top: 6px; }
.trail-item { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--line); }
.trail-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.trail-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--paper);
}
.trail-item.trail-current::before { background: var(--accent); }
.trail-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.trail-place { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.trail-meta { font-size: 0.8rem; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trail-delete-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  flex: none;
}
.trail-delete-btn:hover { color: var(--danger); }

/* ---------- View tabs ---------- */
.view-tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.view-tab {
  border: none;
  background: none;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.view-tab:hover { color: var(--ink); }
.view-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.view[hidden] { display: none; }

.subview-tabs { display: flex; gap: 6px; padding: 16px 28px 0; }
.subview-tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  padding: 7px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 999px;
}
.subview-tab:hover:not(.active) { background: var(--paper-alt); }
.subview-tab.active { background: var(--accent); color: white; border-color: var(--accent); font-weight: 600; }
.modal-body .subview-tabs { padding: 0; margin: 0 0 14px; flex-wrap: wrap; }

.hint-banner {
  margin: 16px 28px 0;
  padding: 12px 16px;
  background: #fdf3dc;
  border: 1px solid #e6cd8b;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #6b5518;
  line-height: 1.45;
}

/* ---------- Income summary ---------- */
.income-fy-label { font-size: 0.85rem; color: var(--muted); align-self: center; }
.section-heading { font-size: 1.1rem; margin: 24px 28px 12px; font-family: Georgia, serif; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  padding: 20px 28px 0;
}
.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 0.76rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 600; margin-top: 4px; color: var(--ink); }
.stat-card.positive .stat-value { color: #4f7a4f; }
.stat-card.negative .stat-value { color: var(--danger); }

.income-table-wrap { padding: 0 28px 30px; overflow-x: auto; }
.income-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; background: white; }
.income-table th, .income-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.income-table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.income-table tfoot td { font-weight: 600; border-top: 2px solid var(--line); }

.table-actions { display: flex; gap: 6px; }

/* ---------- Map ---------- */
.map-caption { display: block; margin: 8px 0 0; }
.map-main {
  display: flex;
  gap: 24px;
  padding: 4px 28px 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.map-panel { flex: 2 1 480px; min-width: 300px; }

#leafletMap {
  width: 100%;
  height: 62vh;
  min-height: 420px;
  max-height: 680px;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 1;
}
.leaflet-tooltip { font-family: inherit; font-size: 0.8rem; }
.leaflet-container { background: var(--paper-alt); font-family: inherit; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
  align-items: center;
}
.legend-swatch { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch .swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,0.1); }
.legend-gradient {
  width: 120px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(to right, #eaf4e6, #1c5e2b);
  border: 1px solid rgba(0,0,0,0.1);
  display: inline-block;
  vertical-align: middle;
  margin: 0 4px;
}

.map-side {
  flex: 1 1 300px;
  min-width: 280px;
  max-height: 62vh;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
}
.map-side h3 { margin: 0 22px 6px 0; font-size: 1.05rem; }
.map-side .side-stat { display: flex; justify-content: space-between; font-size: 0.88rem; padding: 5px 0; border-bottom: 1px solid var(--paper-alt); }
.map-panel-subheading { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin: 16px 0 8px; }

.map-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 10px; right: 10px;
  background: none; border: none;
  font-size: 1.4rem; color: var(--muted);
  cursor: pointer; line-height: 1;
  width: 32px; height: 32px;
}

.map-artwork-list { list-style: none; padding: 0; margin: 0; }
.map-artwork-row {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-alt);
  cursor: pointer;
}
.map-artwork-row:hover { background: var(--paper-alt); }
.map-artwork-thumb {
  width: 52px; height: 52px; flex: none;
  border-radius: 6px;
  background-color: var(--paper-alt);
  background-size: cover;
  background-position: center;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.75rem;
  border: 1px solid var(--line);
}
.map-artwork-info { min-width: 0; }
.map-artwork-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-artwork-meta { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.map-sheet-overlay {
  display: none;
}

/* ---------- Gallery form: county detection ---------- */
.gallery-form-row { display: flex; gap: 8px; width: 100%; }
.gallery-form-row input { flex: 1; }
.gallery-form-actions { display: flex; gap: 8px; width: 100%; justify-content: flex-end; }
.gallery-county-status { font-size: 0.82rem; color: var(--muted); min-height: 1.2em; }
.gallery-county-status.ok { color: #4f7a4f; }
.gallery-county-status.warn { color: var(--danger); }
.warn-text { color: var(--danger); }
#galleryCountySelect, #soldCountySelect { margin-bottom: 4px; }

/* ---------- Print (PDF export) ---------- */
#printArea { display: none; }
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 20px;
  }
  .print-header { margin-bottom: 16px; }
  .print-header h1 { font-size: 1.3rem; margin: 0 0 4px; }
  .print-header p { font-size: 0.85rem; color: #555; margin: 0; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
  .print-table th, .print-table td {
    text-align: left;
    padding: 6px 8px;
    border: 1px solid #999;
  }
  .print-table th { background: #eee; font-weight: 600; }
  .print-table tr { page-break-inside: avoid; }
}

@media (max-width: 560px) {
  .topbar, .filters, main { padding-left: 16px; padding-right: 16px; }
  .form-row { flex-direction: column; }

  .view-tabs { padding: 0 16px; }
  .section-heading { margin-left: 16px; margin-right: 16px; }
  .stat-cards { padding-left: 16px; padding-right: 16px; }
  .income-table-wrap { padding-left: 16px; padding-right: 16px; }
  .map-main { padding-left: 16px; padding-right: 16px; flex-direction: column; }
  #leafletMap { height: 50vh; min-height: 320px; }

  /* Side panel becomes a slide-up bottom sheet on phones */
  .map-side {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 78vh;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
    transform: translateY(105%);
    transition: transform 0.28s ease;
    z-index: 1001;
  }
  body.map-sheet-open .map-side { transform: translateY(0); }

  .map-sheet-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(33,31,28,0.4);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }
  .map-sheet-overlay[hidden] { display: none; }
  body.map-sheet-open .map-sheet-overlay:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    flex-wrap: wrap;
    row-gap: 12px;
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .topbar h1 { font-size: 1.3rem; }
  .brand-logo { height: 32px; width: 32px; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; }

  .detail-grid { grid-template-columns: 1fr; }

  .modal-overlay { padding: 0; align-items: stretch; }
  .modal {
    max-width: none;
    width: 100%;
    min-height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .btn { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .checkbox-chip, .checkbox-row { min-height: 32px; }

  .size-row { flex-wrap: wrap; }
  .size-row select { flex: 1 1 100%; width: auto; }

  /* Two text inputs otherwise sit side-by-side at ~half width here, truncating their
     placeholder text (e.g. Location's Name/Postcode) — stack them full-width instead. */
  .gallery-add-form input[type="text"],
  .gallery-add-form select { flex: 1 1 100%; }
}
