:root {
  --ink: #171613;
  --ink-soft: #22211d;
  --panel: #292823;
  --panel-raised: #31302a;
  --paper: #eee8dc;
  --paper-muted: #aaa497;
  --line: rgba(238, 232, 220, 0.13);
  --line-strong: rgba(238, 232, 220, 0.24);
  --signal: #ef5a3c;
  --signal-bright: #ff7658;
  --gold: #d8aa59;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
  --radius: 4px;
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--paper);
  background: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.app-header {
  height: 72px;
  display: grid;
  grid-template-columns: 200px auto minmax(440px, 600px) 80px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: rgba(23, 22, 19, 0.96);
  position: relative;
  z-index: 1000;
}

.wordmark { display: flex; align-items: center; padding: 0 20px; color: var(--paper); text-decoration: none; border-right: 1px solid var(--line); font-size: 16px; font-weight: 500; letter-spacing: -.01em; }

.view-tabs { display: flex; align-items: stretch; justify-content: center; }
.view-tab { min-width: 116px; padding: 0 20px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--paper-muted); cursor: pointer; position: relative; }
.view-tab:first-child { border-left: 1px solid var(--line); }
.view-tab::after { content: ""; position: absolute; height: 3px; left: 18px; right: 18px; bottom: 0; background: transparent; }
.view-tab:hover { color: var(--paper); background: rgba(255,255,255,.025); }
.view-tab.is-active { color: var(--paper); }
.view-tab.is-active::after { background: var(--signal); }

