/* Gauge Studio: the editor, the gauge catalog and a cluster's page, on the Toolbox's own tokens (app.css). */

.gs-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4) var(--space-6); }
.gs-heading h1 { font-size: var(--text-3xl); }
.gs-heading .lede { max-width: 72ch; }
/* Studio / Catalog: the switch between the tool's two halves (partials/gauge-nav.php). */
.gs-nav { display: inline-flex; flex: none; }
.gs-nav .tab { flex: none; min-width: 6.5rem; text-decoration: none; }
.gs-nav .tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 480px) { .gs-nav { display: flex; width: 100%; } .gs-nav .tab { flex: 1 1 0; min-width: 0; } }

/* ------------------------------------------------------------------ The editor */

/* The editor takes more of a wide screen than a page of reading does: three columns and a stage. */
/* The studio uses the whole window, as a graphics program does. */
.gs-container { max-width: none; padding-inline: clamp(.5rem, 1.2vw, 1.25rem); }

.gs-app { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.gs-app[hidden] { display: none; }

.gs-topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.gs-topbar__name { flex: 1 1 min(280px, 100%); min-width: 0; max-width: 460px; }
.gs-topbar__name .label, .gs-topbar__drafts .label { display: block; margin-bottom: .4rem; }
.gs-topbar__drafts { flex: 0 1 260px; min-width: 0; }
.gs-topbar__drafts[hidden] { display: none; }
.gs-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; align-self: flex-end; }
.gs-status { flex-basis: 100%; min-height: 1.2em; font-size: var(--text-sm); color: var(--text-muted); }
.gs-status:empty { display: none; }
.gs-savestate { display: inline-flex; align-items: center; gap: .45rem; margin-top: .55rem; font-size: var(--text-xs); color: var(--text-muted); }
.gs-savestate::before { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--text-dim); }
.gs-savestate[data-state="saved"]::before { background: var(--ok-text); }
.gs-savestate[data-state="modified"] { color: var(--warn-text); }
.gs-savestate[data-state="modified"]::before { background: var(--warn); }

/* Menus: Export and More, out of the way until wanted. */
.gs-menu { position: relative; }
.gs-menu > summary { list-style: none; cursor: pointer; }
.gs-menu > summary::-webkit-details-marker { display: none; }
.gs-menu > summary::after { content: ''; width: .4rem; height: .4rem; margin-left: .45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.gs-menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.gs-menu__list { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 30; min-width: 15rem; display: grid; padding: .3rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-lg); }
.gs-menu__group { display: grid; }
.gs-menu__list button { all: unset; box-sizing: border-box; padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--text); cursor: pointer; }
.gs-menu__list button[hidden] { display: none; }
.gs-menu__list button:hover, .gs-menu__list button:focus-visible { background: var(--accent-soft); color: var(--accent-text); }
.gs-menu__list button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gs-menu__list button:disabled { color: var(--text-dim); cursor: default; background: none; }
.gs-menu__heading { margin: .5rem .7rem .2rem; padding-top: .5rem; border-top: 1px solid var(--border); font-size: var(--text-xs); font-weight: 650; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }

/* Three columns on a wide screen: the layers, the stage (with the modules to add above it), the properties. */
.gs-workspace { display: grid; grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(280px, 330px); grid-template-areas: "modules centre props"; gap: var(--space-3); align-items: start; }
.gs-modules { grid-area: modules; }
.gs-centre { grid-area: centre; }
.gs-props { grid-area: props; }
/* On a wide screen the side panels keep to the window's edges at its full height, each scrolling on its own. */
@media (min-width: 1181px) {
    .gs-workspace { grid-template-columns: clamp(220px, 15vw, 280px) minmax(0, 1fr) clamp(300px, 20vw, 380px); }
    .gs-modules, .gs-props { position: sticky; top: calc(var(--header-height) + .5rem); max-height: calc(100vh - var(--header-height) - 1rem); overflow: auto; overscroll-behavior: contain; }
    .gs-props { display: flex; flex-direction: column; }
    .gs-props .gs-props__body { max-height: none; overflow: visible; }
    /* The layers fill the column at the window's full height: the head stays, the list scrolls in it. */
    .gs-layerpanel { height: calc(100vh - var(--header-height) - 1rem); overflow: hidden; }
    .gs-workspace .gs-layerpanel .gs-layers { max-height: none; }
}
@media (max-width: 1180px) {
    .gs-workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "centre centre" "modules props"; }
}
@media (max-width: 760px) {
    .gs-workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "centre" "props" "modules"; }
}

