/* VeXtraBOM — drafting-sheet design language.
   Deliberately distinct from other EdgeXene properties: blueprint grid,
   sharp corners, drawing-zone corner ticks, monospace annotations,
   title-block footer. No pastel gradients, no rounded cards. */

:root {
  --bg: #06080d;
  --panel: #0a0f1a;
  --line: rgba(84, 120, 255, 0.22);
  --line-soft: rgba(84, 120, 255, 0.1);
  --grid: rgba(64, 106, 255, 0.055);
  --grid-major: rgba(64, 106, 255, 0.1);
  --text: #eef2ff;
  --muted: #93a0bd;
  --blue: #3b82f6;
  --blue-hi: #60a5fa;
  --indigo: #4f46e5;
  --violet: #8b5cf6;
  --violet-soft: #a78bfa;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size:
    120px 120px,
    120px 120px,
    24px 24px,
    24px 24px;
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Ubuntu,
    sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 26px;
}

.mono {
  font-family: var(--mono);
}

/* ── drawing-zone corner ticks (signature detail) ── */
.zone {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
}
.zone::before,
.zone::after,
.zone > .tick::before,
.zone > .tick::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.zone::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--blue);
  border-left: 2px solid var(--blue);
}
.zone::after {
  top: -1px;
  right: -1px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
}
.zone > .tick::before {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid var(--blue);
  border-left: 2px solid var(--blue);
}
.zone > .tick::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
}

/* ── nav ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand img {
  width: 30px;
  height: 30px;
}
.brand b {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.brand b .x {
  color: var(--violet-soft);
}
.brand .rev {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 8px;
  letter-spacing: 0.12em;
}
.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.nav-links a:hover {
  color: var(--blue-hi);
}

.btn {
  display: inline-block;
  padding: 11px 24px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid var(--blue);
}
.btn-primary {
  background: var(--blue);
  color: #04070f;
  clip-path: polygon(
    0 0,
    calc(100% - 12px) 0,
    100% 12px,
    100% 100%,
    12px 100%,
    0 calc(100% - 12px)
  );
  border: none;
}
.btn-primary:hover {
  background: var(--blue-hi);
}
.btn-ghost {
  color: var(--blue-hi);
  background: transparent;
}
.btn-ghost:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* ── hero: asymmetric, left-aligned ── */
.hero {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 48px;
  padding: 76px 0 64px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.stamp {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--violet-soft);
  border: 2px solid var(--violet);
  padding: 7px 14px;
  transform: rotate(-1.6deg);
  margin-bottom: 28px;
  background: rgba(139, 92, 246, 0.06);
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
  font-weight: 800;
}
.hero h1 .accent {
  color: var(--blue-hi);
}
.hero p.sub {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 34px;
  max-width: 34rem;
}
.hero .ctas {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* hero schematic: mini drawing sheet → BOM table */
.schematic {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
}
.schematic .sheet {
  padding: 14px;
  margin-bottom: 6px;
}
.schematic .sheet .head {
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
  color: var(--blue-hi);
}
.schematic .partline {
  height: 0;
  border-top: 1px solid var(--line);
  margin: 9px 0;
  position: relative;
}
.schematic .partline.p2 {
  width: 72%;
}
.schematic .partline.p3 {
  width: 48%;
}
.schematic .balloon {
  position: absolute;
  right: -4px;
  top: -8px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  border: 1px solid var(--violet);
  border-radius: 50%;
  text-align: center;
  color: var(--violet-soft);
  background: var(--bg);
  font-size: 0.55rem;
}
.schematic .flow {
  text-align: center;
  color: var(--violet-soft);
  letter-spacing: 0.3em;
  padding: 4px 0;
}
.schematic table {
  border-collapse: collapse;
  width: 100%;
}
.schematic td,
.schematic th {
  border: 1px solid var(--line);
  padding: 4px 8px;
  text-align: left;
  font-weight: 400;
}
.schematic th {
  color: var(--blue-hi);
  letter-spacing: 0.1em;
}
.schematic td.q {
  color: var(--violet-soft);
}

/* ── annotation-style section headers ── */
section {
  padding: 58px 0 30px;
}
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 6px;
}
.sec-head .num {
  font-family: var(--mono);
  color: var(--violet-soft);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
}
.sec-head h2 {
  font-size: 1.45rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.sec-head .rule {
  flex: 1;
  border-top: 1px solid var(--line);
  transform: translateY(-4px);
}
.section-sub {
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 640px;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 860px) {
  .grid {
    grid-template-columns: 2fr 2fr;
  }
}
@media (max-width: 580px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  padding: 22px 20px;
}
.card h3 {
  font-size: 0.98rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card p {
  color: var(--muted);
  font-size: 0.88rem;
}

.chip {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 2px 8px;
  white-space: nowrap;
}
.chip-proto {
  color: #6ee7a0;
  border: 1px solid rgba(110, 231, 160, 0.45);
}
.chip-plan {
  color: var(--blue-hi);
  border: 1px solid rgba(96, 165, 250, 0.45);
}
.chip-dev {
  color: var(--violet-soft);
  border: 1px solid var(--violet);
}

/* ── status strip ── */
.strip {
  margin: 44px 0 0;
  padding: 16px 22px;
  font-size: 0.92rem;
  color: var(--muted);
}
.strip b {
  color: var(--blue-hi);
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── final cta ── */
.final {
  text-align: left;
  padding: 64px 0 54px;
}
.final h2 {
  text-transform: uppercase;
  font-size: 1.45rem;
  margin-bottom: 10px;
}
.final p {
  color: var(--muted);
  margin-bottom: 26px;
  max-width: 560px;
}

/* ── title-block footer (literal drawing title block) ── */
.titleblock {
  margin: 24px 0 40px;
}
.titleblock table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.titleblock td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--text);
}
.titleblock td .lbl {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.titleblock a {
  color: var(--blue-hi);
  text-decoration: none;
}
.titleblock a:hover {
  text-decoration: underline;
}

/* ── login ── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 410px;
  padding: 40px 36px;
}
.login-card .brand {
  justify-content: center;
  margin-bottom: 26px;
}
.login-card .access {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  color: var(--violet-soft);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}
.login-card h1 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  text-align: center;
}
.login-card p.sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 26px;
  text-align: center;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: var(--mono);
  border: 1px solid var(--line);
  background: rgba(84, 120, 255, 0.04);
  color: var(--text);
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus {
  border-color: var(--blue);
}
.login-card .btn {
  width: 100%;
  text-align: center;
}
.err {
  color: #f87171;
  font-size: 0.86rem;
  font-family: var(--mono);
  min-height: 1.5em;
  margin-top: 12px;
  text-align: center;
}
.login-card .back {
  display: block;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--mono);
  text-decoration: none;
  text-align: center;
  letter-spacing: 0.06em;
}
.login-card .back:hover {
  color: var(--blue-hi);
}

/* ── console ── */
.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
  gap: 12px;
}
.console-head .right {
  display: flex;
  gap: 20px;
  align-items: center;
}
.console-head .right a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}
.console-head .right a:hover {
  color: var(--blue-hi);
}

