/* Existing VIVA palette and local assets; scoped to the records workspace. */
.records-page {
  --records-ink: #183349;
  --records-blue: #235a7e;
  --records-soft: #eaf0f4;
  --records-muted: #627383;
  --records-line: #dce3e8;
  --records-paper: #f7f9fa;
  background: var(--records-paper);
  color: var(--records-ink);
  min-height: 100dvh;
  font-variant-numeric: tabular-nums;
}
.records-page [hidden] { display: none !important; }
.records-page button, .records-page input, .records-page select, .records-page textarea { font: inherit; }
.records-page button, .records-page a, .records-page summary { -webkit-tap-highlight-color: transparent; }
.records-page button { cursor: pointer; }
.records-page button:disabled { cursor: wait; opacity: .55; }
.records-page :focus-visible { outline: 3px solid #4a8fb8; outline-offset: 3px; }
.records-page .records-header {
  position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1rem 2rem 1rem 5rem; background: #fff; color: var(--records-ink); box-shadow: none; text-align: left;
}
.records-brand { display: flex; align-items: center; }
.records-brand img { width: 11.5rem; height: auto; }
.records-header .header-content > p { font-size: .8rem; color: var(--records-muted); opacity: 1; }
.records-page .records-nav { padding: 0 2rem 0 5rem; overflow-x: auto; gap: 1.4rem; box-shadow: none; z-index: 10; }
.records-nav .nav-btn { flex: 0 0 auto; padding: .85rem .2rem; font-size: .85rem; white-space: nowrap; }
.records-nav .nav-btn.active { color: var(--records-blue); border-bottom-color: var(--records-blue); background: transparent; }
.records-layout { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); max-width: 100rem; margin: auto; padding: 0; }
.records-library { border-right: 1px solid var(--records-line); padding: 1.8rem 1.25rem; min-height: calc(100dvh - 8rem); }
.records-library-heading, .records-section-heading, .records-workspace-heading, .records-result-row, .records-dialog-heading, .records-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.records-library-heading { margin-bottom: 1rem; }
.records-library h2 { font-size: 1rem; letter-spacing: -.02em; }
.records-section-heading { margin: 1.8rem 0 .65rem; }
.records-section-heading h3 { font-size: .78rem; font-weight: 600; color: var(--records-muted); }
.records-tree-button { display: flex; align-items: center; justify-content: space-between; gap: .7rem; width: 100%; border: 0; background: transparent; border-radius: .35rem; padding: .7rem .65rem; text-align: left; color: var(--records-ink); font-size: .86rem !important; transition: background .18s, color .18s; }
.records-tree-button:hover { background: #eaf0f4; }
.records-tree-button.is-active { background: #e3edf3; color: #174f76; font-weight: 600; }
.records-tree-button > span:first-child { overflow-wrap: anywhere; }
.records-quick-links .records-tree-button > span:last-child { color: var(--records-muted); font-size: .75rem; }
.records-site-group { padding: .4rem 0 .65rem; border-bottom: 1px solid var(--records-line); }
.records-site-label { display: flex; gap: .4rem; align-items: center; }
.records-site-label .records-tree-button { font-weight: 600; }
.records-site-label small { display: block; color: var(--records-muted); font-weight: 400; font-size: .72rem; margin-top: .1rem; }
.records-asset-target { margin: .15rem 0 0 .7rem; padding-left: .9rem; width: calc(100% - .7rem); border-left: 1px solid #cbd6de; border-radius: 0 .35rem .35rem 0; font-size: .8rem !important; }
.records-asset-target small { color: var(--records-muted); font-size: .68rem; display: block; }
.records-add-asset { margin: .4rem 0 .2rem 1.65rem; }
.records-tree-hint { font-size: .73rem; line-height: 1.65; color: var(--records-muted); margin: 1.1rem .6rem 0; }
.records-page .records-mobile-tree { display: none; }
.records-workspace { position: relative; min-width: 0; padding: 2rem clamp(1.2rem, 3vw, 3rem) 6rem; }
.records-workspace-heading { align-items: flex-start; margin-bottom: 1.9rem; }
.records-workspace h1 { font-size: clamp(1.6rem, 2.7vw, 2.2rem); line-height: 1.3; letter-spacing: -.045em; font-weight: 650; margin: .25rem 0 .55rem; }
.records-eyebrow { font-size: .7rem; color: var(--records-muted); letter-spacing: .08em; }
.records-muted { color: var(--records-muted); font-size: .87rem; line-height: 1.7; }
.records-small { font-size: .75rem; color: var(--records-muted); line-height: 1.7; }
.records-button, .records-icon-button, .records-text-button { border: 0; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 500; transition: background .18s, color .18s, transform .18s; }
.records-button { min-height: 2.65rem; padding: .55rem .95rem; border-radius: .4rem; background: #e7edf1; color: var(--records-ink); font-size: .84rem !important; white-space: nowrap; }
.records-button:hover { background: #dce7ef; }
.records-button:active, .records-icon-button:active { transform: translateY(1px); }
.records-button.records-primary { background: var(--records-blue); color: #fff; }
.records-button.records-primary:hover { background: #184b70; }
.records-button.records-danger { background: #f8e7e4; color: #a13226; }
.records-button.records-danger:hover { background: #f1d0ca; }
.records-text-button { min-height: 2.3rem; padding: .3rem .15rem; background: transparent; color: var(--records-blue); font-size: .77rem !important; }
.records-text-button:hover { color: #133d5b; text-decoration: underline; }
.records-icon-button { width: 2.55rem; height: 2.55rem; flex-shrink: 0; background: transparent; color: var(--records-muted); font-size: 1.35rem !important; border-radius: .4rem; }
.records-icon-button:hover { background: var(--records-soft); color: var(--records-ink); }
.records-filters { padding-bottom: 1.25rem; border-bottom: 1px solid var(--records-line); }
.records-search-row { display: flex; gap: .55rem; align-items: center; }
.records-search-label { flex: 1; }
.records-page .records-filters input, .records-page .records-filters select, .records-page .records-form input, .records-page .records-form select, .records-page .records-form textarea {
  width: 100%; min-width: 0; padding: .62rem .75rem; border: 1px solid #d0dae2; border-radius: .35rem; color: var(--records-ink); background: #fff; font-size: .85rem; line-height: 1.5;
}
.records-page input::placeholder, .records-page textarea::placeholder { color: #84919c; opacity: 1; }
.records-search-row input { min-height: 2.7rem; }
.records-filter-row { display: flex; align-items: end; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.records-filter-row > label { flex: 1 1 10rem; max-width: 18rem; display: grid; gap: .3rem; font-size: .72rem; color: var(--records-muted); }
.records-more-filters { position: relative; font-size: .8rem; }
.records-more-filters summary { cursor: pointer; padding: .7rem .35rem; color: var(--records-blue); }
.records-date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; width: min(24rem, calc(100vw - 3rem)); background: #fff; padding: 1rem; border: 1px solid var(--records-line); border-radius: .4rem; box-shadow: 0 .5rem 2rem #18334914; position: absolute; top: 100%; right: 0; z-index: 15; }
.records-date-fields label { display: grid; gap: .35rem; font-size: .75rem; }
.records-date-fields label:nth-child(3), .records-date-fields p { grid-column: 1 / -1; }
.records-result-row { margin: 1.15rem 0; font-size: .79rem; color: var(--records-muted); flex-wrap: wrap; }
.records-select-all { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.records-page input[type="checkbox"] { accent-color: var(--records-blue); width: 1.1rem; height: 1.1rem; }
.records-selection-bar { position: sticky; top: 3.3rem; z-index: 9; display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; padding: .65rem .9rem; margin-bottom: 1rem; background: #e1ecf2; border-radius: .4rem; font-size: .82rem; box-shadow: 0 4px 14px #1833490b; }
.records-selection-bar strong { margin-right: auto; }
.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1.4rem 1rem; }
.records-photo { min-width: 0; position: relative; border-radius: .45rem; outline: 2px solid transparent; outline-offset: 4px; transition: outline-color .18s; }
.records-photo.is-selected { outline-color: var(--records-blue); }
.records-photo.is-dragging { opacity: .45; }
.records-photo-open { display: block; width: 100%; background: transparent; color: inherit; border: 0; text-align: left; border-radius: .4rem; }
.records-thumbnail { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border-radius: .4rem; overflow: hidden; background: #e5eaed; }
.records-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform .22s; }
.records-photo-open:hover .records-thumbnail img { transform: scale(1.025); }
.records-media-fallback { font-size: .8rem; color: var(--records-muted); text-align: center; padding: 1.5rem; }
.records-photo-select { position: absolute; top: .5rem; left: .5rem; padding: .25rem; width: 1.8rem; height: 1.8rem; border-radius: .3rem; background: #ffffffed; z-index: 1; display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 4px #18334914; }
.records-pending-tag { position: absolute; top: .6rem; right: .6rem; background: #fff8e8; color: #76561e; border-radius: .2rem; font-size: .65rem; padding: .2rem .4rem; }
.records-photo-text { padding: .65rem .1rem .1rem; }
.records-photo-title { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.records-photo-caption { font-size: .76rem; color: var(--records-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .2rem; }
.records-photo-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .45rem; font-size: .66rem; color: var(--records-muted); }
.records-photo-reference { font-size: .65rem; color: #6b7c88; margin-top: .25rem; overflow-wrap: anywhere; }
.records-state { text-align: center; padding: 4.5rem 1rem; max-width: 32rem; margin: auto; }
.records-state h2 { font-size: 1.1rem; margin-bottom: .7rem; font-weight: 600; }
.records-state p { color: var(--records-muted); font-size: .85rem; line-height: 1.8; }
.records-state button { margin-top: 1.2rem; }
.records-skeleton { border-radius: .4rem; background: #e5eaed; aspect-ratio: 4 / 3; animation: records-pulse 1.5s ease-in-out infinite alternate; }
@keyframes records-pulse { to { opacity: .45; } }
.records-notice { margin-top: 1rem; padding: .85rem 1rem; background: #e6eef4; font-size: .82rem; border-left: 3px solid #5d829a; border-radius: .2rem; }
.records-notice.is-error, .records-form-error { color: #963e37; background: #fff0ed; }
.records-notice.is-error { border-left-color: #a3554d; }
.records-load-more { display: flex; margin: 2rem auto; }
.records-file-drop { position: absolute; inset: .5rem; display: grid; place-items: center; z-index: 20; background: #e7f0f6ed; border: 2px dashed #4f7f9f; border-radius: .5rem; font-size: 1.2rem; pointer-events: none; }
.records-tree-button.is-drop-valid { box-shadow: inset 0 0 0 1px #8eb1c7; }
.records-tree-button.is-drop-over { background: #d1e5ee; box-shadow: inset 0 0 0 2px var(--records-blue); }
.records-tree-button.is-drop-over::after { content: attr(data-drop-count) " 張"; font-size: .7rem; color: var(--records-blue); white-space: nowrap; }
.records-tree-button.is-drop-invalid { opacity: .4; }
.records-undo { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 1rem; z-index: 30; background: #213c50; color: #fff; box-shadow: 0 .4rem 1.7rem #18334925; border-radius: .45rem; padding: .8rem 1rem; max-width: calc(100vw - 2rem); font-size: .82rem; }
.records-undo button { border: 0; background: transparent; color: #d2e7f4; font-size: .82rem; padding: .35rem; white-space: nowrap; text-decoration: underline; }
.records-dialog { margin: auto; padding: 0; border: 0; border-radius: .7rem; width: min(42rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; background: #fff; color: var(--records-ink); box-shadow: 0 1.5rem 5rem #152e4b30; }
.records-dialog::backdrop { background: #132a3d66; }
.records-dialog-heading { padding: 1.3rem 1.6rem 1rem; border-bottom: 1px solid var(--records-line); }
.records-dialog-heading h2 { font-size: 1.15rem; font-weight: 600; margin-top: .2rem; }
.records-form { display: grid; gap: 1rem; padding: 1.4rem 1.6rem 1.6rem; }
.records-form > label, .records-form-pair > label, #catalog-equipment-fields > label { display: grid; gap: .4rem; font-size: .78rem; font-weight: 500; }
.records-form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.records-form .records-small { margin-top: -.45rem; }
.records-form-error { padding: .75rem; border-radius: .3rem; font-size: .8rem; }
.records-form-footer { border-top: 1px solid var(--records-line); padding-top: 1rem; }
.records-upload-zone { border: 1px dashed #9fb2c1; border-radius: .4rem; text-align: center; padding: 1.5rem 1rem; background: #f6f9fa; }
.records-upload-zone > p { font-size: .81rem; }
.records-upload-zone .records-file-button { margin: .7rem 0 1rem; cursor: pointer; position: relative; overflow: hidden; }
.records-file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.records-upload-zone.is-drop-over { background: #dcecf4; border-color: var(--records-blue); }
.records-staged-files { list-style: none; max-height: 15rem; overflow: auto; }
.records-staged-files li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--records-line); font-size: .78rem; }
.records-staged-files li span { overflow-wrap: anywhere; min-width: 0; }
.records-staged-files small { display: block; color: var(--records-muted); }
.records-staged-files .is-invalid, .records-staged-files .is-invalid small { color: #963e37; }
.records-inline-note { background: #f7f0df; color: #76561e; border-radius: .3rem; padding: .8rem; font-size: .8rem; }
.records-small-dialog { max-width: 30rem; }
#catalog-equipment-fields { display: grid; gap: 1rem; }
.records-detail-dialog { margin: 0 0 0 auto; width: min(35rem, 100vw); height: 100dvh; max-height: 100dvh; border-radius: 0; }
.records-detail-media { background: #e8edf0; min-height: 10rem; display: grid; place-items: center; }
.records-detail-media img { display: block; width: 100%; max-height: 25rem; object-fit: contain; }
.records-detail-body { padding: 1.3rem 1.5rem 3rem; }
.records-detail-location { font-size: 1rem; font-weight: 600; }
.records-detail-location small { font-size: .77rem; display: block; font-weight: 400; margin-top: .25rem; color: var(--records-muted); }
.records-detail-actions { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.records-detail-body .records-form { padding: 1.1rem 0 1.5rem; border-top: 1px solid var(--records-line); }
.records-detail-body .records-section-heading { margin: .35rem 0 -.5rem; }
.records-reading-row { display: grid; grid-template-columns: 1.4fr .85fr .7fr auto; align-items: end; gap: .45rem; margin-bottom: .7rem; }
.records-reading-row label { font-size: .68rem; display: grid; gap: .25rem; color: var(--records-muted); min-width: 0; }
.records-reading-row input { padding: .5rem !important; }
.records-history { border-top: 1px solid var(--records-line); padding-top: 1.5rem; }
.records-history h3 { font-size: .9rem; }
.records-history-entry { padding: 1rem 0; border-bottom: 1px solid var(--records-line); font-size: .77rem; }
.records-history-entry strong { font-weight: 600; }
.records-history-entry p { color: var(--records-muted); margin-top: .35rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.records-sr-only, .records-skip { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.records-skip:focus { clip-path: none; width: auto; height: auto; margin: 0; top: .5rem; left: .5rem; z-index: 3000; background: #fff; padding: .7rem; }
@media (max-width: 1000px) {
  .records-layout { grid-template-columns: 14rem minmax(0, 1fr); }
  .records-library { padding-inline: .75rem; }
  .records-grid { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
}
@media (max-width: 700px) {
  .records-page .records-header { padding: .9rem 1rem .9rem 4.4rem; }
  .records-brand img { width: 9.2rem; }
  .records-header .header-content > p { display: none; }
  .records-header .header-content { font-size: .7rem; }
  .records-page .records-nav { padding: 0 1rem 0 4.4rem; gap: 1.3rem; }
  .records-layout { display: block; }
  .records-library { min-height: 0; padding: .75rem 1rem; border-right: 0; border-bottom: 1px solid var(--records-line); }
  .records-library-heading { margin: 0; }
  .records-library h2 { font-size: .85rem; }
  .records-page .records-mobile-tree { display: inline-flex; }
  #library-content[data-open="false"] { display: none; }
  #library-content { padding-top: .7rem; }
  .records-workspace { padding: 1.4rem 1rem 6rem; }
  .records-workspace-heading { gap: .8rem; margin-bottom: 1.2rem; }
  .records-workspace-heading .records-button { padding-inline: .7rem; font-size: .77rem !important; margin-top: .45rem; }
  .records-workspace h1 { font-size: 1.6rem; }
  .records-workspace-heading .records-muted { font-size: .77rem; max-width: 16rem; }
  .records-filter-row { gap: .65rem; }
  .records-filter-row > label { flex-basis: calc(50% - .5rem); min-width: 0; }
  .records-more-filters { position: static; }
  .records-filters { position: relative; }
  .records-date-fields { top: 100%; right: 0; left: 0; width: 100%; }
  .records-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem .75rem; }
  .records-photo-title { font-size: .79rem; }
  .records-photo-caption { font-size: .7rem; }
  .records-photo-meta { font-size: .64rem; }
  .records-selection-bar { top: 3.25rem; gap: .65rem; padding: .6rem; }
  .records-selection-bar .records-button { padding: .45rem .65rem; }
  .records-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); border-radius: .5rem; }
  .records-dialog-heading { padding: 1rem; }
  .records-form { padding: 1rem; gap: .85rem; }
  .records-form-pair { gap: .65rem; }
  .records-detail-dialog { width: 100vw; max-height: 100dvh; border-radius: 0; }
  .records-detail-body { padding: 1rem 1rem 3rem; }
  .records-reading-row { grid-template-columns: 1.3fr .8fr .7fr auto; gap: .35rem; }
  .records-undo { bottom: .7rem; gap: .6rem; width: max-content; }
}
@media (prefers-reduced-motion: reduce) {
  .records-page *, .records-page *::before, .records-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
