/* ============================================================
   SPECIMEN DESK — clinical workstation shell
   Shell only: surface, rail, icons, windows, taskbar, boot.
   Tokens live in tokens.css; note typography lives in note.css.
   ============================================================ */



/* ---------- reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bench);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input  { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: rgba(11, 224, 255, 0.28); }

/* ============================================================
   DESKTOP SURFACE
   Cleanroom floor: fine graph grid, soft cyan bloom top-left.
   ============================================================ */

#surface {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120vw 90vh at 8% -10%, rgba(0, 169, 196, 0.10), transparent 60%),
    radial-gradient(80vw 70vh at 100% 110%, rgba(12, 27, 36, 0.055), transparent 65%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--bench);
}

/* A faint horizon rule so the surface reads as a physical bench. */
#surface::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: var(--bar-h);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
  pointer-events: none;
}

/* ============================================================
   TOP RAIL — instrument panel
   ============================================================ */

#rail {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--rail-h);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  background: var(--glass-heavy);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--slate);
}

.rail-mark {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.rail-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 169, 196, 0.16);
}

.rail-sep {
  width: 1px;
  height: 13px;
  background: var(--rule-strong);
  flex: none;
}

.rail-stat { white-space: nowrap; }
.rail-stat b { color: var(--ink-mid); font-weight: 600; }

.rail-spacer { flex: 1; }

/* ---------- search field ---------- */

#searchWrap {
  position: relative;
  width: min(420px, 40vw);
  flex: none;
}

#search {
  width: 100%;
  height: 24px;
  padding: 0 30px 0 28px;
  background: rgba(12, 27, 36, 0.05);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--ink);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

#search::placeholder { color: var(--slate-light); letter-spacing: 0.06em; }

#search:focus {
  outline: none;
  background: #fff;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 169, 196, 0.15);
}

.search-icon {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  width: 12px; height: 12px;
  color: var(--slate-light);
  pointer-events: none;
}

.search-key {
  position: absolute;
  right: 7px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--slate-light);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 4px;
  pointer-events: none;
}

#search:focus ~ .search-key { opacity: 0; }

/* ---------- search results panel ---------- */

#results {
  position: fixed;
  top: calc(var(--rail-h) + 8px);
  z-index: 950;
  width: min(560px, 92vw);
  max-height: 62vh;
  overflow-y: auto;
  padding: 6px;
  background: var(--glass-heavy);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--lift-3);
  display: none;
}

#results.open { display: block; }

.result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.result:hover,
.result.active { background: rgba(0, 169, 196, 0.10); }

.result-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.result-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.result-path {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-light);
  margin-left: auto;
  white-space: nowrap;
}

.result-snip {
  font-family: var(--prose);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--slate);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-snip mark {
  background: rgba(11, 224, 255, 0.32);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}

.result-empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--slate);
  font-size: 13px;
}

.result-empty span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--slate-light);
  margin-top: 5px;
}

/* ============================================================
   DESKTOP ICONS
   ============================================================ */

#icons {
  position: fixed;
  top: calc(var(--rail-h) + 22px);
  left: 22px;
  bottom: calc(var(--bar-h) + 16px);
  width: 118px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.icon {
  width: 100%;
  padding: 10px 6px 9px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s, transform 0.14s var(--ease);
}

.icon:hover {
  background: var(--glass-thin);
  border-color: var(--rule);
}

.icon.selected {
  background: rgba(0, 169, 196, 0.13);
  border-color: rgba(0, 169, 196, 0.4);
}

.icon:active { transform: scale(0.97); }

.icon-art {
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  color: var(--cyan-deep);
  filter: drop-shadow(0 2px 4px rgba(12, 27, 36, 0.14));
}

.icon-art svg { width: 100%; height: 100%; }

.icon-label {
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  color: var(--ink);
  word-break: break-word;
}

.icon-count {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--slate-light);
}

