/* OpenWire styles.
   The drawing is a white sheet, like paper on a drawing board.
   The interface around it stays quiet: slate ink, steel grey, and one marker yellow.
   The only strong colors come from the IEC 60757 wire colors. */

/* ---------- Font: Barlow Semi Condensed (SIL Open Font License, see fonts/OFL.txt) ---------- */

@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/barlow-semi-condensed-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/barlow-semi-condensed-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/barlow-semi-condensed-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/barlow-semi-condensed-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/barlow-semi-condensed-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/barlow-semi-condensed-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */

/* The colors of each theme are in themes.css. */

:root {
  --font: 'Barlow Semi Condensed', 'Bahnschrift', 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --radius: 4px;
  --tap: 36px;
  --dock-width: 400px;
}

@media (pointer: coarse) {
  :root {
    --tap: 42px;
  }
}

/* ---------- Base ---------- */

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

[hidden] {
  display: none !important;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

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

kbd {
  font: inherit;
  font-size: 13px;
  color: var(--ink-muted);
}

h2,
h3,
p {
  margin: 0;
}

.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--chrome);
  border-bottom: 1px solid var(--rule);
  position: relative;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
}

.toolbar,
.zoom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.doc {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.doc-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-state {
  font-size: 13px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-state.is-dirty::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--warning-fill);
  vertical-align: 1px;
}

/* ---------- Buttons ---------- */

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.1;
  cursor: pointer;
  touch-action: manipulation;
}

.button {
  padding: 6px 12px;
}

.icon-button {
  width: var(--tap);
  padding: 0;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button:hover,
.icon-button:hover {
  border-color: var(--ink-muted);
}

.button.primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--primary-fg);
  font-weight: 600;
}

.button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button.danger {
  color: var(--error);
}

.button.danger:hover {
  border-color: var(--error);
}

.button:disabled,
.icon-button:disabled {
  opacity: 0.4;
  cursor: default;
  border-color: var(--rule-strong);
}

.button.small {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 14px;
}

/* ---------- File menu ---------- */

.menu {
  position: relative;
}

.menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 250px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.menu-list [role^='menuitem'] {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: var(--tap);
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.menu-list [role^='menuitem']:hover,
.menu-list [role^='menuitem']:focus-visible {
  background: var(--hover);
  outline: none;
}

.menu-list hr {
  margin: 4px 6px;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* ---------- Workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--dock-width);
  min-height: 0;
}

.canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ow-sheet);
}

.grid-paper {
  fill: var(--ow-sheet);
}

.grid-line-minor {
  stroke: var(--ow-grid-minor);
}

.grid-line-major {
  stroke: var(--ow-grid-major);
}

.dock {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--chrome);
  border-left: 1px solid var(--rule);
}

@media (max-width: 900px) {
  :root {
    --dock-width: 100%;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 44%);
  }

  .dock {
    border-left: 0;
    border-top: 1px solid var(--rule-strong);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (min-width: 1500px) {
  :root {
    --dock-width: 460px;
  }
}

/* Phones: two rows. The commands on the first row, the file name and Fit on the second.
   Pinch or the + and - keys zoom, so the zoom buttons are not necessary. */
@media (max-width: 700px) {
  .topbar {
    gap: 6px 8px;
    padding-bottom: 6px;
  }

  .toolbar {
    gap: 5px;
  }

  .doc {
    order: 5;
    flex: 1 1 calc(100% - 80px);
    font-size: 14px;
  }

  .zoom {
    order: 6;
    margin-left: auto;
  }

  .zoom [data-cmd='zoom-in'],
  .zoom [data-cmd='zoom-out'] {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand span {
    display: none;
  }
}

@media (pointer: coarse) {
  .menu-list kbd {
    display: none;
  }
}

/* ---------- Drawing ---------- */

.canvas-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.canvas-svg.is-panning,
.canvas-svg.is-panning * {
  cursor: grabbing !important;
}

.ow-hit {
  fill: transparent;
  stroke: none;
}

.ow-pin-hit {
  cursor: crosshair;
}

.ow-wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}

.ow-wlabel {
  cursor: pointer;
}

.ow-head-g,
.ow-drag {
  cursor: grab;
}

.ow-sel,
.ow-temp {
  pointer-events: none;
}

.ow-temp {
  fill: none;
  stroke: var(--ow-text);
  stroke-width: 2;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
}

.ow-pinrow.is-source .ow-row-bg {
  fill: #f2c12e;
  fill-opacity: 0.45;
}

.ow-pinrow.is-target .ow-row-bg {
  fill: #2e8b3e;
  fill-opacity: 0.22;
}

.ow-pinrow.is-source .ow-anchor,
.ow-pinrow.is-target .ow-anchor {
  stroke: var(--ow-text);
  stroke-width: 1.6;
}

@media (hover: hover) {
  .ow-pinrow:hover .ow-row-bg {
    fill: #1f5fbf;
    fill-opacity: 0.08;
  }

  .ow-wire:hover .ow-wire-outline {
    stroke: #1f5fbf;
  }
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--ow-text);
  pointer-events: none;
}