.gs-panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); min-width: 0; }
.gs-layerpanel { display: flex; flex-direction: column; min-height: 0; }
.gs-layerpanel__head { padding: .8rem .9rem .2rem; }
.gs-layerpanel .gs-layers__tools { padding: 0 .9rem .55rem; border-bottom: 1px solid var(--border); }
.gs-layerpanel .gs-layers { flex: 1 1 auto; min-height: 0; max-height: 70vh; overflow-y: auto; padding: .45rem .5rem .8rem .6rem; gap: .2rem; align-content: start; }
.gs-layers__tools { display: grid; gap: .35rem; }
.gs-layers__tools .gs-input { padding-top: .3rem; padding-bottom: .3rem; font-size: var(--text-sm); }

/* What can be added, as menus above the stage: a category, then the module. */
.gs-insert { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.gs-insert__label { margin-right: .25rem; font-size: var(--text-xs); font-weight: 650; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.gs-insert .gs-menu__list { left: 0; right: auto; min-width: 17rem; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .15rem; }
.gs-insert .gs-menu__list .gs-insert__item, .gs-insert__single { display: flex; align-items: center; gap: .45rem; }
.gs-insert .gs-menu__list .gs-insert__item { padding: .45rem .55rem; font-size: var(--text-xs); font-weight: 600; }
.gs-insert__item .gs-glyph, .gs-insert__single .gs-glyph { flex: none; width: 1rem; height: 1rem; }
@media (max-width: 520px) { .gs-insert .gs-menu__list { min-width: min(17rem, calc(100vw - 3rem)); grid-template-columns: minmax(0, 1fr); } }
.gs-panel__section { padding: .9rem 1rem; }
.gs-panel__section + .gs-panel__section { border-top: 1px solid var(--border); }
.gs-panel__title { display: flex; align-items: center; gap: .5rem; font-size: .95rem; line-height: 1.3; margin-bottom: .6rem; }
.gs-panel__note { font-size: var(--text-xs); color: var(--text-dim); margin: -.3rem 0 .6rem; }
.gs-panel__head { padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.gs-panel__head h2 { font-size: 1rem; }
.gs-panel__head p { margin-top: .25rem; font-size: var(--text-xs); color: var(--text-dim); line-height: 1.5; }
.gs-count { min-width: 1.6rem; padding: .05rem .45rem; border-radius: var(--radius-full); background: var(--surface-sunken); color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; text-align: center; }
.gs-glyph { display: inline-flex; width: 1.15rem; height: 1.15rem; flex: none; }
.gs-glyph svg { width: 100%; height: 100%; }

/* Add a module */

/* Layers: the front at the top */
.gs-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; max-height: 520px; overflow-y: auto; overflow-x: hidden; }
.gs-layers__search.input { margin-bottom: 0; }
.gs-layer__grip { flex: none; display: grid; place-items: center; width: .55rem; color: var(--text-dim); font-size: .65rem; letter-spacing: -.1em; cursor: grab; opacity: .6; }
.gs-layer.is-dragging { opacity: .45; }
.gs-drag-ghost { position: fixed; top: -200px; left: 0; padding: .3rem .6rem; border-radius: 999px; background: var(--accent); color: var(--bg, #000); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; pointer-events: none; }
.gs-layer.is-drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.gs-layer.is-drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.gs-layer__chips { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .15rem; }
.gs-layer__sub { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .3rem; min-width: 0; }
.gs-layer__sub .gs-layer__detail { max-width: 100%; }
.gs-layer__sub .gs-layer__chip { line-height: 1.35; }
.gs-layer__chip { font-size: .62rem; padding: 0 .35rem; border-radius: 999px; background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gs-layer__rename.input { flex: 1; min-width: 0; padding: .2rem .4rem; font-size: var(--text-sm); }
/* A layer not drawn on the stage as it stands (another page, a widget not shown, a popup not chosen) is dimmed. */
.gs-layer.is-away .gs-layer__pick { opacity: .6; }
.gs-layer.is-away.is-selected .gs-layer__pick { opacity: 1; }
/* A widget's chip in its area's colour, a popup's in the warning colour. */
.gs-layer__chip--widget { --chip: 190; color: hsl(var(--chip) 70% 72%); border-color: hsl(var(--chip) 60% 45% / .55); background: hsl(var(--chip) 60% 40% / .14); }
.gs-layer__chip--widget[data-area="1"] { --chip: 32; }
.gs-layer__chip--widget[data-area="2"] { --chip: 275; }
.gs-layer__chip--widget[data-area="3"] { --chip: 130; }
.gs-layer__chip--widget[data-area="4"] { --chip: 335; }
.gs-layer__chip--widget[data-area="5"] { --chip: 55; }
.gs-layer__chip--popup { color: var(--warn-text); border-color: var(--warn-text); }
[data-theme="light"] .gs-layer__chip--widget { color: hsl(var(--chip) 70% 32%); }
/* A group in the layers: a head with what it holds below it, indented */
.gs-group-layer { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; min-width: 0; }
.gs-group-layer__head { cursor: grab; }
.gs-group-layer__head .gs-layer__name { font-weight: 700; }
.gs-group-layer__caret { flex: none; width: 1.1rem; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-dim); font: inherit; font-size: .75rem; cursor: pointer; }
.gs-group-layer__caret:hover { background: var(--surface-hover); color: var(--text); }
.gs-group-layer__caret:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gs-group-layer__list { list-style: none; margin: 0 0 0 .55rem; padding: 0 0 0 .2rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; border-left: 1px dashed var(--border-strong, var(--border)); min-width: 0; }
.gs-props__ingroup { margin: .5rem 0; padding: .1rem .6rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.gs-levels { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.gs-levels legend { padding: 0; margin-bottom: .3rem; }
.gs-levels__item { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--text-sm); }
.gs-layers__empty { font-size: var(--text-sm); color: var(--text-dim); padding: .4rem 0; }
.gs-layer { display: flex; align-items: stretch; gap: .15rem; border-radius: var(--radius-sm); }
.gs-layer.is-selected { background: var(--accent-soft); }
.gs-layer.is-out .gs-layer__pick { opacity: .55; }
.gs-layer__pick { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .5rem; padding: .35rem .45rem; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.gs-layer__pick:hover { background: var(--surface-hover); }
.gs-layer.is-selected .gs-layer__pick { color: var(--accent-text); }
.gs-layer__text { display: grid; min-width: 0; }
.gs-layer__name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-layer__detail { font-size: .7rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-layer__toggle { flex: none; width: 1.9rem; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-dim); cursor: pointer; }
.gs-layer__toggle .gs-glyph { width: 1rem; height: 1rem; }
.gs-layer__toggle:hover { background: var(--surface-hover); color: var(--text); }
.gs-layer__toggle[aria-pressed="true"] { color: var(--warn-text); }
.gs-layer__pick:focus-visible, .gs-layer__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The stage: the cluster at its zoom, on a dark checkerboard that shows through a transparent background */
.gs-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
.gs-toolbar__group { display: inline-flex; align-items: center; gap: .15rem; }
.gs-pagebar { display: grid; gap: .45rem; padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
.gs-pagebar:empty { display: none; }
.gs-pagebar__row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .8rem; min-width: 0; }
.gs-pagebar__tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; min-width: 0; }
.gs-pagebar__tab { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-sunken); color: var(--text-muted); font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.gs-pagebar__tab[aria-selected="true"] { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent); }
.gs-pagebar__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.gs-pagebar__live { border-style: dashed; }
/* ▶ Live: the page (or the screen a touch opened) showing now. */
.gs-pagebar__tab.is-showing { color: var(--text); border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.gs-pagebar__add.select { width: auto; max-width: 100%; }
.gs-pagebar__area { display: inline-flex; align-items: center; gap: .2rem; min-width: 0; }
.gs-pagebar__area .select { width: auto; min-width: 0; max-width: 12rem; }
.gs-pagebar__label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); margin-right: .2rem; }
.gs-guide { position: absolute; pointer-events: none; background: #ff3ec9; z-index: 3; }
.gs-guide--x { top: 0; bottom: 0; width: 1px; }
.gs-guide--y { left: 0; right: 0; height: 1px; }
.gs-pagecard { display: grid; gap: .5rem; padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-sunken); min-width: 0; }
.gs-widgetlist { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.gs-widgetrow { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, auto); align-items: center; gap: .2rem; }
.gs-toolbar__check { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--text-sm); color: var(--text-muted); }
.gs-zoom { min-width: 3.2rem; text-align: center; font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.gs-toolbar [aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }
.gs-stage {
    display: flex; overflow: auto; height: clamp(300px, 60vh, 660px); padding: 20px;
    background-color: hsl(222 18% 9%);
    background-image: conic-gradient(hsl(222 14% 13%) 25%, transparent 0 50%, hsl(222 14% 13%) 0 75%, transparent 0);
    background-size: 20px 20px;
}
.gs-board { position: relative; flex: none; margin: auto; box-shadow: 0 0 0 1px hsl(0 0% 100% / .12), 0 18px 50px -20px hsl(0 0% 0% / .8); }
.gs-board canvas { display: block; width: 100%; height: 100%; }
.gs-overlay { position: absolute; inset: 0; touch-action: none; cursor: default; outline: none; }
.gs-overlay:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.gs-overlay.is-grid {
    background-image: linear-gradient(to right, hsl(0 0% 100% / .08) 1px, transparent 1px), linear-gradient(to bottom, hsl(0 0% 100% / .08) 1px, transparent 1px);
    background-size: var(--gs-grid, 16px) var(--gs-grid, 16px);
}
.gs-sel { position: absolute; box-sizing: border-box; outline: 1.5px solid hsl(187 92% 60%); box-shadow: 0 0 0 1px hsl(0 0% 0% / .5); pointer-events: none; }
.gs-sel.is-group { outline-style: dashed; }
.gs-sel.is-locked { outline-color: var(--warn); outline-style: dotted; }
.gs-handle { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 1.5px solid hsl(187 92% 45%); border-radius: 2px; background: #fff; pointer-events: auto; touch-action: none; }
.gs-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.gs-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.gs-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.gs-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.gs-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }
.gs-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.gs-handle--sw { left: 0; top: 100%; cursor: nesw-resize; }
.gs-handle--w { left: 0; top: 50%; cursor: ew-resize; }
@media (pointer: coarse) { .gs-handle { width: 18px; height: 18px; margin: -9px 0 0 -9px; } }
.gs-marquee { position: absolute; border: 1px dashed hsl(187 92% 60%); background: hsl(187 92% 60% / .1); pointer-events: none; }

/* Test it: the demo drive, or values set by hand */
.gs-sim { padding: .8rem .9rem 1rem; border-top: 1px solid var(--border); }
.gs-sim__title { font-size: .9rem; margin-bottom: .55rem; }
.gs-sim__demo { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-top: .7rem; }
.gs-sim__demo .range { flex: 1 1 200px; min-width: 0; }
.gs-sim__demo .gs-field__help { flex-basis: 100%; }
.gs-sim__time { min-width: 3.5rem; font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--text-muted); }
.gs-sim__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: .5rem .9rem; margin-top: .7rem; max-height: 300px; overflow: auto; padding-right: .2rem; }
.gs-sim__row { display: grid; gap: .25rem; min-width: 0; }
.gs-sim__row > label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
.gs-sim__row--check { grid-template-columns: auto 1fr; align-items: center; }
.gs-sim__row--check > label { order: 2; }
.gs-sim__number-row { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.gs-sim__number-row .range { flex: 1 1 auto; min-width: 0; }
.gs-sim__number { width: 5.5rem; flex: none; }
.gs-sim__unit { font-size: var(--text-xs); color: var(--text-dim); min-width: 2rem; }

/* A row of choices drawn as one control (test values; who can see it) */
.gs-seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: var(--radius); background: var(--surface-sunken); border: 1px solid var(--border); }
.gs-seg__option { position: relative; display: inline-flex; }
.gs-seg__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.gs-seg__option span { padding: .35rem .8rem; border-radius: calc(var(--radius) - 3px); font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); }
.gs-seg__option input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.gs-seg__option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Properties */
.gs-props__title { padding: .9rem 1rem 0; }
.gs-props__body { padding: 0 1rem 1rem; max-height: min(82vh, 980px); overflow: auto; }
.gs-props__head { margin-bottom: .7rem; }
.gs-props__type { display: flex; align-items: center; gap: .45rem; font-size: 1rem; }
.gs-props__hint { font-size: var(--text-xs); color: var(--text-dim); line-height: 1.5; margin-top: .25rem; }
.gs-props__reads { font-size: var(--text-xs); color: var(--accent-text); margin-top: .3rem; }
.gs-props__sub { font-size: var(--text-xs); font-weight: 650; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin: .9rem 0 .4rem; }
.gs-props__actions, .gs-props__aligns { display: flex; flex-wrap: wrap; gap: .35rem; margin: .7rem 0; }
.gs-danger { color: var(--danger-text); }
.gs-group { border-top: 1px solid var(--border); }
.gs-group__title { display: flex; align-items: center; justify-content: space-between; padding: .65rem 0; font-size: var(--text-sm); font-weight: 650; cursor: pointer; list-style: none; }
.gs-group__title::-webkit-details-marker { display: none; }
.gs-group__title::after { content: ''; width: .4rem; height: .4rem; border-right: 1.5px solid var(--text-dim); border-bottom: 1.5px solid var(--text-dim); transform: rotate(45deg); transition: transform var(--fast) var(--ease); }
.gs-group[open] > .gs-group__title::after { transform: rotate(-135deg); }
.gs-group__title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.gs-group__body { display: grid; gap: .6rem; padding-bottom: .9rem; }
.gs-group__body.gs-props__aligns { display: flex; margin: 0; padding-bottom: .9rem; }
.gs-group__body--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.gs-field { display: grid; gap: .3rem; min-width: 0; }
.gs-field--wide { grid-column: 1 / -1; }
.gs-field--check { grid-template-columns: auto 1fr; align-items: center; gap: .45rem; font-size: var(--text-sm); }
.gs-field--check .gs-field__help { grid-column: 1 / -1; }
.gs-field__label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.gs-field__help { font-size: .72rem; color: var(--text-dim); line-height: 1.45; }
.gs-input.input, .gs-input.select { padding: .4rem .55rem; font-size: var(--text-sm); }
.gs-input.select { padding-right: 1.8rem; }
.gs-colour { display: grid; grid-template-columns: 2.1rem minmax(0, 1fr) minmax(60px, 90px) auto; align-items: center; gap: .4rem; }
.gs-colour__picker { width: 2.1rem; height: 2.1rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: none; cursor: pointer; }
.gs-colour__text { font-family: var(--font-mono); }
.gs-colour__none[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }
.gs-colour__slot { grid-column: 1 / -1; }
.gs-sim__mode { display: grid; grid-template-columns: minmax(0, 1fr) 2.1rem; gap: .4rem; align-items: center; }
.gs-channel { display: grid; gap: .35rem; }
.gs-channel input[hidden] { display: none; }
.gs-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .3rem; }
.gs-icons__item { display: grid; place-items: center; aspect-ratio: 1; padding: 4px; border: 1px solid hsl(220 18% 24%); border-radius: var(--radius-sm); background: hsl(222 24% 9%); color: #e7ecf2; cursor: pointer; }
.gs-icons__item[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gs-icons__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.gs-icons__canvas { width: 26px; height: 26px; }
.gs-icons__words { font-size: .7rem; font-weight: 700; }
.gs-assets { display: grid; gap: .5rem; }
.gs-assets__list { display: flex; flex-wrap: wrap; gap: .4rem; }
.gs-assets__item { width: 64px; height: 48px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: hsl(222 24% 9%); cursor: pointer; }
.gs-assets__item img { width: 100%; height: 100%; object-fit: contain; }
.gs-assets__item[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gs-pictures { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.gs-pictures li { display: flex; align-items: center; gap: .6rem; font-size: var(--text-xs); color: var(--text-muted); }
.gs-pictures img { width: 56px; height: 40px; object-fit: contain; border-radius: 4px; background: hsl(222 24% 9%); }
.gs-pictures span { flex: 1 1 auto; min-width: 0; }

/* Under the workspace: into BeamNG, and publishing */
.gs-bottom { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--space-3); align-items: start; }
@media (max-width: 1000px) { .gs-bottom { grid-template-columns: minmax(0, 1fr); } }
.gs-export__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; padding: 1rem 1.1rem 1.1rem; }
.gs-export__body code { overflow-wrap: anywhere; }
.gs-export__fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: .7rem .9rem; }
.gs-export__actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.gs-code { margin: 0; max-height: 300px; overflow: auto; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-sunken); font-family: var(--font-mono); font-size: .74rem; line-height: 1.55; white-space: pre; tab-size: 4; }
.gs-code:focus-visible { outline: 2px solid var(--accent); }
/* Where an infotainment screen is in the car: three corners, x, y and z each. */
.gs-touchplace { margin: 0; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-md); display: grid; gap: .6rem; min-width: 0; }
.gs-touchplace[hidden] { display: none; }
.gs-touchplace legend { padding: 0 .3rem; }
.gs-touchplace__grid { display: grid; gap: .35rem; }
.gs-touchplace__row { display: grid; grid-template-columns: minmax(5.5rem, auto) repeat(3, minmax(0, 1fr)); gap: .4rem; align-items: center; }
.gs-touchplace__head { font-size: var(--text-xs); color: var(--text-muted); text-align: center; }
.gs-touchplace__name { font-size: var(--text-sm); color: var(--text-muted); }
.gs-touchplace__more { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem 1.2rem; }
.gs-export__lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: .9rem; }
.gs-export__heading { font-size: var(--text-sm); margin-bottom: .4rem; }
.gs-reads, .gs-checks { margin: 0 0 .4rem; padding-left: 1.1rem; display: grid; gap: .2rem; font-size: var(--text-sm); color: var(--text-muted); }
.gs-reads code { color: var(--text); }
.gs-checks li::marker { color: var(--warn-text); }
.gs-how { border-top: 1px solid var(--border); padding-top: .7rem; }
.gs-how summary { cursor: pointer; font-weight: 650; font-size: var(--text-sm); }
.gs-how .prose { margin-top: .6rem; font-size: var(--text-sm); }
.gs-how .prose p + p { margin-top: .6rem; }
.gs-account__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 1rem 1.1rem 1.1rem; }
.gs-account__intro { font-size: var(--text-sm); color: var(--text-muted); }
.gs-account__form { display: grid; gap: .8rem; }
.gs-account__sharing { border: 0; margin: 0; padding: 0; display: grid; gap: .4rem; min-width: 0; }
.gs-account__target { font-size: var(--text-sm); color: var(--text-muted); }
.gs-account__actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.gs-account__actions [hidden] { display: none; }
.gs-account__message { font-size: var(--text-sm); }
.gs-account__message:empty { display: none; }
.gs-account__message[data-tone="ok"] { color: var(--ok-text); }
.gs-account__message[data-tone="warn"] { color: var(--warn-text); }
.gs-account__heading { font-size: var(--text-sm); margin-bottom: .5rem; }
.gs-account__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.gs-account__list li { display: flex; align-items: center; gap: .7rem; padding: .45rem; border-radius: var(--radius-sm); }
.gs-account__list li.is-current { background: var(--accent-soft); }
.gs-account__list img { width: 96px; height: 48px; flex: none; object-fit: contain; border-radius: 4px; background: hsl(222 24% 7%); }
.gs-account__name { display: grid; flex: 1 1 auto; min-width: 0; font-size: var(--text-sm); }
.gs-account__name span { font-size: var(--text-xs); color: var(--text-dim); }
.gs-account__links { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }

