.bk-main {
  padding-top: 48px;
  padding-bottom: 50px;
}
.tool-badge {
  color: #9cdfca;
  border: 1px solid #53e3bd44;
  border-radius: 5px;
  padding: 5px 9px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.bk-intro h1 {
  font-size: clamp(2.3rem, 4.3vw, 3.7rem);
  margin-bottom: 20px;
}
.bk-intro .eyebrow {
  margin-bottom: 20px;
}
.bk-intro > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 660px;
}
.privacy-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #8fcbb8;
  font-size: 0.8rem;
  margin-top: 18px;
}
.privacy-line > span {
  font-size: 1.15rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}
.quiet {
  border: 0;
  padding: 9px 0;
  background: none;
  color: #b5c6d9;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.utility-actions {
  display: flex;
  gap: 18px;
}

/* Workbench layout */
.bk-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 40px;
}
.bk-form {
  border: 1px solid #35465d;
  border-radius: 10px;
  background: #0b1526;
  padding: 22px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.bk-form-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.bk-form h2,
.bk-panel h2 {
  font-size: 1rem;
  margin: 0;
}
fieldset {
  border: 0;
  border-top: 1px solid #22314a;
  margin: 0;
  padding: 18px 0 6px;
}
legend {
  font-weight: 650;
  font-size: 0.92rem;
  padding: 0 0 10px;
  color: var(--text);
}
.bk-form label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin: 10px 0 6px;
  color: #d4e1ee;
}
.req {
  color: #8fcbb8;
  font-weight: 500;
  font-size: 0.74rem;
  margin-left: 6px;
}
.bk-form input:not([type="radio"], [type="checkbox"], [type="color"]),
.bk-form textarea,
.bk-form select {
  width: 100%;
  color: #e4edf6;
  background: #132036;
  border: 1px solid #3a4d68;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 0.9rem;
}
.bk-form textarea {
  resize: vertical;
  min-height: 72px;
}
.bk-form [aria-invalid="true"] {
  border-color: #ee9b97;
}
.hint {
  color: #93a6bf;
  font-size: 0.78rem;
  line-height: 1.5;
  margin: 6px 0 0;
}
.field-error {
  color: #ffb9b3;
  font-size: 0.8rem;
  margin: 6px 0 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.bk-form .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #3a4d68;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 550;
}
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip:has(input:checked) {
  background: #53e3bd;
  border-color: #53e3bd;
  color: #091224;
}
.chip:has(input:focus-visible) {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}
.chip-order:empty {
  display: none;
}
.chip-order {
  font-size: 0.7rem;
  background: #091224;
  color: #53e3bd;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-row input[type="color"] {
  width: 44px;
  height: 40px;
  padding: 2px;
  border: 1px solid #3a4d68;
  border-radius: 7px;
  background: #132036;
  flex: none;
}
.color-row .quiet {
  flex: none;
}
.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: #111e32;
  border: 1px solid #2a3a52;
  border-radius: 9px;
}
.bk-form .segmented label {
  margin: 0;
  cursor: pointer;
}
.segmented input,
.library-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented span {
  display: block;
  text-align: center;
  padding: 8px 4px;
  border-radius: 6px;
  color: #a7b5c9;
}
.segmented input:checked + span {
  background: #53e3bd;
  color: #091224;
}
.segmented input:focus-visible + span,
.library-option input:focus-visible + span {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}
.library-list {
  display: grid;
  gap: 8px;
}
.bk-form .library-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}
.library-option span {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #3a4d68;
  border-radius: 8px;
}
.library-option small {
  color: #93a6bf;
  font-weight: 450;
}
.library-option input:checked + span {
  border-color: #53e3bd;
  box-shadow: inset 3px 0 #53e3bd;
  background: #0f2233;
}