/* New items land with a brief cyan pulse so re-indexing is visible. */
@keyframes land {
  from { opacity: 0; transform: translateY(6px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

.icon.fresh { animation: land 0.42s var(--ease) both; }

/* ============================================================
   WINDOWS — mac-style glass
   ============================================================ */

.win {
  position: fixed;
  min-width: 320px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(26px);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--lift-2);
  overflow: hidden;
  z-index: 100;
  animation: winopen 0.26s var(--ease) both;
}

@keyframes winopen {
  from { opacity: 0; transform: scale(0.965) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.win.focused {
  background: var(--glass-heavy);
  box-shadow: var(--lift-3);
  border-color: rgba(0, 169, 196, 0.34);
}

.win.minimised { display: none; }

.win.maximised {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.win.closing { animation: winclose 0.16s ease-in both; }

@keyframes winclose {
  to { opacity: 0; transform: scale(0.97); }
}

/* ---------- title bar ---------- */

.win-bar {
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.28));
  border-bottom: 1px solid var(--rule);
  cursor: grab;
  user-select: none;
}

.win-bar:active { cursor: grabbing; }

.lights { display: flex; gap: 7px; flex: none; }

.light {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(12, 27, 36, 0.16);
  transition: filter 0.14s;
  position: relative;
}

.light:hover { filter: brightness(1.1); }
.light-close { background: #FF5F57; }
.light-min   { background: #FEBC2E; }
.light-max   { background: #28C840; }

.win:not(.focused) .light { background: #C8D2D8; }

.win-icon {
  width: 17px; height: 17px;
  flex: none;
  color: var(--cyan-deep);
  display: grid;
  place-items: center;
}

.win-icon svg { width: 100%; height: 100%; }

.win-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-meta {
  margin-left: auto;
  flex: none;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-light);
  white-space: nowrap;
}

/* ---------- window body ---------- */

.win-body {
  flex: 1;
  position: relative;   /* containing block for absolutely-filled contents
                           such as the model viewer — without this they
                           resolve against .win and cover the title bar */
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.5);
}

.win-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.win-resize {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  z-index: 5;
}

.win-resize::before {
  content: "";
  position: absolute;
  right: 4px; bottom: 4px;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--slate-light);
  border-bottom: 1.5px solid var(--slate-light);
  border-radius: 0 0 2px 0;
}

.win.maximised .win-resize { display: none; }

/* ---------- folder window contents ---------- */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 4px;
  padding: 16px;
}

.file {
  padding: 12px 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: background 0.13s, border-color 0.13s;
}

.file:hover { background: rgba(0, 169, 196, 0.08); border-color: var(--rule); }
.file.selected { background: rgba(0, 169, 196, 0.15); border-color: rgba(0, 169, 196, 0.42); }

.file-art {
  width: 40px; height: 40px;
  color: var(--cyan-deep);
  display: grid;
  place-items: center;
}

.file-art svg { width: 100%; height: 100%; }

.file-name {
  font-size: 11.5px;
  line-height: 1.3;
  text-align: center;
  color: var(--ink);
  word-break: break-word;
}

.file-date {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.07em;
  color: var(--slate-light);
}

.folder-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--slate);
}

.folder-empty h4 {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink-mid);
}

.folder-empty p {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--slate-light);
}

/* ---------- scrollbars inside windows ---------- */

.win-body::-webkit-scrollbar { width: 11px; height: 11px; }
.win-body::-webkit-scrollbar-track { background: transparent; }
.win-body::-webkit-scrollbar-thumb {
  background: rgba(12, 27, 36, 0.18);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
.win-body::-webkit-scrollbar-thumb:hover { background: rgba(0, 169, 196, 0.5); background-clip: content-box; }

#results::-webkit-scrollbar { width: 9px; }
#results::-webkit-scrollbar-thumb {
  background: rgba(12, 27, 36, 0.16);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

/* ============================================================
   TASKBAR + START ORB (the signature element)
   ============================================================ */

#bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--bar-h);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--glass-heavy);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--rule);
}

#start {
  position: relative;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 32% 26%, #fff, var(--bench-deep));
  border: 1px solid var(--rule-strong);
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.9), var(--lift-1);
  transition: transform 0.16s var(--ease), box-shadow 0.16s;
}

#start:hover { transform: scale(1.05); }
#start:active { transform: scale(0.96); }
#start.open { box-shadow: inset 0 1px 3px rgba(255,255,255,0.9), 0 0 0 3px rgba(0,169,196,0.28); }

#start img,
#start .orb-fallback {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#start .orb-fallback {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--signal);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

/* The indexing ring: spins only while a scan is in flight. */
.orb-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}

.orb-ring circle {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 26 130;
  filter: drop-shadow(0 0 3px rgba(11, 224, 255, 0.8));
}

#start.scanning .orb-ring {
  opacity: 1;
  animation: ringspin 1s linear infinite;
}

@keyframes ringspin { to { transform: rotate(360deg); } }

/* ---------- open window buttons ---------- */

#tasks {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#tasks::-webkit-scrollbar { display: none; }