.drop {
  margin: 36px 0 22px;
  border: 1px dashed var(--blue);
  padding: 52px 30px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
  background: rgba(59, 130, 246, 0.03);
}
.drop.drag {
  background: rgba(59, 130, 246, 0.1);
}
.drop b {
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.94rem;
}
.drop p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 8px;
}

.status-line {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.82rem;
  min-height: 1.6em;
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}
.status-line.busy {
  color: var(--blue-hi);
}
.status-line.error {
  color: #f87171;
}

.results {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 46px;
}
@media (max-width: 820px) {
  .results {
    grid-template-columns: 1fr;
  }
}
.panel {
  padding: 20px;
  overflow-x: auto;
}
.panel h3 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-hi);
  margin-bottom: 14px;
}
.panel h3 span {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.04em;
}

.panel-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.btn-mini {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: 0.15s;
  color: var(--blue-hi);
  background: transparent;
  border: 1px solid var(--blue);
}
.btn-mini:hover {
  background: rgba(59, 130, 246, 0.12);
}

table.bom {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.84rem;
}
table.bom td {
  border: 1px solid var(--line);
  padding: 7px 12px;
  white-space: nowrap;
}
table.bom tr:first-child td {
  color: var(--blue-hi);
}

.lines {
  list-style: none;
  font-size: 0.8rem;
  font-family: var(--mono);
}
.lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.lines .conf {
  color: var(--violet-soft);
  font-variant-numeric: tabular-nums;
}
.note {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 10px 0 44px;
  max-width: 720px;
}

input[type="file"] {
  display: none;
}

