@font-face { font-family: "Michroma"; src: url("/static/Michroma-Regular.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
:root { --drawer: 308px; --bar: 66px; --orange: #f67704; --ink: #f5f4fa; --muted: #aaa6b4; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; color: var(--ink); background: #101010; font-family: proxima-nova, "Avenir Next", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
.viewer-shell { display: grid; grid-template-columns: var(--drawer) 1fr; }
.viewer-drawer { height: 100vh; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid #343434; background: #1b1b1b; z-index: 20; }
.drawer-brand { height: var(--bar); flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-bottom: 1px solid #343434; }
.drawer-brand a { display: flex; align-items: center; color: white; text-decoration: none; }
.drawer-brand .tiscan-wordmark { color: white; font-family: "Michroma", "Arial Black", sans-serif; font-size: 15px; font-weight: 400; line-height: 1; letter-spacing: .035em; white-space: nowrap; -webkit-text-stroke: .45px currentColor; }
.drawer-brand .tiscan-wordmark b { color: var(--orange); font: inherit; }
.drawer-brand button { display: none; border: 0; color: #aaa6b4; background: none; font-size: 25px; cursor: pointer; }
.drawer-project { padding: 20px 18px 16px; display: grid; gap: 4px; }
.drawer-project small { color: #8b8794; font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.drawer-project strong { font-size: 25px; letter-spacing: -.04em; }
.drawer-project span { color: var(--muted); font-size: 10px; }
.viewer-search { padding: 0 14px; }
.viewer-search span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.viewer-search input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid #3d3a45; border-radius: 8px; outline: none; color: #eeeef4; background: #292731; font-size: 11px; }
.viewer-search input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(246,119,4,.14); }
.viewer-search input::placeholder { color: #7d7986; }
.viewer-filters { display: flex; gap: 6px; padding: 11px 14px; overflow-x: auto; scrollbar-width: none; }
.viewer-filters::-webkit-scrollbar { display: none; }
.viewer-filters button { height: 27px; padding: 0 9px; border: 1px solid #3d3a45; border-radius: 99px; color: #aaa6b4; background: transparent; font-size: 9px; white-space: nowrap; cursor: pointer; }
.viewer-filters button.active { border-color: var(--orange); color: white; background: #9a4900; }
.sheet-list { min-height: 0; flex: 1; overflow-y: auto; border-top: 1px solid #34313c; scrollbar-color: #4d4957 #1d1b23; scrollbar-width: thin; }
.sheet-list button { width: 100%; min-height: 62px; display: grid; grid-template-columns: 28px 1fr; gap: 9px; align-items: center; padding: 9px 13px; border: 0; border-bottom: 1px solid #302e37; color: #bcb8c5; background: transparent; text-align: left; cursor: pointer; }
.sheet-list button:hover { background: #24222b; }
.sheet-list button.active { color: white; background: #302d29; box-shadow: inset 3px 0 var(--orange); }
.sheet-list button > span { color: #6f6b78; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sheet-list button.active > span { color: #ffac62; }
.sheet-list i { min-width: 0; display: flex; flex-direction: column; gap: 3px; font-style: normal; }
.sheet-list strong { overflow: hidden; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.sheet-list small { overflow: hidden; color: #77737f; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.sheet-list button.active small { color: #a39faa; }

.viewer-main { min-width: 0; height: 100vh; display: grid; grid-template-rows: var(--bar) minmax(0, 1fr) 28px; }
.viewer-topbar { display: grid; grid-template-columns: 1fr minmax(220px, 1.2fr) 1fr; align-items: center; padding: 0 13px; border-bottom: 1px solid #34313c; background: #1b1920; z-index: 10; }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions { justify-content: flex-end; }
.icon-button, .fit-button, .pdf-button { height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #403d48; border-radius: 8px; color: #d4d1dc; background: #24222a; text-decoration: none; cursor: pointer; }
.icon-button { width: 34px; font-size: 18px; }
.fit-button { padding: 0 12px; font-size: 10px; font-weight: 700; }
.pdf-button { padding: 0 12px; border-color: var(--orange); color: white; background: var(--orange); font-size: 10px; font-weight: 750; }
.pdf-button span { margin-left: 7px; }
.icon-button:hover, .fit-button:hover { border-color: #676270; background: #302e37; }
.pdf-button:hover { background: #d85f00; }
.menu-button { display: none; font-size: 15px; }
.project-return { display: flex; align-items: center; gap: 7px; color: #d4d1dc; text-decoration: none; font-size: 11px; }
.project-return span { color: #807c89; }
.sheet-position { padding-left: 9px; border-left: 1px solid #45414c; color: #817d89; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sheet-identity { min-width: 0; display: flex; flex-direction: column; gap: 3px; text-align: center; }
.sheet-identity small { color: #817d89; font-size: 8px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.sheet-identity strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.drawing-stage { min-height: 0; position: relative; overflow: hidden; background-color: #242229; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 24px 24px; cursor: grab; touch-action: none; }
.drawing-stage.dragging { cursor: grabbing; }
.drawing-stage > img { position: absolute; top: 50%; left: 50%; max-width: none; max-height: none; opacity: 0; user-select: none; transform-origin: center; box-shadow: 0 12px 60px rgba(0,0,0,.44); transition: opacity .16s ease; will-change: transform; }
.drawing-stage > img.ready { opacity: 1; }
.stage-loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; color: #9a96a3; font-size: 10px; letter-spacing: .04em; z-index: 2; }
.stage-loader[hidden] { display: none; }
.stage-loader i { width: 22px; height: 22px; border: 2px solid #4a4652; border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.edge-nav { position: absolute; top: 0; bottom: 0; width: 76px; border: 0; color: white; background: transparent; cursor: pointer; opacity: .25; transition: opacity .15s, background .15s; z-index: 4; }
.edge-nav:hover { opacity: 1; background: linear-gradient(90deg, rgba(0,0,0,.19), transparent); }
.edge-nav.next:hover { background: linear-gradient(-90deg, rgba(0,0,0,.19), transparent); }
.edge-nav.previous { left: 0; }
.edge-nav.next { right: 0; }
.edge-nav span { width: 34px; height: 48px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.2); border-radius: 9px; background: rgba(24,22,28,.76); font-size: 31px; font-weight: 250; }
.zoom-readout { position: absolute; right: 13px; bottom: 12px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.11); border-radius: 6px; color: #bdb9c4; background: rgba(23,21,27,.78); font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; z-index: 4; }
.viewer-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 13px; border-top: 1px solid #34313c; color: #77737f; background: #1b1920; font-size: 8px; }
.viewer-footer span:first-child { color: #aaa6b3; }
.drawer-scrim { display: none; }

@media (max-width: 900px) {
  .viewer-shell { display: block; }
  .viewer-drawer { width: min(86vw, 340px); position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-105%); box-shadow: 20px 0 70px rgba(0,0,0,.45); transition: transform .22s ease; }
  .drawer-open .viewer-drawer { transform: translateX(0); }
  .drawer-brand button { display: block; }
  .drawer-scrim { position: fixed; inset: 0; display: block; visibility: hidden; opacity: 0; background: rgba(9,8,11,.6); transition: opacity .22s, visibility .22s; z-index: 15; }
  .drawer-open .drawer-scrim { visibility: visible; opacity: 1; }
  .menu-button { display: inline-flex; }
  .viewer-topbar { grid-template-columns: 1fr minmax(160px, 1fr) 1fr; }
  .project-return span, .project-return b { display: none; }
}

@media (max-width: 600px) {
  :root { --bar: 58px; }
  .viewer-topbar { grid-template-columns: auto 1fr auto; gap: 6px; padding-inline: 8px; }
  .sheet-position, .topbar-actions .icon-button, .topbar-actions .fit-button { display: none; }
  .sheet-identity { padding-inline: 5px; }
  .sheet-identity strong { max-width: 48vw; }
  .pdf-button { height: 32px; padding-inline: 10px; }
  .edge-nav { width: 50px; opacity: .45; }
  .edge-nav span { width: 29px; height: 42px; }
  .viewer-footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
