/* CAD's own layout and density, on top of Hub's design system (app.css).
   Every colour, font and form control is Hub's; what is here is the CAD bar,
   the panes and the Viewer, which Hub has none of, and the density issue 30
   settled: no padding between panes, only a one pixel line, and buttons that
   are flat sections of their bar. */

body.cad {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cad .navbar {
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  position: static;
}
.cad .navbar-link {
  padding: 0 10px;
  font-size: 12px;
}

/* ---- The CAD bar ---- */
.cadbar {
  display: flex;
  align-items: stretch;
  height: 26px;
  min-height: 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.cadbar > * {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.cadbar-name {
  font-weight: 600;
}
.cadbar select.form-control {
  width: auto;
  min-width: 220px;
  height: 100%;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 0 28px 0 8px;
  font-size: 12px;
  font-weight: 600;
}
.cadbar .badge {
  align-self: center;
  margin: 0 8px;
  border-right: 0;
  padding: 0 5px;
  font-size: 10px;
}
.cadbar-status {
  margin-left: auto;
  border-right: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Panes ---- */
#panes {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}
.split {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.split-down {
  flex-direction: column;
}
.divider {
  flex: 0 0 1px;
  background: var(--border);
}
.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.pane.card {
  border: 0;
}
.pane-head {
  display: flex;
  align-items: stretch;
  height: 22px;
  min-height: 22px;
  border-bottom: 1px solid var(--border);
  background: #f8f9fa;
  user-select: none;
}
.pane-head select.form-control {
  width: auto;
  height: 100%;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 0 24px 0 6px;
  font-size: 12px;
  font-weight: 600;
  background-color: transparent;
  background-position: right 6px center;
}
.pane-bar {
  display: flex;
  align-items: stretch;
  margin-left: auto;
}
.barbtn {
  display: flex;
  align-items: center;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 0 9px;
  font-size: 12px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.barbtn:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.pane-body.pad,
.pad {
  padding: 8px;
}

/* ---- The Viewer ---- */
.view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.view canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.view-hint {
  position: absolute;
  left: 6px;
  bottom: 3px;
  font-size: 10px;
  color: var(--text-muted);
  pointer-events: none;
}
.view-selected {
  position: absolute;
  left: 6px;
  top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
}
.boxsel {
  position: absolute;
  border: 1px solid var(--primary);
  background: var(--primary-light);
  pointer-events: none;
}
.boxsel.touch {
  border-style: dashed;
  border-color: #2a9d8f;
  background: rgba(42, 157, 143, 0.08);
}

/* ---- Density inside panes ---- */
.pane-body .form-group {
  margin-bottom: 8px;
}
.pane-body .form-label {
  font-size: 10px;
  margin-bottom: 2px;
}
.pane-body .form-control {
  padding: 3px 6px;
  font-size: 12px;
}
.pane-body select.form-control {
  padding-right: 24px;
}
.pane-body .form-group .form-control + .form-control {
  margin-top: 3px;
}
.pane-body .form-check-label {
  font-size: 12px;
}
.pane-body .alert {
  overflow-wrap: anywhere;
  padding: 6px 8px;
  font-size: 12px;
  margin-bottom: 8px;
}
.pane-body .data-table th,
.pane-body .data-table td {
  padding: 3px 8px;
  font-size: 12px;
}
.pane-body .stats-list-row {
  padding: 2px 0;
  font-size: 12px;
}
.pane-body .badge {
  padding: 0 5px;
  font-size: 10px;
}
.variant-state {
  margin-bottom: 8px;
}

/* ---- Asking for the token and the document; the kernel check ---- */
.start-card {
  width: 420px;
  max-width: calc(100% - 32px);
  margin: 48px auto;
  align-self: flex-start;
}
.main-content {
  padding: 16px;
}
/* Above the bars' own display rules. */
body.cad .cadbar [hidden],
body.cad .view [hidden] {
  display: none;
}

/* ---- Splitting, closing and resizing panes ---- */
.divider {
  position: relative;
  z-index: 2;
}
.divider::after {
  content: "";
  position: absolute;
  inset: 0 -3px;
  cursor: col-resize;
}
.split-down > .divider::after {
  inset: -3px 0;
  cursor: row-resize;
}
.divider:hover,
.divider:active {
  background: var(--primary);
}
.pane-arrange {
  display: flex;
  align-items: stretch;
}
.barbtn:disabled {
  color: var(--border);
  cursor: default;
  background: transparent;
}
.pane-bar select.form-control {
  border-left: 1px solid var(--border);
  border-right: 0;
  font-weight: 400;
}
.pane-note {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  white-space: nowrap;
}
.pane-title {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
}

/* ---- The pane setups, along the bottom ---- */
.setups {
  display: flex;
  align-items: stretch;
  height: 24px;
  min-height: 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.setup-tab {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
}
.setup-tab:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.setup-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.setup-reset {
  margin-left: auto;
  border-right: 0;
  border-left: 1px solid var(--border);
}
.setup-reset:disabled {
  color: var(--border);
  cursor: default;
  background: transparent;
}

/* ---- Features, Parts list, BOM and Checks ---- */
.feature-list tbody tr,
.pane-body tr[data-part],
.check-line {
  cursor: pointer;
}
.pane-body .data-table.nowrap td,
.pane-body .data-table td.mono {
  white-space: nowrap;
}
.pane-body .data-table tr.selected td {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.feature-details {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  max-height: 45%;
  overflow: auto;
}
.feature-title {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.feature-section {
  margin-top: 6px;
}
.feature-link {
  padding: 1px 0;
  overflow-wrap: anywhere;
}
.feature-link a {
  color: var(--primary);
  text-decoration: none;
}
.feature-link a:hover {
  text-decoration: underline;
}
.check-line.selected {
  outline: 1px solid var(--primary);
}
.pane-body .empty-state {
  padding: 16px 8px;
  font-size: 12px;
}

/* ---- The Graph ---- */
.graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #fafbfc;
  user-select: none;
  touch-action: none;
}
.graph text {
  font-family: var(--font);
  font-size: 11px;
  fill: var(--text);
  pointer-events: none;
}
.graph-body {
  fill: var(--surface);
  stroke: var(--border);
}
.graph-head {
  fill: #eef0f4;
  stroke: var(--border);
}
.graph-box {
  cursor: pointer;
}
.graph-box.holds .graph-head {
  fill: #dfe2f1;
}
.graph-box.outside {
  opacity: 0.55;
}
.graph-box.selected .graph-body,
.graph-box.selected .graph-head {
  stroke: var(--primary);
  stroke-width: 2;
}
.graph-box.failed .graph-head {
  fill: var(--danger-bg);
  stroke: var(--danger);
}
.graph .graph-name {
  font-weight: 600;
}
.graph .graph-type,
.graph .graph-socket-name {
  fill: var(--text-secondary);
  font-size: 10px;
}
.graph-socket {
  fill: var(--surface);
  stroke: var(--text-secondary);
}
.graph-wire {
  fill: none;
  stroke: #9aa0b5;
  stroke-width: 1.5;
}
.graph-wire.selected {
  stroke: var(--primary);
  stroke-width: 2.5;
}
.graph-outline rect {
  fill: rgba(45, 51, 131, 0.03);
  stroke: var(--primary);
  stroke-dasharray: 5 4;
  cursor: pointer;
}
.graph-outline text {
  fill: var(--primary);
  font-weight: 600;
}

/* ---- The Drawing ---- */
.sheets {
  padding: 8px;
  background: #e9ebef;
  min-height: 100%;
}
.sheets.stale {
  opacity: 0.5;
}
img.sheet {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
body.cad .pane-head [hidden],
body.cad .setups [hidden] {
  display: none;
}
.feature-name {
  overflow-wrap: anywhere;
}
.feature-name .text-muted {
  font-size: 11px;
}
