/* The dashboard editor (task T-20261028-scroll-dashboards plan 15.6,
   T-20261029-flex-widgets 3.4). Builds on /styles.css and the manual's code
   blocks. The simulated device is the D1: a pale case around a black glass
   with the 480 x 480 screen; the grid shows while something is dragged. */
.editor-hero { padding-block: 140px 26px; }
.editor-hero h1 { margin-top: 18px; }
.editor-hero .intro { max-width: 760px; margin-top: 22px; }
.start { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 26px; }
.start-label { font: 500 11px var(--mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.templates { display: flex; flex-wrap: wrap; gap: 8px; }
.editor { padding-block: 34px 80px; background: #f4f5f7; }
.editor-grid { display: grid; grid-template-columns: 236px minmax(0, 520px) minmax(260px, 1fr); gap: 32px; align-items: start; }
.editor h2 { font-size: 15px; letter-spacing: -.2px; margin: 0 0 10px; }
.ed-side > h2:not(:first-child) { margin-top: 28px; }
.ed-side label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.ed-side input, .ed-side select, .ed-props input, .ed-props select, .ed-props textarea, .import textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid #d5d9e0; border-radius: 2px;
  font: 14px/1.3 inherit; color: var(--ink); background: #fff; box-sizing: border-box; }
.ed-side input:focus, .ed-props input:focus, .ed-props select:focus, .ed-props textarea:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: var(--blue); }
.ed-props textarea, .import textarea { font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; min-height: 90px; }

/* The palette: tiles with a small picture of the type (ptile: the site's
   .tile is the hero's view-menu tile). */
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.ptile { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid #d5d9e0; border-radius: 2px; background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: grab; touch-action: none; user-select: none; transition: border-color .2s, box-shadow .2s; }
.ptile:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgb(31 111 204 / 12%); }
.ptile:active { cursor: grabbing; }
.ptile-icon { flex: none; width: 22px; height: 18px; border-radius: 3px; background: #0f131a; position: relative; overflow: hidden; }
.ptile-icon::after { content: ''; position: absolute; inset: 4px; }
.icon-metric::after { inset: 5px 4px; background: linear-gradient(#6cc4ff 0 0) 100% 50% / 9px 6px no-repeat; }
.icon-gauge::after { inset: 3px 5px 1px; border: 3px solid #7fe0b0; border-bottom-color: transparent; border-radius: 50%; }
.icon-bars::after { inset: 4px 4px; background: repeating-linear-gradient(#7fe0b0 0 2px, transparent 2px 4px); clip-path: polygon(0 0, 80% 0, 80% 34%, 50% 34%, 50% 67%, 100% 67%, 100% 100%, 0 100%); }
.icon-graph::after { inset: 4px 3px; background: linear-gradient(160deg, transparent 45%, #7fe0b0 46% 56%, transparent 57%); }
.icon-sparkline::after { inset: 7px 3px; border-top: 2px solid #6cc4ff; border-radius: 40% 40% 0 0; }
.icon-table::after { inset: 4px 3px; background: repeating-linear-gradient(#c9d0d9 0 1.5px, transparent 1.5px 4px); }
.icon-status::after { inset: 6px auto auto 4px; width: 6px; height: 6px; border-radius: 50%; background: #7fe0b0; }
.icon-text::after { inset: 8px 4px auto; height: 2px; background: #eef1f5; box-shadow: 0 4px 0 #9aa4b2; }
.icon-primitives::after { inset: 4px 6px; border: 2px solid #ffb547; border-radius: 3px; }
.ghost { position: fixed; z-index: 30; transform: translate(-50%, -50%); padding: 7px 12px; border-radius: 2px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600; pointer-events: none; box-shadow: 0 8px 20px rgb(16 17 18 / 25%); }

/* The simulated D1: its case, the black glass, the screen. */
.device { padding: 26px; border-radius: 34px; background: linear-gradient(160deg, #f1ebe8, #ddd3cf); box-shadow: inset 0 1px 0 #fff, 0 2px 0 #cfc4bf, 0 24px 50px rgb(16 17 18 / 18%); position: relative; }
.device::before { content: ''; position: absolute; top: -5px; left: 54px; width: 46px; height: 8px; border-radius: 4px 4px 0 0; background: repeating-linear-gradient(90deg, #8bd24f 0 3px, #6cb43a 3px 5px); }
.board-frame { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #0b0e13; box-shadow: 0 0 0 14px #0c0e12, 0 0 0 15px #2a2d33; }
.board-frame canvas { width: 100%; height: 100%; display: block; }
/* The grid: 12 x 12 cells of 38 x 34 from (12, 68) on the 480 canvas. */
.gridlines { position: absolute; left: 2.5%; top: 14.1667%; width: 95%; height: 85%; pointer-events: none; opacity: 0; transition: opacity .15s;
  background-image: linear-gradient(to right, rgb(108 196 255 / 35%) 1px, transparent 1px), linear-gradient(to bottom, rgb(108 196 255 / 35%) 1px, transparent 1px);
  background-size: calc(100% / 12) calc(100% / 12); box-shadow: inset -1px -1px 0 rgb(108 196 255 / 35%); }
.board-frame.dragging .gridlines { opacity: 1; }
.overlay { position: absolute; inset: 0; }
.overlay .w { position: absolute; border: 1.5px dashed transparent; border-radius: 10px; cursor: grab; touch-action: none; }
.overlay .w:hover { border-color: rgb(108 196 255 / 50%); }
.overlay .w.sel { border: 2px solid #6cc4ff; }
.overlay .w.bad { border: 2px solid #ff6b5e; }
.overlay .w .grip { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 4px; background: #6cc4ff; cursor: nwse-resize; display: none; touch-action: none; }
.overlay .w.sel .grip { display: block; }
.drop { position: absolute; border-radius: 10px; pointer-events: none; }
.drop.ok { background: rgb(127 224 176 / 18%); outline: 2px solid #7fe0b0; }
.drop.no { background: rgb(255 107 94 / 16%); outline: 2px solid #ff6b5e; }
.sim { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.sim #play { min-width: 84px; }
.sim #play[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

/* The properties: cards, each field with its limit, the board's objections under it. */
.ed-props > h2 { margin-bottom: 12px; }
.card { background: #fff; border: 1px solid #e3e6eb; border-radius: 2px; padding: 14px 14px 4px; margin: 0 0 12px; }
.card h3 { font-size: 13px; margin: 0 0 12px; letter-spacing: -.1px; }
.field { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.field small { display: block; margin-top: 4px; font-size: 11.5px; color: #8a929e; }
.field-error { margin: 6px 0 0; font-size: 12px; color: #b3261e; }
.card > .field-error { margin: -6px 0 12px; }
.ed-props .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.ed-props .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 8px; }
.ed-props .row > .ed-btn { margin-bottom: 12px; }
.ed-props .choice, .output .choice { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); margin: 0 0 12px; }
.ed-props .choice input, .output .choice input { width: auto; margin: 0; }
.swatches { display: flex; gap: 6px; margin-top: 6px; }
.swatch { width: 24px; height: 24px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px #d5d9e0; cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--blue); }
.ed-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border: 1px solid #d5d9e0; border-radius: 2px; background: #fff; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; transition: background .2s, border-color .2s; }
.ed-btn:hover { background: #edf2ff; border-color: var(--blue); color: var(--blue); }
.ed-btn:disabled { opacity: .5; cursor: default; }
.ed-btn.danger { color: #b3261e; }
.ed-btn.danger:hover { background: #fdecea; border-color: #b3261e; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* The output. */
.ed-error { margin: 22px 0 0; padding: 12px 14px; border-left: 3px solid #b3261e; background: #fdecea; color: #7a1a14; font-size: 14px; }
.output { margin-top: 26px; }
.output-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.output-head h2, .output-head h3 { margin: 0 auto 0 0; }
.output-head h3 { font-size: 13px; }
.output .bytes { font: 12.5px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.output .bytes.over { color: #b3261e; font-weight: 700; }
.copy-note { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.copy-note:empty { display: none; }
.meter { width: 90px; height: 6px; border-radius: 3px; background: linear-gradient(var(--blue) 0 0) 0 0 / var(--fill, 0%) 100% no-repeat, #e3e6eb; }
.meter.over { background: #b3261e; }
.output pre, .values pre { max-height: 360px; }
.output pre code, .values pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.values, .import { margin-top: 18px; }
.values summary, .import summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.values .output-head { margin-top: 10px; }
.import textarea { margin: 8px 0 10px; }
.ed-board > .hint { margin-top: 12px; }
.output > .hint { margin-top: 10px; }
@media (max-width: 1100px) { .editor-grid { grid-template-columns: 220px minmax(0, 1fr); } .ed-props { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .ed-board { order: -1; }
  .device { padding: 14px; border-radius: 22px; }
  .board-frame { box-shadow: 0 0 0 8px #0c0e12, 0 0 0 9px #2a2d33; }
}
