/* Building blocks of the app's own look (Board 2's shared styles): buttons, fields, tags,
   segmented controls, switches, cards and type. Values come from skins.css; the few rules
   that differ in shape between Retro and Clean are scoped by [data-skin]. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { display: block; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.i .fill { fill: currentColor; }
.i .fill-accent { fill: var(--accent-ink); stroke: none; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.nowrap { white-space: nowrap; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Type */
.card-title { margin: 0; font-family: var(--display); font-size: var(--card-title); font-weight: var(--hw); letter-spacing: var(--hs); text-transform: var(--ht); line-height: 1.2; }
.title { margin: 0; font-family: var(--display); font-size: var(--title); font-weight: var(--hw); letter-spacing: var(--hs); text-transform: var(--ht); line-height: 1.2; }
.big-title { margin: 0; font-family: var(--display); font-size: var(--big-title); font-weight: var(--big-title-w); letter-spacing: var(--big-title-s); text-transform: var(--ht); line-height: 1.15; }
.eyebrow { margin: 0; font-family: var(--ui); font-size: var(--esz); font-weight: var(--ew); letter-spacing: var(--es); text-transform: var(--et); color: var(--muted); }
.micro { font-family: var(--ui); font-size: var(--micro); font-weight: var(--micro-w); letter-spacing: var(--micro-s); text-transform: var(--micro-t); color: var(--muted); }
.label { font-family: var(--ui); font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sub { margin: 0; font-size: 12px; line-height: 1.35; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.muted { color: var(--muted); }
.lab { font-family: var(--ui); font-size: var(--lsz); font-weight: var(--lw); letter-spacing: var(--ls); text-transform: var(--lt); }

/* Buttons */
.btn, .btn-sm, .btn-primary, .btn-reset, .btn-danger, .on-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  font-family: var(--ui);
  font-size: var(--lsz);
  font-weight: var(--lw);
  letter-spacing: var(--ls);
  text-transform: var(--lt);
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  border: var(--bwc) solid var(--control);
  border-radius: var(--rc);
  box-shadow: var(--shadow-c);
}
.btn-sm, .btn-reset, .on-sm { height: 32px; padding: 0 11px; }
.btn-primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent-line); box-shadow: var(--shadow-r); }
.btn-reset { border-color: var(--warn); }
:root[data-skin="clean"] .btn-reset { color: var(--danger); }
.btn-danger { color: #ffffff; background: var(--danger); border: 2px solid #271813; border-radius: 0; box-shadow: var(--shadow-r); }
:root[data-skin="clean"] .btn-danger { color: var(--danger); background: var(--surface); border: 1px solid var(--danger); border-radius: var(--rc); box-shadow: var(--shadow-c); }
.on-sm, .btn-name.is-on, .btn-sm.is-on { color: var(--ink); background: var(--accent); border-color: var(--line); box-shadow: 1px 1px 0 #271813; }
:root[data-skin="clean"] .on-sm, :root[data-skin="clean"] .btn-name.is-on, :root[data-skin="clean"] .btn-sm.is-on { color: var(--accent-ink); background: var(--tint); border-color: var(--accent); box-shadow: none; }
.btn-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 9px 0 11px;
  font-family: var(--ui);
  font-size: 13.5px;
  font-weight: var(--name-w);
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  border: var(--bwc) solid var(--control);
  border-radius: var(--rc);
  box-shadow: var(--shadow-c);
  max-width: 260px;
}
.btn-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  font-family: var(--ui);
  font-size: var(--lsz);
  font-weight: var(--lw);
  letter-spacing: var(--ls);
  text-transform: var(--lt);
  color: var(--ink);
  background: transparent;
  border: 2px dashed var(--line);
  border-radius: var(--rc);
}
:root[data-skin="clean"] .btn-add { color: var(--accent-ink); border: 1.5px dashed var(--control); }
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-family: var(--ui);
  font-size: var(--lsz);
  font-weight: var(--lw);
  letter-spacing: var(--ls);
  text-transform: var(--lt);
  color: var(--accent-ink);
  background: transparent;
  border: 0;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn, .icon-sm, .icon-touch, .on-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: var(--bwc) solid var(--control);
  border-radius: var(--rc);
  box-shadow: var(--shadow-c);
}
.icon-sm, .on-icon { width: 30px; height: 30px; box-shadow: var(--shadow-sm); }
.icon-touch { width: 44px; height: 44px; }
.on-icon, .icon-sm.is-on { color: var(--ink); background: var(--accent); border-color: var(--line); box-shadow: none; }
:root[data-skin="clean"] .on-icon, :root[data-skin="clean"] .icon-sm.is-on { color: var(--accent-ink); background: var(--tint); border-color: var(--accent); }
.icon-quiet { width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--ink); background: transparent; border: 0; border-radius: var(--rs); }
.icon-quiet:hover { background: var(--surface2); }
.btn:active, .btn-sm:active, .btn-primary:active, .btn-name:active, .icon-btn:active, .icon-sm:active, .icon-touch:active, .btn-reset:active, .btn-danger:active { transform: translate(1px, 1px); box-shadow: none; }
:root[data-skin="clean"] .btn:active, :root[data-skin="clean"] .btn-sm:active, :root[data-skin="clean"] .btn-primary:active, :root[data-skin="clean"] .btn-name:active, :root[data-skin="clean"] .icon-btn:active, :root[data-skin="clean"] .icon-sm:active, :root[data-skin="clean"] .icon-touch:active { transform: scale(0.98); }

