:root { --user-font-scale: 1; }
body { zoom: var(--user-font-scale); }
@supports not (zoom: 1) { body { font-size: calc(16px * var(--user-font-scale)); } }

.skip-link { position: fixed; z-index: 1000; left: 12px; top: 10px; padding: 10px 15px; color: white; background: #173e34; border-radius: 10px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid #d06f3f !important; outline-offset: 3px; }

.settings-action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.settings-action-row button { flex: 1 1 150px; }
.trash-list { display: grid; gap: 9px; }
.trash-list article { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 34px; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.trash-kind { display: grid; width: 40px; height: 40px; place-items: center; color: var(--green); border-radius: 12px; background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.trash-list article div { min-width: 0; }
.trash-list article small, .trash-list article strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-list article small { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.trash-list article strong { font-size: 13px; }
.trash-forget { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 9px; cursor: pointer; }
.trash-forget:hover { color: #a34435; background: #f7e9e6; }
.trash-empty { min-height: 220px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.trash-empty > span { display: grid; width: 52px; height: 52px; place-items: center; color: #55785d; border-radius: 17px; background: #eaf1e9; }
.trash-empty h3 { margin: 12px 0 0; color: var(--ink); }
.trash-empty p { margin: 6px 0; }

.export-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.export-options button { display: grid; grid-template-columns: 42px 1fr; gap: 3px 11px; min-height: 88px; padding: 14px; color: var(--ink); text-align: left; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; }
.export-options button:hover { border-color: #9d735a; background: color-mix(in srgb, var(--surface) 90%, var(--clay) 5%); }
.export-options button > span { grid-row: 1 / 3; display: grid; width: 42px; height: 42px; place-items: center; color: var(--green); border-radius: 13px; background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.export-options strong { align-self: end; font-size: 12px; }
.export-options small { color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.import-backup { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 15px; padding: 15px; border: 1px dashed #bdb4a9; border-radius: 16px; background: color-mix(in srgb, var(--surface) 92%, var(--paper)); }
.import-backup > div { display: flex; align-items: center; gap: 11px; }
.import-backup strong, .import-backup p { display: block; margin: 0; }
.import-backup p { margin-top: 4px; color: var(--muted); font-size: 10px; }
.export-footnote { display: flex; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.item-life-section { margin: 14px 0; border: 1px solid var(--line); border-radius: 17px; overflow: hidden; }
.item-life-section > summary { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; min-height: 62px; padding: 10px 14px; list-style: none; cursor: pointer; }
.item-life-section > summary::-webkit-details-marker { display: none; }
.item-life-section > summary > span { display: grid; width: 38px; height: 38px; place-items: center; color: #8d5a3f; border-radius: 12px; background: #f4e8df; }
.item-life-section > summary strong, .item-life-section > summary small { display: block; }
.item-life-section > summary strong { font-size: 12px; }
.item-life-section > summary small { margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.item-life-body { padding: 15px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, var(--paper)); }
.item-life-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.item-life-grid [hidden] { display: none; }
.item-resource-editor { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.item-resource-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.item-resource-head strong, .item-resource-head p { display: block; margin: 0; }
.item-resource-head p { margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.item-resource-head > span { color: var(--muted); font-size: 10px; }
[data-resource-list] { display: grid; gap: 7px; margin-top: 10px; }
.item-resource-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.item-resource-row > span { display: grid; width: 32px; height: 32px; place-items: center; color: var(--green); border-radius: 9px; background: color-mix(in srgb, var(--green) 9%, var(--surface)); }
.item-resource-row small, .item-resource-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-resource-row small { color: var(--muted); font-size: 8px; }
.item-resource-row strong { font-size: 10.5px; }
.item-resource-row button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; color: #a04e3e; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.item-resource-empty { margin: 8px 0; color: var(--muted); font-size: 10px; }
.item-resource-add, .item-link-add { display: flex; gap: 8px; margin-top: 9px; }
.item-resource-add select, .item-link-add input { min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.item-link-add input { flex: 1; }

.item-life-detail { margin-top: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: color-mix(in srgb, var(--surface) 95%, var(--paper)); }
.item-life-status { display: flex; align-items: center; gap: 10px; }
.item-life-status > span { display: grid; width: 38px; height: 38px; place-items: center; color: #56755d; border-radius: 12px; background: #eaf0e8; }
.item-life-status.status-loaned > span { color: #846130; background: #f5ecd9; }
.item-life-status.status-given > span, .item-life-status.status-sold > span { color: #6d6671; background: #ece9ef; }
.item-life-status small, .item-life-status strong, .item-life-status p { display: block; margin: 0; }
.item-life-status small { color: var(--muted); font-size: 8.5px; text-transform: uppercase; }
.item-life-status strong { margin-top: 2px; font-size: 12px; }
.item-life-status p { margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.item-life-notes { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.item-life-notes span { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 8px; color: #6c594c; background: #f1eae3; font-size: 9px; }
.item-resource-links { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.item-resource-links h3 { margin: 0 0 8px; font-size: 11px; }
.item-resource-links a { display: grid; grid-template-columns: 30px 1fr auto 16px; align-items: center; gap: 8px; min-height: 44px; padding: 6px 8px; border-radius: 10px; }
.item-resource-links a:hover { background: color-mix(in srgb, var(--surface) 75%, var(--green) 8%); }
.item-resource-links a > span { display: grid; width: 30px; height: 30px; place-items: center; color: var(--green); border-radius: 9px; background: color-mix(in srgb, var(--green) 9%, var(--surface)); }
.item-resource-links a strong { overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.item-resource-links a small { color: var(--muted); font-size: 8.5px; }

.workshop-alerts { margin: -8px 0 24px; padding: 18px; border: 1px solid #ded2c7; border-radius: 21px; background: #f5eee7; }
.workshop-alert-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.workshop-alert-head h2 { margin: 0; font-size: 17px; }
.workshop-alert-head > span { display: grid; min-width: 28px; height: 28px; place-items: center; padding: 0 8px; color: white; border-radius: 9px; background: #8d5c45; font-size: 10px; font-weight: 700; }
.workshop-alert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.workshop-alert-grid button { display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; align-items: center; gap: 9px; min-height: 66px; padding: 10px; color: var(--ink); text-align: left; border: 1px solid rgb(126 91 68 / 15%); border-radius: 13px; background: rgb(255 255 255 / 58%); cursor: pointer; }
.workshop-alert-grid button:hover { background: rgb(255 255 255 / 90%); }
.alert-icon { display: grid; width: 36px; height: 36px; place-items: center; color: #5a745e; border-radius: 11px; background: #e6eee5; }
.alert-icon.is-low { color: #99613f; background: #f4e4d8; }
.alert-icon.is-overdue { color: #a44238; background: #f6dfdc; }
.workshop-alert-grid small, .workshop-alert-grid strong, .workshop-alert-grid p { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workshop-alert-grid small { color: #8b6450; font-size: 8px; }
.workshop-alert-grid strong { margin-top: 2px; font-size: 11px; }
.workshop-alert-grid p { margin-top: 3px; color: var(--muted); font-size: 8.5px; }

.accessibility-controls { display: grid; gap: 10px; margin-top: 13px; }
.accessibility-controls > label:not(.accessibility-check) { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.2fr) auto; align-items: center; gap: 9px; font-size: 10.5px; }
.accessibility-controls select { min-height: 38px; padding: 7px 9px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.accessibility-controls output { color: var(--muted); font-size: 9px; }
.accessibility-check { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 10.5px; }
.accessibility-check input { width: 18px; height: 18px; accent-color: var(--green); }
.a11y-check-result { display: flex; gap: 7px; margin-top: 12px; padding: 9px; color: #486950; border-radius: 10px; background: #eaf1e9; font-size: 9px; line-height: 1.45; }
.shopping-input { flex-wrap: wrap; }
.shopping-due { display: grid; gap: 3px; color: var(--muted); font-size: 8px; }
.shopping-due input { min-height: 38px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.shopping-reminder { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: #9a6244; font-size: 8px; }
.project-delete-action, .pattern-delete-action { color: #a4493b !important; }

:root[data-large-controls="true"] button,
:root[data-large-controls="true"] input,
:root[data-large-controls="true"] select,
:root[data-large-controls="true"] textarea,
:root[data-large-controls="true"] .side-nav a { min-height: 52px; }
:root[data-large-controls="true"] .icon-button,
:root[data-large-controls="true"] .favorite-button { min-width: 48px; min-height: 48px; }
:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

:root[data-theme="dark"] {
  --paper: #171b19; --surface: #222825; --surface-2: #2b322e; --ink: #f1f4f0; --muted: #a9b1ab;
  --line: #3c4540; --green: #376f61; --green-2: #75a99b; --sage: #647766; --cream: #39352e;
  --clay: #dc8d70; --ochre: #d7ae65; --blue: #82a3ad; --shadow: 0 18px 45px rgb(0 0 0 / 28%); --shadow-sm: 0 8px 24px rgb(0 0 0 / 25%);
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .topbar { background-color: var(--paper); color: var(--ink); }
:root[data-theme="dark"] .sidebar { background: #1c211f; }
:root[data-theme="dark"] .topbar { background: rgb(23 27 25 / 90%); }
:root[data-theme="dark"] .global-search,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .help-button,
:root[data-theme="dark"] .filter-chip,
:root[data-theme="dark"] .install-card,
:root[data-theme="dark"] .quick-panel,
:root[data-theme="dark"] .quick-action,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .search-collection,
:root[data-theme="dark"] .advanced-search-form,
:root[data-theme="dark"] .search-match-reason { color: var(--ink); background: var(--surface); border-color: var(--line); }
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea { color: var(--ink); background-color: #1d2320; border-color: var(--line); }
:root[data-theme="dark"] .workshop-alerts { background: #2b2521; border-color: #4b3c33; }
:root[data-theme="dark"] .workshop-alert-grid button { color: var(--ink); background: rgb(255 255 255 / 5%); }
:root[data-theme="dark"] .primary-button { color: white; }
:root[data-theme="dark"] img { opacity: .94; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --paper: #171b19; --surface: #222825; --surface-2: #2b322e; --ink: #f1f4f0; --muted: #a9b1ab; --line: #3c4540;
    --green: #376f61; --green-2: #75a99b; --sage: #647766; --cream: #39352e; --clay: #dc8d70; --ochre: #d7ae65; --blue: #82a3ad;
  }
  :root[data-theme="system"] body, :root[data-theme="system"] .sidebar, :root[data-theme="system"] .topbar { background-color: var(--paper); color: var(--ink); }
  :root[data-theme="system"] .sidebar { background: #1c211f; }
  :root[data-theme="system"] .topbar { background: rgb(23 27 25 / 90%); }
}

@media (max-width: 900px) {
  .workshop-alert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-life-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .export-options, .workshop-alert-grid, .item-life-grid { grid-template-columns: 1fr; }
  .trash-list article { grid-template-columns: 38px minmax(0, 1fr) 34px; }
  .trash-list article .secondary-button { grid-column: 1 / -1; }
  .import-backup { align-items: stretch; flex-direction: column; }
  .item-resource-add, .item-link-add { flex-direction: column; }
  .item-resource-add > *, .item-link-add > * { width: 100%; }
  .workshop-alerts { margin-inline: -4px; padding: 14px; }
}