/* ------------------------------------------------------------------ The gauge catalog */

.gc-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.gc-filter { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); color: var(--text-muted); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.gc-filter:hover { border-color: var(--border-strong); color: var(--text); }
.gc-filter.is-active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.gc-filter__count { font-size: var(--text-xs); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.gc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--space-4); }
.gc-card { overflow: hidden; }
.gc-card__picture { display: grid; place-items: center; aspect-ratio: 2 / 1; padding: .6rem; background: hsl(222 24% 6%); border-bottom: 1px solid var(--border); }
.gc-card__picture img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gc-card__title { font-size: 1.05rem; line-height: 1.3; }
.gc-card__meta { margin-top: .3rem; font-size: var(--text-sm); color: var(--text-muted); }
.gc-card__summary { margin-top: .5rem; font-size: var(--text-sm); color: var(--text-muted); }
.gc-card__foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .7rem; }

/* ------------------------------------------------------------------ A cluster's page */

.gc-head h1 { font-size: var(--text-3xl); }
.gc-preview { position: relative; margin-top: var(--space-5); padding: clamp(.5rem, 2vw, 1.25rem); border: 1px solid var(--border); border-radius: var(--radius-lg); background: hsl(222 24% 5%); }
.gc-preview canvas, .gc-preview img { display: block; width: 100%; height: auto; margin: 0 auto; }
.gc-preview__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; font-size: var(--text-sm); color: hsl(214 14% 68%); }
.gc-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.gc-actions form { display: inline; }
.gc-reads { display: flex; flex-wrap: wrap; gap: .35rem; }
.gc-reads code { font-size: .75rem; }
/* The game's keys are written as they are: BeamNG tells rpmTacho from RPMTACHO. */
.gc-keys dt { text-transform: none; letter-spacing: 0; }
.gc-keys dt code { font-size: var(--text-sm); color: var(--text); }
.gc-cars { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .3rem; }