/* Fields */
.field, .field-sm, .field-touch {
  height: 34px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--field-bg);
  border: var(--bwc) solid var(--control);
  border-radius: var(--rs);
  text-align: left;
}
.field-sm { height: 30px; padding: 0 8px; font-size: 12.5px; }
.field-touch { height: 44px; gap: 8px; padding: 0 12px; font-size: 15px; border-radius: var(--rc); }
button.field, button.field-sm, button.field-touch { cursor: pointer; }
.field > span, .field-sm > span, .field-touch > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input.field, input.field-sm, input.field-touch, textarea.field { cursor: text; outline-offset: 1px; }
textarea.field { height: auto; min-height: 72px; padding: 8px 10px; line-height: 1.4; resize: vertical; align-items: flex-start; }
.field-off { height: 34px; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-family: var(--ui); font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface2); border: var(--bwc) solid rgba(39, 24, 19, 0.35); border-radius: var(--rs); }
:root[data-skin="clean"] .field-off { border-color: var(--line); }
.field-search { height: 38px; cursor: text; }
.field-search input { flex: 1 1 auto; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; font-size: 13px; }
.field-search input::placeholder { color: var(--muted); opacity: 1; }
input[type="range"] { accent-color: var(--accent); }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input { flex: 1 1 auto; min-width: 0; }
.range-row b { min-width: 30px; font-family: var(--mono); font-size: 13px; text-align: right; }

