/* ===== Storage breakdown (views/storage.js) and part documents (views/parts.js) ===== */

/* One colour per kind of file, in a fixed order (validated for colour-blind separation between neighbours, light and dark).
   The legend always carries the name and size, so no colour stands alone. */
.stor { --s-library: #2a78d6; --s-images: #eb6834; --s-videos: #1baf7a; --s-prints: #eda100; --s-receipts: #e87ba4; --s-part_docs: #008300; --s-jobs: #6250d6; --s-other: #e34948; --s-free: var(--muted-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stor { --s-library: #3987e5; --s-images: #d95926; --s-videos: #199e70; --s-prints: #c98500; --s-receipts: #d55181; --s-part_docs: #008300; --s-jobs: #9085e9; --s-other: #e66767; } }
:root[data-theme="dark"] .stor { --s-library: #3987e5; --s-images: #d95926; --s-videos: #199e70; --s-prints: #c98500; --s-receipts: #d55181; --s-part_docs: #008300; --s-jobs: #9085e9; --s-other: #e66767; }
.s-library { --c: var(--s-library); } .s-images { --c: var(--s-images); } .s-videos { --c: var(--s-videos); } .s-prints { --c: var(--s-prints); }
.s-receipts { --c: var(--s-receipts); } .s-part_docs { --c: var(--s-part_docs); } .s-jobs { --c: var(--s-jobs); } .s-other { --c: var(--s-other); } .s-free { --c: var(--s-free); }

.stor { display: grid; gap: 10px; }
.stor-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; } .stor-head .warn { color: var(--warn); } .stor-head .bad { color: var(--bad); font-weight: 600; }
/* The bar: the whole allowance; each kind a segment, a 2px gap of surface between them, what is left plain. */
.stor-bar { display: flex; height: 18px; padding: 0; background: var(--s-free); border-radius: 4px; overflow: hidden; }
.stor-seg { flex: none; box-sizing: border-box; min-width: 6px; height: 100%; padding: 0; border: 0; border-right: 2px solid var(--surface); border-radius: 0; background: var(--c); background-clip: padding-box; cursor: pointer; }
.stor-seg:hover, .stor-seg.on { filter: brightness(1.12); } .stor-seg:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.stor-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 16px; }
.stor-key { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; width: 100%; padding: 5px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer; }
button.stor-key:hover { background: var(--surface-2); } .stor-key.on { border-color: var(--border-strong); background: var(--surface-2); } .stor-key.free { cursor: default; }
.stor-key .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .stor-key .val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.stor-key .cnt { grid-column: 2 / -1; font-size: 12px; color: var(--text-3); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; } .stor-key .sw { grid-row: 1; } .sw.s-free { box-shadow: inset 0 0 0 1px var(--border-strong); }
.stor-files:empty { display: none; } .stor-files { border-top: 1px solid var(--border); padding-top: 12px; }
.stor-files h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 14px; }
.stor-list td.name { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .stor-legend { grid-template-columns: 1fr; } .stor-list .col-date { display: none; } .stor-list td.name { max-width: 160px; } }
@media (forced-colors: active) { .stor-seg, .sw { forced-color-adjust: none; border: 1px solid CanvasText; } }

/* ----- Photo size (Settings > Billing > Storage): three choices, each with what it keeps, its size and how many more fit ----- */
.ps { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ps h3 { margin: 0 0 4px; } .ps-lead { margin: 0 0 10px; }
.ps-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ps-opt { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; }
.ps-opt:hover { background: var(--surface-2); }
.ps-opt:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-soft); }
.ps-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.ps-opt:has(input:disabled) { cursor: default; } .ps-opt:has(input:disabled):hover:not(:has(input:checked)) { background: var(--surface); }
.ps-opt:has(input:disabled:not(:checked)) { color: var(--text-2); }
.ps-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.ps-what { color: var(--text-2); line-height: 1.4; } .ps-size { margin-top: auto; padding-top: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ps-fit { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ps-note { margin: 10px 0 0; } .ps-actions { margin-top: 10px; }
@media (max-width: 760px) { .ps-opts { grid-template-columns: 1fr; } }

/* ----- Part documents: a tile per document, thumbnails for pictures ----- */
.pdoc-card { position: relative; }
.pdoc-actions { gap: 8px; } .pdoc-as { display: inline-flex; align-items: center; gap: 6px; } .pdoc-as select { height: 30px; font-size: 13px; }
.pdoc-filter { margin-bottom: 12px; } .pdoc-filter .chip { font: inherit; font-size: 12px; cursor: pointer; }
.pdoc-ups { margin: 0 0 12px; padding: 0; border: 0; }
.pdocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pdoc { position: relative; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 4px; }
.pdoc-thumb { grid-column: 1 / -1; display: block; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.pdoc-thumb:hover { border-color: var(--border-strong); } .pdoc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdoc-tile { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-2); } .pdoc-tile b { font-size: 15px; letter-spacing: .04em; color: var(--text); }
.pdoc-meta { min-width: 0; display: grid; padding-top: 6px; } .pdoc-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdoc-sub { font-size: 12px; color: var(--text-3); } .pdoc-sub span { white-space: nowrap; }
.pdoc .row-menu { align-self: start; padding-top: 4px; } .pdoc .row-menu .menu { right: 0; }
.pdoc-drop { display: none; } .pdoc-card.over .pdoc-drop { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 8px; background: color-mix(in srgb, var(--primary-soft) 88%, transparent); border: 2px dashed var(--primary); border-radius: var(--radius); font-weight: 600; color: var(--link); z-index: 2; }
.lib-preview video { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; background: #000; }
@media (max-width: 600px) { .pdocs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .pdoc-as span { display: none; } }
/* The plain usage bar the breakdown replaces (its display rule would otherwise beat [hidden]). */
.usage[hidden] { display: none; }