.canvas-empty p {
  font-size: 17px;
}

.is-loading .canvas-empty {
  visibility: hidden;
}

.canvas-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
}

.canvas-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 7px 11px;
  border-radius: var(--radius);
  background: rgba(38, 50, 63, 0.92);
  color: #ffffff;
  font-size: 14px;
  pointer-events: none;
}

/* ---------- Dock tabs ---------- */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}

.tabs [role='tab'] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 10px 5px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-muted);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.tabs [role='tab']:hover {
  color: var(--ink);
}

.tabs [role='tab'][aria-selected='true'] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--marker);
}

.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #c42b27;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.badge.is-warning {
  background: var(--warning-fill);
  color: #1d2833;
}

.panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 24px;
  outline: none;
}

.panel.is-table {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.panel.is-table[hidden] {
  display: none;
}

/* ---------- Properties ---------- */

.props-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
}

.props-sub {
  margin: 3px 0 14px;
  color: var(--ink-muted);
  font-size: 14px;
}

.field {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  min-width: 0;
}

.field label,
.field .label {
  font-size: 14px;
  color: var(--ink-muted);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.field-help {
  font-size: 13px;
  color: var(--ink-muted);
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 6px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.input:hover {
  border-color: var(--ink-muted);
}

.input:focus-visible {
  outline-offset: 0;
  border-color: var(--focus);
}

.input[readonly] {
  background: transparent;
  border-style: dashed;
}

/* Stops iPhone and iPad from zooming in when an input gets focus. */
@media (pointer: coarse) {
  .input {
    font-size: 16px;
  }
}

.with-unit {
  position: relative;
}

.with-unit .input {
  padding-right: 42px;
}

.with-unit .unit {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  font-size: 14px;
  pointer-events: none;
}

.color-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #26323f;
  background: var(--swatch, transparent);
}

.swatch.is-none {
  background: repeating-linear-gradient(45deg, transparent 0 4px, var(--rule-strong) 4px 5px);
  border-style: dashed;
}

.outputs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 4px 0 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--marker);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.outputs dt {
  color: var(--ink-muted);
}

.outputs dd {
  margin: 0;
  font-weight: 500;
}

.section-title {
  margin: 18px 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.pins {
  display: grid;
  gap: 4px;
}

.pin-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 0.7fr);
  align-items: center;
  gap: 8px;
}