.task {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  max-width: 190px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--glass-thin);
  font-size: 12px;
  color: var(--ink-mid);
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.task:hover { background: #fff; }

.task.active {
  background: #fff;
  border-color: rgba(0, 169, 196, 0.45);
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(0, 169, 196, 0.12);
}

.task-icon { width: 14px; height: 14px; flex: none; color: var(--cyan-deep); }
.task-icon svg { width: 100%; height: 100%; }

.task-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#clock {
  flex: none;
  text-align: right;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--slate);
  line-height: 1.35;
}

#clock b { display: block; color: var(--ink); font-weight: 600; font-size: 12.5px; letter-spacing: 0.04em; }

/* ---------- start menu ---------- */

#menu {
  position: fixed;
  left: 14px;
  bottom: calc(var(--bar-h) + 8px);
  z-index: 950;
  width: 268px;
  padding: 8px;
  background: var(--glass-heavy);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--lift-3);
  display: none;
  animation: menuup 0.2s var(--ease) both;
}

#menu.open { display: block; }

@keyframes menuup {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 6px;
}

.menu-head strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.menu-head span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--slate-light);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
  color: var(--ink-mid);
  transition: background 0.12s, color 0.12s;
}

.menu-item:hover { background: rgba(0, 169, 196, 0.11); color: var(--ink); }

.menu-item svg { width: 15px; height: 15px; flex: none; color: var(--cyan-deep); }

.menu-item small {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  color: var(--slate-light);
}

/* ============================================================
   BOOT SEQUENCE
   Reflects the real scan result, not a fake progress bar.
   ============================================================ */

#boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bench);
  display: grid;
  place-items: center;
  transition: opacity 0.5s ease, visibility 0.5s;
}

#boot.done { opacity: 0; visibility: hidden; }

.boot-inner {
  width: min(400px, 84vw);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--slate);
}

.boot-mark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 18px;
}

.boot-line {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  opacity: 0;
  animation: bootline 0.3s ease forwards;
}

@keyframes bootline { to { opacity: 1; } }

.boot-line b { color: var(--cyan-deep); font-weight: 600; }
.boot-line i { margin-left: auto; font-style: normal; color: var(--slate-light); }

.boot-bar {
  height: 2px;
  margin-top: 18px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.boot-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--signal));
  transition: width 0.45s var(--ease);
}

/* ============================================================
   RESPONSIVE — below 780px the window metaphor stops helping
   ============================================================ */

@media (max-width: 780px) {
  #icons {
    left: 0; right: 0;
    top: calc(var(--rail-h) + 10px);
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 12px;
    align-content: flex-start;
  }

  .icon { width: 92px; }

  #searchWrap { width: auto; flex: 1; }
  .search-key { display: none; }
  .rail-stat, .rail-sep { display: none; }

  .win {
    left: 0 !important;
    right: 0;
    top: var(--rail-h) !important;
    width: 100% !important;
    height: calc(100dvh - var(--rail-h) - var(--bar-h)) !important;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .win-resize { display: none; }
  #clock b { font-size: 11px; }
  #clock span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  #start.scanning .orb-ring { opacity: 1; }
}

/* ============================================================
   MODEL VIEWER
   ============================================================ */

.viewer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(80% 70% at 50% 15%, rgba(255, 255, 255, 0.9), transparent 70%),
    linear-gradient(180deg, #F3F7F9, #E4EBEF);
}

.viewer-main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.viewer-stage {
  flex: 1;
  min-width: 0;
  position: relative;
  cursor: grab;
}

.viewer-stage:active { cursor: grabbing; }
.viewer-stage canvas { display: block; width: 100%; height: 100%; }

.viewer-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--slate);
  pointer-events: none;
}

.viewer-status.is-error { color: var(--amber); padding: 0 32px; text-align: center; }

/* ---------- hamburger ---------- */

.viewer-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--rule);
  background: var(--glass-heavy);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  color: var(--ink-mid);
  box-shadow: var(--lift-1);
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.viewer-menu svg { width: 17px; height: 17px; }
.viewer-menu:hover { background: #fff; color: var(--ink); border-color: var(--rule-strong); }

.viewer-menu.is-open {
  background: rgba(0, 169, 196, 0.14);
  border-color: rgba(0, 169, 196, 0.45);
  color: var(--cyan-deep);
}

/* ---------- details panel ---------- */

.viewer-panel {
  flex: none;
  width: 0;
  overflow: hidden;
  border-left: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  transition: width 0.26s var(--ease), border-color 0.26s;
}

.viewer.panel-open .viewer-panel {
  width: 272px;
  border-left-color: var(--rule);
}

/* Fixed inner width so text does not reflow during the slide. */
.viewer-panel-inner {
  width: 272px;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 46px 20px 24px;
}

.panel-eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan-deep);
  margin-bottom: 6px;
}