/* ------------------------------------------------------------------ On a catalog trim */

.trim-gauges { display: grid; gap: .8rem; margin-top: .6rem; }
.trim-gauges__item { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); gap: .9rem; align-items: center; }
@media (max-width: 520px) { .trim-gauges__item { grid-template-columns: minmax(0, 1fr); } }
.trim-gauges__picture { display: block; padding: .3rem; border-radius: var(--radius-sm); background: hsl(222 24% 6%); }
.trim-gauges__picture img { display: block; width: 100%; height: auto; }
.trim-gauges__fit-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.trim-gauges__fit-row .select { flex: 1 1 220px; width: auto; min-width: 0; }
.gs-layers .gs-layer__toggle { width: 1.55rem; }
.gs-layers .gs-layer__pick { gap: .35rem; padding: .3rem .3rem; }
.gs-layer { min-width: 0; }
.gs-layers { grid-template-columns: minmax(0, 1fr); }

/* A scale's own figures: a box for each, one more to add, where to start from */
.gs-steps { display: grid; gap: .45rem; min-width: 0; }
.gs-steps__list { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.gs-steps__item { position: relative; display: inline-flex; }
.gs-steps__figure.input { width: 4.6rem; padding: .3rem .4rem; font-size: var(--text-sm); text-align: center; -moz-appearance: textfield; }
.gs-steps__figure::-webkit-inner-spin-button, .gs-steps__figure::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.gs-steps__remove { position: absolute; top: -.45rem; right: -.4rem; width: 1.05rem; height: 1.05rem; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-muted); font: inherit; font-size: .7rem; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s; }
.gs-steps__item:hover .gs-steps__remove, .gs-steps__item:focus-within .gs-steps__remove, .gs-steps__remove:focus-visible { opacity: 1; }
.gs-steps__remove:hover { color: var(--warn-text); border-color: currentColor; }
@media (pointer: coarse) { .gs-steps__remove { opacity: 1; } }
.gs-steps__warn { margin: 0; font-size: var(--text-xs); color: var(--warn-text); }
.gs-steps__note { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: var(--text-xs); color: var(--text-muted); }
