:root { font: 15px system-ui, sans-serif; color: #eef4f5; background: #10202b; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; }
header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .85rem 1rem; background: #172e3d; }
header strong { font-size: 1.15rem; }
header span, #fileinfo, #notehint, #partdims, aside label { font-size: .85rem; color: #c5d7e4; }
main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 310px); gap: .9rem; padding: .9rem; }
.viewport { position: relative; }
#view { height: min(72dvh, 900px); min-height: 290px; touch-action: none; overflow: hidden; border-radius: 10px; background: #e8eff1; }
#view canvas { display: block; }
.viewport { scroll-margin-block: .65rem; }
#info { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem .8rem; padding: .55rem .15rem .1rem; overflow-wrap: anywhere; }
#dims { color: #c5d7e4; font-size: .85rem; }
#fileinfo:empty, #dims:empty { display: none; }
.workspace { min-width: 0; }
.toolbar { align-items: flex-start; }
.tool-group { min-inline-size: 0; }
.tool-group > summary { min-height: 44px; display: flex; align-items: center; gap: .45rem; padding: .55rem .75rem; border: 1px solid #587689; border-radius: 8px; background: #294b5e; }
.tool-group > summary::-webkit-details-marker { display: none; }
.tool-group > summary::after { content: ""; inline-size: .45rem; block-size: .45rem; border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: translateY(-.1rem) rotate(45deg); }
.tool-group[open] > summary::after { transform: translateY(.1rem) rotate(225deg); }
.tool-group > summary:focus-visible { outline: 2px solid #85d7f9; outline-offset: 2px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding-block: .5rem .15rem; }
.tool-actions > :is(button, .upload) { min-height: 44px; max-inline-size: 100%; text-align: start; }
html, .viewer-expanded .workspace { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html, .viewer-expanded .workspace { scroll-behavior: auto; }
}

#dims, #partdims { margin-top: .2rem; }
button, .upload, select { border: 1px solid #587689; background: #294b5e; color: white; padding: .58rem .7rem; border-radius: 8px; font: inherit; }
button, .upload { cursor: pointer; }
button:hover:not(:disabled), .upload:hover, button[aria-pressed=true] { background: #376680; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, textarea:focus-visible, select:focus-visible, .upload:focus-within { outline: 2px solid #85d7f9; outline-offset: 2px; }
.upload { position: relative; display: inline-block; }
.upload input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.toolbar, .controls { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin-top: .65rem; }
#status { min-height: 1.3em; font-size: .85rem; color: #b5d5e7; }
#status[role=alert] { color: #ffd9bd; }
aside { min-width: 0; }
aside details { background: #172e3d; border: 1px solid #476271; border-radius: 9px; padding: .8rem; margin-bottom: .65rem; }
summary { cursor: pointer; font-weight: 650; }
aside label { display: block; margin: .6rem 0 .3rem; }
select, textarea { width: 100%; }
textarea { min-height: 66px; resize: vertical; background: #eef4f5; color: #11232c; padding: .55rem; border-radius: 7px; border: 0; font: inherit; }
aside .check { display: flex; gap: .4rem; align-items: baseline; }
#notes { max-height: 14rem; overflow: auto; padding-left: 1.25rem; }
#notes li { padding: .25rem 0; overflow-wrap: anywhere; }
#notes small { display: block; color: #c5d7e4; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  main { display: block; padding: .65rem; }
  #view { height: 52dvh; }
  .toolbar, .controls { font-size: .9rem; }
}
#dimension-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#dimension-labels span { position: absolute; transform: translate(-50%, -50%); background: #fff3dd; color: #753313; border-radius: 5px; padding: .18rem .35rem; font-size: .76rem; white-space: nowrap; }
#dimension-summary { white-space: pre-line; font-size: .9rem; line-height: 1.45; }

#view-message { position: absolute; top: 42%; inset-inline: 8%; z-index: 2; margin: 0; padding: .8rem; border-radius: 8px; background: #172e3d; color: #fff; text-align: center; pointer-events: none; }

#component-search { width: 100%; padding: .65rem; border: 1px solid #587689; border-radius: 7px; font: inherit; }
#component-count { font-size: .8rem; color: #c5d7e4; margin: .35rem 0; }

.moving-filter { display: flex; align-items: center; gap: .5rem; min-height: 36px; }

/* Enlarge the model within the page, including in browsers without element fullscreen. */
body.viewer-expanded { overflow: hidden; }
.viewer-expanded header, .viewer-expanded main > aside { visibility: hidden; }
.viewer-expanded .workspace {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #10202b;
  padding: max(.6rem, env(safe-area-inset-top)) max(.6rem, env(safe-area-inset-right))
    max(.6rem, env(safe-area-inset-bottom)) max(.6rem, env(safe-area-inset-left));
}
.viewer-expanded #view { height: 75dvh; min-height: 150px; }

#project-qr-image { display: block; max-width: min(100%, 75vw); height: auto; }

#selection-caption {
  position: absolute; bottom: .45rem; left: .65rem; margin: 0; max-inline-size: calc(100% - 1.3rem);
  padding: .42rem .7rem; border-radius: 7px; background: #3a2418; color: #ffddad;
  font-weight: 700; pointer-events: none; overflow-wrap: anywhere;
}
#notes li { --author-color: #eef4f5; margin-block: .5rem; padding: .5rem .6rem; border-left: 3px solid var(--author-color); }
#notes li[data-role=client] { --author-color: #94d0ff; }
#notes li[data-role=designer] { --author-color: #dfc0ff; }
#notes li[data-role=production] { --author-color: #9bedc3; }
#notes li[data-role=owner], .note-reply { color: #ffdb9c; --author-color: #ffdb9c; }
.note-author, .note-text { color: var(--author-color); }
.note-text, .note-reply { font-size: 1rem; margin: .28rem 0 .5rem; white-space: pre-wrap; }
.note-reply { padding: .45rem .6rem; border-inline-start: 2px solid currentColor; font-weight: 500; }
.note-reply strong { display: block; }
#note-position, .note-saved-position { font-size: 1rem; margin: .42rem 0; font-weight: 700; overflow-wrap: anywhere; }
#choose-note-position { margin-top: .6rem; text-align: left; }
#new-notes-badge { display: inline-block; color: #152c3c; background: #ffdb9c; margin-left: .35rem; padding: .15rem .45rem; border-radius: .5rem; }

.toolbar { display: flex; align-items: flex-start; }
.tool-group, .tool-group[open] > summary { flex: 1 1 8.5rem; }
.tool-group[open] { display: contents; }
.tool-group[open] > .tool-actions { flex: 1 0 100%; order: 1; }
#exit-expanded { margin-bottom: .55rem; min-height: 44px; }
@media (max-width: 520px) {
  .tool-group, .tool-group[open] > summary { flex-basis: calc(50% - .45rem); }
}
