/* v3.9.0 M-BOARD spare parts */
#spareParent[hidden],#spareChild[hidden],#spareMobile[hidden],#spareModal [hidden],#spareView [hidden],#spareUsagePreview[hidden]{display:none!important}
.sidebar .spare-child{padding-left:24px;font-size:12px}.sidebar .spare-mobile{display:none}
#spareView{--spare-line:#e1e0da;--spare-yellow:#f4c745;color:#212328}#spareView h2,#spareView h3{margin:0 0 7px}#spareView p{margin:5px 0;color:#646970}#spareView #spareSearch{width:100%;background:#fff;padding:12px;border:1px solid var(--spare-line);border-radius:9px;margin:12px 0}.spare-heading{display:flex;justify-content:space-between;gap:12px;align-items:center;background:white;padding:18px;border:1px solid var(--spare-line);border-radius:12px;margin-bottom:12px}.spare-heading small{font-weight:700;color:#9a7713;letter-spacing:.08em}.spare-preview-badge{font-size:12px;color:#7a6324;background:#fff3ca;padding:6px 10px;border-radius:8px;white-space:nowrap}.spare-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:14px}.spare-stat{display:grid;gap:6px;background:white;border:1px solid var(--spare-line);border-radius:10px;padding:15px}.spare-stat small{color:#656b76}.spare-stat b{font-size:24px}.spare-toolbar,.spare-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.spare-toolbar select{max-width:125px;padding:8px}.spare-panel{padding:16px;background:white;border:1px solid var(--spare-line);border-radius:12px;margin-bottom:10px}.spare-table-wrap{overflow:auto;max-height:65vh;margin-top:12px}.spare-table{border-collapse:separate;border-spacing:0;min-width:1040px;width:100%;font-size:12px;font-variant-numeric:tabular-nums}.spare-table th,.spare-table td{border-bottom:1px solid #e7e7e5;text-align:center;padding:10px 8px;white-space:nowrap}.spare-table th{position:sticky;top:0;background:#f0eee9;z-index:1;color:#4f5359}.spare-table td:nth-child(4),.spare-table td:nth-child(5){text-align:left;white-space:pre-line;min-width:120px}.spare-table td:nth-last-child(2){white-space:normal;min-width:130px;max-width:220px}.spare-table tr:hover td{background:#fffbec}.spare-warn{color:#a75e00}.spare-field-card{display:grid;gap:12px}.spare-field-card>div:first-child{display:grid;gap:5px}.spare-field-card small,.spare-log small{color:#687078}.spare-log{display:grid;gap:5px;padding:10px 0;border-bottom:1px solid #e8e7e2}.spare-dialog{display:grid;gap:12px}.spare-dialog #spareReceiveFields{display:grid;gap:10px}.spare-dialog img{max-height:280px;max-width:100%;border-radius:10px;object-fit:contain}.spare-usage{white-space:pre-line;background:#fffae5;padding:10px;border-radius:7px;color:#6f5816;font-size:12px}#spareModal .modal{max-width:520px}
@media(max-width:650px),(pointer:coarse){.sidebar .spare-parent,.sidebar .spare-child{display:none!important}.sidebar .spare-mobile:not([hidden]){display:flex!important}#spareView .spare-stats,#spareView #spareYear,#spareView #spareStockTab,#spareView #spareExport{display:none!important}.spare-heading{padding:12px;align-items:start}.spare-heading h2{font-size:20px}.spare-preview-badge{font-size:10px}.spare-toolbar button{flex:1;font-size:12px}.spare-field-card .spare-actions button{flex:1}.spare-panel{padding:12px}.spare-dialog label{font-size:14px}}
@media(max-width:650px){.sidebar nav:has(#spareMobile:not([hidden])){grid-template-columns:repeat(5,minmax(0,1fr))!important}.sidebar nav>#spareMobile:not([hidden]){min-width:0;padding:7px 0}.sidebar nav>#spareMobile span[data-mobile-label]::after{font-size:10px}}

/* Expandable per-part history, separate from raw monthly totals. */
.spare-stock-row{cursor:pointer}.spare-stock-row.spare-open td{background:#fff5d5}.spare-expand{border:0;background:transparent;color:#725700;font-weight:750;cursor:pointer;padding:5px 7px;border-radius:5px}.spare-expand:focus-visible{outline:2px solid #a17d00}.spare-table .spare-history-row>td{text-align:left;background:#faf9f5;padding:12px;white-space:normal}.spare-history-detail{background:#fff;border:1px solid #e5e1d6;border-left:4px solid #eab900;border-radius:8px;padding:12px;max-width:min(100%,1000px);box-sizing:border-box;text-align:left}.spare-history-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.spare-history-scroll{overflow-x:auto}.spare-history-table{width:100%;border-collapse:collapse;font-size:12px}.spare-history-table th,.spare-history-table td,.spare-table .spare-history-table th,.spare-table .spare-history-table td{position:static;text-align:left;white-space:normal;min-width:0;max-width:none;padding:8px;border-bottom:1px solid #eee;background:#fff}.spare-history-table th{background:#f4f3ee!important}.spare-out{color:#b23b32;font-weight:700}.spare-in{color:#167348;font-weight:700}.spare-field-card .spare-history-detail{min-width:0;width:100%}@media(max-width:650px){.spare-history-table{min-width:680px}.spare-history-head .spare-actions{width:100%}}

.spare-stock-status{display:block;font-size:11px;color:#92600b}.spare-month-summary{margin-bottom:16px}.spare-month-summary h4{margin:0 0 8px}.spare-alert-overlay[hidden]{display:none!important}.spare-alert-overlay{position:fixed;inset:0;z-index:1200;background:#14151888;display:flex;align-items:center;justify-content:center;padding:22px}.spare-alert-dialog{background:white;color:#202124;border-radius:16px;padding:24px;width:min(620px,100%);max-height:86vh;display:flex;flex-direction:column;gap:16px;box-shadow:0 20px 64px #0004}.spare-alert-header{display:flex;align-items:center;gap:12px}.spare-alert-header h2{font-size:21px;margin:0 0 4px}.spare-alert-header small{color:#6d7076}.spare-alert-symbol{display:grid;place-items:center;background:#ffd000;color:#181818;border-radius:10px;width:46px;height:46px;font-size:28px;font-weight:800}.spare-alert-list{overflow:auto;min-height:0;display:grid;gap:9px}.spare-alert-item{display:flex;align-items:center;gap:12px;background:#f8f6ef;border:1px solid #e8dfbc;border-radius:9px;padding:12px}.spare-alert-item div{flex:1;min-width:0}.spare-alert-item small{display:block;color:#6c6a63;margin-top:4px}.spare-alert-item p{margin:6px 0 0;font-size:13px;color:#845800}.spare-alert-item strong{color:#9b6400;white-space:nowrap;font-size:21px}.spare-alert-item.empty{background:#fff3f1;border-color:#f0c9c3}.spare-alert-item.empty strong,.spare-alert-item.empty p{color:#b42d25}.spare-alert-footer{display:flex;justify-content:flex-end;gap:8px}.spare-alert-footer button{min-height:40px}.spare-alert-footer .primary{background:#f4c745;color:#191919}

.spare-field-summary{display:grid;gap:5px}.spare-field-summary small{color:#687078}.spare-field-summary button{justify-self:start}.spare-field-pn{white-space:pre-line;overflow-wrap:anywhere;font-weight:650;color:#3c526d!important}.spare-field-qty strong{font-size:1.12em}.spare-field-card>div:first-child{min-width:0;overflow-wrap:anywhere}

/* Compact field cards: stable top-right quantity controls and equal-sized actions. */
#spareView .spare-field-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;min-width:0}
#spareView .spare-field-name{display:grid;gap:4px;flex:1;min-width:0;overflow-wrap:anywhere}
#spareView .spare-quick{display:grid;grid-template-columns:repeat(2,40px);gap:5px;flex:none;align-items:start}
#spareView .spare-quick-button{display:grid;place-items:center;width:40px;min-width:0;max-width:40px;height:40px;min-height:40px;padding:0;border:1px solid #d6d6d1;border-radius:8px;font-size:22px;font-weight:750;line-height:1;color:#222;background:#fff;touch-action:manipulation}
#spareView .spare-quick-plus:not(:disabled){background:#f4c745;border-color:#d4a525}#spareView .spare-quick-minus:not(:disabled){background:#f5f5f3;border-color:#d6d6d1}
#spareView .spare-quick-button:disabled{background:#f4f4f2;color:#9b9b98;opacity:.65}
#spareView .spare-card-actions{display:grid;gap:6px;align-items:stretch;width:100%;min-width:0}
#spareView .spare-actions-three{grid-template-columns:repeat(3,minmax(0,1fr))}#spareView .spare-actions-two{grid-template-columns:repeat(2,minmax(0,1fr))}
#spareView .spare-card-actions>button{width:100%;min-width:0;max-width:100%;height:44px;min-height:44px;padding:0 3px;display:flex;align-items:center;justify-content:center;white-space:nowrap;word-break:keep-all;font-size:clamp(10px,3.1vw,13px);line-height:1.2;letter-spacing:-.025em;box-sizing:border-box}
#spareView .spare-confirmed{color:#286d48;font-weight:650;font-size:11px}
@media(max-width:360px){#spareView .spare-quick{grid-template-columns:repeat(2,36px);gap:4px}#spareView .spare-quick-button{width:36px;max-width:36px;height:40px;min-height:40px}#spareView .spare-card-actions{gap:4px}}
.catalog-bar{display:flex;align-items:end;justify-content:space-between;gap:10px;margin:0 0 10px;border-bottom:2px solid #155675;background:#eef4f7;border-radius:9px 9px 0 0;padding:8px 8px 0}.catalog-bar #catalogTabs{display:flex;gap:5px;align-items:end;overflow-x:auto;min-width:0}.catalog-tab{flex:0 0 auto;max-width:220px;border:1px solid #b9cbd5;border-bottom:0;background:#fff;color:#435764;padding:9px 13px;border-radius:9px 9px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;font-weight:700;min-height:40px}.catalog-tab.selected{background:#155675;color:#fff;border-color:#155675}.catalog-tab small{font-size:11px;opacity:.8;margin-left:4px}.catalog-plus{font-size:20px;padding:5px 14px}.catalog-bar #catalogNew{flex:0 0 auto;margin-bottom:6px;white-space:nowrap}.catalog-words{display:block;font-size:11px;color:#567080;white-space:normal;max-width:260px;margin-top:4px}.catalog-edit{margin-left:5px;font-size:11px!important}.catalog-key-mobile{justify-self:start;font-size:12px!important;min-height:32px!important;padding:5px 10px!important}#catalogModal .modal{max-width:530px}#catalogModal label{display:grid;gap:5px}@media(max-width:650px){.catalog-bar{flex-wrap:wrap;align-items:center}.catalog-bar #catalogTabs{width:100%}.catalog-bar #catalogNew{margin-left:auto}.catalog-tab{font-size:12px;padding:8px 10px}}

/* Catalog chatbot: per-part private location photo preview. */
.spare-chat-result{width:100%;max-width:100%;box-sizing:border-box;white-space:normal;}
.spare-chat-card{margin-top:10px;padding:12px;border:1px solid #d9e0e8;border-radius:10px;background:#fff;color:#17293d;overflow-wrap:anywhere;}
.spare-chat-card strong{display:block;margin-bottom:5px;}
.spare-chat-photo-status{margin-top:8px;font-size:12px;color:#64748b;}
.spare-chat-thumb{display:flex;flex-direction:column;align-items:center;width:100%;padding:6px;gap:6px;border:1px solid #d9e0e8;border-radius:8px;background:#f8fafc;color:#245e9b;font-size:12px;cursor:zoom-in;}
.spare-chat-thumb img{display:block;width:100%;max-height:190px;object-fit:contain;border-radius:5px;background:#edf0f4;}
.spare-chat-photo-dialog{width:min(840px,calc(100vw - 24px));max-height:calc(100dvh - 32px);box-sizing:border-box;padding:16px;border:1px solid #d9e0e8;border-radius:14px;color:#17293d;background:#fff;overflow:auto;}
.spare-chat-photo-dialog::backdrop{background:#0009;}
.spare-chat-photo-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;overflow-wrap:anywhere;}
.spare-chat-photo-dialog img{display:block;width:100%;max-height:70dvh;object-fit:contain;background:#f2f4f6;}
.spare-chat-photo-dialog p{margin:10px 0 0;overflow-wrap:anywhere;}

/* v3.9.2: category context menu */
.catalog-context-menu{position:fixed;z-index:2000;min-width:148px;padding:5px;background:#fff;border:1px solid #b9cbd5;border-radius:8px;box-shadow:0 6px 20px #172b4040;}
.catalog-context-menu button{display:block;width:100%;min-height:36px;text-align:left;background:#fff;color:#203c50;border:0;border-radius:5px;padding:8px 13px;font-size:13px;white-space:nowrap;}
.catalog-context-menu button:hover,.catalog-context-menu button:focus-visible{background:#eaf2f7;outline:1px solid #155675;}

/* v3.9.2 mobile catalog: visible before search, scrollable without shrinking labels. */
@media(max-width:650px),(pointer:coarse){
 #spareView .catalog-bar{display:flex;flex-direction:column;align-items:stretch;gap:6px;width:100%;max-width:100%;box-sizing:border-box;margin:12px 0 0;padding:8px 6px 0;}
 #spareView .catalog-bar #catalogTabs{display:flex;width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;gap:4px;scrollbar-width:thin;align-items:end;}
 #spareView .catalog-tab{flex:0 0 auto;min-height:44px;padding:8px 10px;font-size:13px;white-space:nowrap;touch-action:manipulation;}
 #spareView .catalog-tab small{margin-left:2px;}
 #spareView .catalog-bar #catalogNew{align-self:flex-end;min-height:36px;font-size:12px;margin:0 0 5px;padding:6px 10px;}
 #spareView #spareSearch{margin:8px 0 12px;}
}