.pin-num {
  text-align: right;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.pin-wires {
  font-size: 13px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.props-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.props-hint {
  margin-top: 16px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* ---------- Tables ---------- */

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  flex: none;
}

.panel-summary {
  font-size: 14px;
  color: var(--ink-muted);
}

.panel-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.panel-actions {
  display: flex;
  gap: 6px;
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.panel-empty {
  padding: 18px 16px;
  color: var(--ink-muted);
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--chrome);
  color: var(--ink-muted);
  font-weight: 600;
  border-bottom-color: var(--rule-strong);
}

.data-table .num {
  text-align: right;
}

.data-table tbody tr[data-target-id] {
  cursor: pointer;
}

.data-table tbody tr[data-target-id]:hover {
  background: var(--hover);
}

.data-table tbody tr.is-selected {
  background: var(--selected);
}

.data-table tfoot td {
  font-weight: 600;
  border-bottom: 0;
  border-top: 1px solid var(--rule-strong);
}

.data-table td:first-child,
.data-table th:first-child {
  padding-left: 16px;
}

/* ---------- Checks ---------- */

.issues {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.issue {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--level, var(--rule-strong));
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.issue:hover {
  border-color: var(--rule-strong);
  border-left-color: var(--level, var(--rule-strong));
}

.issue.is-error {
  --level: var(--error);
}

.issue.is-warning {
  --level: var(--warning-fill);
}

.issue.is-info {
  --level: var(--info);
}

.issue-level {
  font-weight: 600;
  color: var(--level);
}

.issue.is-warning .issue-level {
  color: var(--warning);
}

.checks-ok {
  padding: 12px 14px;
  border-left: 4px solid #2e8b3e;
  background: var(--surface);
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(92vw, 460px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 6px;
  background: #26323f;
  color: #ffffff;
  box-shadow: var(--shadow);
  animation: toast-in 160ms ease-out;
}

.toast.is-error {
  background: #9e1f1b;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

.noscript {
  margin: 40px auto;
  max-width: 480px;
  padding: 16px;
  text-align: center;
}

/* ---------- Print ---------- */

.print-sheet {
  display: none;
}

@page {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  html,
  body {
    height: auto;
    background: #ffffff;
    color: #000000;
  }

  .app,
  .toasts {
    display: none !important;
  }

  .print-sheet {
    display: block;
    font-size: 11pt;
    color: #000000;
  }

  .print-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding-bottom: 6pt;
    border-bottom: 1.5pt solid #000000;
  }

  .print-title h1 {
    margin: 0;
    font-size: 18pt;
    font-weight: 600;
  }

  .print-title dl {
    display: flex;
    gap: 18pt;
    margin: 0;
  }

  .print-title dt {
    font-size: 8pt;
    color: #444444;
  }

  .print-title dd {
    margin: 0;
    font-weight: 600;
  }

  .print-drawing {
    margin: 10pt 0;
    break-inside: avoid;
  }

  .print-drawing svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 160mm;
  }

  .print-table {
    margin-top: 12pt;
    break-before: page;
  }

  .print-table h2 {
    margin: 0 0 6pt;
    font-size: 13pt;
  }

  .print-table .data-table {
    width: 100%;
    font-size: 9pt;
  }

  .print-table .data-table th {
    position: static;
    background: none;
    color: #000000;
    border-bottom: 1pt solid #000000;
  }

  .print-table .data-table td {
    border-bottom: 0.5pt solid #999999;
  }

  .print-table .data-table td:first-child,
  .print-table .data-table th:first-child {
    padding-left: 4pt;
  }

  .print-table tr {
    break-inside: avoid;
  }
}

/* ---------- Pictures ---------- */

.ow-bg.is-movable {
  cursor: move;
}

.ow-bg-frame {
  fill: none;
  stroke: #1f5fbf;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.photo-preview {
  margin: 0 0 4px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--ow-sheet);
}

.photo-preview img,
.photo-preview .photo-svg {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
}

.photo-preview.is-small img,
.photo-preview.is-small .photo-svg {
  height: 130px;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.range {
  width: 100%;
  min-height: var(--tap);
  margin: 0;
  accent-color: var(--ink);
}

.range-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.check-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}

.check-field input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.photo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 2px;
}

.icon-text svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Add menu ---------- */

.caret {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-note {
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---------- Pins, inputs and outputs ---------- */

.pin-row.has-role {
  grid-template-columns: 30px minmax(0, 1fr) 92px minmax(0, 0.55fr);
}

.pin-role {
  padding-left: 6px;
  padding-right: 4px;
}

.pin-lists .outputs {
  margin-top: 0;
}

.pin-group-title {
  margin: 10px 0 4px;
  font-size: 14px;
  color: var(--ink-muted);
}

.lever-dot {
  display: inline-block;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: var(--swatch);
  vertical-align: middle;
}

/* ---------- Crop window ---------- */

.crop-dialog {
  width: min(94vw, 760px);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--chrome);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.crop-dialog::backdrop {
  background: rgba(15, 22, 30, 0.55);
}

.crop-form {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.crop-title {
  font-size: 19px;
  font-weight: 600;
}

.crop-help,
.crop-size {
  color: var(--ink-muted);
  font-size: 14px;
}

.crop-stage {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: #1d2833;
}

.crop-svg {
  display: block;
  width: 100%;
  height: min(60vh, 480px);
  touch-action: none;
  overflow: visible;
}

.crop-shade {
  fill: rgba(10, 14, 20, 0.6);
  pointer-events: none;
}

.crop-frame {
  fill: transparent;
  stroke: #f2c12e;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: move;
}

.crop-handle {
  fill: #f2c12e;
  stroke: #26323f;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.crop-handle[data-drag='nw'],
.crop-handle[data-drag='se'] {
  cursor: nwse-resize;
}

.crop-handle[data-drag='ne'],
.crop-handle[data-drag='sw'] {
  cursor: nesw-resize;
}

.crop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crop-spacer {
  flex: 1;
}

/* ---------- Version ---------- */

.version {
  align-self: center;
  padding: 2px 7px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}

.version:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
}

@media (max-width: 700px) {
  .topbar .doc {
    flex: 1 1 40%;
  }

  .version {
    order: 6;
  }

  .topbar .zoom {
    order: 7;
    margin-left: 0;
  }
}

/* ---------- Sides and pin groups ---------- */

.side-card {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}

.side-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}

.side-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.side-count {
  margin-left: 4px;
  color: var(--ink-muted);
  font-weight: 400;
  font-size: 13.5px;
}

.side-actions,
.group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-card {
  margin-top: 10px;
  padding: 10px 10px 8px;
  border-left: 3px solid var(--marker);
  border-radius: 0 4px 4px 0;
  background: var(--chrome);
}

.group-card .field {
  margin-bottom: 8px;
}

.group-actions {
  margin-top: 8px;
}

.pin-row.has-role {
  grid-template-columns: 26px minmax(0, 1fr) 84px 32px;
  row-gap: 0;
}

.pin-row.has-role .pin-wires {
  grid-column: 2 / -1;
  margin-top: -2px;
}

.small-icon {
  width: 32px;
  min-height: 32px;
}

.small-icon svg {
  width: 15px;
  height: 15px;
}

/* ---------- Theme menu ---------- */

.menu-right {
  left: auto;
  right: 0;
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.menu-group {
  margin: 6px 10px 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.menu-list [role='menuitemradio'] {
  justify-content: flex-start;
  gap: 10px;
}

.menu-list [role='menuitemradio'][aria-checked='true'] {
  background: var(--selected);
  font-weight: 600;
}

.theme-dots {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  overflow: hidden;
}

.theme-dots span {
  width: 10px;
  height: 18px;
}

@media (max-width: 700px) {
  .theme-menu {
    order: 6;
  }
}

/* ---------- Selecting several components ---------- */

.ow-box {
  fill: var(--ow-sel);
  fill-opacity: 0.12;
  stroke: var(--ow-sel);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.canvas-svg.is-selecting {
  cursor: crosshair;
}

.icon-button[aria-pressed='true'] {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--primary-fg);
}

.multi-list {
  margin: 4px 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
}

.multi-list li {
  padding: 5px 9px;
  border-left: 3px solid var(--marker);
  background: var(--surface);
  font-size: 14px;
}

/* ---------- Schematics ---------- */

.count-badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--rule);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}

.sch-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 24px;
}

.sch-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.sch-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}

.sch-card.is-missing {
  border-style: dashed;
}

.sch-preview {
  display: grid;
  place-items: center;
  width: 84px;
  height: 100px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--ow-sheet);
  cursor: pointer;
  overflow: hidden;
}

.sch-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sch-icon svg {
  width: 44px;
  height: 55px;
}

.sch-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.sch-name {
  font-weight: 600;
}

.sch-facts {
  font-size: 13px;
  color: var(--ink-muted);
}

.sch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sch-drop {
  padding: 18px 16px;
  border: 2px dashed var(--rule-strong);
  border-radius: 6px;
  color: var(--ink-muted);
  text-align: center;
  cursor: pointer;
}

.sch-drop:hover,
.sch-drop:focus-visible {
  border-color: var(--focus);
  color: var(--ink);
}

.sch-drop p + p {
  margin-top: 4px;
  font-size: 14px;
}

/* ---------- Copy and paste ---------- */

/* The Paste buttons show only when OpenWire has a copy. */
.paste-action,
.paste-only {
  display: none !important;
}

.has-clip .paste-action {
  display: inline-flex !important;
}

.has-clip .paste-only {
  display: flex !important;
}