/* Results */
.bk-results {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.bk-panel {
  border: 1px solid #35465d;
  border-radius: 10px;
  background: #0b1526;
  overflow: hidden;
  min-width: 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #132036;
  border-bottom: 1px solid #2b3c55;
  padding: 12px 18px;
}
.panel-heading > span {
  color: #a7b5c9;
  font-size: 0.82rem;
}
.mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #0b1526;
  border: 1px solid #2a3a52;
  border-radius: 9px;
}
.mode-switch button {
  border: 0;
  background: transparent;
  color: #a7b5c9;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 550;
}
.mode-switch [aria-pressed="true"] {
  color: #091224;
  background: #53e3bd;
}
.primary-action {
  border: 0;
  border-radius: 7px;
  background: #53e3bd;
  color: #091224;
  font-weight: 650;
  padding: 9px 14px;
  font-size: 0.85rem;
}
.primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Live preview: every colour, font and shape comes from the generated tokens. */
.bk-preview {
  background: var(--bk-background);
  color: var(--bk-foreground);
  font-family: var(--bk-font-body);
  padding: 22px;
  display: grid;
  gap: 22px;
  transition: background-color 200ms ease;
}
.pv-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bk-border);
}
.pv-logo {
  font-family: var(--bk-font-heading);
  font-weight: var(--bk-weight-heading);
  font-size: 1.15rem;
  color: var(--bk-foreground);
}
.pv-nav nav {
  display: flex;
  gap: 4px;
}
.pv-link {
  padding: 6px 10px;
  border-radius: var(--bk-radius-md);
  font-size: 0.9rem;
}
.pv-link.is-current {
  background: var(--bk-secondary);
  color: var(--bk-secondary-foreground);
  font-weight: 600;
}
.pv-hero {
  display: grid;
  gap: 12px;
  justify-items: start;
}
.pv-badge {
  padding: 3px 10px;
  border-radius: var(--bk-radius-full);
  background: var(--bk-accent-subtle);
  color: var(--bk-accent-subtle-foreground);
  font-size: 0.75rem;
  font-weight: 650;
}
.pv-h1 {
  margin: 0;
  font-family: var(--bk-font-heading);
  font-weight: var(--bk-weight-heading);
  font-size: clamp(1.6rem, 3vw, var(--bk-text-4xl));
  line-height: 1.1;
  text-wrap: balance;
}
.pv-lead {
  margin: 0;
  color: var(--bk-muted-foreground);
  line-height: 1.6;
  max-width: 56ch;
}
.pv-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.pv-button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--bk-radius-md);
  background: var(--bk-primary);
  color: var(--bk-primary-foreground);
  font-weight: 600;
  box-shadow: var(--bk-shadow-sm);
}
.pv-secondary {
  background: var(--bk-secondary);
  color: var(--bk-secondary-foreground);
  border: 1px solid var(--bk-border);
  box-shadow: none;
}
.pv-link-text {
  color: var(--bk-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.pv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.pv-card {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius-lg);
  background: var(--bk-surface);
  color: var(--bk-surface-foreground);
  box-shadow: var(--bk-shadow-md);
}
.pv-h3 {
  margin: 0 0 6px;
  font-family: var(--bk-font-heading);
  font-weight: var(--bk-weight-heading);
  font-size: 1.1rem;
}
.pv-label {
  font-size: 0.82rem;
  font-weight: 600;
}
.pv-input {
  padding: 9px 12px;
  border: 1px solid var(--bk-input);
  border-radius: var(--bk-radius-md);
  background: var(--bk-background);
  color: var(--bk-muted-foreground);
  outline: 2px solid var(--bk-ring);
  outline-offset: 2px;
}
.pv-muted {
  color: var(--bk-muted-foreground);
  font-size: 0.82rem;
  margin-top: 4px;
}
.pv-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}
.pv-alert {
  padding: 10px 14px;
  border-radius: var(--bk-radius-md);
  border-left: 4px solid currentColor;
  font-size: 0.9rem;
}
.pv-success {
  background: var(--bk-success-subtle);
  color: var(--bk-success-subtle-foreground);
}
.pv-warning {
  background: var(--bk-warning-subtle);
  color: var(--bk-warning-subtle-foreground);
}
.pv-danger {
  background: var(--bk-danger-subtle);
  color: var(--bk-danger-subtle-foreground);
}
.pv-info {
  background: var(--bk-info-subtle);
  color: var(--bk-info-subtle-foreground);
}
.pv-code {
  justify-self: start;
  font-family: var(--bk-font-mono);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: var(--bk-radius-sm);
  background: var(--bk-muted);
  color: var(--bk-foreground);
}
.contrast-status {
  margin: 0;
  padding: 12px 18px;
  font-size: 0.88rem;
  color: #9cdfca;
  border-top: 1px solid #2b3c55;
}
.contrast-status.is-warning {
  color: #ffd59a;
}
.contrast-details {
  border-top: 1px solid #22314a;
  padding: 10px 18px 14px;
  font-size: 0.85rem;
}
.contrast-details summary {
  cursor: pointer;
  color: #b5c6d9;
}
.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}
.contrast-details table {
  width: 100%;
  border-collapse: collapse;
}
.contrast-details th,
.contrast-details td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #22314a;
  white-space: nowrap;
}

/* Palette */
.palette {
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}
.palette-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.palette-name {
  font-size: 0.82rem;
  color: #c4d2e2;
  text-transform: capitalize;
}
.palette ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 3px;
}
.palette li {
  background: var(--swatch);
  color: var(--swatch-text);
  min-height: 46px;
  border-radius: 5px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}
.palette li.is-base {
  outline: 2px solid #53e3bd;
  outline-offset: 2px;
}
.swatch-hex {
  opacity: 0.85;
}

/* Type */
.type-sample {
  padding: 8px 18px 16px;
}
.type-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid #1d2b42;
}
.type-meta {
  color: #93a6bf;
  font-size: 0.76rem;
  font-family: ui-monospace, monospace;
}
.type-heading {
  font-family: var(--bk-font-heading);
  font-weight: var(--bk-weight-heading);
  overflow-wrap: anywhere;
}
.type-body {
  font-family: var(--bk-font-body);
  color: #d4e1ee;
}

/* Files */
.file-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 14px 0;
  border-bottom: 1px solid #2b3c55;
}
.file-tabs button {
  border: 1px solid transparent;
  border-bottom: 0;
  background: none;
  color: #a7b5c9;
  padding: 8px 12px;
  border-radius: 6px 6px 0 0;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}
.file-tabs [aria-selected="true"] {
  color: var(--text);
  background: #132036;
  border-color: #2b3c55;
}
.file-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: #93a6bf;
}
.file-actions div {
  display: flex;
  gap: 16px;
}
.file-view pre {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 0 18px 18px;
  color: #d4e4ee;
  font:
    0.8rem/1.65 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.file-view:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: -2px;
}
.bk-about {
  margin-top: 46px;
  max-width: 760px;
}
.bk-about h2 {
  font-size: 1.3rem;
}
.bk-about li {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .bk-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
  .bk-form {
    position: static;
    max-height: none;
  }
}
@media (max-width: 560px) {
  .palette-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .palette li {
    min-height: 36px;
  }
  .swatch-hex {
    display: none;
  }
  .type-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .bk-form-top {
    flex-wrap: wrap;
  }
  .panel-heading {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bk-preview {
    transition: none;
  }
}
