/* Asset Photo Storage — warm editorial archive theme */

:root {
  --paper: #f4f0e7;
  --paper-soft: #faf7f0;
  --card: #fffdf8;
  --ink: #211d17;
  --ink-soft: #554d41;
  --muted: #8a8071;
  --line: #e2dacb;
  --line-strong: #cfc4b1;
  --accent: #b45f2a;
  --accent-deep: #8d4316;
  --accent-soft: #f3e2d2;
  --green: #3e6a4f;
  --green-soft: #e7f0e8;
  --red: #a03a2c;
  --red-soft: #f7e5e1;
  --amber: #99701f;
  --amber-soft: #f6ecd4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -35px rgba(40, 30, 18, .55);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 12% -10%, #fbf6ec 0%, transparent 65%),
    radial-gradient(900px 500px at 100% 0%, #f1e7d8 0%, transparent 55%),
    var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 3vw, 2.75rem); line-height: 1.08; margin: 0 0 .35rem; }
h2 { font-size: 1.3rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 .4rem; }
p { margin: 0 0 .9rem; }
code, pre, .mono { font-family: var(--mono); }
code { font-size: .86em; background: rgba(33, 29, 23, .055); padding: .12em .35em; border-radius: 5px; }
pre code { background: none; padding: 0; font-size: inherit; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.break { word-break: break-all; }
.eyebrow {
  margin: 0 0 .45rem;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.lede { color: var(--ink-soft); max-width: 62ch; font-size: 1.02rem; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 243, 235, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  min-height: var(--topbar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--ink);
  color: #f7efe2;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--serif); font-size: 1.02rem; letter-spacing: -.01em; }
.brand-text span {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted);
}
.primary-nav { display: flex; gap: 4px; flex: 1; }
.primary-nav a {
  padding: 8px 13px;
  border-radius: 999px;
  font-size: .875rem;
  color: var(--ink-soft);
  white-space: nowrap;
  border: 1px solid transparent;
}
.primary-nav a:hover { background: rgba(255, 253, 248, .7); color: var(--ink); }
.primary-nav a.is-active { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.usage-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink-soft);
}
.usage-chip .dot, .pill-note .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: .82rem;
}
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  font-weight: 700; font-size: .78rem;
  font-family: var(--mono);
}
.user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 60px -30px rgba(40, 30, 18, .5);
  padding: 6px;
  display: flex; flex-direction: column;
}
.menu-panel a, .menu-panel button {
  padding: 9px 11px; border-radius: 8px; font-size: .86rem;
  text-align: left; color: var(--ink);
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--paper-soft); }
.link-button { border: 0; background: none; font: inherit; cursor: pointer; width: 100%; }

.ticker {
  background: var(--amber-soft);
  border-bottom: 1px solid #e8dcc0;
  color: #6f5218;
  font-size: .78rem;
  text-align: center;
  padding: 6px 16px;
}