/* ── small screens ── */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-links { gap: 14px; }
  .nav-links a:not(.btn) { display: none; }  /* text links collapse; LOG IN stays */
  .brand .rev { display: none; }
  .hero { padding: 48px 0 40px; gap: 30px; }
  .stamp { font-size: 0.62rem; letter-spacing: 0.16em; padding: 6px 10px; }
  .hero p.sub { font-size: 0.96rem; }
  .btn { padding: 10px 16px; font-size: 0.78rem; }
  .strip { padding: 14px 16px; font-size: 0.86rem; }
  .sec-head h2 { font-size: 1.15rem; }
  .titleblock { overflow-x: auto; }
  .drop { padding: 38px 18px; }
  .panel { padding: 16px 12px; }
}

/* ── console: editable tables, history ── */
.edit-hint { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); margin-bottom: 16px; letter-spacing: 0.02em; }
.tbl { margin-bottom: 26px; }
.tbl-cap { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.14em; color: var(--violet-soft); margin-bottom: 8px; text-transform: uppercase; }
.tbl-cap .tbl-mode { color: var(--muted); text-transform: none; letter-spacing: 0.03em; }
table.bom td.low { border-left: 3px solid var(--violet); }
table.bom td.rowctl { border: none; padding: 0 6px 0 0; white-space: nowrap; }
table.bom td.rowctl button { background: transparent; border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 3px 7px; }
table.bom td.rowctl button:hover { color: #f87171; border-color: #f87171; }
table.bom tr.hdr td:not(.rowctl) { color: var(--blue-hi); font-weight: 700; background: rgba(59, 130, 246, 0.06); }
table.bom td[contenteditable]:focus { outline: 1px solid var(--blue); background: rgba(59, 130, 246, 0.08); }
.hist-panel { margin-bottom: 30px; }
.hist a { color: var(--blue-hi); text-decoration: none; }
.hist a:hover { text-decoration: underline; }
.drop a { color: var(--blue-hi); }

/* ── PDF page selector ── */
.page-sel { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em; color: var(--blue-hi); margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.page-sel select { background: var(--panel); color: var(--text); border: 1px solid var(--line); font-family: var(--mono); font-size: 0.82rem; padding: 5px 10px; outline: none; }
.page-sel select:focus { border-color: var(--blue); }

/* ── drawing-type selector ── */
.dtype { margin: 34px 0 8px; }
.dtype-head { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.16em; color: var(--blue-hi); text-transform: uppercase; margin-bottom: 12px; }
.dtype-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .dtype-cards { grid-template-columns: 1fr; } }
.dtype-card { text-align: left; padding: 14px; cursor: pointer; color: var(--text); font-family: inherit; transition: border-color 0.15s; }
.dtype-card b { display: block; font-size: 0.9rem; margin-bottom: 6px; }
.dtype-card p { color: var(--muted); font-size: 0.78rem; line-height: 1.5; margin: 0; }
.dtype-card.active { border-color: var(--violet); background: rgba(139, 92, 246, 0.06); }
.dtype-card.active::before, .dtype-card.active::after,
.dtype-card.active > .tick::before, .dtype-card.active > .tick::after { border-color: var(--violet); }
.mini { position: relative; height: 92px; border: 1px solid var(--line); margin-bottom: 12px; background: rgba(84, 120, 255, 0.03); }
.mini-sketch { position: absolute; border: 1px solid rgba(148, 163, 255, 0.35); }
.mini-region { position: absolute; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 0.5rem; letter-spacing: 0.08em; text-align: center; padding: 2px; }
.mini-region.r-bom { background: rgba(59, 130, 246, 0.18); border: 1px solid var(--blue); color: var(--blue-hi); }
.mini-region.r-calc { background: rgba(139, 92, 246, 0.16); border: 1px solid var(--violet); color: var(--violet-soft); }
.mini-line { position: absolute; border-top: 1px solid rgba(148, 163, 255, 0.5); }
.mini-tblk { position: absolute; right: 3%; bottom: 6%; width: 26%; height: 14%; border: 1px solid rgba(148, 163, 255, 0.35); }

/* highlighted (engineer-selected) rows in variant mode */
table.bom tr.sel td:not(.rowctl) { background: rgba(139, 92, 246, 0.12); }
table.bom tr.sel td:not(.rowctl):first-of-type { border-left: 3px solid var(--violet); }

/* author display:flex would defeat the hidden attribute — restore it */
.page-sel[hidden] { display: none; }

/* auto-detect card: dashed "wherever they sit" regions; 4-up grid */
.mini-region.r-auto { background: rgba(148, 163, 255, 0.06); border: 1px dashed rgba(148, 163, 255, 0.55); color: var(--muted); font-size: 0.62rem; }
@media (min-width: 981px) { .dtype-cards { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 980px) and (min-width: 721px) { .dtype-cards { grid-template-columns: repeat(2, 1fr); } }
