:root{--app-bg:#f5f7fa;--app-border:#e5e9ef;--app-text:#1f2937;--app-muted:#6b7280;--app-sidebar:#fff;--app-radius:14px}
*{box-sizing:border-box}body{margin:0;background:var(--app-bg);color:var(--app-text);font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.app-shell{min-height:100vh}.sidebar{position:fixed;inset:0 auto 0 0;width:232px;background:var(--app-sidebar);border-right:1px solid var(--app-border);padding:22px 18px;z-index:20}.brand,.mobile-brand{font-weight:750;color:var(--app-text);text-decoration:none;letter-spacing:-.02em}.sidebar .nav-link{color:#4b5563;border-radius:10px;padding:.65rem .75rem;transition:.16s ease}.sidebar .nav-link:hover{background:#f1f5f9;color:#111827;transform:translateX(2px)}.main-content{padding:34px;max-width:1500px;margin-left:232px}.mobile-header{height:62px;background:white;border-bottom:1px solid var(--app-border);display:flex;align-items:center;justify-content:space-between;padding:0 14px;position:sticky;top:0;z-index:15}.page-header{margin-bottom:22px}.page-header h1{font-size:clamp(1.55rem,2vw,2rem);letter-spacing:-.025em;margin:.25rem 0}.page-header p{color:var(--app-muted);margin:0}.back-link{color:var(--app-muted);text-decoration:none;font-size:.9rem}.panel-card,.metric-card,.info-tile,.mobile-item-card{border:1px solid var(--app-border);border-radius:var(--app-radius);background:#fff;box-shadow:0 1px 2px rgba(16,24,40,.02)}.metric-card{padding:18px;height:100%;transition:transform .18s ease,box-shadow .18s ease}.metric-card:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(16,24,40,.06)}.metric-value{font-weight:760;font-size:1.75rem;letter-spacing:-.03em}.metric-label{font-size:.85rem;color:var(--app-muted);margin-top:2px}.filter-bar{display:grid;grid-template-columns:minmax(0,1fr) 220px;gap:10px;margin-bottom:16px}.table>:not(caption)>*>*{padding:.85rem 1rem;border-bottom-color:#eef1f4}.status-badge{display:inline-flex;align-items:center;padding:.28rem .52rem;border-radius:999px;font-size:.76rem;font-weight:650;background:#eef2f7;color:#475569}.status-active{background:#eaf8ef;color:#18733a}.status-issued{background:#eaf2ff;color:#245ea9}.status-in_repair{background:#fff4dc;color:#8a5700}.status-lost,.status-retired{background:#fcebea;color:#a2332b}.mobile-cards{display:grid;gap:10px}.mobile-item-card{padding:16px;transition:transform .15s ease}.mobile-item-card:active{transform:scale(.985)}.inventory-number{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--app-muted);font-weight:650}.info-tile{padding:16px;height:100%}.info-tile span,.details-grid span{display:block;font-size:.78rem;color:var(--app-muted);margin-bottom:4px}.info-tile strong,.details-grid strong{font-size:.95rem}.details-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px}.action-row{display:flex;flex-wrap:wrap;gap:8px}.timeline{position:relative}.timeline-item{display:grid;grid-template-columns:18px 1fr;gap:10px;padding:12px 0;border-bottom:1px solid #eef1f4}.timeline-dot{width:9px;height:9px;background:#64748b;border-radius:50%;margin-top:6px}.label-preview{background:#fafafa;border:1px dashed #cfd6df;border-radius:12px;padding:18px;display:flex;justify-content:center;overflow:auto}.label-preview img{max-width:100%;height:auto}.skeleton-line{height:13px;border-radius:7px;background:linear-gradient(90deg,#eef1f4 25%,#f8fafc 50%,#eef1f4 75%);background-size:200% 100%;animation:shimmer 1.3s infinite;margin:10px 0}.skeleton-line.short{width:65%}@keyframes shimmer{to{background-position:-200% 0}}.htmx-request{opacity:.55;transition:opacity .15s}.htmx-added{animation:fadein .18s ease}@keyframes fadein{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}.login-page{min-height:100vh;display:grid;place-items:center;padding:20px}.login-card{width:min(100%,430px);border-radius:18px}.toast-copy{background:#172033;color:#fff;border-radius:10px;padding:11px 14px;box-shadow:0 12px 30px rgba(0,0,0,.16);animation:fadein .15s ease}
@media(max-width:991.98px){.main-content{margin-left:0;padding:22px 18px 42px}.details-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:575.98px){.main-content{padding:18px 12px 36px}.filter-bar{grid-template-columns:1fr}.details-grid{grid-template-columns:1fr 1fr;gap:15px}.page-header{margin-bottom:16px}.panel-card{border-radius:12px}.action-row .btn{min-height:44px}.btn{min-height:42px}.form-control,.form-select{min-height:44px}}
@media print{.sidebar,.mobile-header,.action-row,.page-header .btn{display:none!important}.main-content{margin:0;padding:0}.panel-card{box-shadow:none;border:0}}

/* Readable form fields and keyboard/mobile-friendly actions */
.required-star{color:#c62828;font-weight:700}
.field-help{display:inline-flex;align-items:center;justify-content:center;width:19px;height:19px;vertical-align:middle;margin-left:3px;border:1px solid #9aa9b9;border-radius:50%;color:#5c697a;background:#fff;font-size:12px;font-weight:700;line-height:1;cursor:help}
.field-help:focus-visible{outline:3px solid #80b8ff;outline-offset:2px}
.form-select:has(option[value=""]:checked){color:#717e8c}
.form-select option{color:#1f2937}
.form-select option[value=""]{color:#808996;font-style:italic}
.ts-wrapper{min-height:44px}
.ts-wrapper .ts-control{min-height:44px;border-color:#dee2e6;border-radius:.375rem;align-items:center;padding:8px 12px}
.ts-wrapper .ts-dropdown{border-radius:10px;box-shadow:0 10px 24px rgba(16,24,40,.1);z-index:1080}
.ts-dropdown .option{min-height:42px;padding:10px 12px;display:flex;align-items:center}
.equipment-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.equipment-toolbar-secondary{display:flex;flex-wrap:wrap;gap:8px;margin-left:auto}
.equipment-toolbar .dropdown-menu{min-width:240px;max-width:calc(100vw - 24px)}
.equipment-toolbar .dropdown-item{white-space:normal;padding:12px 14px}
@media(max-width:575.98px){.equipment-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.equipment-toolbar>.dropdown>.btn{width:100%;min-height:48px}.equipment-toolbar-secondary{grid-column:1/-1;display:flex;width:100%;margin:2px 0 0;gap:8px}.equipment-toolbar-secondary>.btn{flex:1;font-size:.82rem}.equipment-toolbar .dropdown-menu{min-width:260px}.equipment-toolbar>.dropdown:first-child:last-of-type{grid-column:1/-1}}

.directory-tabs{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:thin}
.directory-tabs .btn{white-space:nowrap}
.directory-editor{background:#f8fafc;border:1px solid #e5e9ef;border-radius:12px}
.location-toggle{text-decoration:underline dotted;text-underline-offset:3px}
.location-toggle:hover{text-decoration:underline}
.guest-page{min-height:100vh;padding:28px 16px;display:flex;align-items:flex-start;justify-content:center}
.guest-card{width:min(100%,620px)}
.guest-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.guest-fields dt{font-weight:400;color:#6b7280;font-size:.8rem;margin-bottom:4px}
.guest-fields dd{font-size:1rem;font-weight:600;margin:0;overflow-wrap:anywhere}
@media(max-width:575.98px){.guest-page{padding:16px 10px}.guest-fields{grid-template-columns:1fr;gap:13px}}

.copy-dialog{width:min(94vw,600px);max-height:85vh;overflow:auto;background:#fff;border:1px solid #e5e9ef;border-radius:14px;padding:22px;box-shadow:0 24px 80px rgba(0,0,0,.23)}
.copy-dialog::backdrop{background:rgba(15,23,42,.5)}
.copy-dialog #copy-dialog-text{max-height:42vh;white-space:pre-wrap}
.operation-uuid{display:block;font-size:.75rem;color:#64748b;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;overflow-wrap:anywhere}
.equipment-notes{white-space:pre-wrap;overflow-wrap:anywhere}

.label-select-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:9px;max-height:480px;overflow-y:auto;padding:4px}
.label-pick-card{border:1px solid #e2e8f0;border-radius:10px;padding:12px;display:flex;gap:12px;cursor:pointer;background:#fff;min-width:0;transition:background .15s ease,border-color .15s ease}
.label-pick-card:hover{background:#f8fafc;border-color:#94a3b8}
.label-pick-card:has(input:checked){background:#eff6ff;border-color:#3b82f6}
.label-pick-checkbox{flex-shrink:0;margin-top:4px}
.label-pick-text{display:flex;flex-direction:column;min-width:0;gap:3px;overflow-wrap:anywhere}
.label-pick-text strong{font-size:.87rem}.label-pick-text small{font-size:.81rem}

.directory-tree{border:1px solid var(--app-border);border-radius:12px;background:#fcfdff;padding:14px 12px;overflow-x:auto}
.directory-tree ul{list-style:none;padding:0;margin:0}
.directory-tree-roots{display:grid;gap:7px}
.directory-tree-children{margin:6px 0 4px 15px!important;padding-left:15px!important;border-left:2px solid #dce5ef;display:grid;gap:5px}
.directory-tree-item{min-width:0}
.directory-tree-branch{position:relative}
.directory-tree-branch>summary{cursor:pointer;min-height:40px;padding:8px 88px 8px 12px;background:#f0f4f9;border-radius:8px;display:list-item;list-style-position:inside}
.directory-tree-branch>summary:hover{background:#e6eef8}
.directory-tree-branch>summary::marker{color:#607994}
.directory-tree-label{font-weight:600;overflow-wrap:anywhere}
.directory-tree-count{font-weight:400;font-size:.8rem;color:#64748b;margin-left:5px}
.directory-tree-edit{color:#2563eb;text-decoration:none;font-size:.83rem;white-space:nowrap}
.directory-tree-branch>.directory-tree-edit{position:absolute;right:10px;top:10px}
.directory-tree-leaf{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-height:38px;padding:7px 12px;border-radius:8px}
.directory-tree-leaf:hover{background:#f5f7fa}
.directory-tree-leaf-icon{font-size:20px;color:#94a3b8;line-height:1}
.directory-tree-leaf>.directory-tree-edit{margin-left:auto}
@media(max-width:575.98px){.directory-tree{padding:10px 7px}.directory-tree-children{margin-left:7px!important;padding-left:8px!important}.directory-tree-branch>summary{padding-right:78px}}

.attachment-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.attachment-tile{min-width:0;padding:12px;border:1px solid #e5e9ef;border-radius:10px}
.attachment-thumb{width:100%;height:115px;object-fit:contain;border-radius:6px;background:#f1f5f9}
.attachment-pdf-icon{height:115px;display:flex;align-items:center;justify-content:center;color:#b91c1c;font-weight:700;font-size:1.5rem;background:#fff1f2;border-radius:6px}
.attachment-tile a{overflow-wrap:anywhere}

/* v0.8: mobile tables are explicit expandable rows, no horizontal scroll. */
.compact-expand-list{display:grid;gap:9px}
.compact-expand-item{border:1px solid #dee6ef;border-radius:10px;background:#fff;min-width:0;overflow:hidden}
.compact-expand-item>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:13px 14px;min-height:56px;cursor:pointer;list-style:none}
.compact-expand-item>summary::-webkit-details-marker{display:none}
.compact-expand-item>summary:focus-visible{outline:2px solid #2563eb;outline-offset:-3px}
.compact-expand-item[open]>summary{border-bottom:1px solid #e5eaf0;background:#f8fafc}
.compact-expand-main{min-width:0;display:flex;flex-direction:column;gap:3px;overflow-wrap:anywhere}
.compact-expand-main strong{font-size:.94rem}
.compact-expand-sub{font-size:.8rem;color:#64748b}
.compact-expand-chevron{flex:none;color:#475569;font-size:1.25rem;line-height:1;transition:transform .16s ease}
.compact-expand-item[open] .compact-expand-chevron{transform:rotate(180deg)}
.compact-expand-extra{padding:14px}
.compact-expand-fields{margin:0;display:grid;gap:9px}
.compact-expand-fields>div{display:grid;grid-template-columns:90px minmax(0,1fr);gap:12px;align-items:start}
.compact-expand-fields dt{font-size:.81rem;font-weight:400;color:#64748b}
.compact-expand-fields dd{margin:0;min-width:0;font-size:.88rem;overflow-wrap:anywhere}
@media(prefers-reduced-motion:reduce){.compact-expand-chevron{transition:none}}


/* v0.15.1: compact equipment search, independently collapsible JSONB filters. */
.equipment-filter-bar{display:grid;grid-template-columns:minmax(0,1fr) minmax(170px,220px) minmax(230px,350px);gap:10px;align-items:start;margin-bottom:16px}
.equipment-filter-bar > *{min-width:0}
.equipment-filter-bar .form-control,.equipment-filter-bar .form-select{width:100%;min-width:0}
.equipment-filter-bar .ts-wrapper{min-width:0;width:100%;max-width:100%}
.equipment-filter-advanced{grid-column:1 / -1;border:1px solid var(--app-border);border-radius:10px;background:#fff;min-width:0}
.equipment-filter-summary{display:flex;align-items:center;gap:10px;padding:11px 14px;min-height:44px;cursor:pointer;list-style:none;color:#334155;font-size:.9rem}
.equipment-filter-summary::-webkit-details-marker{display:none}
.equipment-filter-summary:focus-visible{outline:2px solid #2563eb;outline-offset:2px}
.equipment-filter-advanced[open] .equipment-filter-summary{border-bottom:1px solid var(--app-border);background:#f8fafc;border-radius:10px 10px 0 0}
.equipment-filter-counter{font-size:.77rem;color:#1d4ed8;background:#eaf2ff;padding:2px 8px;border-radius:30px}
.equipment-filter-chevron{margin-left:auto;width:8px;height:8px;border-right:2px solid #64748b;border-bottom:2px solid #64748b;transform:rotate(45deg);transition:transform .15s}
.equipment-filter-advanced[open] .equipment-filter-chevron{transform:rotate(225deg)}
.equipment-filter-advanced-body{padding:14px;min-width:0}
.equipment-filter-advanced-body [data-spec-filters] > *{min-width:0}
.category-picker-option{display:flex;flex-direction:column;gap:2px;padding:7px 10px 7px calc(10px + var(--category-depth,0) * 13px);border-left:2px solid transparent;min-width:0}
.category-picker-option .category-picker-name{font-size:.9rem;line-height:1.3}
.category-picker-ancestors{font-size:.73rem;color:#64748b;line-height:1.3;overflow-wrap:anywhere}
.category-picker-selected{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}
.category-picker-selected .category-picker-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block}
.ts-wrapper .ts-control{min-width:0}
.ts-dropdown .active .category-picker-option{border-left-color:#2563eb}
@media(max-width:1199.98px){
  .equipment-filter-bar{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .equipment-filter-search{grid-column:1 / -1}
}
@media(max-width:575.98px){
  .equipment-filter-bar{grid-template-columns:minmax(0,1fr)}
  .equipment-filter-search{grid-column:auto}
}
@media(prefers-reduced-motion:reduce){.equipment-filter-chevron{transition:none}}
