:root {
  --ink: #254c3f;
  --muted: #829176;
  --line: #e1e7dc;
  --teal: #366e55;
  --teal-dark: #254c3f;
  --paper: #fff;
  --wash: #f5f8f1;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: #f7f9f4;
  color: var(--ink);
  font:
    12px Arial,
    Helvetica,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #3b8874;
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration: none;
}
svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topbar {
  height: 75px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  gap: 30px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -1px;
}
.header-brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: contain;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: #edf4eb;
  width: 38px;
  height: 38px;
  border-radius: 8px;
}
.brand-mark svg {
  width: 28px;
  height: 28px;
}
.brand-dot {
  color: var(--teal);
}
.topbar nav {
  display: flex;
  align-self: stretch;
  gap: 30px;
}
.nav-link {
  position: relative;
  color: #88948c;
  font-size: 12px;
}
.nav-link.active {
  color: var(--ink);
  font-weight: 600;
}
.nav-link.active:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--teal);
}
.header-end {
  display: flex;
  align-items: center;
  gap: 15px;
}
.preview-badge,
.profile-badge {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #839473;
  background: #eff4e9;
  padding: 6px 8px;
  border-radius: 4px;
}
.connect-button {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 11px;
}
.connect-button svg {
  width: 17px;
  height: 17px;
}
.status-dot,
.tiny-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a9b89e;
}
.connected .status-dot {
  background: #35a075;
}
.tiny-dot {
  background: #80a674;
}
main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 0 26px;
  gap: 20px;
}
.breadcrumb {
  font-size: 10px;
  color: #9aa590;
  margin-bottom: 12px;
}
.breadcrumb span {
  margin: 0 9px;
}
.breadcrumb strong {
  font-weight: 500;
  color: #788c70;
}
h1 {
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: -0.9px;
  font-weight: 600;
}
.page-heading p {
  margin: 0;
  color: #95a389;
  font-size: 12px;
}
.heading-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.private-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #91a284;
  font-size: 10px;
}
.private-tag svg {
  width: 15px;
  height: 15px;
}
.quiet-button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 12px;
  font-size: 10px;
}
.quiet-button span {
  margin-left: 12px;
}
.studio {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr) 235px;
  min-height: 740px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.left-rail {
  border-right: 1px solid var(--line);
  position: relative;
  padding-bottom: 74px;
  display: flex;
  flex-direction: column;
}
.rail-tabs {
  height: 56px;
  display: flex;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-shrink: 0;
}
.rail-tabs button {
  font-size: 11px;
  font-weight: 600;
  position: relative;
  color: #88948c;
  padding: 0 0 2px;
}
.rail-tabs button.selected {
  color: #254c3f;
}
.rail-tabs button.selected:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #366e55;
}
.rail-tabs span {
  margin-left: 5px;
  font-size: 9px;
  background: #f0f4ed;
  border-radius: 3px;
  padding: 2px 3px;
}
.rail-intro {
  padding: 24px 17px 15px;
}
.rail-intro h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 8px;
}
.rail-intro p {
  font-size: 10px;
  line-height: 1.55;
  color: #99a48f;
  margin: 0;
}
.category-chips {
  display: flex;
  gap: 4px;
  padding: 0 15px 15px;
  flex-wrap: wrap;
}
.category-chips button {
  font-size: 9px;
  border-radius: 4px;
  padding: 5px 7px;
  color: #7a897f;
  background: #f4f6f1;
}
.category-chips button.selected {
  background: #e4f0e3;
  color: #315741;
}
.template-list {
  max-height: 440px;
  overflow-y: auto;
  padding: 0 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.template-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  text-align: left;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  min-height: 90px;
}
.template-card:hover,
.template-card.chosen {
  border-color: #80ac91;
  background: #f9fcf7;
}
.template-card canvas {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  image-rendering: pixelated;
}
.template-card strong {
  font-size: 10px;
  font-weight: 600;
  display: block;
  margin: 0 0 5px;
}
.template-card small {
  font-size: 9px;
  line-height: 1.45;
  color: #99a48f;
  display: block;
}
.blank-button {
  border: 1px dashed #d7e0d0;
  border-radius: 5px;
  font-size: 10px;
  color: #8b9e80;
  padding: 11px;
  margin: 14px 15px;
  width: calc(100% - 30px);
}
.rail-footer {
  position: absolute;
  bottom: 20px;
  left: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #9aa991;
  font-size: 9px;
  line-height: 1.6;
}
.rail-footer strong {
  font-weight: 500;
}
.rail-footer .tiny-dot {
  margin-top: 5px;
}
.layer-list {
  max-height: 470px;
  overflow: auto;
  padding: 0 12px;
}
.layer-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  padding: 11px 9px;
  margin-bottom: 6px;
  border-radius: 4px;
  font-size: 10px;
  text-align: left;
}
.layer-row.selected {
  background: #e9f4ed;
  border-color: #73a48b;
}
.layer-row small {
  font-size: 8px;
  color: #95a38c;
}
.layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 14px;
}
.layer-actions button {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px;
  font-size: 9px;
}
.canvas-column {
  /* Inspector content must not stretch/recenter the drawing column. */
  align-self: start;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.document-bar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 15px;
  gap: 10px;
}
.document-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.paper-icon {
  font-size: 19px;
  color: #8c9e80;
}
.document-name input {
  border: 0;
  background: transparent;
  min-width: 0;
  width: 150px;
  font-size: 11px;
  font-weight: 600;
}
.document-name #save-state {
  font-size: 8px;
  color: #a1ae95;
  white-space: nowrap;
}
.document-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.document-actions button {
  font-size: 10px;
  padding: 8px;
  color: #88a07b;
}
.save-button {
  background: #eef4e8 !important;
  border: 1px solid #dce5d4 !important;
  border-radius: 4px;
}
.export-button {
  border: 1px solid var(--line) !important;
  border-radius: 4px;
}
.separator {
  height: 15px;
  width: 1px;
  background: var(--line);
}
.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.tools {
  display: flex;
  gap: 3px;
}
.tool {
  height: 30px;
  width: 29px;
  padding: 5px;
  color: #8c9c83;
  border-radius: 4px;
}
.tool svg {
  width: 19px;
  height: 19px;
}
.tool.selected,
.tool:hover {
  background: #eaf1e3;
  color: #486d45;
}
.canvas-options {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #95a18a;
  font-size: 8px;
  white-space: nowrap;
}
.canvas-options label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.canvas-options input {
  accent-color: var(--teal);
  width: 11px;
  height: 11px;
}
.canvas-options button {
  font-size: 13px;
}
.canvas-workspace {
  position: relative;
  background: #f0f3eb;
  flex: 1;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Keep the stage pinned below its toolbar for every selection/tool. */
  justify-content: flex-start;
  padding: 55px 22px 30px;
  overflow: hidden;
}
.workspace-label {
  position: absolute;
  top: 20px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 0.8px;
  color: #9ba890;
}
.workspace-label span:last-child {
  letter-spacing: 0;
}
.display-frame {
  padding: 12px;
  background: #e5e9d9;
  border-radius: 11px;
  box-shadow: 0 8px 28px #677d4520;
  flex-shrink: 0;
}
.display-stage {
  position: relative;
  width: 400px;
  height: 400px;
  background: #fff;
}
.display-stage.grid::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(20, 144, 147, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 144, 147, 0.45) 1px, transparent 1px),
    linear-gradient(to right, rgba(20, 144, 147, 0.2) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 144, 147, 0.2) 1px, transparent 1px);
  background-size:
    var(--grid-major-step, 20px) var(--grid-major-step, 20px),
    var(--grid-major-step, 20px) var(--grid-major-step, 20px),
    var(--grid-step, 4px) var(--grid-step, 4px),
    var(--grid-step, 4px) var(--grid-step, 4px);
}
.display-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.display-stage #selection-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
}
.drawing #selection-canvas {
  cursor: crosshair;
}
.display-caption {
  display: flex;
  justify-content: space-between;
  width: min(100%, 420px);
  margin: 20px 0;
  color: #98a58d;
  font-size: 8px;
  gap: 15px;
}
.size-label {
  font-family: Consolas, monospace;
}
.size-label span {
  margin-left: 7px;
  color: #a9b49e;
}
.display-kind {
  font-size: 7px;
  letter-spacing: 1px;
}
.canvas-hint {
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
  color: #a1af95;
  margin-top: 0;
}
.output-bar {
  padding: 13px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #dfe6d7;
  gap: 10px;
  min-height: 68px;
  background: #fcfdf9;
}
.device-summary {
  display: flex;
  gap: 9px;
  align-items: center;
}
.device-glyph {
  font-size: 25px;
  color: #7a9570;
}
.device-summary strong {
  display: block;
  font-size: 9px;
  color: #4d6748;
  font-weight: 600;
}
.device-summary span:not(.device-glyph) {
  display: block;
  font-size: 8px;
  color: #9ca991;
  margin-top: 5px;
}
.output-end {
  display: flex;
  align-items: center;
  gap: 11px;
}
.refresh-label {
  font-size: 8px;
  color: #99a98e;
  white-space: nowrap;
}
.refresh-label .tiny-dot {
  width: 4px;
  height: 4px;
  margin-right: 4px;
  margin-top: 0;
}
.primary-button {
  background: var(--teal);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 11px 14px;
  border: 1px solid var(--teal);
  border-radius: 5px;
  white-space: nowrap;
}
.primary-button:hover:not(:disabled) {
  background: var(--teal-dark);
}
.primary-button span {
  margin-left: 9px;
}
.primary-button:disabled {
  background: #b7c9ad;
  color: #f5f8f1;
  border-color: #b7c9ad;
  opacity: 1;
}
.properties-rail {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.properties-heading {
  height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  gap: 8px;
}
.properties-heading h2 {
  font-size: 11px;
  font-weight: 600;
  margin: 0;
}
.properties-heading span {
  font-size: 8px;
  color: #8b9986;
  text-transform: uppercase;
}
.empty-properties {
  text-align: center;
  padding: 68px 23px 25px;
  color: #a0ae93;
}
.empty-properties > svg {
  width: 43px;
  height: 43px;
  stroke: #a9b89e;
  margin-bottom: 14px;
}
.empty-properties h3 {
  font-size: 11px;
  color: #718667;
  font-weight: 550;
  margin: 0 0 10px;
}
.empty-properties p {
  font-size: 10px;
  line-height: 1.7;
  margin: 0 0 17px;
  color: #a0ae94;
}
.empty-properties .quiet-button {
  font-size: 9px;
  color: #7a9070;
  background: #fcfef8;
}
.property-section {
  padding: 16px 17px;
  border-bottom: 1px solid #e7ece1;
}
.field-label {
  display: block;
  font-size: 9px;
  color: #7f8f74;
  margin: 0 0 7px;
}
.property-section input,
.property-section textarea,
.property-section select,
dialog > input {
  border: 1px solid #dfe7d6;
  border-radius: 4px;
  background: #fbfdf8;
  padding: 8px;
  width: 100%;
  font-size: 10px;
  color: #4b6643;
  max-width: 100%;
}
.property-section textarea {
  resize: vertical;
}
.coordinate-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 11px;
}
.coordinate-fields label,
.field-pair label {
  font-size: 8px;
  color: #8c9c80;
}
.coordinate-fields input {
  margin-top: 5px;
  font-family: Consolas, monospace;
  font-size: 10px;
}
.field-pair {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 12px 0 15px;
}
.field-pair label {
  width: 70px;
}
.field-pair input {
  margin-top: 5px;
}
.font-caption {
  font-size: 8px;
  line-height: 1.6;
  color: #9aa98c;
}
.property-section select {
  margin-bottom: 13px;
}
.property-section input[type="number"] {
  max-width: 100%;
}
.field-help {
  font-size: 9px;
  color: #91a384;
  line-height: 1.55;
  margin: 2px 0 0;
}
.danger-button {
  padding: 8px;
  border: 1px solid #e7cfc7;
  border-radius: 4px;
  color: #a7624e;
  font-size: 10px;
}
.properties-note {
  display: flex;
  gap: 8px;
  padding: 16px;
  margin-top: auto;
  color: #98ab8e;
  font-size: 9px;
  line-height: 1.5;
}
.properties-note p {
  margin: 0;
}
.properties-note > span {
  color: #76a377;
}
.library-view {
  min-height: 600px;
}
.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  color: #819176;
  font-size: 11px;
}
.library-toolbar > div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.library-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.card-preview {
  padding: 23px;
  background: #eef3e7;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
.card-preview canvas {
  width: 200px;
  height: 200px;
  max-width: 100%;
  image-rendering: pixelated;
  border: 1px solid #dbe3d2;
}
.card-body {
  padding: 18px;
}
.card-body h3 {
  font-size: 14px;
  margin: 0 0 9px;
  font-weight: 600;
}
.card-body p {
  font-size: 11px;
  color: #93a18a;
  line-height: 1.55;
  min-height: 45px;
  margin: 0 0 16px;
}
.card-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.card-buttons button {
  font-size: 10px;
  border: 1px solid var(--line);
  padding: 8px;
  border-radius: 4px;
}
.card-buttons small {
  font-size: 8px;
  letter-spacing: 1px;
  color: #9bad8f;
}
.delete-saved {
  color: #ae7363;
}
.library-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px;
  color: #8e9c83;
}
.library-empty h2 {
  font-size: 20px;
}
.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 9px;
  color: #a5b09b;
  padding: 24px 0 35px;
}
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
}
.footer-brand img {
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: contain;
}
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  border: 1px solid #739681;
  background: #254c3f;
  color: white;
  box-shadow: 0 6px 25px #1e39262a;
  border-radius: 6px;
  padding: 13px 18px;
  font-size: 12px;
  max-width: calc(100% - 30px);
  line-height: 1.5;
}
.toast.error {
  background: #7c493d;
}
dialog {
  border: 1px solid #dce4d4;
  border-radius: 12px;
  padding: 27px;
  max-width: 550px;
  width: calc(100% - 40px);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 25px 75px #1b362c28;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
dialog::backdrop {
  background: #17282065;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 22px;
}
.eyebrow {
  font-size: 8px;
  letter-spacing: 1.7px;
  color: #8ba178;
}
.dialog-header h2 {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin: 8px 0 0;
}
.dialog-close {
  font-size: 23px;
  color: #92a487;
  padding: 0 3px;
}
.dialog-note {
  font-size: 10px;
  color: #99a88f;
  line-height: 1.6;
}
.export-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.export-choices button {
  position: relative;
  text-align: left;
  padding: 15px 42px 15px 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfdf9;
}
.export-choices button:hover {
  border-color: #77a78c;
}
.export-choices strong {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}
.export-choices span {
  font-size: 10px;
  color: #9aaa8e;
  line-height: 1.5;
  display: block;
}
.export-choices b {
  position: absolute;
  right: 17px;
  top: 25px;
  color: #8bab75;
  font-size: 17px;
}
.export-choices .export-bundle {
  border-color: var(--teal);
  background: #edf7f4;
}
.export-choices .export-bundle strong {
  color: var(--teal-dark);
}
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 11px;
  margin: 16px 0;
  line-height: 1.5;
}
.checkbox-label input {
  accent-color: var(--teal);
}
.full-button {
  width: 100%;
  margin-top: 15px;
}
.board-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 20px;
}
.board-icon {
  font-size: 32px;
  color: #8fa181;
}
.board-profile strong {
  font-size: 11px;
}
.board-profile p {
  margin: 5px 0 0;
  font-size: 10px;
  color: #94a58b;
}
.board-profile .profile-badge {
  margin-left: auto;
  letter-spacing: 0;
  font-size: 7px;
}
dialog > p {
  font-size: 12px;
  line-height: 1.65;
  color: #819276;
}
.device-actions {
  display: flex;
  gap: 8px;
  margin: 15px 0;
}
.connection-status,
.device-status {
  font-size: 11px;
  padding: 12px;
  background: #f2f7ed;
  border-radius: 5px;
  line-height: 1.5;
}
.connection-status.error {
  background: #fff0e9;
  color: #9b5945;
}
.transfer-box,
.firmware-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 15px;
  margin-top: 18px;
}
.progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 10px;
}
progress {
  width: 100%;
  height: 7px;
  accent-color: var(--teal);
}
.firmware-warning {
  font-size: 11px;
  line-height: 1.6;
  background: #fff8e9;
  border: 1px solid #ebdec1;
  border-radius: 5px;
  padding: 12px;
  color: #938064;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    10px/1.6 Consolas,
    monospace;
  padding: 12px;
  background: #f3f7ef;
  border: 1px solid var(--line);
  border-radius: 5px;
  max-height: 200px;
  overflow: auto;
}
.guide-steps {
  font-size: 12px;
  line-height: 1.7;
  padding-left: 20px;
}
.guide-steps li {
  padding-bottom: 8px;
}
.icon-options {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
}
.icon-options label {
  flex: 1;
  font-size: 9px;
  color: var(--ink);
}
.icon-options select {
  width: 100%;
  margin-top: 5px;
  padding: 6px 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-size: 9px;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 12px;
  max-height: 420px;
  overflow-y: auto;
}
.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 70px;
  padding: 8px 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}