/* Tags and counts */
.tag, .tag-accent, .tag-dark, .tag-dash {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  font-family: var(--ui);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: var(--tag-s);
  text-transform: var(--tag-t);
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface2);
  border: 2px solid var(--line);
  border-radius: var(--pill);
}
.tag-accent { color: var(--on-accent); background: var(--accent); }
.tag-dark { color: #ffffff; background: var(--dark); border-color: #271813; }
.tag-dash { color: var(--muted); background: transparent; border-style: dashed; }
:root[data-skin="clean"] .tag { color: var(--accent-ink); background: var(--tint); border: 0; }
:root[data-skin="clean"] .tag-accent, :root[data-skin="clean"] .tag-dark { border: 0; }
:root[data-skin="clean"] .tag-dash { border: 1px dashed #b9ab92; }
.count { min-width: 20px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--ink); background: #ffffff; border: 2px solid var(--line); border-radius: var(--pill); }
:root[data-skin="clean"] .count { background: var(--surface2); border: 0; }

/* Segmented control */
.seg-wrap { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 0; background: #ffffff; border: 2px solid var(--line); border-radius: var(--rc); box-shadow: var(--shadow-c); }
:root[data-skin="clean"] .seg-wrap { gap: 3px; padding: 3px; background: var(--surface2); border: 0; box-shadow: none; }
.seg { min-width: 0; height: 32px; padding: 0 6px; font-family: var(--ui); font-size: var(--seg-size); font-weight: var(--lw); letter-spacing: var(--ls); text-transform: var(--lt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); background: transparent; border: 0; border-radius: var(--rs); }
.seg + .seg { border-left: 2px solid var(--line); }
.seg.is-on { color: var(--ink); background: var(--accent); }
:root[data-skin="clean"] .seg { color: var(--muted); }
:root[data-skin="clean"] .seg + .seg { border-left: 0; }
:root[data-skin="clean"] .seg.is-on { color: var(--ink); background: var(--surface); box-shadow: 0 1px 2px rgba(28, 34, 48, 0.14); }

/* Switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; padding: 0; background: #ffe9e3; border: 2px solid #271813; border-radius: 0; }
.switch.is-on { background: var(--accent); }
.knob { position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; background: #ffffff; border: 2px solid #271813; border-radius: 0; transition: left 160ms ease, right 160ms ease; }
.switch.is-on .knob { left: calc(100% - 22px); }
:root[data-skin="clean"] .switch { background: var(--control); border: 0; border-radius: 999px; }
:root[data-skin="clean"] .switch.is-on { background: var(--accent); }
:root[data-skin="clean"] .knob { left: 3px; top: 3px; width: 20px; height: 20px; border: 0; border-radius: 50%; }
:root[data-skin="clean"] .switch.is-on .knob { left: calc(100% - 23px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row .col { min-width: 0; }

/* Cards */
.card { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-flat { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r); }
.card-head { background: var(--head); border-bottom: var(--bw) solid var(--line); }
.card-foot { background: var(--head); border-top: var(--bw) solid var(--line); }
.chip-ui { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; font-family: var(--ui); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; color: var(--ink); background: var(--surface); border: var(--bwc) solid var(--line); border-radius: 0; box-shadow: var(--shadow-r); }
:root[data-skin="clean"] .chip-ui { font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; border-radius: 999px; box-shadow: var(--shadow-c); }
.handle { align-self: center; width: 40px; height: 5px; flex: none; background: rgba(39, 24, 19, 0.35); border-radius: 0; }
:root[data-skin="clean"] .handle { background: var(--control); border-radius: 3px; }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; font-family: var(--mono); font-size: 11px; font-weight: 700; background: var(--surface2); border: var(--bwc) solid var(--control); border-radius: var(--rs); }
.empty-note { padding: 14px; font-size: 13px; color: var(--muted); text-align: center; border: 2px dashed var(--line); border-radius: var(--rc); }
:root[data-skin="clean"] .empty-note { border: 1.5px dashed var(--control); }

/* Drop-downs: a real select drawn as a Board 2 field, with its own chevron */
.select { position: relative; min-width: 0; display: flex; align-items: center; }
.select select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 28px 0 10px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--field-bg);
  border: var(--bwc) solid var(--control);
  border-radius: var(--rs);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}
.select > .i { position: absolute; right: 9px; top: 50%; margin-top: -6.5px; pointer-events: none; }
.select.has-icon select { padding-left: 30px; }
.select.has-icon > .i:first-child { left: 9px; right: auto; margin-top: -7px; }
.select.is-strong select { font-weight: 700; }
.select-sm select { height: 30px; padding: 0 26px 0 8px; font-size: 12.5px; }
.select-sm.has-icon select { padding-left: 28px; }
.select-sm.has-icon > .i:first-child { left: 8px; }
.select-touch select { height: 44px; padding: 0 34px 0 12px; font-size: 15px; border-radius: var(--rc); }
.select-touch > .i { right: 12px; }
.select-touch.has-icon select { padding-left: 36px; }
.select-touch.has-icon > .i:first-child { left: 12px; }
.select.is-off select { color: var(--muted); background: var(--surface2); cursor: default; }
.select select:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }

/* A field with a small label inside (W, H) */
.field-pre { display: flex; align-items: center; gap: 8px; cursor: text; }
.field-pre-label { flex: none; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); }
.field-pre input { flex: 1 1 auto; min-width: 0; width: 100%; padding: 0; font-family: var(--mono); font-size: 12.5px; color: inherit; background: transparent; border: 0; outline: 0; }
.field-pre.is-off { cursor: default; }
.field-pre input:disabled { color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; }
.field-pre input::-webkit-inner-spin-button, .field-pre input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field-pre input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.is-mono { font-family: var(--mono); }

/* Radio dot (option lists, History) */
.radio-dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: #ffffff; border: 2px solid #271813; }
.radio-dot.is-on { background: #ff5f1f; }
:root[data-skin="clean"] .radio-dot { border: 1.5px solid #b9ab92; }
:root[data-skin="clean"] .radio-dot.is-on { border: 4.5px solid #9a3412; background: #ffffff; }

.eyebrow-row { display: flex; align-items: center; gap: 8px; }
.seg-sm .seg { height: 28px; font-size: 10px; }
:root[data-skin="clean"] .seg-sm .seg { height: 26px; font-size: 12px; }
.anchor { position: relative; display: inline-flex; }
