body { margin: 0; background: #0A0C10; }

.layerline {
  --bg: #0A0C10;
  --panel: #11151B;
  --raised: #161B23;
  --line: #222834;
  --text: #E6E9EE;
  --muted: #8A93A2;
  --dim: #5C6574;
  --brand: #FF7A1A;
  --blue: #5CC8FF;
  --green: #56E39F;
  --red: #FF5D5D;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  height: calc(100vh - var(--sx-bar-height, 0px));
  height: calc(100dvh - var(--sx-bar-height, 0px));
  min-height: 660px;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.layerline * { box-sizing: border-box; }
.layerline button { font: inherit; color: inherit; cursor: pointer; }
.layerline a { color: inherit; text-decoration: none; }
.layerline svg { flex: none; }
.layerline :is(.logo, .org, .menu a, .docs) svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sidebar */
.layerline .sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.layerline .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.layerline .logo svg { width: 24px; height: 24px; color: var(--brand); stroke-width: 2; }
.layerline .org {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  text-align: left;
}
.layerline .org span:nth-child(2) { flex: 1; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.layerline .org-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, #7B61FF, #5CC8FF);
  font-size: 12px;
  font-weight: 700;
}
.layerline .org svg { color: var(--muted); }
.layerline .menu { display: grid; gap: 2px; }
.layerline .menu a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.layerline .menu a:hover { background: var(--raised); color: var(--text); }
.layerline .menu a.active { background: #1C222C; color: var(--text); }
.layerline .menu a.active svg { color: var(--brand); }
.layerline .count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #232A35;
  color: var(--muted);
  font: 500 11.5px/1.5 'JetBrains Mono', ui-monospace, monospace;
}
.layerline .sidebar-foot { display: grid; gap: 8px; margin-top: auto; }
.layerline .docs { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.layerline .docs:hover { color: var(--text); }

.layerline .support {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  text-align: left;
  animation: support-in .4s ease both;
}
.layerline .support[hidden] { display: none; }
.layerline .support:hover { background: var(--raised); color: var(--text); }
.layerline .support svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.layerline .support:focus-visible,
.layerline .help:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.layerline .live {
  width: 8px;
  height: 8px;
  flex: none;
  margin-left: auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(86, 227, 159, .16);
}
.layerline .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Demo annotation: explains the Support item. Not part of the pattern. */
.layerline .support-slot { position: relative; }
.layerline .demo-note {
  position: absolute;
  z-index: 5;
  bottom: 14px;
  left: calc(100% + 74px);
  display: none;
  width: 250px;
  margin: 0;
  padding: 12px 16px 13px;
  border-radius: 14px 14px 14px 4px;
  background: #F6C510;
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .6);
  color: #1A1405;
  font: 400 20px/1.12 Caveat, 'Segoe Print', 'Bradley Hand', cursive;
  pointer-events: none;
}
.layerline .support:not([hidden]) + .demo-note { display: block; animation: note-in .6s .3s ease both; }
.layerline .demo-note svg {
  position: absolute;
  bottom: -24px;
  left: -66px;
  width: 66px;
  height: 40px;
  overflow: visible;
  fill: none;
  stroke: #F6C510;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.layerline .demo-note strong { font-weight: 700; }
@keyframes support-in {
  from { opacity: 0; transform: translateX(-6px); }
}
@keyframes note-in {
  from { opacity: 0; transform: translateX(-10px); }
}

.layerline .me {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 10px 2px;
  border-top: 1px solid var(--line);
}
.layerline .me > span:last-child { display: grid; }
.layerline .me small { color: var(--muted); font-size: 12px; }
.layerline .initials {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2A2140;
  color: #C8B9FF;
  font-size: 13px;
  font-weight: 700;
}

/* Main */
.layerline .main { min-width: 0; overflow: auto; padding: 28px clamp(20px, 3vw, 36px) 40px; }
.layerline .topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.layerline h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.layerline .topbar p { margin: 0; color: var(--muted); }
.layerline .actions { display: flex; gap: 10px; }
.layerline .actions button { padding: 9px 14px; border-radius: 9px; font-weight: 600; }
.layerline .ghost { border: 1px solid var(--line); background: transparent; }
.layerline .ghost:hover { background: var(--raised); }
.layerline .primary { border: 1px solid var(--brand); background: var(--brand); color: #1A0D02 !important; }
.layerline .primary::before { content: '+ '; }

.layerline .kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.layerline .kpis > div {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.layerline .kpis span { color: var(--muted); font-size: 12.5px; }
.layerline .kpis strong { font: 500 22px/1.25 'JetBrains Mono', ui-monospace, monospace; letter-spacing: -.02em; }
.layerline .kpis strong b { font-weight: 500; }
.layerline .kpis strong small { color: var(--dim); font-size: 16px; }
.layerline .kpis > div > small { color: var(--dim); font-size: 12px; }
.layerline .kpis .low strong { color: #FFB86B; }

.layerline .printers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 12px;
}

/* Printer card */
.layerline .printer {
  --state: var(--blue);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.layerline .printer[data-state="error"] {
  --state: var(--red);
  border-color: rgba(255, 93, 93, .45);
  background: linear-gradient(180deg, #1D1216, var(--panel) 70%);
  box-shadow: 0 0 0 4px rgba(255, 93, 93, .06);
}
.layerline .printer[data-state="done"] { --state: var(--green); }
.layerline .printer[data-state="idle"] { --state: var(--dim); }
.layerline .printer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.layerline .printer h2 { margin: 0; font-size: 15px; font-weight: 600; }
.layerline .printer header p { margin: 1px 0 0; color: var(--dim); font-size: 12px; }
.layerline .state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--state) 14%, transparent);
  color: var(--state);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.layerline .state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.layerline .printer[data-state="printing"] .state::before { animation: blink 1.6s ease-in-out infinite; }

.layerline .cam {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: radial-gradient(120% 90% at 50% 100%, #1B212B, #0D1015);
}
.layerline .cam .head { transition: transform 1.2s linear; }
.layerline .cam .head path { fill: #AEB6C2; }
.layerline .cam .sweep { transform: translateX(132px); }
.layerline .printer[data-state="printing"] .cam .sweep { animation: sweep 2.6s ease-in-out infinite alternate; }
.layerline .printer[data-state="error"] .cam .sweep { transform: translateX(96px); }
.layerline .printer[data-state="error"] .cam .head path { fill: var(--red); }

.layerline .job { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.layerline .file { overflow: hidden; color: #C3CAD5; font: 400 12px/1.4 'JetBrains Mono', ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.layerline .material { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.layerline .material i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.layerline .bar { height: 5px; overflow: hidden; border-radius: 99px; background: #1F252F; }
.layerline .bar span { display: block; height: 100%; border-radius: inherit; background: var(--state); transition: width 1.2s linear; }
.layerline .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: auto 0 0; }
.layerline .stats dt { color: var(--dim); font-size: 11px; }
.layerline .stats dd { margin: 0; font: 500 13px/1.5 'JetBrains Mono', ui-monospace, monospace; }
.layerline .printer[data-state="error"] [data-nozzle] { color: var(--red); }

.layerline .alert { display: grid; gap: 10px; padding-top: 2px; }
.layerline .alert p { margin: 0; color: #F3B8B8; font-size: 12.5px; }
.layerline .alert strong { display: block; margin-bottom: 2px; color: #FFD2D2; font-weight: 600; }
.layerline .alert .help {
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: var(--red);
  color: #2A0707;
  font-weight: 600;
  animation: support-in .45s ease both;
}
.layerline .alert .help[hidden] { display: none; }
.layerline .alert .help:hover { background: #FF7A7A; }
.layerline .alert .log { color: var(--muted); font-size: 12.5px; text-align: center; }

@keyframes sweep { from { transform: translateX(44px); } to { transform: translateX(116px); } }
@keyframes blink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .layerline *,
  .layerline .cam .sweep { animation: none !important; transition: none !important; }
}

@media (max-width: 1100px) {
  .layerline .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .layerline { display: block; height: auto; min-height: 0; }
  .layerline .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .layerline .org,
  .layerline .menu,
  .layerline .docs,
  .layerline .me { display: none; }
  .layerline .sidebar-foot { flex: 1; margin: 0; }
  .layerline .support-slot { margin-left: auto; }
  .layerline .support { width: auto; }
  .layerline .demo-note { top: calc(100% + 18px); right: 0; bottom: auto; left: auto; width: 230px; border-radius: 14px 4px 14px 14px; font-size: 19px; }
  .layerline .demo-note svg { top: -30px; right: 14px; bottom: auto; left: auto; width: 34px; height: 28px; transform: scaleX(-1) rotate(-80deg); }
  @keyframes note-in { from { opacity: 0; transform: translateY(-6px); } }
  .layerline .main { overflow: visible; }
  .layerline .topbar { align-items: flex-start; flex-direction: column; }
}
