:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e9e9ec;
  --soft: #f6f6f7;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
button, input, select, textarea, a { outline-offset: 3px; }
:focus-visible { outline: 2px solid #a1a1aa; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
span[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.muted { color: var(--muted); line-height: 1.6; }
.small, small { font-size: 12px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; letter-spacing: -.9px; font-weight: 600; margin-bottom: 0; }
h2 { font-size: 15px; font-weight: 550; letter-spacing: -.15px; margin-bottom: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 40px; border: 1px solid transparent; padding: 9px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.button .icon { width: 16px; height: 16px; }
.primary { background: var(--ink); color: white; }
.primary:hover { background: #353538; }
.secondary { border-color: #dedee2; background: white; color: var(--ink); }
.secondary:hover { background: var(--soft); }
.text-button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: none; }
.text-button:hover { color: var(--ink); }
.text-button .icon { width: 15px; height: 15px; }
.icon-button { width: 36px; height: 36px; background: none; border: 0; border-radius: 5px; display: inline-flex; justify-content: center; align-items: center; color: var(--muted); }
.icon-button:hover { background: var(--soft); color: var(--ink); }
.danger { color: #b74747; }
.button-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.app-header { height: 65px; border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { max-width: 1200px; padding: 0 32px; margin: auto; height: 100%; display: flex; align-items: center; gap: 54px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; letter-spacing: -.4px; text-decoration: none; }
.brand .icon { width: 22px; height: 22px; stroke-width: 1.6; }
.app-header nav { display: flex; align-items: stretch; height: 100%; gap: 26px; }
.nav { display: flex; align-items: center; padding: 1px 0 0; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: none; font-size: 13px; font-weight: 450; }
.nav:hover { color: var(--ink); }
.nav.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 550; }
.content { max-width: 1200px; margin: 0 auto; padding: 48px 32px 32px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.page-count { font-size: 16px; font-weight: 400; color: #a1a1aa; margin-left: 10px; letter-spacing: -.3px; vertical-align: middle; }
.toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 24px; }
.search { display: flex; align-items: center; gap: 9px; padding: 0 12px; min-width: 180px; flex: 1; background: var(--soft); border: 1px solid transparent; border-radius: 6px; color: #929299; }
.search:focus-within { border-color: #c9c9ce; }
.search input { margin: 0; padding: 10px 0; min-width: 0; width: 100%; min-height: 40px; border: 0; background: none; font-size: 14px; font-weight: 400; outline: 0; box-shadow: none; }
.search .icon { width: 17px; height: 17px; }
kbd { font: 12px ui-monospace, monospace; color: #aaaab1; border: 1px solid #dddde2; border-radius: 3px; padding: 0 5px; }
.toolbar select { width: auto; max-width: 165px; min-height: 40px; margin: 0; font-size: 12px; padding-left: 10px; }
.view-switch { display: flex; padding: 3px; border: 1px solid #e2e2e6; border-radius: 6px; gap: 2px; }
.view-switch button { background: white; border: 0; padding: 7px; border-radius: 3px; color: #a1a1aa; display: flex; align-items: center; justify-content: center; }
.view-switch button.selected { background: #eeeef0; color: var(--ink); }
.view-switch .icon { width: 16px; height: 16px; }
.box-tabs { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 0; }
.box-tabs::-webkit-scrollbar { display: none; }
.box-tab { display: flex; gap: 8px; align-items: center; min-height: 46px; padding: 0 0 13px; border: 0; border-bottom: 2px solid transparent; background: none; white-space: nowrap; color: var(--muted); font-size: 13px; }
.box-tab:hover { color: var(--ink); }
.box-tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.box-tab span { color: #a1a1aa; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 400; }
.collection-heading { min-height: 43px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.collection-heading h2 { color: var(--muted); font-size: 12px; font-weight: 400; }
.count { margin-left: 7px; color: #a1a1aa; font-size: 12px; font-variant-numeric: tabular-nums; }
.parts-table { width: 100%; }
.table-head, .part-row { display: grid; grid-template-columns: minmax(200px,1.7fr) minmax(100px,.8fr) minmax(150px,1fr) 80px 14px; align-items: center; gap: 18px; padding: 0 8px; }
.table-head { height: 44px; color: #929299; font-size: 11px; }
.table-head>span:nth-child(4) { text-align: right; }
.part-row { width: 100%; min-height: 65px; text-align: left; border: 0; border-top: 1px solid #f0f0f2; background: none; color: var(--ink); }
.part-row:hover { background: #fafafa; }
.part-name-cell, .part-text { display: block; min-width: 0; }
.part-name { display: block; font-size: 14px; font-weight: 500; letter-spacing: -.1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.part-meta { display: block; color: #929299; font: 11px ui-monospace, "SFMono-Regular", monospace; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-meta:empty { display: none; }
.tag { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag.empty { color: #b9b9c0; }
.part-location { display: block; color: #929299; font: 11px ui-monospace, "SFMono-Regular", monospace; line-height: 1.7; }
.part-location strong { display: block; color: #52525b; font: 400 12px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin-bottom: 2px; }
.quantity { font: 13px ui-monospace, "SFMono-Regular", monospace; text-align: right; color: #52525b; }
.quantity.unknown { color: #b9b9c0; }
.row-arrow { color: #b9b9c0; opacity: 0; }
.row-arrow .icon { width: 14px; height: 14px; }
.part-row:hover .row-arrow, .part-row:focus-visible .row-arrow { opacity: 1; }
.table-footer { border-top: 1px solid var(--line); padding-top: 17px; margin-top: 0; color: #929299; font-size: 11px; }
.parts-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; padding: 20px 0; }
.part-card { background: white; border: 1px solid var(--line); border-radius: 7px; padding: 20px; min-width: 0; text-align: left; color: var(--ink); }
.part-card:hover { border-color: #bcbcc4; }
.part-card .part-name { white-space: normal; line-height: 1.5; min-height: 42px; overflow-wrap: anywhere; }
.part-card .part-meta { margin-bottom: 16px; }
.part-card .tag { font-size: 11px; margin-top: 10px; }
.part-card-footer { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.empty-state { text-align: center; padding: 75px 20px; color: var(--muted); }
.empty-state>.icon { width: 24px; height: 24px; color: #a1a1aa; margin-bottom: 16px; }
.empty-state h2 { color: var(--ink); margin-bottom: 9px; }
.empty-state p { font-size: 13px; line-height: 1.6; margin-bottom: 20px; }
label { display: block; font-size: 12px; font-weight: 500; color: #52525b; }
input, select, textarea { display: block; width: 100%; max-width: 100%; margin-top: 7px; border: 1px solid #dedee3; border-radius: 5px; padding: 10px 11px; min-height: 40px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 400; }
input::placeholder, textarea::placeholder { color: #a1a1aa; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #929299; box-shadow: 0 0 0 2px #18181b08; }
select { padding-right: 25px; }
input[type=number] { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fields>label { min-width: 0; }
.storage-fields { grid-template-columns: 1.6fr 1fr; }
.map-toolbar { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 25px; }
.map-toolbar label { min-width: 150px; }
.map-key { display: flex; align-items: center; gap: 7px; margin-left: auto; padding-bottom: 12px; color: var(--muted); font-size: 11px; }
.key-filled, .key-empty { width: 8px; height: 8px; display: inline-block; background: #e2e2e7; border-radius: 2px; }
.key-empty { margin-left: 13px; background: white; border: 1px solid #dddde3; }
.drawer-map { display: grid; gap: 8px; }
.drawer-col, .drawer-row { display: grid; place-items: center; color: #929299; font: 11px ui-monospace, monospace; }
.drawer-col { min-height: 25px; }
.drawer-cell { min-width: 0; min-height: 94px; padding: 13px; border: 1px solid #e4e4e8; border-radius: 5px; background: #f6f6f8; text-align: left; color: #3f3f46; }
.drawer-cell:hover { border-color: #a1a1aa; }
.drawer-cell.empty { background: #fff; border-color: #eeeef0; color: #c9c9d0; }
.drawer-coordinate { display: block; font: 10px ui-monospace, monospace; color: #a1a1aa; margin-bottom: 9px; }
.drawer-cell strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; font-weight: 450; }
.drawer-extra { display: block; margin-top: 5px; font-size: 10px; color: var(--muted); }
.map-note { font-size: 12px; color: var(--muted); margin-top: 20px; line-height: 1.6; }
.activity-entry { display: flex; gap: 20px; align-items: center; padding: 19px 0; border-bottom: 1px solid var(--line); }
.activity-name { display: block; font-size: 14px; font-weight: 450; margin-bottom: 6px; }
.activity-entry small { font-size: 12px; color: var(--muted); }
.activity-time { margin-left: auto; color: #929299; font-size: 12px; text-align: right; white-space: nowrap; }
.settings-list { max-width: 900px; }
.settings-section { display: grid; grid-template-columns: 1fr 1.4fr; gap: 70px; padding: 29px 0; border-top: 1px solid var(--line); }
.settings-section:first-child { padding-top: 0; border-top: 0; }
.settings-section h2 { margin-bottom: 9px; font-size: 14px; }
.settings-description p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.settings-section label { margin-bottom: 17px; }
.settings-section .muted { font-size: 13px; }
.settings-section .small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.import-filename { font: 12px ui-monospace, monospace; color: var(--muted); overflow-wrap: anywhere; margin-bottom: 17px; }
.import-line { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.import-line b { font-weight: 450; color: var(--muted); }
.part-dialog { width: 510px; max-width: calc(100% - 40px); max-height: calc(100dvh - 80px); padding: 0; border: 1px solid #dedee3; border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 20px 80px #0002; overflow: hidden; }
.part-dialog[open] { display: flex; flex-direction: column; }
.part-dialog::backdrop { background: #18181b50; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; gap: 20px; flex-shrink: 0; }
.dialog-top h2 { font-size: 19px; font-weight: 550; letter-spacing: -.4px; }
.part-dialog form { display: flex; flex-direction: column; min-height: 0; }
.dialog-body { padding: 8px 24px 15px; overflow-y: auto; }
.dialog-body label { margin-bottom: 18px; }
.field-divider { font-size: 12px; font-weight: 500; padding: 20px 0 16px; border-top: 1px solid var(--line); margin-top: 3px; }
.extra-fields { border-top: 1px solid var(--line); margin-top: 1px; }
.extra-fields summary { padding: 17px 0; cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.extra-fields summary::-webkit-details-marker { display: none; }
.extra-fields summary:hover { color: var(--ink); }
.extra-fields summary .icon { width: 14px; height: 14px; }
.extra-fields[open] summary .icon { transform: rotate(90deg); }
.reference-links { display: flex; gap: 15px; margin: -2px 0 17px; }
.reference-links:empty { display: none; }
.reference-links a { font-size: 12px; color: var(--muted); }
.photo-area { position: relative; padding-top: 4px; }
.photo-area img { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: 5px; margin-bottom: 10px; }
.photo-area label.photo-upload { display: inline-flex; margin: 0; cursor: pointer; }
.photo-area>#remove-photo { position: absolute; top: 12px; right: 8px; background: white; border: 1px solid var(--line); }
.dialog-footer { padding: 15px 24px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-shrink: 0; }
.dialog-footer .primary { margin-left: auto; }
.error { font-size: 12px; color: #b74747; line-height: 1.6; }
.error:empty { display: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 18px; border: 1px solid #e4e4e8; border-radius: 7px; background: #fff; box-shadow: 0 4px 24px #0001; font-size: 13px; z-index: 10; max-width: calc(100% - 30px); width: max-content; line-height: 1.5; }
.offline { background: #f5f5f5; color: #71717a; padding: 12px 24px; font-size: 13px; text-align: center; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-form { max-width: 320px; width: 100%; }
.login-icon { display: inline-flex; margin-bottom: 25px; }
.login-icon .icon { width: 30px; height: 30px; stroke-width: 1.4; }
.login-form h1 { font-size: 26px; margin-bottom: 10px; }
.login-form>.muted { font-size: 13px; margin-bottom: 30px; }
.login-form .primary { margin-top: 18px; width: 100%; justify-content: space-between; }
@media(max-width:900px) {
  .content { padding-top: 35px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar select { max-width: none; flex: 1; }
  .table-head, .part-row { grid-template-columns: minmax(180px,1.4fr) 95px 150px 65px 10px; gap: 14px; }
  .parts-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settings-section { gap: 35px; }
}
@media(max-width:600px) {
  .app-header { height: 57px; }
  .header-inner { padding: 0 20px; gap: 30px; justify-content: space-between; }
  .brand-name { display: none; }
  .brand .icon { width: 22px; height: 22px; }
  .app-header nav { gap: 23px; }
  .nav { font-size: 12px; }
  .content { padding: 30px 20px 24px; }
  .page-heading { margin-bottom: 23px; gap: 15px; }
  h1 { font-size: 26px; }
  .page-count { font-size: 15px; }
  .toolbar { gap: 8px; margin-bottom: 16px; }
  .search input { min-height: 44px; font-size: 16px; }
  .toolbar select { min-width: 0; height: 40px; font-size: 16px; padding: 7px 6px; letter-spacing: -.4px; }
  .view-switch button { padding: 7px 6px; }
  .search kbd { display: none; }
  .box-tabs { gap: 22px; margin-right: -20px; padding-right: 20px; }
  .box-tab { font-size: 12px; gap: 6px; min-height: 43px; padding-bottom: 11px; }
  .box-tab span { font-size: 10px; }
  .table-head { display: none; }
  .part-row { grid-template-columns: minmax(0,1fr) 100px; gap: 5px 15px; min-height: 78px; padding: 15px 0; }
  .part-name-cell { grid-row: 1 / 3; grid-column: 1; }
  .part-name { font-size: 13px; white-space: normal; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .part-meta { font-size: 10px; margin-top: 5px; }
  .part-row>.category-cell, .part-row>.row-arrow { display: none; }
  .part-row>.part-location { grid-column: 2; grid-row: 1; text-align: right; font-size: 10px; line-height: 1.65; }
  .part-location strong { font-size: 11px; margin-bottom: 1px; }
  .part-row>.quantity { grid-column: 2; grid-row: 2; font-size: 11px; }
  .part-row>.quantity.unknown { display: none; }
  .parts-cards { gap: 10px; padding-top: 16px; }
  .part-card { padding: 15px 12px; }
  .part-card .part-name { font-size: 12px; }
  .part-card-footer { gap: 5px; }
  .part-card .quantity { font-size: 11px; }
  .collection-heading h2, .collection-heading .text-button { font-size: 11px; }
  .map-toolbar { flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
  .map-toolbar label { flex: 1; min-width: 0; }
  .map-key { width: 100%; margin-left: 0; padding: 4px 0 0; font-size: 11px; }
  .drawer-map { gap: 5px; }
  .drawer-cell { padding: 8px 5px; min-height: 90px; }
  .drawer-coordinate { font-size: 9px; margin-bottom: 7px; }
  .drawer-cell strong { font-size: 11px; -webkit-line-clamp: 3; line-height: 1.45; }
  .drawer-row, .drawer-col { font-size: 10px; }
  .drawer-extra { font-size: 9px; }
  .map-note { font-size: 11px; }
  .activity-entry { gap: 16px; }
  .activity-name { font-size: 13px; overflow-wrap: anywhere; }
  .activity-entry small { font-size: 11px; }
  .activity-time { font-size: 10px; white-space: normal; max-width: 90px; flex-shrink: 0; }
  .settings-section { display: block; padding: 25px 0; }
  .settings-description { margin-bottom: 22px; }
  .settings-section h2 { font-size: 15px; }
  .settings-description p { margin-bottom: 0; }
  .part-dialog { width: 100%; max-width: 100%; max-height: 100dvh; margin: auto 0 0; border: 0; border-radius: 12px 12px 0 0; }
  .dialog-top { padding: 18px 20px 12px; }
  .dialog-body { padding: 6px 20px 13px; }
  .dialog-footer { padding: 14px 20px max(14px,env(safe-area-inset-bottom)); }
  .dialog-body label { margin-bottom: 16px; }
  .fields { gap: 12px; }
  input, select, textarea, .map-toolbar select { font-size: 16px; }
  .extra-fields summary { font-size: 12px; }
  .toast { font-size: 12px; bottom: 18px; }
}
@media(prefers-reduced-motion:reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
