* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --ink: #2c241d;
  --muted: #66584a;
  --line: rgba(77, 55, 35, .28);
  --accent: #7b3828;
  --good: #345a37;
  --warning: #85551e;
  --danger: #8d3028;
  --surface-atlas: url("/assets/icons/photography/surfaces-atlas.png?v=59");
  --paper-photo: url("/assets/icons/photography/paper-surface.png?v=59");
  --walnut-photo: url("/assets/icons/photography/walnut-surface.png?v=59");
  --board-photo: url("/assets/icons/photography/board-day.png?v=59");
  --shadow-board: 0 14px 35px rgba(37, 26, 17, .28), 0 3px 8px rgba(37, 26, 17, .2);
  --shadow-card: 0 8px 15px rgba(36, 25, 17, .32), 0 2px 4px rgba(36, 25, 17, .2);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eee1ce;
  --muted: #d1c1ac;
  --line: rgba(224, 203, 172, .34);
  --accent: #d27e5f;
  --good: #9abe8d;
  --warning: #e0b36d;
  --danger: #e29180;
  --surface-atlas: url("/assets/icons/photography/surfaces-atlas-dark.png?v=59");
  --paper-photo: url("/assets/icons/photography/paper-surface.png?v=59");
  --walnut-photo: url("/assets/icons/photography/walnut-surface.png?v=59");
  --board-photo: url("/assets/icons/photography/board-dark.png?v=59");
  --shadow-board: 0 14px 35px rgba(0, 0, 0, .5), 0 3px 8px rgba(0, 0, 0, .34);
  --shadow-card: 0 8px 15px rgba(0, 0, 0, .4), 0 2px 4px rgba(0, 0, 0, .28);
}

html { min-width: 320px; min-height: 100%; background: #80563b; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background-color: #80563b;
  background-image: var(--board-photo);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  font-family: "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.item-card:focus-visible { outline: 3px solid #ffd78d; outline-offset: 3px; }
.app {
  width: min(1440px, calc(100% - 42px));
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 0 max(36px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  min-height: 75px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #eee0c8;
  background-image: var(--paper-photo);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-board);
}
.brand { display: flex; align-items: center; gap: 13px; }
.mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(75, 52, 31, .56);
  border-radius: 50%;
  color: #3e3023;
  background-color: #b4aca0;
  background-image: var(--surface-atlas);
  background-size: 200% 200%;
  background-position: 0 100%;
  box-shadow: 0 2px 5px rgba(45, 30, 18, .26);
}
.mark span { font: 800 26px/1 "Songti SC", "STSong", serif; text-shadow: 0 1px 1px rgba(255,255,255,.72), 0 -1px 1px rgba(34,25,18,.36); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 1px; color: #2f251c; font: 700 27px/1.08 "Avenir Next", "PingFang SC", sans-serif; letter-spacing: .025em; }
.sub { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.version-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 2px 8px;
  border: 1px solid rgba(94, 57, 30, .25);
  border-radius: 99px;
  color: #593e2b;
  background: rgba(248, 240, 226, .9);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

.settings-wrap { position: relative; z-index: 5; }
.settings-button, .btn, .icon-btn {
  border: 1px solid rgba(44, 33, 23, .42);
  box-shadow: 0 2px 4px rgba(37, 26, 17, .3);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.settings-button {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 50%;
  color: #30261d;
  background-color: #48433d;
  background-image: var(--surface-atlas);
  background-size: 200% 200%;
  background-position: 0 100%;
}
.settings-button:hover, .btn:hover, .icon-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.settings-button:active, .btn:active, .icon-btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(37, 26, 17, .3); }
.settings-menu {
  position: absolute;
  top: 54px;
  right: 0;
  display: grid;
  width: min(248px, calc(100vw - 32px));
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(43, 30, 20, .56);
  border-radius: 8px;
  color: #fff0dc;
  background-color: #4e3325;
  background-image: var(--walnut-photo);
  background-size: cover;
  background-position: center;
  box-shadow: 0 13px 30px rgba(22, 15, 10, .42);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-5px);
  transform-origin: top right;
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
}
.settings-menu.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }

