/* Force the self-hosted UI to stay light on iOS dark mode. */
:root,html,body{color-scheme:light only!important}
html{background:#f7f8fc!important}
body{background:#f7f8fc!important;color:#252936!important}
button,input,select,textarea{color-scheme:light!important}
.modal-sheet,.summary-review,.summary-item,.summary-fields input{color-scheme:light!important}
.card-actions{display:flex;gap:7px;margin-top:10px}.card-actions button,.project-actions button{cursor:pointer}.danger-text{background:#fff0f0!important;color:#d95b62!important}.project-actions{flex-wrap:wrap}.project-actions button{min-width:0}.project-actions .danger-text{background:#fff0f0!important;color:#d95b62!important}.stock-input{width:92px;padding:8px 6px;border:1px solid #dfe2f1;border-radius:10px;background:#fff;text-align:center;font-size:18px;font-weight:800;color:#2d3350}.stock-input:focus{outline:2px solid #9da7f5;border-color:#6975e8}.stock-save{background:#6975e8!important;color:white!important;border-color:#6975e8!important}
[hidden]{display:none!important}
.pattern-preview.has-cover{height:220px;position:relative;background:#f3f2fa;padding:8px}
.pattern-preview.has-cover img{display:block;width:100%;height:100%;object-fit:contain;min-height:0;border-radius:7px}
.cover-hint{position:absolute;bottom:7px;right:7px;padding:3px 7px;border-radius:7px;background:#fffE;color:#6964ac;font-size:10px}
.cover-fallback{font-size:14px}.card-actions button{border:0;border-radius:7px;padding:5px 9px;font:inherit;background:#efeffc;color:var(--primary)}
.summary-item{display:grid;grid-template-columns:90px minmax(0,1fr);gap:8px;padding:10px 8px;margin:10px 0;border:1px solid #e4e5ef;border-radius:12px;background:#fafaff}
.summary-item.uncertain{border-color:#eab86d;background:#fff8eb}.summary-snippet{width:90px;height:65px;object-fit:contain;background:white;border-radius:5px}.summary-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 28px;gap:5px;align-items:center}.summary-fields input{min-width:0;width:100%;font-size:16px;padding:9px 5px}.summary-fields button{border:0;border-radius:6px;height:34px}.summary-candidates{grid-column:1/-1;font-size:11px;line-height:1.6;color:#79643f;overflow-wrap:anywhere}#summaryExtra small{line-height:1.6}#tableCloseup{width:100%;min-width:0}.detail-original{display:block;text-align:center;color:var(--primary);text-decoration:none}
@media(max-width:760px){.pattern-preview.has-cover{height:205px}.summary-item{grid-template-columns:80px minmax(0,1fr);padding:8px 6px;gap:6px}.summary-snippet{width:80px;height:60px}}
.auto-field{display:flex;align-items:center;min-height:40px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#f8f8fd;color:var(--primary);font-weight:700;font-size:12px}
@media(max-width:760px){
  .modal-sheet.detail-sheet{width:100%;height:100dvh;max-height:100dvh;border-radius:0;padding:calc(17px + env(safe-area-inset-top)) 15px calc(25px + env(safe-area-inset-bottom))}
  .detail-sheet .pattern-detail-grid{grid-template-columns:1fr;gap:12px}
  .detail-sheet .grid-preview{width:100%;max-height:52dvh;overflow:auto;padding:8px}
  .detail-sheet .grid-canvas{width:100%;grid-template-columns:repeat(var(--grid-width),minmax(0,1fr))!important;gap:1px}
  .detail-sheet .grid-cell{display:block;width:100%;height:auto;min-width:0;aspect-ratio:1/1}
  .detail-sheet .detail-materials{max-height:none;overflow:visible}
  .detail-sheet .material-line{grid-template-columns:22px minmax(0,1fr) auto auto;min-width:0}
  .detail-sheet .material-line b{min-width:0}
}
/* Mobile summary review: fixed header outside the scrolling content. */
.summary-review-shell{position:relative;min-height:0}.summary-review-head{display:none}
@media(max-width:760px){
  .modal-sheet.review-sheet{position:relative;display:flex;flex-direction:column;width:100%;height:100dvh;max-height:100dvh;border-radius:0;padding:0 12px calc(20px + env(safe-area-inset-bottom));overflow:hidden}
  .modal-sheet.review-sheet>.modal-head{display:none}
  .modal-sheet.review-sheet>#modalBody{flex:1 1 auto;min-height:0;height:auto;overflow:hidden}
  .modal-sheet.review-sheet .summary-review-shell{height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden}
  .modal-sheet.review-sheet .summary-review-head{display:flex;position:relative;flex:0 0 52px;z-index:1000;align-items:center;justify-content:space-between;height:52px;padding:env(safe-area-inset-top) 2px 0;background:#fff}
  .modal-sheet.review-sheet .summary-review-head b{font-size:18px;color:var(--ink)}
  .modal-sheet.review-sheet .summary-review-head .summary-close{display:grid;place-items:center;flex:0 0 auto;width:42px;height:42px;font-size:28px;background:#eef0fa;color:#6870a5;box-shadow:0 2px 8px rgba(44,49,95,.12)}
  .modal-sheet.review-sheet .summary-review{flex:1 1 auto;min-height:0;height:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:12px 0 calc(20px + env(safe-area-inset-bottom))}
  .modal-sheet.review-sheet .summary-review>.notice{margin-top:0}
}

/* Project material availability */
.material-main{min-width:0}.material-main b{display:block}.material-main small{display:block;margin-top:3px;color:var(--muted);font-size:10px;line-height:1.45;overflow-wrap:anywhere}.stock-notice-good{background:#e8f8ef;color:#287c5b}.stock-notice-bad{background:#fff0e5;color:#a45e27}.stock-good{color:var(--green)}.stock-bad{color:var(--red)}.stock-footnote{margin-top:14px;font-size:11px}.project-stock{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:12px;padding:9px 10px;border-radius:10px;font-size:11px;font-weight:700}.project-stock.good{background:#e8f8ef;color:#287c5b}.project-stock.bad{background:#fff0e5;color:#a45e27}.project-stock button{flex:0 0 auto;padding:5px 8px;border-radius:8px;background:#fff;color:var(--primary);font-size:10px;font-weight:700}.project-stock.bad button{color:#a45e27}.project-stock+ .project-actions{margin-top:10px}
@media(max-width:760px){.project-stock{align-items:flex-start;flex-direction:column}.project-stock button{width:100%}.detail-sheet .material-line{grid-template-columns:22px minmax(0,1fr) auto;align-items:start}.detail-sheet .material-main small{white-space:normal}}

/* Forecast stock warning on dashboard */
.panel-subtitle{display:block;margin-top:4px;color:var(--muted);font-size:11px;font-weight:500}.panel-head-note{color:#a45e27;font-size:11px;font-weight:700}.future-stock-panel{border-color:#f0dfc8;background:linear-gradient(180deg,#fffdf9,#fff)}.future-stock-row .row-main small{white-space:normal;line-height:1.45}.future-stock-row .row-value{min-width:72px}.future-stock-row .row-value small{white-space:normal;line-height:1.35}
@media(max-width:760px){.panel-head-note{max-width:100px;text-align:right;line-height:1.35}.future-stock-row{align-items:flex-start}.future-stock-row .row-value{min-width:76px}}

/* AI rows without snippets use the full mobile width. */
.summary-item:not(.has-snippet){display:block}
.summary-item:not(.has-snippet) .summary-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px}
.summary-item:not(.has-snippet) .summary-fields input{min-width:0}
@media(max-width:760px){
  .summary-item:not(.has-snippet){padding:10px 8px}
  .summary-item:not(.has-snippet) .summary-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;gap:8px}
  .summary-item:not(.has-snippet) .summary-fields input{min-height:48px;font-size:18px;padding:9px 10px}
  .summary-item:not(.has-snippet) .summary-fields button{width:44px;height:44px;font-size:24px}
}

.archived-card{opacity:.78}.archived-card .pattern-preview{filter:grayscale(.45)}.archived-card .tag{background:#ececf2;color:#737789}

/* Project headers use the linked pattern, without cropping the drawing. */
.project-card .project-top.project-cover{position:relative;display:block;height:clamp(155px,18vw,225px);padding:0;overflow:hidden;background:linear-gradient(135deg,#eeefff,#faf2ff)}
.project-cover-open{position:absolute;inset:0;display:grid;place-items:center;width:100%;height:100%;padding:8px 8px 34px;background:transparent;border:0;border-radius:0}
.project-cover-open:focus-visible{outline:3px solid var(--primary);outline-offset:-3px}
.project-cover-image{display:block;width:100%;height:100%;min-width:0;min-height:0;object-fit:contain;border-radius:6px}
.project-card .project-top .project-cover-fallback{font-size:42px;color:#737be0}
.project-card .project-top .project-cover-progress{position:absolute;z-index:1;top:9px;right:9px;padding:5px 9px;border:1px solid rgba(105,117,232,.15);border-radius:11px;background:rgba(255,255,255,.94);box-shadow:0 2px 7px rgba(48,55,102,.1);color:#626bcb;font-size:16px;line-height:1.25;pointer-events:none}
.project-cover-meta{position:absolute;left:0;right:0;bottom:0;height:27px;display:flex;align-items:center;justify-content:center;padding:4px 8px;border-top:1px solid rgba(233,234,241,.7);background:rgba(255,255,255,.94);color:#6f7589;font-size:11px;line-height:1.3;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
@media(max-width:760px){.project-card .project-top.project-cover{height:clamp(150px,43vw,225px)}.project-card .project-top .project-cover-progress{top:7px;right:7px;padding:4px 7px;font-size:14px}.project-cover-meta{font-size:10px}}