/* ---------- Layout ---------- */

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 34px 24px 64px; flex: 1; }
.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 24px;
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  justify-content: space-between;
  color: var(--muted);
  font-size: .74rem;
  font-family: var(--mono);
}
.site-footer a { color: var(--muted); }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 28px;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.section-head h2 { margin: 0; }

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font: inherit; font-size: .855rem; font-weight: 550;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { background: #fff; border-color: var(--ink-soft); color: var(--ink); transform: translateY(-1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #f8f2e7; }
.btn-primary:hover { background: #332c23; border-color: #332c23; color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #862f23; border-color: #862f23; color: #fff; }
.btn-danger-ghost { color: var(--red); border-color: #e7c8c1; background: transparent; }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: var(--red); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 11px; font-size: .76rem; }
.btn-block { width: 100%; }
.btn.is-disabled, .btn:disabled { opacity: .45; pointer-events: none; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.stack { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .78rem; font-weight: 600; letter-spacing: .01em; color: var(--ink-soft); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea,
.search-field input, .select-field select, .filter-bar input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--paper-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.field textarea { resize: vertical; font-family: var(--mono); font-size: .8rem; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); background: #fff; }
.field-hint { font-size: .72rem; color: var(--muted); line-height: 1.4; }
.field-label { display: flex; justify-content: space-between; }
.check-field { display: inline-flex; align-items: center; gap: 8px; font-size: .83rem; color: var(--ink-soft); cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form .field { flex: 1 1 170px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.switch-row:last-of-type { border-bottom: 0; }
.switch-row strong { display: block; font-size: .88rem; font-weight: 600; }
.switch-row small { display: block; color: var(--muted); font-size: .75rem; }
.switch-row input[type="checkbox"] { width: 34px; height: 19px; accent-color: var(--ink); flex-shrink: 0; }

/* ---------- Alerts, badges, notes ---------- */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  margin-bottom: 20px;
  font-size: .86rem;
  border: 1px solid var(--line);
  background: var(--card);
}
.alert-ok { background: var(--green-soft); border-color: #c8ddcd; color: #2c523a; }
.alert-error { background: var(--red-soft); border-color: #eccac3; color: #7c2b20; }
.alert-warn { background: var(--amber-soft); border-color: #e8d9b6; color: #6c5015; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: .68rem;
  font-family: var(--mono);
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-ok { background: var(--green-soft); border-color: #cbe0d0; color: var(--green); }
.badge-error { background: var(--red-soft); border-color: #eccac3; color: var(--red); }
.badge-wait { background: var(--amber-soft); border-color: #e8d9b6; color: var(--amber); }
.badge-muted { opacity: .6; }
.badge-link:hover { border-color: var(--accent); color: var(--accent-deep); }

.pill-note {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  font-size: .76rem;
  color: var(--muted);
  background: rgba(255, 253, 248, .5);
}
.pill-note .dot { background: var(--muted); }
.pill-note.is-on .dot { background: var(--green); }

/* ---------- Stats ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 26px;
}
.stat {
  background: rgba(255, 253, 248, .72);
  padding: 17px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-label {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted);
}
.stat strong { font-family: var(--serif); font-size: 1.5rem; line-height: 1.2; font-weight: 600; }
.stat-sub { font-size: .7rem; color: var(--muted); }

/* ---------- Library ---------- */

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .65);
  margin-bottom: 24px;
}
.search-field {
  flex: 1 1 260px;
  display: flex; align-items: center; gap: 8px;
  color: var(--muted);
  background: var(--paper-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 13px;
}
.search-field input {
  border: 0; background: transparent; padding: 10px 0; border-radius: 0;
}
.search-field input:focus { outline: none; }
.search-field:focus-within { border-color: var(--accent); background: #fff; }
.select-field select { border-radius: 999px; padding: 9px 13px; background: var(--paper-soft); }
.filter-count { margin-left: auto; font-size: .74rem; color: var(--muted); font-family: var(--mono); }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 18px;
}
.asset-card {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.asset-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.asset-thumb { position: relative; aspect-ratio: 4 / 3; background: #eae2d4; overflow: hidden; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.asset-card:hover .asset-thumb img { transform: scale(1.025); }
.size-tag, .geo-tag {
  position: absolute;
  font-family: var(--mono); font-size: .64rem;
  background: rgba(24, 20, 15, .72); color: #f7f0e4;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.size-tag { left: 10px; bottom: 10px; padding: 3px 8px; }
.geo-tag { right: 10px; top: 10px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; }
.asset-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 7px; }
.asset-body h2 {
  font-family: var(--sans); font-size: .88rem; font-weight: 600; letter-spacing: 0;
  margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asset-meta {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: .67rem; color: var(--muted);
}
.asset-badges { display: flex; flex-wrap: wrap; gap: 5px; min-height: 20px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 34px; }
.page-counter { font-size: .78rem; color: var(--muted); font-family: var(--mono); }

.empty-state, .error-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .55);
  text-align: center;
  padding: 70px 24px;
  max-width: 660px;
  margin: 30px auto;
}
.empty-icon { font-size: 2.4rem; color: var(--accent); margin-bottom: 8px; }
.empty-state p { color: var(--ink-soft); max-width: 46ch; margin: 0 auto 20px; }
.error-state h1 { overflow-wrap: anywhere; }

/* ---------- Upload ---------- */

.upload-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); gap: 26px; align-items: start; }
.upload-main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 20px;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 38px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background:
    repeating-linear-gradient(135deg, rgba(180, 95, 42, .03) 0 12px, transparent 12px 24px),
    var(--paper-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background-color: #fbf4ea; }
.dropzone strong { font-family: var(--serif); font-size: 1.15rem; }
.dropzone-icon { color: var(--accent); margin-bottom: 2px; }
.dropzone .muted { font-size: .76rem; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
  font-size: .8rem;
}
.file-row .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .file-size { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.upload-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #d08a55); transition: width .2s ease; }
.result-block { border-top: 1px solid var(--line); padding-top: 16px; }
.result-block h2 { font-size: 1.1rem; }
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.result-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: .8rem;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
}
.result-list li.ok { border-left: 3px solid var(--green); }
.result-list li.error { border-left: 3px solid var(--red); color: #7c2b20; }
.result-file { font-weight: 600; }
.result-list li a { margin-left: auto; }

.upload-side { display: flex; flex-direction: column; gap: 16px; }
.side-card {
  background: rgba(255, 253, 248, .8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.side-card h2 { font-size: 1.05rem; }
.side-card-soft { background: #f7efe3; }
.side-card-danger { border-color: #eccac3; background: #fdf5f3; }
.field-docs { margin: 0; }
.field-docs dt { font-size: .78rem; margin-top: 9px; }
.field-docs dd { margin: 1px 0 0; font-size: .73rem; color: var(--muted); line-height: 1.45; }
.field-docs .type { font-family: var(--mono); font-size: .62rem; color: var(--muted); }
.steps { margin: 0; padding-left: 18px; font-size: .79rem; color: var(--ink-soft); line-height: 1.5; }
.steps li { margin-bottom: 8px; }

/* ---------- Asset detail ---------- */

.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: .76rem; color: var(--muted); margin-bottom: 16px; }
.breadcrumb span:last-child { color: var(--ink-soft); overflow-wrap: anywhere; }
.detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.detail-head h1 { overflow-wrap: anywhere; }
.detail-head .asset-badges { margin-top: 10px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, .85fr); gap: 24px; align-items: start; }
.viewer-card {
  background: var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #100d0a;
}
.viewer-frame {
  display: grid; place-items: center;
  min-height: 300px; max-height: 72vh;
  background:
    linear-gradient(45deg, #2a251f 25%, transparent 25%) 0 0/24px 24px,
    linear-gradient(-45deg, #2a251f 25%, transparent 25%) 0 12px/24px 24px,
    linear-gradient(45deg, transparent 75%, #2a251f 75%) 12px -12px/24px 24px,
    linear-gradient(-45deg, transparent 75%, #2a251f 75%) -12px 0/24px 24px,
    #211d18;
  padding: 16px;
}
.viewer-frame img { max-height: 68vh; width: auto; max-width: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 20px 50px -20px #000; }
.viewer-foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 16px;
  color: #c9bda9;
  background: #17130f;
  font-family: var(--mono); font-size: .66rem;
}
.detail-side { display: flex; flex-direction: column; gap: 14px; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: .8rem; }
.kv dt { color: var(--muted); font-size: .74rem; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.kv .mono { font-size: .68rem; text-align: left; }
.kv-columns { grid-template-columns: 180px 1fr; }
.kv-columns dd { text-align: left; }

.metadata-section {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  padding-top: 26px;
}
.metadata-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.metadata-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.metadata-table th, .metadata-table td { padding: 10px 14px; text-align: left; font-size: .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.metadata-table tr:last-child th, .metadata-table tr:last-child td { border-bottom: 0; }
.metadata-table th { font-weight: 500; color: var(--muted); width: 40%; }
.metadata-table th code { background: none; padding: 0; color: var(--accent-deep); }
.json-block {
  margin: 0; padding: 18px;
  background: #241f19;
  color: #e8dece;
  border-radius: var(--radius);
  overflow: auto;
  font-size: .75rem;
  line-height: 1.6;
  max-height: 460px;
  border: 1px solid #120f0c;
}

/* ---------- Map ---------- */

.map-page .page { max-width: none; padding: 0; }
.map-page .site-footer { display: none; }
.map-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h));
  min-height: 480px;
}
.map-panel {
  background: var(--paper-soft);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
  z-index: 5;
}
.map-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 20px 10px; }
.map-panel-head h1 { font-size: 1.8rem; margin: 0; }
.map-search { margin: 0 20px 12px; flex: 0 0 auto; }
.map-list { overflow-y: auto; padding: 4px 10px 20px; flex: 1; min-height: 120px; }
.map-item {
  display: flex; gap: 10px; align-items: center; width: 100%;
  padding: 8px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; text-align: left; font: inherit; color: var(--ink);
  cursor: pointer;
}
.map-item:hover { background: #fff; border-color: var(--line); }
.map-item.is-active { background: #fff; border-color: var(--accent); box-shadow: 0 6px 20px -16px rgba(40,30,18,.6); }
.map-item img { width: 52px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--line); flex-shrink: 0; }
.map-item-body { min-width: 0; display: flex; flex-direction: column; }
.map-item-body strong { font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-item-body span { font-family: var(--mono); font-size: .64rem; color: var(--muted); }
.map-detail {
  margin: 0 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  max-height: 54vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.map-detail img.map-detail-img { width: 100%; max-height: 190px; object-fit: cover; border-radius: 8px; background: #eae2d4; margin-bottom: 9px; }
.map-detail h3 { margin: 0 0 2px; font-family: var(--sans); font-size: .88rem; overflow-wrap: anywhere; }
.map-detail .map-detail-meta { font-family: var(--mono); font-size: .65rem; color: var(--muted); margin-bottom: 8px; }
.map-detail dl { margin: 0 0 10px; display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; font-size: .7rem; }
.map-detail dt { color: var(--muted); }
.map-detail dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.map-detail .map-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.map-detail .close-detail { position: absolute; }
.map-stage { position: relative; min-height: 0; }
.map-canvas { position: absolute; inset: 0; background: #e7e0d2; }
.map-overlay {
  position: absolute; z-index: 500; left: 50%; top: 16px; transform: translateX(-50%);
  background: var(--ink); color: #f7efe2; padding: 8px 14px; border-radius: 999px;
  font-size: .76rem; box-shadow: var(--shadow);
}
.map-empty {
  position: absolute; inset: 0; z-index: 400;
  display: grid; place-items: center;
  background: rgba(244, 240, 231, .86);
  backdrop-filter: blur(3px);
  text-align: center; padding: 24px;
}
.map-empty > div { max-width: 380px; }
.map-empty p { color: var(--ink-soft); }
.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content-wrapper { border-radius: 10px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 10px 12px; font-size: .76rem; }
.leaflet-popup-content img { width: 180px; height: 110px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.leaflet-popup-content strong { display: block; margin-bottom: 2px; }

/* ---------- Help ---------- */

.help-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; }
.help-toc { position: sticky; top: calc(var(--topbar-h) + 22px); display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--line); }
.help-toc a { padding: 6px 0 6px 14px; font-size: .8rem; color: var(--ink-soft); border-left: 2px solid transparent; margin-left: -1px; }
.help-toc a:hover { color: var(--accent-deep); border-left-color: var(--accent); }
.help-body { max-width: 860px; }
.help-section { padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + 20px); }
.help-section:last-child { border-bottom: 0; }
.help-section h2 { font-size: 1.55rem; }
.help-section h3 { color: var(--ink-soft); }
.help-section p, .help-section li { color: var(--ink-soft); }
.help-section ul, .help-section ol { padding-left: 20px; }
.help-section li { margin-bottom: 5px; }
.code-block {
  background: #241f19;
  color: #e9dfcf;
  padding: 16px 18px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: .76rem;
  line-height: 1.6;
  border: 1px solid #120f0c;
  margin: 0 0 14px;
}
.code-block code { color: inherit; }
.callout, .guarantee {
  background: var(--accent-soft);
  border: 1px solid #e6cdb5;
  border-radius: 12px;
  padding: 14px 17px;
  margin: 14px 0;
  font-size: .85rem;
}
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li { color: #6c4123; }
.guarantee strong { display: block; font-family: var(--serif); font-size: 1.05rem; color: var(--accent-deep); }
.guarantee p { margin: 4px 0 0; color: #6c4123; }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.doc-table th, .doc-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table thead th { background: var(--paper-soft); font-family: var(--mono); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table td:first-child { white-space: nowrap; }
.doc-table code { background: none; padding: 0; color: var(--accent-deep); }
.compact-table td, .compact-table th { padding: 8px 10px; font-size: .76rem; }
.compact-table tr.is-revoked { opacity: .5; }
.faq dt { font-weight: 600; font-size: .86rem; margin-top: 14px; }
.faq dd { margin: 3px 0 0; color: var(--ink-soft); font-size: .82rem; }

/* ---------- Admin ---------- */

.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.panel {
  background: rgba(255, 253, 248, .8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.panel-wide { grid-column: 1 / -1; }
.action-list { display: flex; flex-direction: column; }
.action-form {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.action-form:last-child { border-bottom: 0; }
.action-form strong { display: block; font-size: .84rem; }
.action-form small { display: block; color: var(--muted); font-size: .72rem; }
.action-form .check-field { margin-top: 5px; font-size: .72rem; }
.log-details { margin-top: 14px; }
.log-details summary { cursor: pointer; font-size: .78rem; color: var(--ink-soft); }
.log-block { max-height: 220px; overflow: auto; margin-top: 10px; font-size: .68rem; }
.key-reveal { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.key-reveal code { display: inline-block; margin-top: 8px; padding: 8px 10px; background: #fff; border: 1px solid #c8ddcd; border-radius: 8px; font-size: .74rem; word-break: break-all; }
.create-user-form { padding-bottom: 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.user-list { display: flex; flex-direction: column; }
.user-row {
  display: grid;
  grid-template-columns: minmax(170px, .8fr) minmax(0, 2.4fr) auto;
  gap: 16px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.user-identity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-identity strong { display: block; font-size: .85rem; }
.user-identity small { display: block; font-size: .66rem; color: var(--muted); }
.user-edit { display: grid; grid-template-columns: minmax(120px, 1.4fr) 100px minmax(110px, 1fr) auto auto; gap: 8px; align-items: end; }
.field-compact > span { font-size: .62rem; }
.field-compact input, .field-compact select { padding: 6px 8px; font-size: .78rem; border-radius: 7px; }
.account-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; max-width: 900px; }

/* ---------- Login ---------- */

.auth-page .page { display: flex; align-items: center; padding-top: 46px; }
.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 480px);
  gap: 28px;
  justify-content: center;
  width: 100%;
  margin: 0 auto;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 4px; }
.auth-card .muted { font-size: .84rem; }
.auth-card .stack { margin-top: 22px; }
.login-hint { margin: 18px 0 0; font-size: .74rem; color: var(--muted); }
.auth-aside {
  background: var(--ink);
  color: #efe5d4;
  border-radius: 20px;
  padding: 34px;
  display: flex; align-items: center;
  position: relative;
  overflow: hidden;
}
.auth-aside::after {
  content: "";
  position: absolute; right: -70px; bottom: -90px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(200, 120, 60, .55), transparent 65%);
}
.auth-aside-inner { position: relative; z-index: 1; }
.auth-aside .eyebrow { color: #d99c68; }
.auth-aside h2 { color: #f8f0e2; font-size: 1.9rem; line-height: 1.12; margin-bottom: 12px; }
.auth-aside p { color: #c9bca9; font-size: .87rem; }
.tick-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 9px; font-size: .8rem; color: #ded2c0; }
.tick-list li { padding-left: 20px; position: relative; }
.tick-list li::before { content: "→"; position: absolute; left: 0; color: #d99c68; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .upload-layout, .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .upload-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-side .side-card-danger { grid-column: 1 / -1; }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .user-row { grid-template-columns: minmax(150px, .9fr) minmax(0, 2fr) auto; }
  .user-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-edit .check-field { align-self: center; }
}

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px 16px; padding: 10px 18px; }
  .primary-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .topbar-actions { margin-left: auto; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .help-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; border-left: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; gap: 4px 14px; }
  .help-toc a { padding: 4px 0; border-left: 0; }
  .auth-layout { grid-template-columns: minmax(0, 480px); }
  .auth-aside { display: none; }
  .map-shell { grid-template-columns: minmax(0, 1fr); height: auto; }
  .map-panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: 46vh; }
  .map-stage { height: 62vh; min-height: 380px; }
  .map-page .site-footer { display: none; }
  .map-detail { max-height: 30vh; }
}

@media (max-width: 680px) {
  .page { padding: 24px 16px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .asset-body { padding: 10px 11px 12px; }
  .asset-meta { font-size: .62rem; }
  .upload-main { padding: 15px; }
  .upload-side, .detail-side { grid-template-columns: minmax(0, 1fr); }
  .metadata-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-head { align-items: flex-start; }
  .viewer-frame { min-height: 220px; }
  .user-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .user-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row > form:last-child { justify-self: start; }
  .account-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-count { margin-left: 0; width: 100%; }
  .auth-card { padding: 22px; }
  .inline-form .field { flex-basis: 100%; }
  .key-reveal { flex-direction: column; align-items: flex-start; }
}