.workspace { display: grid; }
.panel.library {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(64, 41, 26, .65);
  border-radius: 8px;
  background: rgba(55, 40, 28, .17);
  box-shadow: var(--shadow-board);
}
.panel-head, .items { position: relative; z-index: 1; }
.panel-head {
  padding: 23px 25px 10px;
  color: #fff1dc;
  background-color: #473126;
  background-image: var(--walnut-photo);
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 10px rgba(27, 18, 12, .35);
}
.inventory-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.eyebrow { display: block; margin-bottom: 4px; color: #f0cf9f; font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.panel-title { margin: 0; color: #fff5e6; font-size: 21px; font-weight: 800; line-height: 1.2; }
.sync-status { margin-top: 6px; color: #eee0ca; }
.sync-status[data-state="loading"] { color: #ffda91; }
.sync-status[data-state="success"] { color: #c7e2b5; }
.sync-status[data-state="error"] { color: #ffc0a8; }
.controls { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.controls label, .form-grid label, .dialog-input-wrap {
  display: grid;
  gap: 5px;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid rgba(73, 53, 36, .5);
  border-radius: 5px;
  color: #30261d;
  background-color: #f1e8d8;
  background-image: var(--paper-photo);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 1px 2px rgba(54, 37, 23, .17), 0 1px rgba(255,255,255,.5);
}
.controls input { width: 160px; }
.controls select { min-width: 120px; }
input::placeholder, textarea::placeholder { color: #806e5c; }
.btn {
  min-height: 39px;
  padding: 8px 13px;
  border-radius: 5px;
  color: #2b2520;
  background-color: #d8d5cf;
  background-image: var(--surface-atlas);
  background-size: 200% 200%;
  background-position: 0 100%;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.btn:not(.primary):not(.sync):not(.danger) { color: #30261d; background-color: #eee1cd; background-position: 100% 0; }
.btn.primary {
  border-color: #38271d;
  color: #fff4e5;
  background-color: #493024;
  background-image: var(--walnut-photo);
  background-size: cover;
  background-position: center;
  box-shadow: 0 3px 6px rgba(34, 22, 14, .36);
  text-shadow: 0 1px rgba(23, 15, 10, .45);
}
.btn.sync { color: #fff5e9; background-position: 0 100%; }
.btn.tool { color: #30261d; background-color: #eee1cd; background-position: 100% 0; }
.btn.danger { color: #fff0e6; background-color: #762b25; background-position: 100% 100%; }
.btn.compact { min-height: 32px; padding: 6px 10px; }
.btn:disabled { cursor: wait; opacity: .6; transform: none; }

.filters { display: flex; gap: 7px; margin-top: 17px; }
.filters button {
  min-width: 58px;
  min-height: 31px;
  padding: 5px 13px;
  border: 1px solid rgba(255, 239, 217, .52);
  border-radius: 4px;
  color: #fff0dc;
  background-color: #523b2b;
  background-image: var(--surface-atlas);
  background-size: 200% 200%;
  background-position: 100% 100%;
  box-shadow: 0 2px 4px rgba(25, 17, 11, .3);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.filters button.active { border-color: #f3d4a5; color: #30251a; background-color: #efe1cc; background-position: 100% 0; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat {
  display: grid;
  min-height: 61px;
  align-content: center;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid rgba(71, 51, 33, .38);
  border-radius: 5px;
  color: #30251c;
  background-color: #eee2d0;
  background-image: var(--paper-photo);
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 5px rgba(31, 21, 14, .24);
}
.stat span { color: #665443; font-size: 10px; font-weight: 700; }
.stat strong { color: #30251c; font-size: 16px; letter-spacing: -.02em; }

.items { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch; gap: 17px; padding: 25px 25px 27px; }
.item-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 218px;
  flex-direction: column;
  padding: 17px 12px 12px;
  border: 1px solid rgba(91, 65, 41, .42);
  border-radius: 3px;
  color: #2e251d;
  background-color: #f1e9db;
  background-image: var(--paper-photo);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
}
.item-card::before {
  position: absolute;
  top: -19px;
  left: calc(50% - 16px);
  width: 32px;
  height: 40px;
  content: "";
  background: url("/assets/icons/photography/hook-brass.png?v=59") center / contain no-repeat;
  pointer-events: none;
}
.item-card:hover { box-shadow: 0 12px 20px rgba(32, 22, 14, .38), 0 3px 5px rgba(32, 22, 14, .22); }
.item-card.dragging {
  position: fixed;
  z-index: 30;
  left: 0;
  top: 0;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 18px 25px rgba(20, 14, 9, .5);
}
.items.drag-active { align-items: start; }
.drag-placeholder { min-width: 0; border: 1px dashed rgba(241, 219, 184, .88); border-radius: 4px; background: rgba(27, 20, 15, .24); box-shadow: inset 0 2px 7px rgba(0, 0, 0, .24); }
.item-visual { position: relative; display: grid; height: 101px; place-items: center; overflow: hidden; border: 1px solid rgba(62, 48, 35, .24); border-radius: 2px; background: #d9d0c4; box-shadow: inset 0 1px 3px rgba(30, 22, 15, .18); }
.thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { display: block; width: 100%; height: 100%; background: #d9d0c4; }
.hero-fallback { position: absolute; inset: 0; background: #d9d0c4; }
.category-photo { display: block; width: 100%; height: 100%; background-image: url("/assets/icons/photography/categories-atlas.png?v=59"); background-repeat: no-repeat; background-size: 200% 400%; }
.category-electronics { background-position: 0 0; }
.category-home { background-position: 100% 0; }
.category-kitchen { background-position: 0 33.333%; }
.category-travel { background-position: 100% 33.333%; }
.category-hobby { background-position: 0 66.667%; }
.category-clothing { background-position: 100% 66.667%; }
.category-health { background-position: 0 100%; }
.category-other { background-position: 100% 100%; }
.category-label { position: absolute; right: 5px; bottom: 5px; padding: 3px 7px; border-radius: 2px; color: #fff8ee; background: rgba(35, 28, 22, .86); font-size: 9px; }
.item-main { display: grid; gap: 7px; padding: 9px 2px 0; }
.item-name { overflow: hidden; color: #30261d; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.item-value-line { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.item-cost { color: #493324; font-size: 18px; font-weight: 850; letter-spacing: -.04em; white-space: nowrap; }
.item-cost small { margin-left: 2px; color: #655443; font-size: 9px; font-weight: 650; letter-spacing: 0; }
.pill { max-width: 56%; overflow: hidden; padding: 3px 6px; border-radius: 2px; font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.pill.good { color: #fff; background: #38573a; }
.pill.warn { color: #fff; background: #78501f; }
.item-footer { color: #645547; font-size: 9px; }
.icon-btn { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #352b23; background-color: #eee1cd; background-image: var(--surface-atlas); background-size: 200% 200%; background-position: 100% 0; }
.icon-btn .trash { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.delete-card { position: absolute; top: 10px; right: 8px; z-index: 1; width: 29px; height: 29px; color: #493a30; opacity: .94; }
.empty { grid-column: 1 / -1; min-height: 190px; display: grid; place-items: center; border: 1px solid rgba(80, 58, 38, .34); border-radius: 4px; color: #33271e; background-color: #eee1cd; background-image: var(--paper-photo); background-size: cover; background-position: center; box-shadow: var(--shadow-card); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(22, 16, 12, .72);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility 0s linear .18s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
:root:has(#detailModal.open) { overflow-x: clip; }
.modal-backdrop.open { overscroll-behavior: contain; }
.modal {
  width: min(620px, 100%);
  max-height: 100%;
  overflow: auto;
  border: 1px solid rgba(73, 51, 33, .5);
  border-radius: 5px;
  color: #30261d;
  background-color: #efe5d5;
  background-image: var(--paper-photo);
  background-size: cover;
  background-position: center;
  box-shadow: 0 22px 60px rgba(0,0,0,.5);
  transform: translateY(10px);
  transition: transform .18s ease;
}
.modal-backdrop.open .modal { transform: none; }
.detail-modal { width: min(700px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px 10px; }
.modal-head .sub { margin-top: 4px; }
.modal .panel-title { color: #30261d; }
#itemForm { padding: 4px 18px 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 12px; }
.form-grid label { color: #4c3d30; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid textarea { min-height: 72px; resize: vertical; }
.preview { display: none; max-height: 200px; overflow: hidden; border: 1px solid rgba(73, 53, 36, .42); border-radius: 4px; background: #e8dfd3; }
.preview img { display: block; width: 100%; max-height: 200px; object-fit: contain; }
.image-tools { display: none; align-items: center; justify-content: space-between; gap: 10px; }
.image-tools.visible { display: flex; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 15px; }
.form-error { margin: 12px 0 0; color: #80291f; font-size: 12px; font-weight: 700; }
.focus { position: relative; margin: 0; }
.detail-close { position: absolute; top: 12px; right: 12px; z-index: 2; font-size: 22px; }
.hero { position: relative; height: min(38vh, 280px); min-height: 180px; overflow: hidden; background: #d5c9b8; }
.hero > img { width: 100%; height: 100%; object-fit: cover; }
.hero-fallback { position: absolute; inset: 0; }
.hero-label { position: absolute; left: 12px; bottom: 12px; padding: 4px 8px; border-radius: 2px; color: #fff; background: rgba(37, 29, 22, .84); font-size: 11px; }
.hero-cost { position: absolute; right: 13px; bottom: 13px; display: grid; gap: 2px; min-width: 104px; padding: 8px 12px; border: 1px solid rgba(255, 242, 222, .42); border-radius: 3px; color: #fff5e8; background-color: #3d2b20; background-image: var(--walnut-photo); background-size: cover; background-position: center; box-shadow: 0 4px 10px rgba(0,0,0,.36); }
.hero-cost span { font-size: 10px; }
.hero-cost strong { font-size: 21px; }
.focus-body { margin: -1px 13px 13px; padding: 17px; border: 1px solid rgba(82, 61, 42, .34); border-radius: 0 0 4px 4px; color: #30261d; background-color: #efe5d5; background-image: var(--paper-photo); background-size: cover; background-position: center; box-shadow: var(--shadow-card); }
.focus-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.focus-title-row h2 { margin: 0 0 4px; color: #30261d; font-size: 23px; }
.note { color: #5d4c3d; font-size: 12px; line-height: 1.55; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 15px 0; }
.metric { display: grid; gap: 5px; padding: 10px 9px; border: 1px solid rgba(82, 61, 42, .32); border-radius: 3px; color: #30261d; background-color: #f1e7d8; background-image: var(--paper-photo); background-size: cover; background-position: center; }
.metric span { color: #665544; font-size: 10px; }
.metric strong { color: #34281e; font-size: 13px; overflow-wrap: anywhere; }
.progress-block { margin: 12px 0; }
.progress-top { display: flex; justify-content: space-between; gap: 12px; color: #514335; font-size: 11px; }
.bar { height: 10px; overflow: hidden; margin-top: 7px; border: 1px solid rgba(68, 51, 34, .48); border-radius: 99px; background: rgba(117, 95, 70, .24); }
.bar span { display: block; width: var(--pct); height: 100%; border-radius: inherit; background: #607844; }

.app-dialog {
  width: min(430px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100% - 36px);
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(73, 51, 33, .54);
  border-radius: 5px;
  color: #30261d;
  background-color: #efe5d5;
  background-image: var(--paper-photo);
  background-size: cover;
  background-position: center;
  box-shadow: 0 22px 65px rgba(0,0,0,.52);
}
.app-dialog::backdrop { background: rgba(22, 16, 12, .74); }
.dialog-card { position: relative; padding: 24px 22px 18px; }
.dialog-stamp { position: absolute; top: 17px; right: 18px; display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #74553b; border-radius: 50%; color: #6d3526; font-size: 14px; font-weight: 900; }
.dialog-card h2 { margin: 0 42px 9px 0; color: #30261d; font-size: 19px; }
.dialog-card p { margin: 0 0 15px; color: #554536; font-size: 13px; line-height: 1.55; }
.dialog-input-wrap { margin: 0 0 17px; color: #44372a; }
.dialog-input-wrap[hidden] { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.dialog-actions #dialogCancel[hidden] { display: none; }

body.keyboard-open .modal-backdrop { align-items: start; overflow-y: auto; }
body.keyboard-open .modal { max-height: 54vh; }

body[data-theme="dark"] .topbar { background-color: #36271d; }
body[data-theme="dark"] .settings-button { color: #f4e9d8; }
body[data-theme="dark"] h1, body[data-theme="dark"] .version-badge { color: #2f251d; }
body[data-theme="dark"] .topbar .sub, body[data-theme="dark"] .modal-head .sub { color: #665443; }
body[data-theme="dark"] .item-card, body[data-theme="dark"] .focus-body,
body[data-theme="dark"] .modal, body[data-theme="dark"] .app-dialog { color: #30261d; }
body[data-theme="dark"] .item-name, body[data-theme="dark"] .item-cost,
body[data-theme="dark"] .focus-title-row h2 { color: #30261d; }
body[data-theme="dark"] .pill.good { color: #fff; }
body[data-theme="dark"] .drag-placeholder { border-color: rgba(242, 221, 188, .72); background: rgba(26, 19, 13, .3); }

@media (max-width: 1100px) {
  .items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .inventory-head { align-items: flex-start; flex-direction: column; }
  .controls { width: 100%; justify-content: flex-start; }
}
@media (max-width: 820px) {
  .app { width: min(100% - 24px, 680px); padding-top: max(13px, env(safe-area-inset-top)); }
  .panel-head { padding: 18px 17px 8px; }
  .items { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; padding: 25px 17px 19px; }
  .controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .controls label:first-child { grid-column: span 2; }
  .controls input, .controls select { width: 100%; min-width: 0; }
  .controls .btn { align-self: end; }
}
@media (max-width: 600px) {
  body { background-position: center top; background-attachment: fixed; }
  .app { width: calc(100% - 16px); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .topbar { min-height: 62px; margin-bottom: 11px; padding: 7px 9px; }
  .mark { width: 47px; height: 47px; }
  h1 { font-size: 23px; }
  .sub { font-size: 10px; }
  .version-badge { margin-top: 3px; font-size: 9px; }
  .settings-button { width: 40px; height: 40px; }
  .panel.library { border-radius: 5px; }
  .panel-head { padding: 14px 11px 6px; }
  .eyebrow { font-size: 8px; }
  .panel-title { font-size: 19px; }
  .inventory-head { gap: 11px; }
  .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
  .controls label:first-child { grid-column: 1 / -1; }
  .controls label { font-size: 10px; }
  .controls input, .controls select { min-height: 37px; padding: 7px 8px; font-size: 16px; }
  .controls .btn { min-height: 37px; }
  .filters { margin-top: 12px; }
  .filters button { min-height: 29px; padding: 4px 11px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
  .stat { min-height: 48px; padding: 6px 9px; }
  .stat span { font-size: 9px; }
  .stat strong { font-size: 14px; }
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 9px; padding: 24px 10px 14px; }
  .item-card { min-height: 194px; padding: 15px 8px 9px; }
  .item-visual { height: clamp(76px, 25vw, 106px); }
  .item-name { font-size: 12px; }
  .item-main { gap: 6px; padding-top: 8px; }
  .item-cost { font-size: 16px; }
  .pill { font-size: 8px; }
  .delete-card { top: 9px; right: 6px; width: 28px; height: 28px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 60px; }
  .focus-body { margin: -1px 8px 8px; padding: 13px; }
  .focus-title-row h2 { font-size: 20px; }
  .modal-backdrop { padding-right: 9px; padding-left: 9px; }
  .modal { max-height: calc(100% - 8px); }
}
@media (max-width: 380px) {
  .panel-head { padding-right: 8px; padding-left: 8px; }
  .items { gap: 9px 7px; padding-right: 7px; padding-left: 7px; }
  .item-card { min-height: 184px; padding-right: 6px; padding-left: 6px; }
  .item-cost { font-size: 15px; }
  .pill { max-width: 53%; }
  .controls .btn { padding-right: 8px; padding-left: 8px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* White wall pegboard treatment */
:root {
  --ink: #343638;
  --muted: #777b7d;
  --line: rgba(89, 94, 96, .22);
  --accent: #747b7e;
  --good: #527260;
  --warning: #9a8256;
  --danger: #a4514d;
  --paper-photo: none;
  --walnut-photo: none;
  --surface-atlas: none;
  --board-photo: url("/assets/icons/photography/pegboard-white.png?v=59");
  --shadow-board: 0 8px 24px rgba(58, 62, 64, .14);
  --shadow-card: 0 5px 12px rgba(56, 60, 62, .18), 0 1px 2px rgba(56, 60, 62, .12);
}
html, body { background: #fff; }
body {
  color: var(--ink);
  background-image: none;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.app { width: 100%; max-width: 1600px; min-height: 100vh; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 0 max(22px, env(safe-area-inset-bottom)); }
.topbar {
  position: relative;
  z-index: 4;
  width: max-content;
  min-height: 48px;
  margin: 0 0 -52px 5.5%;
  padding: 6px 15px;
  border: 1px solid rgba(168, 171, 172, .65);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,246,246,.96));
  box-shadow: 0 2px 7px rgba(57, 60, 61, .16), inset 0 1px #fff;
}
.brand { gap: 0; }
h1 { margin: 0; color: #62676a; font-size: 17px; font-weight: 650; letter-spacing: .08em; }
.settings-wrap { position: absolute; top: 70px; right: 7%; z-index: 5; }
.settings-button, .btn, .icon-btn {
  border: 1px solid rgba(145, 150, 152, .62);
  color: #53595b;
  background: linear-gradient(180deg, #fff, #edf0f0);
  box-shadow: 0 2px 4px rgba(49, 52, 53, .14), inset 0 1px rgba(255,255,255,.9);
  text-shadow: none;
}
.settings-button { width: 36px; height: 36px; border-radius: 50%; color: #73797b; background: linear-gradient(180deg, #fff, #e9ecec); }
.settings-button svg circle { fill: #aeb4b5 !important; }
.settings-menu {
  top: 43px;
  border: 1px solid rgba(157, 162, 163, .7);
  border-radius: 4px;
  color: #45494a;
  background: rgba(255,255,255,.97);
  box-shadow: 0 8px 20px rgba(47, 52, 54, .2);
}
.settings-menu .btn { justify-content: start; text-align: left; }
.workspace { position: relative; display: block; }
.panel.library.pegboard {
  position: relative;
  min-height: calc(100svh - 34px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: var(--board-photo) center top / cover no-repeat;
  box-shadow: none;
}
.panel-head, .items { z-index: 1; }
.panel-head {
  position: static;
  min-height: 158px;
  padding: 63px 5.5% 12px;
  color: #53585a;
  background: transparent;
  box-shadow: none;
}
.inventory-head { align-items: center; gap: 14px; }
.board-nameplate {
  display: grid;
  flex: 0 0 auto;
  gap: 5px;
  min-width: 125px;
  padding: 8px 12px;
  border: 1px solid rgba(185, 188, 189, .72);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(244,245,245,.95));
  box-shadow: 0 3px 8px rgba(55, 59, 60, .14), inset 0 1px #fff;
}
.panel-title { color: #5b6062; font-size: 15px; font-weight: 650; }
.sync-status { margin: 0; color: #878b8d; font-size: 10px; }
.sync-status[data-state="loading"] { color: #807451; }
.sync-status[data-state="success"] { color: #547360; }
.sync-status[data-state="error"] { color: #a4514d; }
.controls {
  align-items: end;
  gap: 7px;
  padding: 8px 10px 11px;
  border: 1px solid rgba(188, 191, 192, .74);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(240,242,242,.96));
  box-shadow: 0 5px 11px rgba(48, 52, 53, .15), inset 0 1px #fff;
}
.controls label, .form-grid label, .dialog-input-wrap { color: #686d6f; font-size: 10px; }
input, select, textarea {
  min-height: 35px;
  border: 1px solid rgba(185, 188, 189, .85);
  border-radius: 3px;
  color: #454a4c;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(40, 45, 47, .05);
}
input::placeholder, textarea::placeholder { color: #a4a7a8; }
.btn { min-height: 35px; padding: 7px 11px; border-radius: 3px; font-size: 11px; font-weight: 650; }
.btn.primary { border-color: #aeb3b4; color: #454a4c; background: linear-gradient(180deg, #fff, #e7ebeb); box-shadow: 0 3px 7px rgba(48, 52, 53, .17), inset 0 1px #fff; }
.btn.primary span { color: #767d7f; font-size: 16px; vertical-align: -1px; }
.btn.sync, .btn.tool, .btn:not(.primary):not(.sync):not(.danger) { color: #53595b; background: linear-gradient(180deg, #fff, #edf0f0); }
.btn.danger { color: #fff; background: #a4514d; }
.filters { align-items: center; gap: 5px; margin: 10px 0 0; }
.filters button {
  min-width: 54px;
  min-height: 28px;
  padding: 4px 11px;
  border: 1px solid rgba(177, 181, 182, .75);
  border-radius: 2px;
  color: #686d6f;
  background: rgba(255,255,255,.92);
  box-shadow: 0 2px 5px rgba(50, 54, 55, .11);
  font-size: 10px;
}
.filters button.active { border-color: #aeb3b4; color: #414648; background: #edf0f0; }
.summary { display: flex; justify-content: flex-end; gap: 8px; margin: 9px 0 0 auto; }
.stat {
  position: relative;
  min-width: 112px;
  min-height: 50px;
  padding: 7px 10px;
  border: 1px solid rgba(188, 191, 192, .78);
  border-radius: 2px;
  color: #4e5355;
  background: linear-gradient(180deg, #fff, #f5f6f6);
  box-shadow: 0 4px 9px rgba(48, 52, 53, .15), inset 0 1px #fff;
}
.stat::before { position: absolute; top: -4px; left: calc(50% - 3px); width: 6px; height: 6px; content: ""; border: 1px solid #b7bcbd; border-radius: 50%; background: #f8f9f9; box-shadow: 0 1px 2px #969b9d; }
.stat span { color: #85898a; font-size: 9px; font-weight: 550; }
.stat strong { color: #53585a; font-size: 14px; font-weight: 650; }
.items { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 20px 18px; padding: 24px 7% 56px; }
.item-card {
  min-height: 226px;
  padding: 18px 11px 12px;
  border: 1px solid rgba(212, 214, 214, .92);
  border-radius: 2px;
  color: #414648;
  background: linear-gradient(160deg, #fff 0%, #fdfdfd 72%, #f7f8f8 100%);
  box-shadow: 0 5px 12px rgba(56, 60, 62, .2), 0 1px 2px rgba(56, 60, 62, .12), inset 0 1px #fff;
}
.item-card::before {
  top: -13px;
  left: calc(50% - 9px);
  width: 18px;
  height: 16px;
  border: 1.5px solid #b4b9ba;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(90deg, #c7cbcc, #fff 48%, #aab0b1);
  box-shadow: 0 1px 2px rgba(52, 56, 57, .2);
}
.item-card::after { position: absolute; top: 9px; left: calc(50% - 3px); width: 6px; height: 6px; content: ""; border: 1px solid #b9bdbd; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #c1c6c7 70%); box-shadow: 0 1px 2px rgba(40,44,45,.15); }
.item-card:hover { box-shadow: 0 8px 15px rgba(56, 60, 62, .24), 0 2px 3px rgba(56, 60, 62, .13); }
.item-card.dragging { box-shadow: 0 12px 23px rgba(47, 52, 54, .28); }
.item-visual { height: 105px; border-color: #e6e8e8; border-radius: 1px; background: #f7f8f8; box-shadow: inset 0 1px 3px rgba(40, 44, 45, .08); }
.category-label { color: #656a6b; background: rgba(255,255,255,.92); border: 1px solid rgba(212,215,215,.8); font-size: 9px; }
.item-main { gap: 6px; padding: 9px 2px 0; }
.item-name { color: #424749; font-size: 12px; font-weight: 650; }
.item-cost { color: #555b5d; font-size: 17px; font-weight: 650; }
.item-cost small, .item-footer { color: #898d8e; }
.pill { border: 1px solid rgba(174,179,180,.55); color: #626869 !important; background: #eff2f1 !important; font-size: 9px; font-weight: 600; }
.pill.good { color: #527260 !important; background: #f0f5f1 !important; }
.pill.warn { color: #8a7753 !important; background: #f7f4ec !important; }
.delete-card { top: 7px; right: 7px; width: 26px; height: 26px; color: #898e90; opacity: .8; }
.drag-placeholder { border-color: rgba(153, 160, 161, .75); background: rgba(255,255,255,.55); box-shadow: inset 0 1px 7px rgba(75,80,82,.1); }
.empty {
  min-height: 190px;
  border: 1px solid rgba(193, 197, 198, .78);
  border-radius: 3px;
  color: #777d7e;
  background: rgba(255,255,255,.92);
  box-shadow: 0 4px 10px rgba(48,52,53,.12);
}
.modal-backdrop { background: rgba(235, 238, 238, .68); backdrop-filter: blur(3px); }
.modal, .app-dialog {
  border-color: rgba(183, 187, 188, .8);
  border-radius: 4px;
  color: #4b5051;
  background: #fff;
  box-shadow: 0 18px 50px rgba(50,55,57,.22);
}
.modal .panel-title, .focus-title-row h2, .dialog-card h2 { color: #4b5051; }
.modal-head .sub, .note, .focus-body, .form-grid label, .dialog-card p, .dialog-input-wrap { color: #74797a; }
.focus-body, .metric { border-color: #e2e5e5; border-radius: 3px; background: #fff; box-shadow: 0 2px 6px rgba(50,55,57,.08); }
.hero { background: #f3f5f5; }
.hero-label, .hero-cost { color: #515758; background: rgba(255,255,255,.94); border: 1px solid rgba(211,215,215,.9); box-shadow: 0 2px 8px rgba(45,50,51,.15); }
.metric span, .metric strong { color: #626869; }
.bar { border-color: #d9dddd; background: #f0f2f2; }
.bar span { background: #8ca294; }
.dialog-stamp { border-color: #c7cbcc; color: #777d7e; }
body[data-theme="dark"] { color-scheme: light; }
body[data-theme="dark"] .topbar, body[data-theme="dark"] .settings-button,
body[data-theme="dark"] h1, body[data-theme="dark"] .version-badge { color: #62676a; background-color: #fff; }
body[data-theme="dark"] .topbar .sub, body[data-theme="dark"] .modal-head .sub,
body[data-theme="dark"] .item-card, body[data-theme="dark"] .focus-body,
body[data-theme="dark"] .modal, body[data-theme="dark"] .app-dialog,
body[data-theme="dark"] .item-name, body[data-theme="dark"] .item-cost,
body[data-theme="dark"] .focus-title-row h2 { color: #454a4c; }
body[data-theme="dark"] .drag-placeholder { border-color: rgba(153, 160, 161, .75); background: rgba(255,255,255,.55); }
@media (max-width: 1100px) {
  .items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .inventory-head { align-items: flex-start; flex-direction: column; }
  .controls { width: fit-content; max-width: 100%; }
}
@media (max-width: 820px) {
  .app { width: 100%; padding-top: max(9px, env(safe-area-inset-top)); }
  .panel-head { padding: 62px 4% 9px; }
  .items { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 13px; padding: 22px 7% 42px; }
  .controls { display: flex; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .topbar { min-height: 36px; margin: 0 0 -43px 4%; padding: 4px 10px; }
  h1 { font-size: 14px; }
  .settings-wrap { top: 56px; right: 6%; }
  .settings-button { width: 32px; height: 32px; }
  .panel.library.pegboard { min-height: calc(100svh - 6px); background-size: auto 100%; background-position: center top; }
  .panel-head { min-height: auto; padding: 54px 4% 7px; }
  .inventory-head { gap: 7px; }
  .board-nameplate { min-width: 92px; gap: 3px; padding: 6px 8px; }
  .panel-title { font-size: 13px; }
  .sync-status { font-size: 9px; }
  .controls { flex: 1 1 100%; width: 100%; display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr) minmax(0,.9fr); gap: 5px; padding: 7px; }
  .controls label { font-size: 9px; }
  .controls label:first-child { grid-column: span 1; }
  .controls input, .controls select { width: 100%; min-width: 0; min-height: 34px; padding: 6px; font-size: 16px; }
  .controls .btn { grid-column: 1 / -1; min-height: 33px; }
  .filters { margin-top: 7px; }
  .filters button { min-width: 48px; min-height: 26px; padding: 3px 8px; }
  .summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 4px; margin-top: 7px; }
  .stat { min-width: 0; min-height: 45px; padding: 5px 4px; }
  .stat span { font-size: 8px; }
  .stat strong { font-size: 11px; }
  .items { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px 10px; padding: 21px 7% 36px; }
  .item-card { min-height: 190px; padding: 16px 8px 9px; }
  .item-visual { height: 88px; }
  .item-name { font-size: 11px; }
  .item-cost { font-size: 15px; }
  .pill { max-width: 60%; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

:root {
  --steel-mid: #aeb5b7;
  --paper-object: url("/assets/icons/photography/card-hardware.png?v=59");
  --button-object: url("/assets/icons/photography/button-object.png?v=59");
  --tag-object: url("/assets/icons/photography/tag-object.png?v=59");
  --shadow-card: 0 16px 22px rgba(50, 54, 55, .24), 0 4px 7px rgba(50,54,55,.18);
}
.panel.library.pegboard { perspective: 1500px; transform-style: preserve-3d; }
#items { position: static !important; }
.board-piece, .item-card {
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.board-grip {
  position: absolute;
  z-index: 4;
  top: -36px;
  left: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transform: translateX(-50%);
}
.board-grip:active, .board-grip[aria-pressed="true"] { cursor: grabbing; filter: drop-shadow(0 2px 2px rgba(48,42,30,.34)); }
.board-grip:focus-visible { outline: 2px solid #8a682a; outline-offset: 2px; }
.board-grip::before { position: absolute; top: 50%; left: 50%; width: 20px; height: 28px; content: ""; background: transparent url("/assets/icons/photography/hook-brass.png?v=59") center / contain no-repeat; transform: translate(-50%,-50%); }
.board-grip span { display: none; }
.board-piece.is-grabbed, .item-card.is-grabbed { z-index: 101 !important; }
.add-hanger { position: relative; width: max-content; }
.add-hanger > .board-grip { top: -44px; }
.settings-wrap > .board-grip { top: -44px; left: 50%; }
.board-nameplate > .board-grip, .stat > .board-grip { top: -36px; }
.item-grip { top: -36px; }
.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; }
.board-piece.is-moving, .item-card.is-moving {
  z-index: 100 !important;
  cursor: grabbing;
  filter: drop-shadow(0 18px 14px rgba(39,43,44,.28));
  transform: perspective(900px) rotateX(2.5deg) rotateY(-1.5deg) scale(1.035);
  transition: transform .14s ease-out, filter .14s ease-out;
}
.item-card {
  min-height: 298px;
  padding: 76px 24px 24px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  color: #414648;
  background: transparent var(--paper-object) center / 100% 100% no-repeat;
  box-shadow: none;
  transform: perspective(1400px) rotateX(.8deg) rotateY(-.4deg);
  transform-origin: top center;
  transition: transform .2s ease, filter .2s ease;
}
.item-card::before, .item-card::after { content: none; }
.item-card:hover { filter: drop-shadow(0 14px 15px rgba(43,47,48,.22)); transform: perspective(1400px) rotateX(.5deg) translateY(-2px); }
.item-card.dragging { filter: drop-shadow(0 22px 19px rgba(37,41,42,.3)); }
.item-card {
  background-size: 145% auto;
  background-position: center top;
}
.item-card:hover, .item-card.dragging { box-shadow: none !important; }
.item-card .item-visual { box-shadow: inset 0 2px 4px rgba(49,54,56,.13), 0 1px rgba(255,255,255,.9); }
.item-visual {
  height: 106px;
  border: 1px solid rgba(177, 181, 182, .9);
  border-radius: 1px;
  background: #f3f4f4;
  box-shadow: inset 0 2px 4px rgba(49,54,56,.13), 0 1px rgba(255,255,255,.9);
}
.category-label {
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(194,198,199,.9);
  border-radius: 0;
  color: #666c6e;
  background: rgba(255,255,255,.95);
  box-shadow: 0 2px 5px rgba(50,55,56,.12);
}
.item-main { gap: 6px; padding: 9px 2px 0; }
.item-name { color: #424749; font-size: 12px; font-weight: 700; }
.item-cost { color: #4f5557; font-size: 17px; font-weight: 700; }
.item-cost small, .item-footer { color: #858b8c; }
.pill {
  border: 1px solid rgba(175,181,182,.85);
  border-radius: 1px;
  color: #666d6f !important;
  background: linear-gradient(180deg,#fff,#e9eded) !important;
  box-shadow: inset 0 1px #fff, 0 1px 2px rgba(45,50,51,.1);
}
.pill.good { color: #526d5e !important; background: linear-gradient(180deg,#fff,#e5eee8) !important; }
.pill.warn { color: #887452 !important; background: linear-gradient(180deg,#fff,#f1ecdf) !important; }
.delete-card {
  top: 22%; right: 14%;
  width: 25px; height: 25px;
  border: 1px solid #c1c6c7;
  color: #777f81;
  background: radial-gradient(circle at 34% 28%, #fff 0 8%, #e2e6e6 41%, #aeb5b7 100%);
  box-shadow: inset 0 1px 2px #fff, 0 2px 4px rgba(48,53,54,.22);
}
.board-nameplate {
  position: relative;
  border: 1px solid rgba(173,179,180,.8);
  border-radius: 2px;
  background: linear-gradient(155deg,#fff 0%,#f7f8f8 36%,#dfe3e4 100%);
  box-shadow: inset 0 1px 1px #fff, 0 4px 1px #d1d5d6, 0 8px 14px rgba(48,52,53,.18);
  transform: perspective(800px) rotateX(1.2deg);
}
.board-nameplate::before, .board-nameplate::after {
  position: absolute; top: 50%; width: 5px; height: 5px; content: "";
  border: 1px solid #aeb4b5; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,#fff,#a6adaf 80%);
  box-shadow: 0 1px 2px rgba(45,49,50,.25);
}
.board-nameplate::before { left: 5px; }
.board-nameplate::after { right: 5px; }
.settings-button {
  border: 1px solid #a4acae;
  color: #5a6264;
  background: radial-gradient(circle at 35% 25%,#fff 0%,#f5f7f7 28%,#cdd3d4 66%,#a7afb1 100%);
  box-shadow: inset 0 2px 2px rgba(255,255,255,.95), inset 0 -2px 3px rgba(89,96,98,.28), 0 2px 0 #939b9d, 0 6px 10px rgba(45,50,51,.23);
  transform: perspective(400px) rotateX(3deg);
}
.settings-button svg circle { fill: #949d9f !important; stroke: #7e8789; }
.controls label {
  padding: 9px 9px 10px;
  border: 1px solid rgba(185,190,191,.9);
  border-radius: 3px;
  color: #747b7d;
  background: linear-gradient(160deg,#fff 0%,#f8f9f9 44%,#e6e9e9 100%);
  box-shadow: inset 0 1px #fff, 0 3px 1px #d2d6d7, 0 6px 10px rgba(47,51,52,.16);
  transform: perspective(900px) rotateX(1.2deg);
}
.controls input, .controls select {
  border: 1px solid #c3c8c9;
  border-radius: 2px;
  color: #555c5e;
  background: linear-gradient(180deg,#e9eded,#fff 25%,#fff 80%,#f0f2f2);
  box-shadow: inset 0 2px 4px rgba(54,59,60,.12), 0 1px #fff;
}
.btn {
  border: 1px solid #aeb5b7;
  border-radius: 3px;
  color: #4f5759;
  background: linear-gradient(160deg,#fff 0%,#fbfcfc 32%,#e5e9e9 75%,#d2d7d8 100%);
  box-shadow: inset 0 1px 1px #fff, inset 0 -1px rgba(160,167,168,.45), 0 2px 0 #b3babc, 0 5px 8px rgba(47,51,52,.18);
  text-shadow: 0 1px rgba(255,255,255,.9);
  transform: perspective(500px) rotateX(1.5deg);
}
.btn:hover, .icon-btn:hover { filter: brightness(1.025); transform: perspective(500px) rotateX(1deg) translateY(-1px); }
.btn:active, .icon-btn:active { transform: perspective(500px) rotateX(1.5deg) translateY(2px); box-shadow: inset 0 2px 3px rgba(70,76,78,.2), 0 1px 0 #b3babc; }
.btn.primary { color: #4c5557; background: linear-gradient(155deg,#fff 0%,#f8fafa 40%,#dce1e1 100%); box-shadow: inset 0 1px 1px #fff, 0 2px 0 #afb6b7, 0 6px 10px rgba(47,51,52,.2); }
.filters button {
  border: 1px solid #b9bfc0;
  border-radius: 2px;
  color: #686f71;
  background: linear-gradient(155deg,#fff,#e7ebeb);
  box-shadow: inset 0 1px #fff, 0 2px 0 #c1c7c8, 0 4px 6px rgba(48,52,53,.14);
}
.filters button.active { border-color: #a6aeb0; color: #535c5e; background: linear-gradient(150deg,#e0e4e4,#fff); box-shadow: inset 0 2px 4px rgba(61,67,69,.13), 0 1px 0 #fff; }
.stat {
  border: 1px solid rgba(179,185,186,.95);
  border-radius: 2px;
  background: linear-gradient(155deg,#fff 0%,#fafbfb 35%,#e1e5e5 100%);
  box-shadow: inset 0 1px #fff, 0 3px 1px #cbd0d1, 0 7px 13px rgba(45,50,51,.19);
  transform: perspective(900px) rotateX(1deg) rotateY(-.4deg);
}
.stat::before {
  top: -5px; width: 8px; height: 8px;
  border: 1px solid #adb4b5;
  background: radial-gradient(circle at 35% 28%,#fff 0 13%,#d5dada 48%,#8f989a 100%);
  box-shadow: 0 2px 3px rgba(50,55,56,.26);
}
.settings-menu {
  border: 1px solid rgba(166,173,174,.9);
  border-radius: 3px;
  background: linear-gradient(160deg,#fff,#f0f2f2);
  box-shadow: inset 0 1px #fff, 0 4px 0 #cbd0d1, 0 12px 20px rgba(45,50,51,.24);
}
.settings-menu .btn { min-height: 38px; }
.item-card .item-visual, .item-card .item-main { pointer-events: auto; }
.board-piece input, .board-piece select, .board-piece textarea { user-select: text; -webkit-user-select: text; }
body[data-theme="dark"] .settings-button, body[data-theme="dark"] .btn,
body[data-theme="dark"] .board-nameplate, body[data-theme="dark"] .stat,
body[data-theme="dark"] .controls label { color: #4f5759; background: linear-gradient(160deg,#fff,#e6eaea); }
@media (max-width: 600px) {
  .item-card { min-height: 264px; padding: 66px 20px 22px; }
  .item-visual { height: 89px; }
  .delete-card { top: 22%; right: 13%; }
  .controls label { padding: 7px; }
}

.controls .btn.primary, .filters button {
  border: 0;
  border-radius: 0;
  background: var(--button-object) center / 100% 100% no-repeat;
  box-shadow: none;
  color: #4f5759;
  text-shadow: 0 1px rgba(255,255,255,.9);
}
.controls .btn.primary:hover, .filters button:hover { filter: brightness(1.02); }
.controls .btn.primary:active, .filters button:active { filter: brightness(.98); transform: translateY(1px); }
.stat {
  min-height: 54px;
  padding: 15px 10px 4px;
  border: 0;
  border-radius: 0;
  background: var(--tag-object) center / 100% 100% no-repeat;
  box-shadow: none;
}
.stat::before { content: none; }
.item-card {
  width: min(100%, 150px);
  height: 238px;
  min-height: 238px;
  justify-self: center;
  padding: 55px 16px 14px;
}
.item-card .item-visual { height: 82px; }
@media (max-width: 600px) {
  .item-card { width: min(100%, 136px); height: 210px; min-height: 210px; padding: 48px 10px 10px; }
  .item-card .item-visual { height: 66px; }
}

.detail-modal {
  width: min(900px, 100%);
  max-height: 100%;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
}
#detail { width: 100%; }
.dossier {
  position: relative;
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 0 34px 14px;
  overflow: visible;
  border: 1px solid #d8d6cf;
  color: #414446;
  background: #f8f7f2;
  box-shadow: 0 18px 42px rgba(32, 36, 37, .24), 0 3px 7px rgba(32, 36, 37, .12);
}
.dossier-top-tools { position: sticky; top: 8px; z-index: 5; display: flex; justify-content: flex-end; height: 58px; margin: 0 -27px -58px 0; pointer-events: none; }
.detail-close {
  position: static;
  width: 56px;
  height: 58px;
  margin: 0;
  border: 0;
  background: url("/assets/icons/photography/detail-controls.png?v=59") 86% 48% / 224px 149px no-repeat;
  mix-blend-mode: multiply;
  cursor: pointer;
  pointer-events: auto;
  font-size: 0;
}
.dossier-head { display: block; width: calc(100% + 68px); height: 140px; margin: 0 -34px; object-fit: cover; object-position: center top; mix-blend-mode: multiply; }
.dossier-nameplate {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-width: min(250px, 100%);
  margin: -8px auto 20px;
  padding: 8px 22px 10px;
  border: 1px solid #d7d5cf;
  border-top: 2px solid #b9bdbe;
  color: #383d3f;
  background: #fbfaf6;
  box-shadow: 0 4px 8px rgba(45, 48, 49, .16);
  text-align: center;
}
.dossier-category { display: block; color: #747a7c; font-size: 10px; letter-spacing: .14em; }
.dossier-nameplate h2 { margin: 3px 0 0; overflow-wrap: anywhere; color: #303537; font-size: clamp(20px, 3vw, 28px); line-height: 1.25; }
.dossier-opening { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(190px, .8fr); align-items: center; gap: 18px; margin: 2px 0 14px; }
.dossier-photo { position: relative; width: 100%; aspect-ratio: 1.22; overflow: hidden; background: #f0f0ed; box-shadow: 0 4px 11px rgba(40, 44, 45, .2); }
.dossier-photo-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.dossier-photo-example { position: relative; }
.dossier-photo-example .category-photo { position: absolute; inset: 0; display: block; }
.dossier-photo-example .hero-label { position: absolute; right: 8px; bottom: 8px; left: auto; z-index: 1; padding: 3px 6px; color: #555b5d; background: rgba(255,255,255,.88); font-size: 10px; }
.photo-mount { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.dossier-counter { position: relative; width: 100%; max-width: 300px; justify-self: center; text-align: center; }
.dossier-counter > img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.counter-value { position: absolute; top: 43%; left: 50%; width: 72%; transform: translate(-50%, -50%); overflow-wrap: normal; color: #f7f7f1; font: 600 clamp(11px, 2vw, 23px)/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; text-align: center; text-shadow: 0 1px 2px #17191a; white-space: nowrap; }
.counter-label { display: block; margin-top: -4px; color: #555b5d; font-size: 11px; letter-spacing: .12em; }
.dossier-ledger { position: relative; margin: 0 -12px 12px; }
.ledger-paper { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.ledger-entries { position: absolute; inset: 25% 10% 57%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(2, 1fr); margin: 0; }
.ledger-entries > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 0 9%; border-bottom: 1px solid rgba(119, 125, 127, .18); }
.ledger-entries dt { color: #747a7c; font-size: 12px; }
.ledger-entries dd { margin: 0; overflow-wrap: anywhere; color: #303537; font-size: clamp(13px, 2.2vw, 17px); font-weight: 650; text-align: right; }
.dossier-progress { padding: 2px 8px 0; }
.progress-heading { display: flex; justify-content: space-between; gap: 12px; color: #646a6c; font-size: 12px; }
.progress-heading strong { color: #373d3f; font-weight: 600; }
.ruler-track { position: relative; height: 62px; margin: 0 -4px; overflow: hidden; }
.ruler-track > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; mix-blend-mode: multiply; }
.ruler-pointer { position: absolute; top: 26%; left: var(--pointer-left); width: 2px; height: 54%; transform: translateX(-50%); background: #a43d32; box-shadow: 0 0 2px rgba(82, 30, 25, .4); }
.ruler-pointer::before { position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; border-radius: 50%; background: #a43d32; box-shadow: 0 1px 2px rgba(50, 25, 20, .34); content: ""; transform: translateX(-50%); }
.progress-caption { margin: -4px 0 12px; color: #73797b; font-size: 11px; text-align: right; }
.dossier-registration { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 13px 8px; border-top: 1px solid #d6d7d3; border-bottom: 1px solid #d6d7d3; color: #707678; font-size: 11px; }
.dossier-registration strong { margin-left: 5px; color: #3c4244; font-weight: 600; }
.dossier-note { position: relative; margin: 14px 5px 6px; padding: 10px 14px 12px; border: 1px solid #deded8; color: #717779; background: var(--paper-photo) center / cover; box-shadow: 0 4px 9px rgba(45, 48, 49, .12); }
.dossier-note::after { position: absolute; right: 9px; bottom: 6px; left: 9px; height: 1px; background: rgba(126, 157, 174, .36); content: ""; }
.dossier-note > span { font-size: 10px; letter-spacing: .1em; }
.dossier-note p { min-height: 24px; margin: 5px 0 1px; overflow-wrap: anywhere; color: #42484a; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.dossier-foot { display: block; width: calc(100% + 26px); height: 72px; margin: 4px -13px -2px; object-fit: cover; object-position: center 62%; mix-blend-mode: multiply; }
.dossier-actions { position: relative; width: min(100%, 450px); aspect-ratio: 1.5; margin: -3px auto 0; }
.dossier-actions > img { display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.edit-tab, .close-clasp { position: absolute; border: 0; background: transparent; cursor: pointer; }
.edit-tab { top: 35%; left: 7%; width: 38%; height: 28%; color: #414749; font-size: 14px; font-weight: 650; }
.close-clasp { top: 25%; right: 7%; width: 32%; height: 48%; }
body[data-theme="dark"] .dossier { color: #414446; background: #f8f7f2; }
@media (max-width: 600px) {
  .detail-modal { width: 100%; max-height: 100%; }
  .dossier { padding: 0 15px 10px; }
  .dossier-top-tools { height: 50px; margin-right: -8px; margin-bottom: -50px; }
  .detail-close { width: 48px; height: 50px; background-position: 86% 48%; background-size: 200px 133px; }
  .dossier-head { width: calc(100% + 30px); height: 112px; margin-right: -15px; margin-left: -15px; }
  .dossier-nameplate { min-width: min(210px, 100%); margin-bottom: 15px; padding: 7px 14px 9px; }
  .dossier-opening { grid-template-columns: 1fr; gap: 4px; }
  .dossier-photo { width: min(100%, 330px); justify-self: center; aspect-ratio: 1.24; }
  .dossier-counter { width: min(68%, 250px); }
  .dossier-ledger { margin-right: -7px; margin-left: -7px; }
  .ledger-entries { inset: 14% 9% 54%; grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); }
  .ledger-entries > div { gap: 4px; padding: 0 8%; }
  .ledger-entries dt { font-size: 10px; }
  .ledger-entries dd { font-size: clamp(12px, 3.4vw, 15px); white-space: nowrap; }
  .ruler-track { height: 49px; }
  .dossier-registration { gap: 6px 11px; padding: 10px 3px; font-size: 10px; }
  .dossier-note { margin-right: 0; margin-left: 0; }
  .dossier-foot { height: 55px; }
  .dossier-actions { width: min(100%, 360px); }
}
