/* Identidade da 4i Engenharia (4ieng.com.br): branco, marinho e vermelho;
   Archivo larga nos titulos, Inter no texto, JetBrains Mono nos rotulos. */

@font-face {
  font-family: "Archivo";
  src: url("../vendor/fonts/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

@view-transition { navigation: auto; }

::view-transition-group(model-cover) { animation-duration: 0.45s; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }

:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f4f6f9;
  --panel-2: #e9edf3;
  --line: #e3e7ee;
  --line-strong: #cdd3dd;
  --ink: #0b1626;
  --text: #0b1626;
  --muted: #5b6476;
  --navy: #00295a;
  --red: #ec2224;
  --red-dark: #c8161a;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 1px 2px rgb(11 22 38 / 0.05), 0 8px 24px rgb(11 22 38 / 0.07);
  --shadow-lift: 0 2px 4px rgb(11 22 38 / 0.06), 0 16px 36px rgb(11 22 38 / 0.12);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.label {
  color: var(--muted);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.label.red { color: var(--red); }
.muted { color: var(--muted); }
.dim { opacity: 0.7; }
.spacer { flex: 1; }

.logo { display: block; height: 38px; width: auto; }

.btn, .tool {
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 600 13px/1.3 var(--sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s var(--spring), box-shadow 0.15s;
}

.btn:hover, .tool:hover { border-color: var(--ink); }
.btn:active, .tool:active, .cta:active, .play:active, .icon-btn:active { transform: scale(0.97); }
.tool[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { border-color: var(--red); background: var(--red); color: #fff; }
.btn.danger:hover { background: var(--red-dark); border-color: var(--red-dark); }

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font: 700 14px/1 var(--sans);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s var(--spring), box-shadow 0.2s;
}

.cta svg { width: 16px; height: 16px; }
.cta:hover { background: var(--red-dark); box-shadow: 0 8px 20px rgb(236 34 36 / 0.25); }

/* seletores: o fundo desliza entre as opcoes (ver js/ui.js) */
.seg {
  position: relative;
  display: flex;
  flex: none;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
}

.seg button {
  position: relative;
  z-index: 1;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 600 12.5px/1.4 var(--sans);
  cursor: pointer;
  transition: color 0.15s;
}

.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: #fff; }

.slide-thumb {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 6px;
  background: var(--navy);
  pointer-events: none;
}

input[type="search"], .home select, #speed, .cut-panel select {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

input[type="search"]:focus { outline: 2px solid var(--navy); outline-offset: -1px; border-color: transparent; }

input[type="range"] {
  --fill: 0%;
  appearance: none;
  height: 18px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--navy) var(--fill), var(--panel-2) var(--fill));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 1px var(--line-strong);
}

input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--panel-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--navy); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 3px solid #fff; border-radius: 50%; background: var(--red); }

.bar { height: 3px; border-radius: 2px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width 0.3s var(--spring); }

/* ---------------------------------------------------------- biblioteca */

.home-page { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: auto; min-height: 100%; }

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.brand { display: block; padding: 2px 4px 6px; }
.brand .logo { height: 46px; }
.rail .cta { width: 100%; }

.rail-nav { position: relative; display: grid; gap: 2px; }

.rail-nav .slide-thumb { background: var(--panel); border-radius: 8px; }

.rail-nav button {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s;
}

.rail-nav button:hover { color: var(--ink); }
.rail-nav button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.rail-nav span { font: 500 12px/1.6 var(--mono); color: var(--muted); }

.rail-stats { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; margin: auto 0 0; padding: 14px 12px; border: 1px solid var(--line); border-radius: 12px; }
.rail-stats dt { color: var(--muted); font-size: 12.5px; }
.rail-stats dd { margin: 0; font: 600 12.5px/1.5 var(--mono); text-align: right; }

.home { min-width: 0; }

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(58vh, 540px);
  padding: 48px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

#cloud { position: absolute; inset: 0 0 0 44%; width: 56%; height: 100%; }

.hero-copy { position: relative; display: grid; gap: 14px; max-width: 600px; }

.hero h1 {
  margin: 0;
  color: var(--ink);
  font: 760 clamp(34px, 4.6vw, 60px)/1.04 var(--display);
  font-stretch: 125%;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero h1 em { color: var(--red); font-style: normal; }
.hero h1 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hero h1 .w > span { display: inline-block; }

.hero p { margin: 0; max-width: 48ch; color: var(--muted); font-size: 16px; }
.hero code { color: var(--ink); font: 500 14px var(--mono); }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 8px; }

.hero-readout {
  position: absolute;
  right: 40px;
  bottom: 24px;
  display: flex;
  gap: 24px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  text-align: right;
}

.hero-readout b { display: block; color: var(--ink); font: 760 22px/1.1 var(--display); font-stretch: 112%; font-variant-numeric: tabular-nums; }

.library { padding: 28px 48px 72px; background: var(--panel); min-height: 50vh; }

.library-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.library-bar h2 { margin: 0 auto 0 0; font: 760 24px/1.2 var(--display); font-stretch: 118%; letter-spacing: -0.015em; }
.library-bar input { width: 230px; max-width: 100%; }

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: transform 0.25s var(--spring), box-shadow 0.25s, border-color 0.2s;
}

.card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lift); }

