/* Desktop home layout; the mobile page uses its own stylesheet. */
.desktop-view { height: 100dvh; overflow: hidden; }
.desktop-view .shell { display: flex; flex-direction: column; width: 96vw; max-width: 1800px; height: 100dvh; padding: 0 0 84px; }
.desktop-view .shell:has(#market-view:not([hidden])) { max-width: 1800px; }
.desktop-view .header { flex: none; padding: 14px 0; }
.desktop-view .header h1 { font-size: 20px; }
.desktop-view .header p { letter-spacing: .4px; }
.desktop-view .avatar { margin-left: auto; }
.desktop-view #market-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.desktop-view #market-view > :not(#product-grid) { flex-shrink: 0; }
.desktop-view .searchbar { max-width: 100%; }
.desktop-view .tabs { margin-top: 8px; }
.desktop-view .tabs button { min-height: 38px; padding-bottom: 8px; }
.desktop-view .chips { padding: 8px 0 0; }
.desktop-view .weapon-filter { margin-top: 8px; padding: 5px 12px; }
.desktop-view .weapon-filter select { padding: 6px 10px; }
.desktop-view .list-heading { margin: 10px 0; }
.pc-list-actions { display: flex; gap: 16px; align-items: center; }
.pc-view-switch { display: flex; border: 1px solid var(--line); border-radius: 8px; padding: 3px; background: white; }
.pc-view-switch button { min-height: 32px; padding: 4px 12px; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; }
.pc-view-switch button[aria-pressed="true"] { background: var(--mint); color: var(--green); font-weight: 700; }
.pc-summary { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--mint); }
.pc-summary > summary { display: flex; align-items: center; gap: 24px; min-height: 40px; padding: 7px 14px; cursor: pointer; font-size: 12px; }
.pc-summary > summary::before { content: '▸'; color: var(--green); }
.pc-summary[open] > summary::before { content: '▾'; }
.pc-summary .stats { display: flex; gap: 24px; margin: 0; }
.pc-summary .stats > div { display: flex; flex-direction: row; align-items: baseline; gap: 8px; padding: 0; border: 0; }
.pc-summary .stats strong { font-size: 14px; }
.pc-summary-hint { margin-left: auto; color: var(--muted); }
.pc-summary-content { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 14px 8px; color: var(--muted); font-size: 12px; }
.desktop-view #product-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,420px),1fr)); align-content: start; gap: 0; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 10px; background: white; }
.pc-product { display: grid; grid-template-columns: minmax(0,1fr) 40px; min-width: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: white; }
.pc-product:last-child { border-bottom: 0; }
.pc-product-open { display: grid; grid-template-columns: 40px minmax(0,1fr) minmax(80px,auto); align-items: center; gap: 8px; min-width: 0; min-height: 66px; padding: 7px 8px; background: transparent; text-align: left; }
.pc-product-open:hover { background: #f4f9f3; }
.pc-product-open > .pc-item-image { width: 40px; height: 40px; }
.pc-item-image { display: grid; place-items: center; width: 44px; height: 44px; flex: none; }
.pc-item-image img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.pc-item-image > span { display: none; color: var(--muted); font-size: 9px; text-align: center; }
.pc-item-image:has(img[hidden]) > span { display: block; }
.pc-product-name, .pc-product-price { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.pc-product-name strong { overflow-wrap: anywhere; line-height: 1.5; font-size: 14px; }
.pc-product-name small, .pc-product-price small { color: var(--muted); font-size: 11px; }
.pc-product-price { text-align: right; }
.pc-product-price strong { color: var(--green); font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pc-product-stock { text-align: right; font-size: 12px; color: var(--muted); }
.pc-favorite { align-self: stretch; display: grid; place-items: center; width: 40px; background: transparent; color: #8a9690; }
.pc-star { display: inline-block; width: 21px; height: 21px; flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pc-star.is-selected { fill: currentColor; color: #c95663; }
.desktop-view #detail-favorite { display: inline-flex; align-items: center; gap: 7px; }
.desktop-view[data-product-view="card"] #product-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,280px),1fr)); gap: 10px; border: 0; border-radius: 0; background: transparent; }
.desktop-view[data-product-view="card"] .pc-product { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.desktop-view[data-product-view="card"] .pc-product-open { grid-template-columns: 32px minmax(0,1fr) minmax(70px,auto); gap: 6px; }
.desktop-view[data-product-view="card"] .pc-product .pc-item-image { width: 32px; height: 32px; }
.desktop-view[data-product-view="card"] .pc-product-name strong { font-size: 13px; }
.desktop-view[data-product-view="card"] .pc-product-price strong { font-size: 14px; }
.desktop-view #more { margin-top: 8px; padding: 7px 15px; min-height: 34px; }
.desktop-view .market-footnote { margin: 7px 0 0; }
.desktop-view .bottom-nav { padding-top: 5px; padding-bottom: 5px; }

/* Each pane owns a scrolling record area and an immovable pager. */
.desktop-view #detail-dialog[open] { display: flex; flex-direction: column; width: 96vw; max-width: 1800px; height: 92dvh; max-height: 92dvh; overflow: hidden; }
.desktop-view .dialog-bar { flex: none; min-height: 51px; }
.desktop-view .detail-layout { display: grid; grid-template-columns: minmax(240px,.9fr) repeat(2,minmax(0,1.5fr)); flex: 1; min-height: 0; overflow: hidden; }
.desktop-view #detail-head { grid-column: 1; overflow-y: auto; min-height: 0; }
.desktop-view .detail-layout > .detail-tabs { display: none; }
.desktop-view .detail-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-left: 1px solid var(--line); }
.desktop-view #detail-sale-panel { grid-column: 2; }
.desktop-view #detail-history-panel { grid-column: 3; }
.desktop-view .detail-panel-title { flex: none; padding: 12px; margin: 0; border-bottom: 1px solid var(--line); }
.desktop-view .detail-tools { flex: none; max-height: 38vh; overflow-y: auto; margin: 8px 10px 0; }
.pc-panel-toolbar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 6px 10px; }
.desktop-view .pc-panel-toolbar .detail-scope { margin: 0; font-size: 11px; line-height: 1.4; }
.pc-expand-all { flex: none; background: transparent; color: var(--green); min-height: 32px; padding: 5px 8px; font-size: 12px; white-space: nowrap; }
.pc-expand-all[aria-pressed="true"] { background: var(--mint); border-radius: 6px; }
.desktop-view .detail-panel .detail-records { display: block; flex: 1; min-height: 0; padding: 0 10px 10px; overflow-y: auto; overscroll-behavior: contain; }
.desktop-view #detail-body, .desktop-view #history-detail-body { padding: 0 10px 10px; }
.desktop-view .detail-panel .detail-records > .listing { margin: 0 0 7px; }
.desktop-view .pager { display: grid; grid-template-columns: auto minmax(0,1fr) auto; flex: none; align-items: center; gap: 10px; margin: 0; padding: 9px 12px; border-top: 1px solid var(--line); background: var(--bg); text-align: center; }
.desktop-view .pager:empty { display: none; }
.desktop-view .pager button { min-height: 36px; }
.desktop-view .pager span { min-width: 0; font-size: 12px; }
.desktop-view .pc-listing { min-width: 0; padding: 10px; border-radius: 8px; }
.desktop-view .pc-listing .listing-top { display: grid; grid-template-columns: minmax(75px,auto) minmax(0,1fr) auto; gap: 9px; align-items: center; }
.desktop-view .pc-listing .price { min-width: 0; font-size: 15px; overflow-wrap: anywhere; color: var(--green); }
.desktop-view .pc-listing .seller { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; min-width: 0; font-size: 11px; }
.desktop-view .pc-listing .seller strong { white-space: nowrap; padding: 3px 5px; }
.desktop-view .pc-listing .seller span { overflow-wrap: anywhere; }
.desktop-view .pc-listing .listing-date { display: block; font-size: 10px; line-height: 1.5; }
.desktop-view .listing-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.pc-listing-properties { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; }
.desktop-view .pc-listing .attributes { display: flex; flex: 1; min-width: 0; gap: 4px; margin: 0; }
.desktop-view .pc-listing .attributes span { padding: 4px 6px; font-size: 11px; white-space: nowrap; }
.desktop-view .filter-heart { display: grid; place-items: center; }

.desktop-view .filter-workspace { display: grid; grid-template-columns: minmax(200px,.8fr) minmax(290px,1fr) minmax(400px,1.7fr); overflow: hidden; }
.pc-search-sidebar { display: contents; }
.pc-search-tabs { display: none; }
.desktop-view .filter-library, .desktop-view .filter-editor { overflow-y: auto; min-height: 0; }
.desktop-view .filter-results-panel { display: flex; flex-direction: column; overflow: hidden; padding: 0; min-height: 0; container-type: inline-size; }
.desktop-view .filter-results-panel > .filter-column-heading { flex: none; align-items: center; padding: 12px; margin: 0; border-bottom: 1px solid var(--line); }
.desktop-view .filter-results-panel #equip-summary { margin: 3px 0 0; font-size: 11px; }
.desktop-view #equip-results { flex: 1; min-height: 0; padding: 10px; overflow-y: auto; overscroll-behavior: contain; }
.desktop-view .filter-results-panel #equip-pager { margin: 0; }
.desktop-view .pc-search-listing .listing-top { grid-template-columns: minmax(100px,1.25fr) minmax(72px,.7fr) minmax(100px,1fr) auto; }
.pc-result-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pc-result-name .pc-item-image { width: 28px; height: 28px; }
.pc-result-name strong { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.desktop-view #filter-submit { position: sticky; bottom: -16px; z-index: 2; }
@container (max-width: 470px) {
  .desktop-view .pc-search-listing .listing-top { grid-template-columns: minmax(0,1fr) auto; }
  .pc-search-listing .price, .pc-search-listing .listing-count { text-align: right; }
}

@media (max-width: 1279px) {
  .desktop-view .filter-workspace { grid-template-columns: minmax(280px,.85fr) minmax(0,1.3fr); }
  .pc-search-sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
  .pc-search-tabs { display: flex; flex: none; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
  .pc-search-tabs button { flex: 1; color: var(--muted); background: transparent; border-radius: 6px; }
  .pc-search-tabs button[aria-selected="true"] { color: var(--green); background: var(--mint); font-weight: 700; }
  .pc-search-sidebar > .filter-library, .pc-search-sidebar > .filter-editor { flex: 1; min-height: 0; border: 0; }
  .pc-search-sidebar[data-tab="conditions"] > .filter-library, .pc-search-sidebar[data-tab="records"] > .filter-editor { display: none; }
  .desktop-view .filter-results-panel { border-top: 0; }
}
@media (max-width: 1099px) {
  .desktop-view .detail-layout { grid-template-columns: minmax(230px,.85fr) minmax(0,1.5fr); grid-template-rows: auto minmax(0,1fr); }
  .desktop-view #detail-head { grid-column: 1; grid-row: 1/3; }
  .desktop-view .detail-layout > .detail-tabs { display: flex; grid-column: 2; grid-row: 1; }
  .desktop-view #detail-sale-panel, .desktop-view #detail-history-panel { grid-column: 2; grid-row: 2; }
  .desktop-view .detail-panel:not(.is-active) { display: none; }
  .desktop-view .detail-panel-title { display: none; }
}
@media (max-width: 759px) {
  .desktop-view .shell { width: calc(100% - 20px); }
  .desktop-view .header h1 { font-size: 17px; }
  .desktop-view .brand-icon { display: none; }
  .pc-summary > summary { gap: 8px; }
  .pc-summary .stats { gap: 9px; }
  .pc-summary .stats > div { gap: 3px; }
  .pc-summary-hint { display: none; }
  .pc-list-actions { gap: 6px; }
  .pc-view-switch button { padding: 4px 7px; }
  .desktop-view .list-heading h2 { font-size: 15px; }
  .pc-product-open { grid-template-columns: 40px minmax(0,1fr) 84px; gap: 7px; padding-left: 7px; }
  .pc-product-open .pc-item-image { width: 36px; height: 36px; }
  .pc-product-stock { grid-column: 3; }
  .pc-product-price strong { font-size: 14px; }
  .desktop-view .detail-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0,22vh) auto minmax(0,1fr); }
  .desktop-view #detail-head { grid-column: 1; grid-row: 1; }
  .desktop-view .detail-layout > .detail-tabs { grid-column: 1; grid-row: 2; }
  .desktop-view #detail-sale-panel, .desktop-view #detail-history-panel { grid-column: 1; grid-row: 3; }
  .desktop-view .filter-workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0,38vh) minmax(0,1fr); }
  .desktop-view .filter-results-panel { border-top: 1px solid var(--line); }
}

/* Personal favorites and saved market snapshots. */
.focus-tabs { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.focus-tabs button { flex: 1; min-height: 38px; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 650; }
.focus-tabs button[aria-pressed="true"] { background: var(--mint,var(--green-soft)); color: var(--green); }
.focus-records-section { display: flex; flex: 1 1 auto; flex-direction: column; padding: 10px 12px 0; min-width: 0; min-height: 0; overflow: hidden; }
#focus-record-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#focus-record-pager { flex: none; position: sticky; bottom: 0; margin: 0; background: var(--surface, white); }
.focus-record-controls { display: flex; gap: 8px; margin-bottom: 8px; }
.focus-record-controls label { flex: 1; min-width: 0; color: var(--muted); font-size: 11px; }
.focus-record-controls select { width: 100%; min-height: 36px; padding: 5px 8px; }
#focus-record-count { margin-bottom: 10px; }
.saved-record { min-width: 0; margin: 0 0 10px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface, white); }
.saved-record-heading { display: flex; align-items: center; gap: 6px; min-width: 0; margin-bottom: 5px; }
.saved-record-heading img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.saved-record-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-record-heading span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.saved-record-heading button { margin-left: auto; min-height: 34px; padding: 0 5px; color: var(--green); background: transparent; }
.saved-record .listing { margin-bottom: 4px; }
.record-action { min-height: 32px; margin-top: 4px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--green); font-size: 11px; }
.record-action[aria-pressed="true"] { background: var(--mint,var(--green-soft)); font-weight: 700; }
.favorite-note { grid-column: 1/-1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 12px 7px; color: var(--muted); font-size: 11px; }
.favorite-note span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favorite-note button { min-height: 28px; margin-left: auto; padding: 2px 6px; color: var(--green); background: transparent; white-space: nowrap; }
.item-note, .saved-item-records { padding: 10px 12px; border-top: 1px solid var(--line); }
.item-note h3, .saved-item-records h3 { margin-bottom: 6px; font-size: 13px; }
.item-note p { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 12px; }
.saved-item-records .saved-record { padding: 5px; }
.note-form { padding: 16px; }
.note-form textarea { width: 100%; min-height: 95px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; resize: vertical; background: var(--surface, white); color: var(--text); font: inherit; }

.desktop-view #market-view > #focus-records-section { flex: 1 1 auto; min-height: 0; overflow: hidden; }

.record-filter { flex: none; }
.record-filter summary { display: flex; align-items: center; min-height: 30px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--green); background: var(--surface, white); font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; list-style: none; }
.record-filter summary::-webkit-details-marker { display: none; }
.record-filter[open] summary { background: var(--mint, var(--green-soft)); }
.record-filter .focus-record-controls { position: absolute; z-index: 8; top: calc(100% + 4px); right: 0; display: grid; gap: 9px; width: min(270px, calc(100vw - 24px)); margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, white); box-shadow: 0 10px 28px #0002; }
.record-filter .focus-record-controls label { width: 100%; }

/* Save action follows the quantity; personal snapshots use compact rows. */
.has-record-action .record-action { min-height: 28px; margin: 0; padding: 2px 6px; font-size: 11px; white-space: nowrap; justify-self: end; }
.saved-record { margin-bottom: 6px; padding: 7px 9px; }
.saved-record-heading { flex-wrap: nowrap; margin-bottom: 2px; }
.saved-record-heading strong { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-record-heading time { flex: 0 0 auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.saved-record-heading button { flex: 0 0 auto; margin-left: 0; }
.saved-record .listing { margin: 0; padding: 4px 0; border: 0; background: transparent; }
.saved-record .listing-top { min-height: 28px; }
.saved-record .attributes { gap: 4px; }
.saved-record-toolbar { position: relative; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; margin-bottom: 6px; }
.saved-record-toolbar h3, .saved-record-toolbar p { min-width: 0; margin: 0; }
.saved-record-toolbar #focus-record-count { margin: 0; }
.saved-record-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.saved-record-toolbar button { flex: 0 0 auto; min-height: 30px; padding: 3px 7px; color: var(--green); font-size: 11px; font-weight: 700; background: transparent; white-space: nowrap; }
.saved-record-toolbar button[hidden] { display: none; }

.desktop-view .pc-listing .listing-top { grid-template-columns: minmax(145px,auto) minmax(0,1fr) auto; }
.desktop-view .pc-search-listing .listing-top { grid-template-columns: minmax(90px,1.25fr) minmax(145px,.9fr) minmax(75px,1fr) auto; }
.desktop-view .saved-record .pc-listing { padding: 4px 0; }
.desktop-view .pc-listing.has-record-action .listing-top { grid-template-columns: minmax(75px,auto) minmax(0,1fr) auto auto; gap: 6px; }
.desktop-view .pc-search-listing.has-record-action .listing-top { grid-template-columns: minmax(55px,1.25fr) minmax(55px,.7fr) minmax(55px,1fr) auto auto; gap: 5px; }
@container (max-width: 470px) { .desktop-view .pc-search-listing.has-record-action .listing-top { grid-template-columns: minmax(40px,1.25fr) minmax(50px,.7fr) minmax(40px,1fr) auto auto; gap: 3px; } }
@container (max-width: 470px) { .desktop-view .pc-search-listing .listing-top { grid-template-columns: minmax(0,1fr) auto; } }

/* Saved sale and history rows use the same star control as favorites. */
.record-action, .saved-record-heading .record-heart { display: grid; place-items: center; width: 32px; min-width: 32px; min-height: 32px; padding: 0; border: 0; color: #8a9690; background: transparent; }
.record-action[aria-pressed="true"], .saved-record-heading .record-heart[aria-pressed="true"] { color: #c95663; background: transparent; }
.record-action svg, .record-heart svg { width: 21px; height: 21px; }

.desktop-view .bottom-nav .monster-book-link{display:flex;align-items:center;justify-content:center;gap:7px;color:inherit;text-decoration:none;min-height:42px;font-size:13px;border-radius:10px}.desktop-view .bottom-nav .monster-book-link:hover{background:var(--surface-soft,#eef3ef);color:var(--green,#2d6652)}

.desktop-view .bottom-nav .monster-book-link{flex:1;flex-direction:column;gap:4px;font-size:10px;color:var(--muted)}.desktop-view .bottom-nav .monster-book-link>span:first-child{font-size:21px;font-weight:400}

/* Search is a market module; its columns scroll above the shared bottom nav. */
.desktop-view #market-view.is-search > :not(#groups):not(.market-search) { display: none !important; }
.desktop-view #market-view > .market-search { display: flex; flex: 1 1 0; min-height: 0; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.desktop-view .market-search .filter-workspace { flex: 1; min-width: 0; }
.desktop-view .market-search .filter-results-panel { min-height: 0; }