.panel-title {
  font-family: var(--ui);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--ink);
}

.panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-light);
}

.panel-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }

.panel-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-family: var(--prose);
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink-mid);
}

.panel-body > *:first-child { margin-top: 0; }
.panel-body p { margin: 0 0 12px; }
.panel-body ul, .panel-body ol { margin: 0 0 12px; padding-left: 18px; }
.panel-body li { margin-bottom: 5px; }
.panel-body li::marker { color: var(--cyan); }

.panel-body h2, .panel-body h3 {
  font-family: var(--ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--cyan-deep);
  margin: 16px 0 7px;
  border: 0;
  padding: 0;
}

.panel-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(12, 27, 36, 0.06);
  border-radius: 3px;
  padding: 1px 4px;
}

.panel-body pre {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--ink);
  color: #D6E6EC;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0 0 12px;
}

.panel-body pre code { background: none; padding: 0; color: inherit; }

.panel-body a { color: var(--cyan-deep); text-decoration: underline; text-underline-offset: 2px; }

.viewer-panel-inner::-webkit-scrollbar { width: 9px; }
.viewer-panel-inner::-webkit-scrollbar-thumb {
  background: rgba(12, 27, 36, 0.16);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

/* ---------- bottom control bar ---------- */

.viewer-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--glass-heavy);
  border-top: 1px solid var(--rule);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}

.viewer-dims {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--slate);
  white-space: nowrap;
}

.viewer-spacer { flex: 1; }

.viewer-btn {
  flex: none;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.7);
  font-size: 11.5px;
  color: var(--ink-mid);
  white-space: nowrap;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}

.viewer-btn:hover { background: #fff; border-color: var(--rule-strong); color: var(--ink); }

.viewer-btn.is-primary {
  border-color: rgba(0, 169, 196, 0.45);
  background: rgba(0, 169, 196, 0.1);
  color: var(--cyan-deep);
  font-weight: 500;
}

.viewer-btn.is-primary:hover { background: rgba(0, 169, 196, 0.18); }

/* Narrow windows: the panel covers the stage instead of squeezing it. */
@media (max-width: 620px) {
  .viewer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    background: var(--glass-heavy);
  }
  .viewer.panel-open .viewer-panel { width: 100%; }
  .viewer-panel-inner { width: 100%; }
  .viewer-bar { flex-wrap: wrap; }
  .viewer-dims { width: 100%; }
}

/* ============================================================
   CONTEXT MENU
   ============================================================ */

#context {
  position: fixed;
  z-index: 990;
  min-width: 184px;
  padding: 5px;
  background: var(--glass-heavy);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--rule);
  border-radius: 9px;
  box-shadow: var(--lift-3);
  display: none;
}

#context.open { display: block; animation: ctxin 0.12s var(--ease) both; }

@keyframes ctxin {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: none; }
}

#context hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 4px 6px;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 5px;
  font-size: 12.5px;
  text-align: left;
  color: var(--ink-mid);
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.ctx-item:hover { background: rgba(0, 169, 196, 0.12); color: var(--ink); }

.ctx-icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--cyan-deep);
}

.ctx-icon svg { width: 100%; height: 100%; }

@media (max-width: 780px) {
  .viewer-bar { flex-wrap: wrap; }
  .viewer-dims { width: 100%; }
}

/* ============================================================
   APP LAUNCHER WINDOWS
   The tool fills the window. The only chrome is the window's own
   title bar, so a framed app reads as an app, not as a document
   with a toolbar bolted on.
   ============================================================ */

.app-shell {
  position: absolute;
  inset: 0;
  background: #fff;
}

.app-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* No scrollbars around the frame — the tool does its own scrolling. */
.win.is-app-window .win-body { overflow: hidden; }

/* An app icon reads as something that runs, not something that opens. */
.file.is-app .file-art,
.icon.is-app .icon-art { position: relative; }

.file.is-app .file-art::after,
.icon.is-app .icon-art::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--bench);
  box-shadow: 0 0 0 1px rgba(0, 169, 196, 0.35);
  /* small play triangle */
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 100%, 0 0);
}

.file.is-app .file-date,
.icon.is-app .icon-count {
  color: var(--cyan-deep);
  letter-spacing: 0.12em;
}