.card-cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #fff;
}

.card-cover img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.5s var(--spring); }
.card:hover .card-cover img { transform: scale(1.035); }

/* marcas de enquadramento, como as de um desenho tecnico */
.card-cover::after {
  content: "";
  position: absolute;
  inset: 12px;
  opacity: 0;
  background:
    linear-gradient(var(--red), var(--red)) 0 0 / 16px 2px no-repeat,
    linear-gradient(var(--red), var(--red)) 0 0 / 2px 16px no-repeat,
    linear-gradient(var(--red), var(--red)) 100% 100% / 16px 2px no-repeat,
    linear-gradient(var(--red), var(--red)) 100% 100% / 2px 16px no-repeat;
  transition: opacity 0.2s, inset 0.3s var(--spring);
}

.card:hover .card-cover::after { inset: 8px; opacity: 1; }

.card-tags { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 4px; }

.badge {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--navy);
  color: #fff;
  font: 500 10.5px/1.6 var(--mono);
}

.card-body { display: grid; gap: 2px; padding: 12px 16px 14px; min-width: 0; border-top: 1px solid var(--line); }
.card-body h3 { margin: 0 0 3px; overflow: hidden; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.card-body p { margin: 0; }
.card-body .label { text-transform: none; letter-spacing: 0; font-size: 11.5px; }

.card-rename { width: 100%; padding: 3px 6px; border: 1px solid var(--navy); border-radius: 6px; font-size: 15px; }

.card-actions {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }

.card-action {
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.card-action:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.card-action[aria-pressed="true"] { color: var(--red); }
.card-action[aria-pressed="true"]:hover { color: #fff; }

.grid[data-layout="list"] { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.grid[data-layout="list"] .card { flex-direction: row; align-items: center; }
.grid[data-layout="list"] .card-cover { width: 104px; flex: none; }
.grid[data-layout="list"] .card-cover::after { display: none; }
.grid[data-layout="list"] .card-tags { display: none; }
.grid[data-layout="list"] .card-body { flex: 1; padding: 8px 130px 8px 14px; border-top: 0; border-left: 1px solid var(--line); }
.grid[data-layout="list"] .card-actions { top: 50%; translate: 0 -50%; opacity: 1; }

.card.job .card-cover { background: var(--panel); }
.card.job .bar { margin-top: 6px; }

.scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(0 41 90 / 0.08) 50%, transparent 70%);
  animation: scan 1.6s linear infinite;
}

@keyframes scan { from { translate: -100% 0; } to { translate: 100% 0; } }

.empty { margin: 48px auto; max-width: 44ch; color: var(--muted); text-align: center; }

.queue {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  width: 340px;
  max-width: calc(100vw - 40px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-lift);
}

.queue header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.queue ul { max-height: 300px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.queue li:last-child { border-bottom: 0; }
.queue strong { grid-column: 1; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.queue li .label { grid-column: 1; text-transform: none; letter-spacing: 0; }
.queue li a { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--red); font-size: 13px; font-weight: 700; text-decoration: none; }
.queue li .bar { grid-column: 1 / -1; margin-top: 6px; }
.queue li[data-state="error"] .label { color: var(--red); }
.ghost-text { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.ghost-text:hover { color: var(--ink); }

.drop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: rgb(255 255 255 / 0.9); pointer-events: none; }

.drop-frame {
  display: grid;
  place-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  border: 2px dashed var(--red);
  border-radius: 12px;
  text-align: center;
}

.drop-frame strong { font: 760 clamp(26px, 5vw, 46px)/1.1 var(--display); font-stretch: 125%; letter-spacing: -0.02em; }

.confirm {
  width: min(430px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.confirm::backdrop, .file-dialog::backdrop, .help::backdrop { background: rgb(11 22 38 / 0.35); }
.confirm h3 { margin: 6px 0; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.confirm p { margin: 0 0 18px; color: var(--muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

.share-row { display: flex; gap: 8px; margin-bottom: 14px; }
.share-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); font: 500 12px var(--mono); }
.share-days { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.share-days select { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--ink); }

.account { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: var(--muted); font-size: 12.5px; }

.login-page {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 16px;
  background:
    radial-gradient(circle at 1px 1px, #d9dee6 1px, transparent 0) 0 0 / 24px 24px,
    linear-gradient(#ffffff, #f1f4f8);
}

.login-card {
  display: grid;
  gap: 10px;
  width: min(380px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-lift);
}

.login-card .logo { height: 54px; margin-bottom: 10px; }
.login-card h1 { margin: 0 0 6px; font: 760 30px/1.1 var(--display); font-stretch: 125%; letter-spacing: -0.02em; }
.login-card form { display: grid; gap: 12px; }
.login-card label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); }
.login-card input:focus { outline: 2px solid var(--navy); outline-offset: -1px; border-color: transparent; }
.login-card .cta { width: 100%; margin-top: 4px; }
.login-card .cta:disabled { opacity: 0.6; cursor: default; }
.login-error, .login-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: #fdecec; color: var(--red-dark); font-size: 13px; }
.login-foot { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------- visualizador */

.viewer-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.back { display: flex; align-items: center; gap: 6px; flex: none; color: var(--muted); }
.back:hover { color: var(--ink); }
.back svg { width: 16px; height: 16px; }

.title-input {
  min-width: 80px;
  width: 34ch;
  padding: 3px 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.title-input:hover { border-color: var(--line-strong); }
.title-input[readonly], .title-input[readonly]:hover { border-color: transparent; cursor: default; }
body[data-role="client"] .back svg { display: none; }
.title-input:focus { border-color: var(--navy); outline: 0; }

#stats { flex: none; text-transform: none; letter-spacing: 0; }

.help-btn { width: 32px; height: 32px; flex: none; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: none; font: 600 13px var(--mono); color: var(--muted); cursor: pointer; }
.help-btn:hover { border-color: var(--ink); color: var(--ink); }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 348px; min-height: 0; }

.viewport {
  --file-bg: none;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, #d9dee6 1px, transparent 0) 0 0 / 24px 24px,
    linear-gradient(#ffffff, #f1f4f8);
}

.viewport[data-bg="file"] { background: var(--file-bg); }
.viewport > canvas { display: block; width: 100%; height: 100%; outline: none; }

/* marcas de enquadramento da area util */
.viewport::after {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 3;
  pointer-events: none;
  --m: #b8c0cc;
  background:
    linear-gradient(var(--m), var(--m)) 0 0 / 14px 1px no-repeat,
    linear-gradient(var(--m), var(--m)) 0 0 / 1px 14px no-repeat,
    linear-gradient(var(--m), var(--m)) 100% 0 / 14px 1px no-repeat,
    linear-gradient(var(--m), var(--m)) 100% 0 / 1px 14px no-repeat,
    linear-gradient(var(--m), var(--m)) 0 100% / 14px 1px no-repeat,
    linear-gradient(var(--m), var(--m)) 0 100% / 1px 14px no-repeat,
    linear-gradient(var(--m), var(--m)) 100% 100% / 14px 1px no-repeat,
    linear-gradient(var(--m), var(--m)) 100% 100% / 1px 14px no-repeat;
}

#boot { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; }

.loading { position: absolute; inset: 0; z-index: 2000; pointer-events: none; }

.loading-cover {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #fff var(--cover, none) center / contain no-repeat;
  view-transition-name: model-cover;
}

.loading-box {
  position: absolute;
  left: 24px;
  bottom: 22px;
  display: grid;
  gap: 6px;
  width: min(340px, calc(100% - 48px));
}

.loading-box strong { font: 760 20px/1.15 var(--display); font-stretch: 115%; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.loading-box p { margin: 0; }

.arrows { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }

.hud {
  position: absolute;
  left: 20px;
  top: 16px;
  z-index: 900;
  margin: 0;
  color: var(--navy);
  font: 500 11px/1.5 var(--mono);
  pointer-events: none;
}

.gauges {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 900;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}

.scale { display: grid; justify-items: center; gap: 3px; color: var(--ink); font: 500 10.5px/1 var(--mono); }
.scale i { display: block; height: 5px; border: 1px solid var(--ink); border-top: 0; transition: width 0.25s var(--spring); }
.gizmo { width: 58px; height: 58px; overflow: visible; }
.gizmo line { stroke-width: 2; stroke-linecap: round; }
.gizmo text { font: 600 9px var(--mono); text-anchor: middle; dominant-baseline: central; }

.float {
  position: absolute;
  z-index: 1000;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.left-dock {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 290px;
  max-height: calc(100% - 84px);
  pointer-events: none;
}

body[data-level="engineer"] .left-dock { top: 78px; max-height: calc(100% - 144px); }
.left-dock > * { position: relative; flex: 0 1 auto; min-height: 0; pointer-events: auto; }
.part { overflow: auto; }

.commands { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

.commands-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 650 13px/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
}

.commands-toggle svg { width: 12px; height: 12px; flex: none; color: var(--muted); transition: rotate 0.2s var(--spring); }
.commands-toggle[aria-expanded="true"] svg { rotate: 90deg; }
.commands-toggle small { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font: 500 11px/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.commands-toggle b { flex: none; min-width: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font: 700 11px/20px var(--sans); text-align: center; }

.commands-body { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); }
.commands-list { flex: 0 1 auto; min-height: 0; margin: 0; padding: 4px; overflow: auto; list-style: none; }
.commands-body .ghost-text { flex: none; padding: 7px 12px; border-top: 1px solid var(--line); text-align: right; }

.cmd-head { display: flex; align-items: center; border-radius: 6px; }
.cmd-head:hover { background: var(--panel); }

.cmd-open {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.cmd-open i { flex: none; padding: 0 5px; border-radius: 4px; background: var(--panel-2); color: var(--muted); font: 500 10px/1.7 var(--mono); }
.cmd[data-kind="select"] .cmd-open i { background: #1557c0; color: #fff; }
.cmd[data-kind="only"] .cmd-open i { background: var(--navy); color: #fff; }
.cmd-open span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-open small { flex: none; color: var(--muted); font: 500 11px var(--mono); }

.cmd-x { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; }
.cmd-x:hover { background: var(--red); color: #fff; }

.cmd-items { margin: 0 0 4px 12px; padding: 0 0 0 6px; border-left: 1px solid var(--line); list-style: none; }
.cmd-items li { display: flex; align-items: center; border-radius: 5px; }
.cmd-items li:hover { background: var(--panel); }
.cmd-piece { flex: 1; min-width: 0; padding: 3px 6px; overflow: hidden; border: 0; background: none; color: var(--ink); font-size: 12px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cmd-items .cmd-more { padding: 3px 6px; color: var(--muted); font-size: 12px; }
.part h2 { margin: 4px 22px 2px 0; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.part p { margin: 0 0 8px; overflow-wrap: anywhere; }
.part-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.path { margin: 0 0 12px; padding-left: 18px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.ghost {
  position: absolute;
  right: 8px;
  top: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.cut-panel { right: 18px; top: 18px; display: grid; gap: 8px; width: 228px; }
.cut-panel label { display: grid; gap: 3px; color: var(--muted); font-size: 12.5px; }
.cut-panel input { width: 100%; }

.floating { position: absolute; left: 18px; bottom: 16px; z-index: 1000; display: flex; flex-wrap: wrap; gap: 8px; }
.floating .btn { box-shadow: var(--shadow); }
.exit-present { display: none; position: absolute; right: 18px; top: 18px; z-index: 1000; box-shadow: var(--shadow); }

.side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); }

.tabs { position: relative; display: flex; flex: none; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs .slide-thumb { top: auto !important; bottom: -1px; height: 2px !important; border-radius: 0; background: var(--red); }

.tabs button {
  flex: 1 0 auto;
  padding: 11px 5px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 12px/1.3 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s;
}

.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }

.panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }

#view-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  flex: 1;
  margin: 0;
  padding: 10px;
  overflow: hidden auto;
  list-style: none;
}

#view-list button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

#view-list img { display: block; width: 100%; aspect-ratio: 128 / 90; object-fit: cover; }

#view-list span {
  position: absolute;
  left: 5px;
  bottom: 4px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.9);
  font: 500 10px/1.5 var(--mono);
}

#view-list button:hover { border-color: var(--line-strong); color: var(--ink); }
#view-list button[aria-current="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); color: var(--red); }

#search { flex: none; margin: 10px; }

.tree, .tree ul { margin: 0; padding: 0; list-style: none; }
.tree { flex: 1; min-height: 0; overflow: auto; padding: 0 6px 8px; }
.tree ul { padding-left: 14px; }
.row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.row:hover { background: var(--panel); }
.row[aria-current="true"] { background: var(--panel); box-shadow: inset 2px 0 0 var(--red); }
.row.off .name { color: var(--muted); text-decoration: line-through; }
.row button { border: 0; background: none; color: inherit; cursor: pointer; }
.row button:disabled { cursor: default; }
.row .twist, .row .eye { flex: none; width: 22px; height: 24px; padding: 0; color: var(--muted); }
.row .eye svg { display: block; width: 15px; height: 15px; margin: auto; }
.row .name { flex: 1; min-width: 0; padding: 3px 2px; overflow: hidden; font-size: 13px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.tree-note { padding: 4px 8px; color: var(--muted); font-size: 12px; }

.file-list { flex: 1; min-height: 0; margin: 0; padding: 8px; overflow: auto; list-style: none; }

.file-list button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
}

.file-list button:hover { background: var(--panel); }
.file-list small { display: block; color: var(--muted); font: 500 10.5px/1.6 var(--mono); }

.assistant {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 1001;
  display: grid;
  gap: 6px;
  width: min(520px, calc(100% - 380px));
  min-width: 300px;
  translate: -50% 0;
  pointer-events: none;
}

.assistant > * { pointer-events: auto; }
.assistant-reply { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 10px 14px; }
.assistant-reply p { flex: 1; min-width: 0; margin: 0; max-height: 132px; overflow: auto; font-size: 13px; overflow-wrap: anywhere; }
.assistant-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; pointer-events: none; }

.chip {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgb(255 255 255 / 0.94);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: border-color 0.15s, background 0.15s;
}

.chip:hover { border-color: var(--navy); }
.chip.context { border-color: #1557c0; color: #1557c0; }

.prompt { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow-lift); }
.prompt input { flex: 1; min-width: 0; padding: 8px 10px; border: 0; border-radius: 8px; color: var(--ink); }
.prompt .cta { padding: 8px 16px; font-size: 13px; }
body[data-level="present"] .assistant { display: none; }

.viewport[data-measuring] > canvas { cursor: crosshair; }
#measures line { stroke: var(--red); stroke-width: 1.5; }
#measures circle { fill: #fff; stroke: var(--red); stroke-width: 1.5; }
#measures text { fill: var(--ink); stroke: #fff; stroke-width: 3; paint-order: stroke; font: 600 12px var(--mono); text-anchor: middle; }

.finding { display: grid; gap: 1px; width: 100%; padding: 7px 8px 7px 12px; border: 0; border-left: 3px solid var(--line-strong); border-radius: 0 6px 6px 0; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.finding + .finding { margin-top: 4px; }
.finding:hover { background: var(--panel); }
.finding[data-severity="alta"] { border-left-color: var(--red); }
.finding[data-severity="media"] { border-left-color: #e09b00; }
.finding strong { font-size: 13px; font-weight: 650; }
.finding span { color: var(--muted); font-size: 12px; }
.bom-export { width: calc(100% - 12px); margin: 6px; }
.compare-row { display: flex; gap: 6px; padding: 0 6px 6px; }
.compare-row select { flex: 1; min-width: 0; padding: 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--ink); }
.notes-head { flex: none; padding: 10px; border-bottom: 1px solid var(--line); }
.notes-head .btn { width: 100%; }
.notes-head .section-note { margin: 6px 0 0; }
.notes-empty { padding: 14px; }
.note-list { margin: 0; padding: 0; list-style: none; }
.note-item { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.note-item.done { opacity: 0.55; }
.note-open { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 0 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer; }
.note-open b { grid-row: 1 / 3; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; font: 700 11px/20px var(--sans); text-align: center; }
.note-open span { overflow-wrap: anywhere; }
.note-open small { color: var(--muted); font-size: 11.5px; }
.approval { display: grid; gap: 6px; padding: 12px; }
.approval input { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); }
.approval h3 { margin: 0; }
.approval-list { margin: 0; padding: 0; color: var(--muted); font-size: 12.5px; list-style: none; }
.approval-list li[data-decision="aprovado"] { color: #1f7a45; }
.note-field { display: grid; gap: 4px; margin: 10px 0; color: var(--muted); font-size: 13px; }
.note-field input, .note-field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); font: inherit; resize: vertical; }
#measures .pin { fill: var(--red); stroke: #fff; stroke-width: 2; }
#measures .pin-text { fill: #fff; stroke: none; font: 700 10px var(--sans); text-anchor: middle; dominant-baseline: central; }
.section-note { margin: 0 6px 4px; color: var(--muted); font-size: 12px; }
.prompt input:focus { outline: 0; }
.prompt:focus-within { border-color: var(--navy); }
.analysis-scroll { flex: 1; min-height: 0; overflow: auto; }
.prompt-log { margin: 0; padding: 0; list-style: none; }
.prompt-log li { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.prompt-log strong { display: block; font-size: 12.5px; font-weight: 650; overflow-wrap: anywhere; }
.prompt-log p { margin: 2px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.analysis { padding-bottom: 12px; color: var(--muted); }
.analysis section { padding: 12px 8px 4px; }
.analysis h3 { margin: 0 6px 6px; }
.analysis .info-list { padding: 0 6px; gap: 5px 14px; }
.analysis .info-list dd { color: var(--ink); }

.fact-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.fact-row:hover { background: var(--panel); }
.fact-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact-row small { flex: none; color: var(--muted); font: 500 11.5px/1.7 var(--mono); }

.part-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0 0 12px; font-size: 12.5px; }
.part-facts:empty { display: none; }
.part-props { margin: 0 0 12px; font-size: 12.5px; }
.part-props summary { padding: 3px 0; color: var(--ink); font-weight: 600; cursor: pointer; }
.part-props small { color: var(--muted); font: 500 11px var(--mono); }
.part-props .part-facts { margin: 6px 0 0; }
.part-facts dt { color: var(--muted); }
.part-facts dd { margin: 0; font: 500 12px/1.6 var(--mono); text-align: right; overflow-wrap: anywhere; }

.info-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 14px; margin: 0; padding: 16px; overflow: auto; }
.info-list dt { color: var(--muted); font-size: 12.5px; }
.info-list dd { margin: 0; font: 500 12.5px/1.5 var(--mono); text-align: right; overflow-wrap: anywhere; }

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.scrub-wrap { position: relative; display: flex; flex: 1; min-width: 0; }
.scrub-wrap input { width: 100%; }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.ticks i { position: absolute; top: 3px; width: 1px; height: 12px; background: var(--line-strong); }
#view-label { flex: none; min-width: 118px; text-align: right; font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }
#speed { flex: none; padding: 3px 6px; font: 500 12px var(--mono); }

.icon-btn { width: 34px; height: 34px; flex: none; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); cursor: pointer; transition: border-color 0.15s, transform 0.15s var(--spring); }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { display: block; }

.play {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 34px;
  min-width: 122px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font: 700 13px/1 var(--sans);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s var(--spring);
}

.play:hover { background: var(--red-dark); }
.play svg { width: 12px; height: 12px; }
.play .i-pause { display: none; }
.play.on .i-pause { display: block; }
.play.on .i-play { display: none; }
.play.on { background: var(--ink); }

/* niveis da interface */
.eng { display: none; }
body[data-level="engineer"] .eng { display: block; }
body[data-level="engineer"] button.eng { display: inline-block; }

body[data-level="present"] .top,
body[data-level="present"] .side,
body[data-level="present"] .hud,
body[data-level="present"] .gauges { display: none; }
body[data-level="present"] .stage { grid-template-columns: minmax(0, 1fr); }
/* sem a barra de cima, sobram duas linhas: uma terceira deixaria o palco com altura zero */
body.viewer-page[data-level="present"] { grid-template-rows: minmax(0, 1fr) auto; }
body[data-level="present"] .exit-present { display: block; }

.file-dialog {
  width: min(960px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.file-dialog[open] { display: flex; flex-direction: column; }
.file-dialog header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.file-dialog header strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 650; }
.file-dialog a.btn { text-decoration: none; }
.file-body { display: grid; flex: 1; min-height: 0; place-items: center; background: var(--panel); }
.file-body img, .file-body video { max-width: 100%; max-height: 100%; }
.pdf-pages { width: 100%; height: 100%; padding: 8px; overflow: auto; }
.pdf-pages canvas { display: block; width: 100%; margin-bottom: 8px; background: #fff; }

.help {
  width: min(460px, calc(100vw - 32px));
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.help h3 { margin: 4px 0 12px; font: 760 20px/1.2 var(--display); font-stretch: 118%; letter-spacing: -0.015em; }
.help dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; margin: 0 0 16px; }
.help dt { font: 500 12px/1.6 var(--mono); }
.help dd { margin: 0; color: var(--muted); }
kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--panel); font: inherit; }

/* Folha do Composer: mesma proporcao das vistas; 1mm = --mm pixels. */
.texts { position: absolute; z-index: 2; overflow: hidden; pointer-events: none; --mm: 1px; }

.note {
  position: absolute;
  left: calc(var(--x) * var(--mm));
  top: calc(var(--y) * var(--mm));
  min-width: calc(var(--w) * var(--mm));
  min-height: calc(var(--h) * var(--mm));
  padding: 0 calc(0.6 * var(--mm));
  border: 1px solid transparent;
  color: #000;
  font-family: var(--sans);
  font-size: max(11px, calc(var(--fs) * var(--mm)));
  line-height: 1.3;
  white-space: pre;
  animation: note-in 0.3s ease-out;
}

@keyframes note-in { from { opacity: 0; } }

button.note { cursor: pointer; pointer-events: auto; text-decoration: underline; }
button.note:hover { filter: brightness(0.93); }

.diag {
  position: fixed;
  left: 8px;
  bottom: 60px;
  z-index: 5000;
  margin: 0;
  padding: 8px;
  border-radius: 6px;
  background: rgb(11 22 38 / 0.9);
  color: #fff;
  font: 11px/1.4 var(--mono);
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .home-page { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; height: auto; gap: 10px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand .logo { height: 36px; }
  .rail .cta { width: auto; margin-left: auto; padding: 10px 14px; }
  .rail-nav { display: flex; width: 100%; }
  .rail-nav button { flex: 1; }
  .rail-stats { display: none; }
  .hero { min-height: 400px; align-items: flex-end; padding: 24px 16px 84px; }
  #cloud { inset: 0; width: 100%; opacity: 0.22; }
  .hero-readout { right: 16px; left: 16px; bottom: 16px; justify-content: space-between; text-align: left; gap: 10px; }
  .library { padding: 16px 16px 48px; }
  .library-bar input { flex: 1 1 100%; width: auto; order: 3; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card-actions { opacity: 1; }
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 150px; }
  .stage.parts-open { grid-template-rows: minmax(0, 1fr) 45%; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  #view-list { display: flex; gap: 6px; overflow: auto hidden; padding: 6px 8px; }
  #view-list li { flex: none; width: 104px; }
  .top { flex-wrap: wrap; }
  .title-input { flex: 1; width: auto; }
  .logo { height: 28px; }
  #stats, .spacer, .help-btn { display: none; }
  .tool { padding: 5px 9px; }
  .seg button { padding: 4px 8px; }
  .left-dock { width: calc(100% - 36px); }
  .assistant { width: calc(100% - 24px); min-width: 0; bottom: 8px; }
  .assistant-chips { display: none; }
  .assistant:focus-within .assistant-chips { display: flex; }
  .floating, .gauges { bottom: 62px; }
  .play { min-width: 0; }
  #play-label, #view-label { display: none; }
  .gizmo { width: 44px; height: 44px; }
}

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