/* The Themes tool and the design system (Board 2's Themes and "New design system" boards).
   Theme cards draw each theme in its own colours and font; the design system page draws in
   the kit's own colours through the --k-* custom properties set on .sys-doc. */

/* Themes panel */
.panel-body.theme-panel { gap: 14px; padding: 14px 16px 24px; }
.theme-list { display: flex; flex-direction: column; gap: 8px; }
.theme-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  text-align: left;
  font-family: var(--ui);
  color: var(--ink);
  background: #ffffff;
  border: 2px solid #271813;
  border-radius: 0;
  box-shadow: 2px 2px 0 #271813;
}
.theme-card:hover:not(.is-on) { background: #fffaf6; }
.theme-card.is-on { padding: 5px 7px; background: #ffe9e3; border: 3px solid #271813; box-shadow: 4px 4px 0 #ff5f1f; }
.theme-card:active { transform: translate(1px, 1px); }
:root[data-skin="clean"] .theme-card { background: #fffdf8; border: 1px solid #e6dccb; border-radius: 12px; box-shadow: none; padding: 7px 9px; }
:root[data-skin="clean"] .theme-card:hover:not(.is-on) { background: #f7f1e3; }
:root[data-skin="clean"] .theme-card.is-on { padding: 6.5px 8.5px; background: rgba(154, 52, 18, 0.07); border: 1.5px solid #9a3412; box-shadow: none; }
:root[data-skin="clean"] .theme-card:active { transform: scale(0.99); }
.theme-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.theme-name { line-height: 1.15; }
.tn-sketch { font-family: "Patrick Hand", cursive; font-size: 19px; line-height: 1.1; }
.tn-clean { font-family: "Atkinson Hyperlegible Next", sans-serif; font-size: 15px; font-weight: 700; }
.tn-blueprint { font-family: "Space Mono", monospace; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tn-brutal { font-family: "Space Grotesk", sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tn-midnight { font-family: "Geist", sans-serif; font-size: 15px; font-weight: 600; }
.theme-check { position: absolute; right: -10px; top: -10px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; color: #271813; background: #ff5f1f; border: 2px solid #271813; }
:root[data-skin="clean"] .theme-check { right: 8px; top: 8px; width: 20px; height: 20px; color: #ffffff; background: #9a3412; border: 0; border-radius: 50%; }

/* The small picture of each theme */
.tm { flex: none; width: 58px; height: 50px; display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.tm-a { width: 30px; height: 5px; }
.tm-b { width: 40px; height: 12px; }
.tm-row { display: flex; align-items: center; gap: 4px; }
.tm-c { width: 16px; height: 9px; }
.tm-d { width: 18px; height: 3px; }
.tm-sketch { background: #fbf8f1; border: 1.5px solid #2a2a2a; border-radius: 9px 3px 8px 4px / 4px 8px 3px 9px; }
.tm-sketch .tm-a { background: #2a2a2a; border-radius: 3px; }
.tm-sketch .tm-b { background: #1f5fbf; border: 1.5px solid #2a2a2a; border-radius: 8px 3px 7px 3px; }
.tm-sketch .tm-c { background: #ece8de; border: 1.5px solid #2a2a2a; border-radius: 6px; }
.tm-sketch .tm-d { background: #5f5f5f; }
.tm-clean { background: #ffffff; border: 1px solid #d0d7de; border-radius: 8px; }
.tm-clean .tm-a { background: #1f2328; border-radius: 3px; }
.tm-clean .tm-b { background: #3451b2; border-radius: 5px; }
.tm-clean .tm-c { background: #e1e6eb; border-radius: 6px; }
.tm-clean .tm-d { background: #57606a; }
.tm-blueprint {
  background-color: #133b73;
  background-image: linear-gradient(rgba(234, 242, 255, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(234, 242, 255, 0.12) 1px, transparent 1px);
  background-size: 8px 8px;
  border: 1px solid #133b73;
}
.tm-blueprint .tm-a { background: #eaf2ff; }
.tm-blueprint .tm-b { background: #7ddcff; border: 1px solid #eaf2ff; border-radius: 2px; }
.tm-blueprint .tm-c { border: 1px solid #eaf2ff; border-radius: 2px; }
.tm-blueprint .tm-d { background: #b3c8e6; }
.tm-brutal { background: #fffaf6; border: 2px solid #271813; }
.tm-brutal .tm-a { background: #271813; }
.tm-brutal .tm-b { width: 38px; background: #ff5f1f; border: 2px solid #271813; box-shadow: 2px 2px 0 #271813; }
.tm-brutal .tm-c { background: #ffe9e3; border: 2px solid #271813; }
.tm-brutal .tm-d { background: #5b4138; }
.tm-midnight { background: #101318; border: 1px solid #343b46; border-radius: 9px; }
.tm-midnight .tm-a { background: #e9ecf1; border-radius: 3px; }
.tm-midnight .tm-b { background: #c4f25e; border-radius: 6px; }
.tm-midnight .tm-c { background: #262c36; border-radius: 6px; }
.tm-midnight .tm-d { background: #a2a9b4; }

/* Accent, corners and text */
.theme-opts { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 8px 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; padding: 5px 0 5px 3px; }
.swatch { width: 26px; height: 26px; flex: none; padding: 0; border: 2px solid #271813; border-radius: 50%; }
.swatch.is-on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.swatch:hover:not(.is-on) { transform: scale(1.08); }
:root[data-skin="clean"] .swatch { border: 1px solid rgba(28, 34, 48, 0.25); }

/* Design system card */
.ds-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: #ffe9e3; border: 2px solid #271813; box-shadow: 3px 3px 0 #271813; }
:root[data-skin="clean"] .ds-card { background: #f7f1e3; border: 1px solid #e6dccb; border-radius: 14px; box-shadow: none; }
.ds-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ds-icon { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; color: #271813; background: #ffffff; border: 2px solid #271813; }
:root[data-skin="clean"] .ds-icon { color: #9a3412; background: rgba(154, 52, 18, 0.1); border: 0; border-radius: 10px; }
.ds-btn { height: 38px; }
.ds-card .switch-row .label { font-size: 13px; }

/* Themes canvas */
.theme-chip { position: absolute; left: 16px; top: 16px; z-index: 3; }
.theme-chip-sw { width: 14px; height: 14px; flex: none; border: 2px solid #271813; border-radius: var(--rs); }
:root[data-skin="clean"] .theme-chip-sw { border: 1px solid rgba(28, 34, 48, 0.2); border-radius: 4px; }
.theme-dev .wf { pointer-events: none; }

/* Design system panel */
.panel-body.sys-panel { gap: 6px; padding: 14px 16px 24px; }
.sys-step {
  width: 100%;
  min-height: 50px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: var(--bwc) solid transparent;
  border-radius: var(--rc);
}
button.sys-step:hover:not(.is-on) { background: var(--surface2); }
.sys-step.is-on { background: #ffe9e3; border: 2px solid #271813; box-shadow: 2px 2px 0 #271813; }
:root[data-skin="clean"] .sys-step.is-on { background: rgba(154, 52, 18, 0.08); border: 1px solid rgba(154, 52, 18, 0.35); box-shadow: none; }
:root[data-skin="clean"] button.sys-step:hover:not(.is-on) { background: #f7f1e3; }
.sys-step-title { font-weight: 700; }
.sys-step .col { min-width: 0; }
.sys-step .btn-link { flex: none; }
.sys-num { width: 24px; height: 24px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #271813; background: #ffffff; border: 2px solid #271813; }
.sys-num.is-on { background: #ff5f1f; }
.sys-num.is-done { background: #ffe9e3; }
.sys-num.is-warn { background: #ffd84d; }
:root[data-skin="clean"] .sys-num { color: #474e5f; background: #f1e9d8; border: 0; border-radius: 50%; }
:root[data-skin="clean"] .sys-num.is-on { color: #ffffff; background: #9a3412; }
:root[data-skin="clean"] .sys-num.is-done { color: #ffffff; background: #15803d; }
:root[data-skin="clean"] .sys-num.is-warn { color: #1c2230; background: #f6d26b; }
.sys-sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 0 6px 36px; }
.sys-src { height: 32px; padding: 0 8px; font-family: var(--ui); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 0; }
.sys-src.is-wide { grid-column: span 2; }
.sys-src.is-on { color: #271813; background: #ff5f1f; border-color: #271813; }
:root[data-skin="clean"] .sys-src { border: 1px solid var(--control); border-radius: 8px; }
:root[data-skin="clean"] .sys-src.is-on { color: #9a3412; background: rgba(154, 52, 18, 0.1); border-color: #9a3412; }
.sys-name { gap: 4px; }
.sys-name .field-sm { width: 100%; }
.sys-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 14px; border-top: var(--bwc) solid rgba(39, 24, 19, 0.2); }
:root[data-skin="clean"] .sys-foot { border-top-color: #e6dccb; }
.sys-use { font-weight: 600; }
.sys-save { height: 40px; }
.sys-export { height: 38px; }

/* Design system page */
.sys-scroll { container-type: inline-size; }
.sys-doc { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; padding: 26px 28px 96px; }
.sys-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; scroll-margin-top: 20px; transition: box-shadow 200ms ease; }
.sys-card.is-on { box-shadow: 6px 6px 0 #ff5f1f; }
:root[data-skin="clean"] .sys-card.is-on { box-shadow: 0 0 0 2px rgba(154, 52, 18, 0.45), var(--shadow); }
.sys-card-head { display: flex; align-items: center; gap: 12px; }
.sys-card-head.is-base { align-items: baseline; }
.sys-two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.sys-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
  overflow: hidden;
  color: var(--k-ink);
  background-color: var(--k-surface);
  border: var(--bw) solid #271813;
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
:root[data-skin="clean"] .sys-cover { border-color: transparent; }
.sys-cover.has-grid {
  background-image: linear-gradient(color-mix(in srgb, var(--k-ink) 7%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--k-ink) 7%, transparent) 1px, transparent 1px);
  background-size: 16px 16px;
}
.sys-cover-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sys-cover-eyebrow { font-family: var(--k-font); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--k-muted); }
.sys-cover-name { margin: 0; font-family: var(--k-head); font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: 0.02em; text-transform: var(--k-case); overflow-wrap: anywhere; }
.sys-cover-sub { font-size: 14px; color: var(--k-muted); }
.sys-cover-sw { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sys-cover-sw span { height: 44px; border: 1px solid color-mix(in srgb, var(--k-ink) 55%, transparent); border-radius: 3px; }

.sys-colors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sys-sw { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: var(--bwc) solid var(--line); border-radius: var(--rc); }
.sys-sw-color { position: relative; height: 58px; display: block; border-bottom: var(--bwc) solid var(--line); cursor: pointer; }
.sys-sw-color:hover { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.6); }
.sys-pick { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.sys-sw-color:focus-within { outline: 2px solid var(--sel); outline-offset: -4px; }
.sys-sw-text { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; min-width: 0; }
.sys-sw-text b { font-family: var(--mono); font-size: 12.5px; }
.sys-hex { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.sys-note { font-size: 12px; }

.sys-font { width: 170px; }
.sys-type { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid rgba(39, 24, 19, 0.15); }
:root[data-skin="clean"] .sys-type { border-top-color: #e6dccb; }
.sys-type-name { font-weight: 700; }
.sys-type-sample { min-width: 0; font-family: var(--k-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-type-sample.is-head { font-family: var(--k-head); }
.sys-type-sample.is-upper { text-transform: uppercase; }

.sys-space { display: grid; grid-template-columns: 64px minmax(0, 1fr) 36px; align-items: center; gap: 10px; }
.sys-bar { height: 12px; background: var(--accent); border-radius: var(--pill); }
.sys-num-r { text-align: right; }
.sys-corners { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.sys-corner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sys-corner-box { width: 54px; height: 38px; background: var(--k-raised); border: 1.5px solid var(--k-line); }

.sys-comps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sys-comp { display: flex; flex-direction: column; overflow: hidden; border: var(--bwc) solid var(--line); border-radius: var(--rc); }
.sys-comp-view { height: 88px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; overflow: hidden; font-family: var(--k-font); font-size: 12.5px; color: var(--k-ink); background: var(--k-surface); }
.sys-comp-text { display: flex; flex-direction: column; padding: 8px 10px 10px; background: var(--surface); }
.sys-comp-text b { font-size: 13px; }
.kc-primary, .kc-secondary { padding: 7px 13px; font-size: 12px; font-weight: 700; text-transform: var(--k-case); border-radius: var(--k-r-sm); }
.kc-primary { padding: 8px 14px; color: var(--k-on); background: var(--k-accent); }
.kc-secondary { color: var(--k-ink); border: 1.5px solid var(--k-line); }
.sc-text-box { flex-direction: column; align-items: stretch; justify-content: center; gap: 5px; }
.kc-label { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--k-muted); }
.kc-field { height: 32px; display: flex; align-items: center; padding: 0 10px; font-size: 12px; color: var(--k-muted); border: 1.5px solid var(--k-line); border-radius: var(--k-r-sm); }
.sc-toggle { justify-content: space-between; }
.kc-switch { position: relative; width: 42px; height: 24px; flex: none; background: var(--k-accent); border-radius: var(--k-pill); }
.kc-switch span { position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; background: var(--k-surface); border-radius: 50%; }
.sc-list-item { justify-content: flex-start; }
.kc-avatar { width: 36px; height: 36px; flex: none; background: color-mix(in srgb, var(--k-ink) 16%, transparent); border: 1.5px solid var(--k-line); border-radius: 50%; }
.kc-lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kc-lines b { font-size: 12.5px; }
.kc-lines span { font-size: 11px; color: var(--k-muted); }
.kc-time { font-size: 10.5px; color: var(--k-accent); }
.sc-tab-bar { align-items: flex-end; padding: 0; }
.kc-tabs { flex: 1 1 auto; display: flex; justify-content: space-around; padding: 10px 6px; font-size: 10px; text-transform: var(--k-case); color: var(--k-muted); border-top: 1.5px solid var(--k-line); }
.kc-tabs .is-on { font-weight: 700; color: var(--k-accent); }
.kc-card { width: 150px; display: flex; flex-direction: column; overflow: hidden; background: var(--k-raised); border: 1.5px solid var(--k-line); border-radius: var(--k-r-md); }
.kc-pic {
  height: 34px;
  border-bottom: 1.5px solid var(--k-line);
  background-image: linear-gradient(to top right, transparent calc(50% - 0.75px), var(--k-line), transparent calc(50% + 0.75px)), linear-gradient(to bottom right, transparent calc(50% - 0.75px), var(--k-line), transparent calc(50% + 0.75px));
}
.kc-card-title { padding: 5px 8px; font-size: 10.5px; font-weight: 700; text-transform: var(--k-case); }

.sys-check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--rs); }
.sys-check b { font-size: 13px; }
.sys-check.is-warn { background: #fff4c2; }
:root[data-skin="clean"] .sys-check.is-warn { background: rgba(246, 210, 107, 0.22); }
.sys-mark { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #ffffff; background: #15803d; border-radius: 50%; }
.sys-check.is-warn .sys-mark { color: #1c2230; background: #f6d26b; }
.sys-fix { align-self: flex-start; max-width: 100%; }
.sys-fix span { overflow: hidden; text-overflow: ellipsis; }
.sys-book { display: flex; flex-direction: column; gap: 2px; }
.sys-book b { font-size: 13px; }
.sys-book .sub { font-size: 13px; }
.sys-book textarea { margin-top: 2px; min-height: 58px; font-size: 13px; }
.sys-book-edit { align-self: flex-start; }

@container (max-width: 760px) {
  .sys-two { grid-template-columns: minmax(0, 1fr); }
  .sys-colors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-comps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-cover { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 480px) {
  .sys-doc { padding: 16px 12px 96px; }
  .sys-comps { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .sys-card { transition: none; }
  .swatch:hover:not(.is-on) { transform: none; }
}