.icon-tile:hover {
  border-color: var(--teal);
  background: #edf7f4;
}
.icon-tile canvas {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}
.icon-tile span {
  font-size: 8px;
  line-height: 1.25;
  color: var(--ink);
  text-align: center;
}
.icon-help {
  padding: 0 13px;
  color: #7f8f74;
  font-size: 9px;
  line-height: 1.6;
}
@media (max-width: 1200px) {
  .studio {
    grid-template-columns: 190px minmax(0, 1fr) 200px;
  }
  .template-card {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: 7px;
    gap: 8px;
  }
  .template-card canvas {
    width: 58px;
    height: 58px;
  }
  .document-name input {
    width: 130px;
  }
  .document-name #save-state {
    display: none;
  }
  .output-bar {
    padding: 12px;
  }
  .output-end {
    gap: 6px;
  }
  .refresh-label {
    display: none;
  }
  .primary-button {
    font-size: 10px;
    padding: 10px;
  }
  .topbar {
    padding: 0 24px;
    gap: 20px;
  }
  .topbar nav {
    gap: 20px;
  }
}
@media (max-width: 900px) {
  .studio {
    grid-template-columns: 175px minmax(0, 1fr);
  }
  .properties-rail {
    grid-column: 1/-1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  #property-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .empty-properties {
    padding: 22px;
  }
  .properties-note {
    padding: 12px;
  }
  .properties-heading {
    height: 45px;
  }
  .header-end .preview-badge {
    display: none;
  }
  .page-heading h1 {
    font-size: 26px;
  }
  .private-tag {
    display: none;
  }
  .canvas-toolbar {
    flex-wrap: wrap;
  }
  .canvas-workspace {
    min-height: 500px;
  }
  .rail-tabs {
    padding: 0 10px;
    gap: 9px;
  }
  .rail-tabs button {
    font-size: 10px;
  }
  .template-card {
    grid-template-columns: 50px minmax(0, 1fr);
  }
  .template-card canvas {
    width: 50px;
    height: 50px;
  }
  .template-card small {
    font-size: 8px;
  }
}
@media (max-width: 620px) {
  main {
    padding: 0 12px;
  }
  .topbar {
    height: auto;
    min-height: 65px;
    padding: 12px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .brand {
    font-size: 20px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 35px;
    height: 35px;
  }
  .connect-button {
    padding: 8px;
    font-size: 10px;
  }
  .page-heading {
    padding: 22px 0 20px;
  }
  .heading-actions {
    display: none;
  }
  .page-heading h1 {
    font-size: 23px;
  }
  .page-heading p {
    font-size: 11px;
  }
  .studio {
    grid-template-columns: 1fr;
  }
  .left-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }
  .rail-tabs {
    height: 45px;
  }
  .rail-intro {
    padding: 12px 15px;
  }
  .rail-intro p {
    display: none;
  }
  .template-list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .template-card {
    min-width: 175px;
  }
  .blank-button {
    margin: 10px 15px;
  }
  .rail-footer {
    display: none;
  }
  .icon-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-height: 190px;
  }
  .icon-options {
    max-width: 350px;
  }
  .icon-help {
    font-size: 9px;
  }
  .document-bar {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .document-name input {
    width: 140px;
  }
  .document-actions {
    gap: 3px;
  }
  .canvas-toolbar {
    gap: 6px;
  }
  .canvas-workspace {
    padding: 55px 15px 20px;
    min-height: 460px;
  }
  .output-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
  .device-summary {
    width: 100%;
    justify-content: center;
  }
  .output-end {
    margin-top: 5px;
  }
  .display-kind {
    font-size: 6px;
  }
  .page-footer {
    font-size: 8px;
    flex-wrap: wrap;
  }
  .library-grid {
    grid-template-columns: 1fr;
  }
  .library-toolbar {
    font-size: 10px;
  }
  .library-toolbar > div {
    gap: 6px;
  }
  #property-fields {
    grid-template-columns: 1fr;
  }
  .properties-note {
    display: none;
  }
  .property-section {
    padding: 12px 15px;
  }
  .toast {
    font-size: 10px;
  }
  .icon-tile span {
    font-size: 7px;
  }
}