.header-controls { align-self: center; display: grid; grid-template-columns: minmax(132px, .55fr) minmax(230px, 1.45fr); gap: 8px; margin: 0 16px; }
.source-filter, .global-search { height: 40px; border: 1px solid var(--line-strong); background: var(--ink-soft); border-radius: var(--radius); }
.source-filter { display: flex; align-items: center; }
.source-filter select { width: 100%; height: 100%; padding: 0 9px; color: var(--paper-muted); background: transparent; border: 0; outline: 0; font-size: 11px; cursor: pointer; }
.source-filter:focus-within { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(239,90,60,.13); }
.global-search { display: flex; align-items: center; gap: 9px; padding: 0 10px; }
.global-search:focus-within { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(239,90,60,.13); }
.global-search input { min-width: 0; flex: 1; color: var(--paper); background: transparent; border: 0; outline: 0; font-size: 13px; }
.global-search input::placeholder { color: #777369; }
kbd { font-size: 10px; color: #817d73; border: 1px solid var(--line); padding: 2px 5px; border-radius: 3px; }
.archive-count { border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.archive-count strong { color: var(--signal-bright); font: 600 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.archive-count span { font-size: 8px; letter-spacing: .2em; color: var(--paper-muted); margin-top: 4px; }

main { height: calc(100vh - 72px); }
.app-view { display: none; height: 100%; }
.app-view.is-active { display: flex; }

.browse-view { min-width: 0; }
.roll-sidebar { width: 300px; min-width: 240px; min-height: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--ink-soft); }
.sidebar-heading { height: 52px; flex: 0 0 auto; padding: 0 12px 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 600; letter-spacing: .2em; color: var(--paper-muted); }
.text-button { border: 0; background: transparent; color: var(--paper-muted); padding: 6px; cursor: pointer; font-size: 10px; letter-spacing: .05em; }
.text-button:hover { color: var(--paper); }
.roll-list { flex: 1; min-height: 0; overflow: auto; padding: 8px 0 30px; scrollbar-color: #4e4b43 transparent; }
.roll-index-item { width: 100%; min-height: 66px; position: relative; border: 0; background: transparent; color: var(--paper-muted); text-align: left; display: grid; grid-template-columns: 58px minmax(0,1fr); align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; border-left: 3px solid transparent; }
.roll-index-item:hover { background: rgba(255,255,255,.035); color: var(--paper); }
.roll-index-item.is-active { background: rgba(239,90,60,.1); border-left-color: var(--signal); color: var(--paper); }
.roll-index-date { display: flex; flex-direction: column; align-items: flex-start; font: 9px/1.22 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--signal-bright); }
.roll-index-date time { display: block; }
.roll-index-range-dash { color: #77736a; line-height: .9; }
.roll-index-copy { min-width: 0; }
.roll-index-copy strong { font-size: 12px; font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-index-copy small { display: block; color: #858177; font-size: 10px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-folder-tag { display: inline-block; max-width: 94px; padding: 3px 5px; border: 1px solid var(--line-strong); color: #aaa59b; background: rgba(23,22,19,.82); font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-index-item .roll-folder-tag { position: absolute; right: 11px; top: 9px; }
.roll-index-item.has-folder-tag .roll-index-copy strong { padding-right: 88px; }
.roll-year-label { position: sticky; top: 0; z-index: 2; padding: 7px 16px; background: rgba(34,33,29,.96); color: #777369; font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; border-block: 1px solid var(--line); }

.browser-surface { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #1b1a17; }
.browser-toolbar { min-height: 52px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.crumb { color: var(--paper-muted); background: transparent; border: 0; padding: 5px 4px; cursor: pointer; white-space: nowrap; font-size: 12px; }
.crumb:hover, .crumb:last-child { color: var(--paper); }
.crumb-separator { color: #5d5a52; flex: 0 0 auto; font: 11px/1 ui-monospace, monospace; }
.folder-summary { display: flex; align-items: center; gap: 10px; color: var(--paper-muted); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.folder-summary button { border: 1px solid var(--line-strong); padding: 5px 7px; color: var(--paper-muted); background: transparent; cursor: pointer; font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.folder-summary button:hover { color: var(--paper); border-color: var(--signal); }
.file-grid { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-auto-rows: minmax(210px, max-content); align-content: start; align-items: start; gap: 1px; background: var(--line); padding: 1px; }
.file-card { min-width: 0; min-height: 210px; height: auto; align-self: start; border: 0; color: var(--paper); background: var(--ink-soft); padding: 0; text-align: left; cursor: pointer; text-decoration: none; overflow: hidden; }
.file-card:hover { background: var(--panel-raised); }
.file-card.is-selectable { position: relative; }
.file-card.is-selectable.is-selected { box-shadow: inset 0 0 0 3px var(--signal); }
.file-thumb { min-height: 142px; aspect-ratio: 4/3; overflow: hidden; background: #111; position: relative; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease, filter .35s ease; }
.file-card:hover .file-thumb img { transform: scale(1.025); filter: contrast(1.03); }
.roll-contact-sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 1px; }
.roll-contact-sheet img { min-width: 0; min-height: 0; }
.roll-contact-sheet.has-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.roll-contact-sheet.has-2 { grid-template-rows: 1fr; }
.roll-contact-sheet.has-3 img:first-child { grid-row: 1 / 3; }
.file-kind { position: absolute; left: 9px; top: 9px; display: inline-flex; align-items: center; gap: 5px; background: rgba(20,19,17,.83); color: var(--paper); border: 1px solid rgba(255,255,255,.14); padding: 4px 6px; font: 8px/1 ui-monospace, monospace; letter-spacing: .1em; backdrop-filter: blur(8px); }
.selection-mark { position: absolute; right: 10px; top: 10px; width: 23px; height: 23px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; color: white; background: rgba(23,22,19,.72); font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.file-card.is-selected .selection-mark { border-color: var(--signal); background: var(--signal); }
.file-thumb .roll-folder-tag, .folder-placeholder .roll-folder-tag { position: absolute; right: 9px; top: 9px; }
.file-meta { min-height: 64px; padding: 11px 12px 12px; border-top: 1px solid rgba(255,255,255,.05); }
.file-meta strong { display: block; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { display: block; margin-top: 5px; color: #858177; font-size: 10px; }
.roll-tile-meta { min-height: 94px; position: relative; padding-right: 52px; }
.roll-tile-meta > time { display: block; margin-bottom: 6px; color: var(--signal-bright); font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.roll-tile-equipment { display: flex; min-width: 0; align-items: baseline; gap: 6px; font-size: 11px; line-height: 1.25; }
.roll-tile-equipment strong, .roll-tile-equipment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-tile-equipment strong { flex: 0 1 auto; }
.roll-tile-equipment span { flex: 1 1 auto; color: var(--paper-muted); }
.roll-tile-equipment i { flex: 0 0 auto; color: #5f5b53; font-style: normal; }
.roll-tile-meta .roll-tile-notes { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9b968b; }
.roll-tile-meta .roll-tile-count { position: absolute; right: 12px; top: 11px; margin: 0; color: #6f6b63; font: 8px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.folder-placeholder, .file-placeholder { min-height: 142px; aspect-ratio: 4/3; position: relative; display: grid; place-items: center; background: #282722; color: #77736a; font: 10px/1 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.batch-toolbar { min-height: 50px; flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line-strong); background: rgba(23,22,19,.98); }
.batch-toolbar[hidden] { display: none; }
.batch-toolbar span { margin-right: auto; color: var(--signal-bright); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.batch-toolbar button { padding: 7px 9px; border: 1px solid var(--line-strong); color: var(--paper-muted); background: transparent; cursor: pointer; font-size: 9px; }
.batch-toolbar button:hover { color: var(--paper); border-color: var(--signal); }
.batch-toolbar button:disabled { opacity: .35; pointer-events: none; }
#batch-edit { color: var(--signal-bright); border-color: var(--signal); }
.loading-card, .empty-state { grid-column: 1/-1; min-height: 55vh; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--paper-muted); background: var(--ink-soft); }
.loading-card span, .map-loading span { width: 22px; height: 22px; border: 2px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin .85s linear infinite; }
.loading-card p { font-size: 12px; letter-spacing: .08em; }
@keyframes spin { to { transform: rotate(360deg); } }

.timeline-view { overflow: auto; display: none; flex-direction: column; background: var(--ink); }
.timeline-view.is-active { display: flex; }
.view-intro { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 18px 40px; border-bottom: 1px solid var(--line); }
.view-intro h1 { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.eyebrow { color: var(--signal-bright); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; margin: 0; }
.timeline-legend { display: flex; align-items: center; gap: 18px; color: var(--paper-muted); font-size: 10px; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.timeline-legend b { width: 22px; height: 6px; display: inline-block; position: relative; }
.legend-dot::before { content: ""; position: absolute; width: 6px; height: 6px; left: 8px; border-radius: 50%; background: var(--signal-bright); }
.legend-bar { background: var(--signal); border-radius: 4px; }
.legend-selection { background: linear-gradient(to right, var(--signal) 0 25%, transparent 25% 39%, var(--signal) 39% 64%, transparent 64% 78%, var(--signal) 78%); }
.legend-possible { background: repeating-linear-gradient(135deg, rgba(238,232,220,.38) 0 2px, transparent 2px 5px); border: 1px solid rgba(238,232,220,.3); }
.month-key { flex: 0 0 35px; display: grid; grid-template-columns: 74px repeat(12, 1fr); align-items: center; padding: 0 40px; position: sticky; top: 0; z-index: 5; background: rgba(23,22,19,.97); border-bottom: 1px solid var(--line); color: #6f6b63; font: 8px/1 ui-monospace, monospace; }
.month-key span { height: 100%; display: flex; align-items: center; padding-left: 6px; border-left: 1px solid var(--line); }
.month-key span:first-child { border-left: 0; }
.timeline { padding: 0 40px 70px; min-width: 940px; }
.timeline-year { display: grid; grid-template-columns: 74px minmax(760px, 1fr); border-bottom: 1px solid var(--line); }
.timeline-year h2 { margin: 0; padding: 18px 0; color: var(--paper); font: 500 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace; position: sticky; top: 35px; align-self: start; }
.year-tracks { min-width: 0; position: relative; background-image: repeating-linear-gradient(to right, var(--line) 0, var(--line) 1px, transparent 1px, transparent calc(100% / 12)); }
.timeline-event { position: absolute; height: 52px; min-width: 7px; padding: 0; border: 0; background: transparent; color: var(--paper); cursor: pointer; overflow: visible; text-align: left; }
.timeline-event-segment { position: absolute; top: 6px; height: 6px; min-width: 7px; background: var(--signal); border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.16); }
.timeline-event.is-point .timeline-event-segment { width: 7px !important; border-radius: 50%; }
.timeline-event.is-possible .timeline-event-segment { top: 5px; height: 8px; background: repeating-linear-gradient(135deg, rgba(238,232,220,.38) 0 2px, transparent 2px 5px); border: 1px solid rgba(238,232,220,.32); box-shadow: none; }
.timeline-event-label { position: absolute; left: 0; top: 17px; width: 250px; max-width: 34vw; min-width: 150px; padding: 2px 5px 3px 0; color: #aaa59b; background: rgba(23,22,19,.88); font-size: 10px; line-height: 1.2; overflow: hidden; }
.timeline-event-label > strong { display: block; overflow: hidden; color: #cac4b8; font: 500 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.timeline-label-details { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-label-separator { padding: 0 4px; color: #5f5b53; font-style: normal; }
.timeline-event.is-late .timeline-event-label { left: auto; right: 0; text-align: right; padding-inline: 4px 0; }
.timeline-event:hover, .timeline-event:focus-visible { z-index: 3; outline: 0; }
.timeline-event:hover .timeline-event-segment, .timeline-event:focus-visible .timeline-event-segment { background: var(--signal-bright); box-shadow: 0 0 0 3px rgba(239,90,60,.15); }
.timeline-event.is-possible:hover .timeline-event-segment, .timeline-event.is-possible:focus-visible .timeline-event-segment { background: repeating-linear-gradient(135deg, rgba(255,255,255,.62) 0 2px, transparent 2px 5px); }
.timeline-event:hover .timeline-event-label, .timeline-event:focus-visible .timeline-event-label { color: var(--paper); background: var(--ink); }

.map-view { position: relative; background: var(--ink); }
.map-stage { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #242520; }
.basemap-street .leaflet-tile-pane { filter: sepia(.4) saturate(.55) brightness(.64) contrast(1.18); }
.basemap-topographic .leaflet-tile-pane { filter: saturate(.72) brightness(.78) contrast(1.08); }
.basemap-satellite .leaflet-tile-pane { filter: saturate(.88) brightness(.72) contrast(1.12); }
.photo-density-canvas { position: absolute; pointer-events: none; opacity: .96; filter: saturate(1.22) contrast(1.05); }
.leaflet-control-attribution { font-size: 9px !important; background: rgba(23,22,19,.76) !important; color: #aaa !important; }
.leaflet-control-attribution a { color: var(--signal-bright) !important; }
.map-basemap-control { position: absolute; z-index: 700; top: 12px; right: 12px; display: block; }
.map-basemap-control select { height: 32px; min-width: 112px; padding: 0 28px 0 10px; border: 1px solid rgba(255,255,255,.3); border-radius: 2px; outline: 0; color: var(--paper); background: rgba(23,22,19,.9); box-shadow: 0 2px 10px rgba(0,0,0,.36); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; }
.map-basemap-control select:hover, .map-basemap-control select:focus { border-color: rgba(255,255,255,.62); }
.map-loading { position: absolute; z-index: 550; left: 50%; top: 50%; transform: translate(-50%,-50%); display: flex; align-items: center; gap: 10px; background: var(--ink-soft); border: 1px solid var(--line); padding: 12px 16px; box-shadow: var(--shadow); color: var(--paper-muted); font-size: 11px; }
.map-loading.is-hidden { display: none; }
.map-picker-bar { position: absolute; z-index: 700; left: 50%; bottom: 18px; transform: translateX(-50%); min-width: min(420px, calc(100% - 34px)); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 12px 11px 15px; border: 1px solid rgba(255,255,255,.28); background: rgba(23,22,19,.94); box-shadow: var(--shadow); color: var(--paper); font-size: 11px; }
.map-picker-bar[hidden] { display: none; }
.map-picker-bar button { border: 0; padding: 5px 6px; color: var(--paper-muted); background: transparent; cursor: pointer; font-size: 10px; }
.map-picker-bar button:hover { color: var(--paper); }
.location-panel { width: 280px; flex: 0 0 auto; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--ink-soft); }
.location-toolbar { min-height: 58px; flex: 0 0 auto; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 5px 9px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.location-toolbar label { color: #777369; font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; letter-spacing: .12em; }
.location-toolbar select { min-width: 0; width: 100%; color: var(--paper); background: var(--panel); border: 1px solid var(--line-strong); padding: 6px 7px; outline: 0; font-size: 10px; cursor: pointer; }
.location-toolbar select:focus { border-color: var(--signal); }
.location-toolbar span { grid-column: 1/-1; color: var(--paper-muted); font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.location-strip { flex: 1; min-height: 0; overflow: auto; background: var(--ink-soft); }
.location-card { width: 100%; display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: center; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid var(--line); padding: 9px 9px 9px 6px; background: transparent; color: var(--paper); text-align: left; cursor: pointer; transition: opacity .18s ease, background .18s ease, filter .18s ease; }
.location-card:hover { background: var(--panel); }
.location-card.is-selected { border-left-color: var(--signal); background: rgba(239,90,60,.1); opacity: 1; filter: none; }
.location-card.is-outside { opacity: .3; filter: grayscale(1); }
.location-card.is-outside:hover { opacity: .65; }
.location-card.is-selected.is-outside { opacity: .45; filter: grayscale(.8); }
.location-card.is-unknown { opacity: .78; }
.location-card.is-unknown:hover { opacity: 1; }
.location-card img { width: 74px; height: 64px; object-fit: cover; background: #111; }
.location-card strong { display: block; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.location-card small { display: block; color: var(--paper-muted); font: 8px/1.4 ui-monospace, monospace; margin-top: 5px; }
.location-card .unknown-location { color: #8c887e; font-style: italic; }
.location-load-more { width: calc(100% - 20px); margin: 10px; padding: 9px; border: 1px solid var(--line-strong); color: var(--paper-muted); background: transparent; cursor: pointer; font-size: 10px; }
.location-load-more:hover { color: var(--paper); border-color: var(--signal); }
.photo-marker { background: #675379; border: 3px solid rgba(255,255,255,.92); border-radius: 50%; box-shadow: 0 2px 9px rgba(0,0,0,.5), 0 0 0 2px rgba(112,82,151,.22); }
.photo-hover-marker { border: 3px solid white; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px rgba(239,90,60,.28), 0 4px 15px rgba(0,0,0,.62); }
.photo-hover-marker::after { content: ""; position: absolute; width: 4px; height: 4px; left: 5px; top: 5px; border-radius: 50%; background: white; }
.photo-cluster { display: grid; place-items: center; border: 3px solid rgba(255,255,255,.92); border-radius: 50%; background: #675379; color: white; box-shadow: 0 3px 14px rgba(0,0,0,.5), 0 0 0 3px rgba(112,82,151,.22); cursor: pointer; }
.photo-cluster span { font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.photo-pin { width: 88px !important; min-width: 88px !important; max-width: 88px !important; height: 102px !important; min-height: 102px !important; max-height: 102px !important; overflow: visible !important; background: transparent; border: 0; filter: drop-shadow(0 8px 10px rgba(0,0,0,.46)); }
.photo-pin::after { content: ""; position: absolute; z-index: -1; left: 33px; top: 79px; border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 17px solid white; }
.photo-pin::before { content: ""; position: absolute; z-index: 2; left: 37px; bottom: 0; width: 10px; height: 10px; border: 3px solid white; border-radius: 50%; background: #675379; }
.photo-pin-frame { box-sizing: border-box !important; width: 88px !important; min-width: 88px !important; max-width: 88px !important; height: 88px !important; min-height: 88px !important; max-height: 88px !important; aspect-ratio: 1; display: block; position: relative; border: 4px solid white; border-radius: 50%; background: #171613; }
.photo-pin-frame img { position: absolute; inset: 0; width: 100% !important; min-width: 100% !important; max-width: 100% !important; height: 100% !important; min-height: 100% !important; max-height: 100% !important; display: block; object-fit: cover !important; border-radius: 50%; }
.photo-pin-frame b { position: absolute; right: -7px; bottom: 2px; min-width: 23px; height: 23px; display: grid; place-items: center; padding: 0 5px; border: 2px solid white; border-radius: 13px; color: white; background: #675379; font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.photo-dialog { width: min(1180px, calc(100vw - 42px)); max-height: calc(100vh - 42px); padding: 0; color: var(--paper); background: #12110f; border: 1px solid var(--line-strong); box-shadow: 0 25px 100px #000; }
.photo-dialog::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(7px); }
.batch-dialog { width: min(500px, calc(100vw - 34px)); max-height: calc(100vh - 34px); padding: 0; color: var(--paper); background: #171613; border: 1px solid var(--line-strong); box-shadow: 0 25px 100px #000; }
.batch-dialog::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(7px); }
.batch-dialog form { max-height: calc(100vh - 36px); overflow: auto; padding: 22px; }
.batch-dialog-header { margin: 0 0 18px; padding-right: 44px; }
.batch-dialog-header p { margin: 0 0 6px; color: var(--signal-bright); font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
.batch-dialog-header h2 { margin: 0; color: var(--paper); font-size: 15px; font-weight: 500; }
.batch-shift-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.dialog-body { display: grid; grid-template-columns: minmax(0,1fr) 290px; min-height: 55vh; max-height: calc(100vh - 160px); }
.dialog-image-wrap { min-width: 0; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; background: #090908; }
.dialog-image-wrap img { display: block; max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; }
.dialog-navigation { display: inline-flex; gap: 1px; }
.dialog-nav { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--paper); background: transparent; cursor: pointer; font-size: 16px; line-height: 1; transition: color .16s ease, border-color .16s ease, opacity .16s ease; }
.dialog-nav:hover, .dialog-nav:focus-visible { color: var(--signal-bright); border-color: var(--signal); outline: 0; }
.dialog-nav:disabled { opacity: .24; pointer-events: none; }
.dialog-metadata { min-width: 0; overflow: auto; padding: 18px 18px 24px; border-left: 1px solid var(--line); background: #171613; }
.metadata-status { margin: 0; color: var(--paper-muted); font-size: 11px; }
.metadata-heading-row { min-height: 28px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-right: 44px; }
.metadata-heading { margin: 0; color: var(--paper); font-size: 11px; font-weight: 500; }
.metadata-edit-button { flex: 0 0 auto; border: 0; padding: 0; color: var(--signal-bright); background: transparent; cursor: pointer; font-size: 10px; }
.metadata-edit-button:hover { color: var(--paper); }
.metadata-staged { margin: 0 0 14px; padding: 10px; border: 1px solid rgba(239,90,60,.34); background: rgba(239,90,60,.08); }
.metadata-staged strong, .metadata-staged span { display: block; }
.metadata-staged strong { color: var(--signal-bright); font-size: 9px; font-weight: 500; }
.metadata-staged span { margin-top: 5px; color: var(--paper-muted); font: 8px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.metadata-list { margin: 0; }
.metadata-row { padding: 9px 0; border-top: 1px solid var(--line); }
.metadata-row:first-child { border-top: 0; padding-top: 0; }
.metadata-row dt { margin: 0 0 4px; color: #777369; font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; letter-spacing: .09em; }
.metadata-row dd { margin: 0; color: var(--paper-muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.metadata-row.is-location dd { color: var(--signal-bright); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.metadata-editor { margin: 0; }
.metadata-editor-intro { margin: 0 0 15px; color: var(--paper-muted); font-size: 10px; line-height: 1.5; }
.metadata-edit-group { margin: 0 0 13px; padding: 12px; border: 1px solid var(--line); }
.metadata-toggle { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; color: var(--paper); font-size: 10px; cursor: pointer; }
.metadata-toggle input { accent-color: var(--signal); }
.metadata-field { display: block; margin-top: 9px; }
.metadata-field > span { display: block; margin-bottom: 5px; color: #858177; font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; letter-spacing: .06em; }
.metadata-field > span small { color: #625f58; text-transform: none; letter-spacing: 0; }
.metadata-field input { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 0; outline: 0; color: var(--paper); background: var(--panel); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.metadata-field input:focus { border-color: var(--signal); }
.metadata-field input:disabled { opacity: .35; }
.metadata-coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metadata-map-button, .metadata-save-button, .metadata-conflict button { width: 100%; margin-top: 11px; padding: 8px 9px; border: 1px solid var(--line-strong); color: var(--paper); background: transparent; cursor: pointer; font-size: 10px; }
.metadata-map-button:hover, .metadata-save-button:hover { border-color: var(--signal); }
.metadata-map-button:disabled, .metadata-save-button:disabled, .metadata-conflict button:disabled { opacity: .5; cursor: wait; }
.metadata-existing { margin: 9px 0 0; color: #777369; font-size: 9px; line-height: 1.45; }
.metadata-backup-option { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 10px; border: 1px solid var(--line); color: var(--paper-muted); cursor: pointer; }
.metadata-backup-option:hover { border-color: var(--line-strong); }
.metadata-backup-option input { margin-top: 2px; accent-color: var(--signal); }
.metadata-backup-option span, .metadata-backup-option strong, .metadata-backup-option small { display: block; }
.metadata-backup-option strong { color: var(--paper); font-size: 9px; font-weight: 500; }
.metadata-backup-option small { margin-top: 4px; color: #777369; font-size: 8px; line-height: 1.35; }
.metadata-backup-option code { color: #aaa59b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.metadata-editor-message { min-height: 16px; margin: 0 0 7px; color: var(--paper-muted); font-size: 9px; line-height: 1.4; }
.metadata-editor-message.is-error { color: var(--signal-bright); }
.metadata-save-button { margin-top: 0; border-color: var(--signal); color: var(--signal-bright); }
.metadata-conflict { margin-top: 6px; padding: 12px; border: 1px solid rgba(239,90,60,.42); background: rgba(239,90,60,.08); }
.metadata-conflict[hidden] { display: none; }
.metadata-conflict strong { display: block; color: var(--signal-bright); font-size: 10px; font-weight: 500; }
.metadata-conflict p { margin: 7px 0 0; color: var(--paper-muted); font-size: 9px; line-height: 1.5; }
.metadata-conflict code, .metadata-editor-intro code { color: #9c978c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.metadata-conflict button { border-color: var(--signal); color: white; background: var(--signal); }
.dialog-caption { min-height: 86px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 20px; }
.dialog-caption p { margin: 0 0 5px; color: var(--signal-bright); font: 9px/1 ui-monospace, monospace; }
.dialog-caption h2 { margin: 0; font-size: 13px; font-weight: 500; }
.dialog-actions { display: flex; align-items: center; gap: 12px; }
.dialog-counter { color: #858177; font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.dialog-close { position: absolute; right: 10px; top: 10px; z-index: 3; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); background: rgba(20,19,17,.78); color: white; cursor: pointer; }
.dialog-close { font-size: 22px; font-weight: 300; line-height: 1; }
.outline-button { display: inline-flex; align-items: center; gap: 7px; color: var(--paper); text-decoration: none; border: 1px solid var(--line-strong); padding: 8px 11px; font-size: 10px; white-space: nowrap; }
.outline-button:hover { border-color: var(--signal); color: var(--signal-bright); }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 20px; transform: translate(-50%,20px); background: var(--paper); color: var(--ink); padding: 9px 13px; font-size: 11px; opacity: 0; pointer-events: none; transition: .22s ease; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 960px) {
  .app-header { grid-template-columns: 155px 1fr 180px; }
  .wordmark { padding: 0 13px; }
  .view-tab { min-width: 85px; padding-inline: 10px; }
  .header-controls { display: block; margin: 0 10px; }
  .global-search { display: none; }
  .archive-count { display: none; }
  .roll-sidebar { width: 245px; }
  .location-panel { width: 240px; }
}

@media (max-width: 700px) {
  body { overflow: auto; }
  .app-header { height: 112px; grid-template-columns: 1fr 170px; grid-template-rows: 56px 56px; }
  .wordmark { border-right: 0; }
  .header-controls { grid-column: 2; grid-row: 1; }
  .view-tabs { grid-column: 1/3; grid-row: 2; }
  .view-tab { flex: 1; }
  main { height: calc(100vh - 112px); }
  .roll-sidebar { display: none; }
  .file-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .file-meta { min-height: 58px; }
  .view-intro { padding: 16px 18px; display: block; }
  .timeline-legend { margin-top: 12px; gap: 11px; flex-wrap: wrap; }
  .month-key { grid-template-columns: 58px repeat(12, 1fr); padding-inline: 18px; min-width: 940px; }
  .timeline { padding: 0 18px 50px; }
  .timeline-year { grid-template-columns: 58px minmax(820px, 1fr); }
  .timeline-year h2 { top: 0; }
  .map-view.is-active { display: block; overflow: auto; }
  .map-stage { height: 64vh; }
  .location-panel { width: 100%; height: auto; border-left: 0; }
  .location-strip { width: 100%; height: auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .location-load-more { grid-column: 1/-1; }
  .dialog-body { display: block; max-height: none; overflow: auto; }
  .dialog-image-wrap { min-height: 45vh; }
  .metadata-heading-row { padding-right: 0; }
  .dialog-caption { align-items: flex-start; }
  .dialog-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .dialog-metadata { border-left: 0; border-top: 1px solid var(--line); }
  .browser-toolbar { padding-inline: 12px; }
  .folder-summary { display: flex; }
  .folder-summary > span { display: none; }
  .batch-toolbar { flex-wrap: wrap; }
  .batch-toolbar span { flex: 1 0 100%; }
  .batch-dialog form { padding: 18px; }
}