/* OpenWeather follows the existing device-dialog style on every editor view. */
#weather-settings .weather-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
#weather-settings fieldset { border:0; padding:0; margin:0; min-width:0; }
#weather-settings .weather-form-row { display:flex; gap:12px; margin:12px 0; }
#weather-settings .weather-form-row > label { flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted); }
#weather-settings .weather-form-row input, #weather-settings .weather-form-row select, #weather-settings > fieldset > input, #weather-settings > fieldset > select { width:100%; box-sizing:border-box; }
#weather-settings input[type="checkbox"] { width:auto; }
#weather-settings .field-label { display:block; margin-top:12px; }
#weather-settings #weather-api-key { font-family:ui-monospace,monospace; }
#weather-settings fieldset:disabled { opacity:.6; }
#weather-settings .device-buttons { flex-wrap:wrap; }
@media(max-width:560px) { #weather-settings .weather-form-row { flex-direction:column; } }

.device-screen-panel {
  display: flex;
  gap: 24px;
  align-items: center;
  margin: 20px 0;
  padding: 18px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.device-screen-panel canvas {
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
  border: 1px solid var(--muted);
  background: #fff;
}
.device-screen-panel h3 {
  margin: 8px 0 12px;
}
.output-end {
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .device-screen-panel {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Send results stay in the native dialog's top layer, not behind its backdrop. */
.send-feedback {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2f6ed;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.send-feedback[data-state="error"] {
  border-color: #c49b8b;
  background: #fff2ec;
  color: #7c493d;
}
.send-feedback[data-state="success"] {
  border-color: #739681;
  color: #254c3f;
}
.static-preview-option {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfdf9;
}
.static-preview-option h3 {
  margin: 0 0 8px;
  font-size: 13px;
}
.static-preview-option p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.static-preview-option button {
  width: 100%;
  white-space: normal;
}

/* Candidate flow is separate from the previous stable installer. */
.candidate-install-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wash);
}
.candidate-install-panel summary {
  font-weight: 700;
  cursor: pointer;
}
.candidate-install-panel .eyebrow {
  margin-top: 16px;
}
.candidate-install-panel .device-status-box {
  overflow-wrap: anywhere;
}
.candidate-install-panel .device-status-box[data-state="error"] {
  border-color: #a94337;
  color: #8a3028;
}
.candidate-backup-links a {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.candidate-install-panel .device-buttons {
  flex-wrap: wrap;
}
.candidate-install-panel button {
  max-width: 100%;
  white-space: normal;
}
