/* Rollroom Admin — canonical components.
   Naming is normalized to `.button` + modifier (the two kit mockups disagreed:
   index.html used `btn*`, playground.html used `button*`; we ship `.button*`). */

/* ── Buttons ────────────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: 0 14px;
  background: white;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.button:hover { background: var(--soft); }
.button:active { background: var(--soft-strong); }
.button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-soft); border-color: var(--blue); }
.button[disabled], .button.is-loading { opacity: .4; pointer-events: none; }

.button.primary { border-color: var(--text); background: var(--text); color: white; }
.button.primary:hover { background: #1b1b1b; }
.button.blue { border-color: var(--blue); background: var(--blue); color: white; }
.button.blue:hover { background: #0064c8; }
.button.secondary { background: white; }
.button.ghost { border-color: transparent; background: transparent; }
.button.ghost:hover { background: var(--soft); }
.button.danger { border-color: rgb(217 45 32 / 28%); color: var(--red); background: white; }
.button.danger:hover { background: var(--red-soft); }
.button.sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 10px; }
.button.lg { height: 48px; padding: 0 18px; font-size: 14px; }
.button.icon { width: 36px; padding: 0; }

.icon-button {
  display: inline-flex; height: 28px; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px; background: white;
  padding: 0 12px; color: var(--muted); font-size: 12px; font-weight: 650;
}
.icon-button:hover { background: var(--soft); }
.icon-button.primary-action { border-color: var(--text); background: var(--text); color: white; }
.icon-button.danger { color: var(--red); }

/* ── Inputs / fields ────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > .label, label.field-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.field .help { color: var(--tertiary); font-size: 12px; line-height: 16px; }
.field .error { color: var(--red); font-size: 12px; line-height: 16px; }
.date-range-field { min-width: 280px; }
.date-range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.date-range-separator { color: var(--tertiary); font-size: 12px; font-weight: 650; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-size: 13px;
}
input, select { height: 36px; padding: 0 10px; }
textarea { min-height: 72px; padding: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input[disabled], select[disabled], textarea[disabled] { background: var(--soft); color: var(--muted); }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.search { position: relative; }
.search input { padding-left: 32px; }
.search::before { content: "⌕"; position: absolute; left: 11px; top: 8px; color: var(--tertiary); }

/* ── Choices ────────────────────────────────────────────────────────────── */
.segmented { display: inline-grid; grid-auto-flow: column; height: 36px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); padding: 2px; }
.segment { border: 0; border-radius: 10px; padding: 0 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.segment.active { background: white; color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / 8%); }
.switch { position: relative; display: inline-flex; width: 40px; height: 24px; }
.switch input { position: absolute; opacity: 0; }
.switch-track { width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: left .15s; }
.switch input:checked + .switch-track::after { left: 19px; }

/* ── Pills ──────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; height: 24px; align-items: center; gap: 6px;
  border-radius: 999px; padding: 0 9px; background: var(--soft);
  color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.neutral { background: var(--soft); color: var(--muted); }

/* ── Panels / cards ─────────────────────────────────────────────────────── */
.panel { border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); padding: 16px; }
.panel.soft { background: var(--soft); }

/* ── Client API docs ───────────────────────────────────────────────────── */
.api-docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.api-docs-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--soft);
}
.api-docs-anchor {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 620;
  text-decoration: none;
  text-align: left;
}
.api-docs-anchor:hover { background: white; }
.api-docs-anchor-count { color: var(--tertiary); font-family: var(--mono); font-size: 12px; }
.api-docs-content { display: grid; min-width: 0; gap: 20px; }
.api-docs-common {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 12px;
}
.api-docs-note {
  display: grid;
  min-width: 0;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 14px;
  background: var(--surface);
}
.api-docs-note h3,
.api-docs-group-head h3 { font-size: 16px; line-height: 22px; }
.api-docs-note p,
.api-docs-group-head p,
.api-summary,
.api-notes { color: var(--muted); font-size: 13px; line-height: 20px; }
.api-docs-group { display: grid; gap: 12px; scroll-margin-top: 16px; }
.api-docs-group-head {
  display: grid;
  gap: 4px;
  padding-top: 4px;
}
.api-endpoint-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 14px;
  background: var(--surface);
}
.api-endpoint-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.api-endpoint-title {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.api-method {
  display: inline-flex;
  height: 24px;
  min-width: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--soft-strong);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 760;
}
.api-method.post { background: var(--blue-soft); color: var(--blue); }
.api-method.get { background: var(--green-soft); color: var(--green); }
.api-method.delete { background: var(--red-soft); color: var(--red); }
.api-path {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
}
.api-auth {
  flex: 0 0 auto;
  color: var(--tertiary);
  font-size: 12px;
  font-weight: 650;
}
.api-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.api-notes {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}
.api-example {
  margin: 0;
  overflow: visible;
  border-radius: var(--card-radius);
  padding: 12px;
  background: #111315;
  color: #f5f5f5;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 18px;
}
.api-example code { font: inherit; white-space: pre; }
.api-response-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 12px;
  align-items: start;
}
.api-response-json,
.api-response-fields {
  display: grid;
  min-width: 0;
  gap: 8px;
}
.api-response-subtitle {
  color: var(--tertiary);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
}
.api-response-fields table.table { min-width: 460px; }
.api-endpoint-card .table-wrap,
.api-docs-note .table-wrap {
  overflow: auto;
  border-radius: var(--card-radius);
}
.api-endpoint-card table.table { min-width: 720px; }
.api-docs-note table.table { min-width: 520px; }
.api-endpoint-card table.table code,
.api-docs-note table.table code { overflow-wrap: anywhere; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.film-card { border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--surface); overflow: hidden; }
.film-media { aspect-ratio: 16 / 10; background: #c9cbd0; display: grid; place-items: center; color: rgb(0 0 0 / 34%); font-size: 12px; font-weight: 700; }
.film-body { padding: 12px; display: grid; gap: 6px; }
.film-title { font-size: 14px; font-weight: 700; }
.film-meta { color: var(--muted); font-size: 12px; line-height: 16px; }

.roll-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.roll-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.roll-card {
  width: 100%;
  padding: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.roll-card:hover { border-color: var(--line-strong); background: var(--soft); }
.roll-card-cover {
  position: relative;
  overflow: hidden;
}
.roll-card-cover.has-icon {
  padding: 18px;
  background: #d8dade;
}
.roll-card-cover.empty,
.roll-card-cover.unavailable {
  background: #c9cbd0;
}
.roll-card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}
.roll-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.roll-detail-nav,
.section-head,
.roll-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.roll-summary { display: grid; gap: 16px; }
.roll-summary h3 { font-size: 20px; line-height: 26px; }
.roll-summary-kv { grid-template-columns: 132px minmax(0, 1fr); }
.inline-edit-cell { min-width: 0; }
.inline-edit-value {
  display: block;
  width: 100%;
  min-height: 24px;
  border: 0;
  border-radius: 8px;
  padding: 2px 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
}
.inline-edit-value.has-edit-icon {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
}
.inline-edit-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.inline-edit-icon {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  opacity: .42;
}
.inline-edit-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 9px;
  height: 3px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  transform: rotate(-38deg);
}
.inline-edit-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 1px;
  width: 11px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
}
.inline-edit-value:hover,
.inline-edit-value:focus-visible {
  background: var(--soft);
  outline: none;
}
.inline-edit-value[disabled],
.inline-edit-value.is-uploading {
  opacity: .55;
  cursor: wait;
}
.inline-edit-value.multiline {
  white-space: pre-wrap;
  line-height: 20px;
}
.inline-edit-value.multiline .inline-edit-label {
  white-space: pre-wrap;
}
.roll-color-value,
.roll-gradient-colors-value { align-items: center !important; }
.roll-color-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid rgb(0 0 0 / 18%);
  border-radius: 5px;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 28%);
}
.roll-color-swatch.large { width: 38px; height: 38px; border-radius: 9px; }
.roll-gradient-swatches { display: inline-flex; flex: 0 0 auto; gap: 3px; }
.roll-gradient-swatches .roll-color-swatch { width: 16px; height: 20px; border-radius: 4px; }
.roll-color-editor { display: grid; gap: 16px; }
.roll-color-hex-field { display: grid; gap: 7px; }
.roll-color-input-row { display: flex; align-items: center; gap: 10px; }
.roll-color-text-input { flex: 1; min-width: 0; text-transform: uppercase; }
.roll-color-error { display: none; margin: 0; color: var(--red); font-size: 12px; }
.roll-color-error.visible { display: block; }
.roll-color-picker-shell { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.roll-color-palette {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgb(0 0 0 / 16%);
  border-radius: 12px;
  background:
    linear-gradient(to bottom, rgb(255 255 255 / 88%) 0%, transparent 48%, rgb(0 0 0 / 90%) 100%),
    linear-gradient(to right, #f00 0%, #ff0 16.67%, #0f0 33.33%, #0ff 50%, #00f 66.67%, #f0f 83.33%, #f00 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 20%);
  cursor: crosshair;
  touch-action: none;
}
.roll-color-palette:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.roll-color-palette-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 56%), 0 2px 5px rgb(0 0 0 / 28%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.roll-gradient-color-editor { display: grid; gap: 14px; }
.roll-gradient-color-rows { display: grid; gap: 8px; }
.roll-gradient-color-row { display: grid; grid-template-columns: 24px 48px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.roll-gradient-color-index { color: var(--tertiary); font: 600 12px/1 var(--mono); text-align: center; }
.roll-gradient-color-picker { width: 48px; height: 42px; padding: 2px; border: 2px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; }
.roll-gradient-color-picker.active { border-color: var(--blue); background: var(--blue-soft); }
.roll-gradient-color-picker .roll-color-swatch.large { width: 34px; height: 34px; }
.roll-gradient-color-text { min-width: 0; text-transform: uppercase; }
.roll-gradient-color-toolbar { display: flex; justify-content: flex-start; }
.roll-gradient-palette-section { display: grid; gap: 8px; }
.roll-gradient-active-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.roll-gradient-palette-section .roll-color-palette { width: min(100%, 320px); }
.roll-media-upload {
  position: relative;
  display: inline-grid;
  width: min(100%, 560px);
  min-height: 112px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
}
.roll-media-upload:hover,
.roll-media-upload:focus-visible {
  border-color: var(--line-strong);
  background: var(--soft);
  outline: none;
}
.roll-media-upload.icon {
  width: 88px;
  min-height: 88px;
  aspect-ratio: 1;
  padding: 6px;
}
.roll-media-upload.resource {
  width: 120px;
  min-height: 92px;
  aspect-ratio: 4 / 3;
}
.roll-media-upload.sample {
  cursor: default;
}
.roll-media-upload.sample:hover {
  background: var(--surface);
}
.roll-media-upload[aria-disabled="true"] {
  cursor: wait;
}
.roll-media-upload.is-uploading::after,
.roll-media-tile-button.is-uploading::after,
.roll-media-add.is-uploading::after {
  content: attr(data-upload-status);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  background: rgb(255 255 255 / 82%);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  z-index: 2;
}
.roll-media-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-width: 0;
}
.roll-media-upload.sample .roll-media-grid {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
}
.roll-sample-pair {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 96px);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.roll-sample-pair.pending {
  grid-template-columns: 96px;
  border-style: dashed;
}
.roll-sample-delete {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  min-width: 44px;
  padding: 6px 8px;
  transform: translateY(-50%);
  border: 1px solid rgb(220 38 38 / 24%);
  border-radius: 7px;
  background: rgb(220 38 38 / 7%);
  color: #b42318;
  font-size: 11px;
  cursor: pointer;
}
.roll-sample-delete:hover,
.roll-sample-delete:focus-visible {
  background: rgb(220 38 38 / 13%);
  outline: none;
}
.roll-media-add.roll-sample-add {
  display: flex;
  width: 206px;
  height: 48px;
  aspect-ratio: auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  background: var(--soft);
}
.roll-sample-add-icon {
  font-size: 20px;
  line-height: 1;
}
.roll-sample-add-label {
  font-size: 12px;
  font-weight: 600;
}
.roll-sample-image-label {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  padding: 3px 4px;
  border-radius: 5px;
  background: rgb(0 0 0 / 58%);
  color: white;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}
.roll-media-upload.icon .roll-media-grid {
  width: 100%;
  height: 100%;
}
.roll-media-tile {
  position: relative;
  display: block;
  width: 96px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: #c9cbd0;
}
.roll-media-upload.icon .roll-media-tile {
  width: 100%;
}
.roll-media-tile-button,
.roll-media-add {
  position: relative;
  display: block;
  width: 96px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
}
.roll-media-tile-button:hover,
.roll-media-tile-button:focus-visible,
.roll-media-add:hover,
.roll-media-add:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--blue-soft);
}
.roll-media-tile-button[disabled],
.roll-media-add[disabled],
.roll-media-tile-button[aria-disabled="true"],
.roll-media-add[aria-disabled="true"] {
  cursor: wait;
}
.roll-media-tile-button .roll-media-tile {
  width: 100%;
  height: 100%;
}
.roll-media-add .roll-media-empty {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px dashed var(--line-strong);
  background: var(--soft);
}
.roll-media-tile img,
.roll-media-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.roll-media-tile.unavailable img,
.roll-media-tile.unavailable video {
  opacity: .22;
}
.roll-media-unavailable {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  background: rgb(255 255 255 / 76%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.roll-media-play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgb(0 0 0 / 54%);
}
.roll-media-play::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid white;
}
.roll-media-empty {
  display: grid;
  width: 100%;
  min-height: 72px;
  place-items: center;
  border-radius: 8px;
  background: var(--bubble);
  color: var(--tertiary);
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
}
.roll-media-upload.icon .roll-media-empty,
.roll-media-upload.resource .roll-media-empty {
  min-height: 100%;
}
.roll-resource-preview {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 72px;
  place-items: center;
  border-radius: 8px;
  background: var(--bubble);
  color: var(--text);
  overflow: hidden;
}
.roll-resource-preview::before {
  content: "";
  position: absolute;
  inset: 14px 26px 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}
.roll-resource-preview::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 26px;
  width: 18px;
  height: 18px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-bottom-left-radius: 4px;
  background: var(--soft-strong);
}
.roll-resource-zipper {
  position: absolute;
  z-index: 1;
  top: 20px;
  bottom: 18px;
  left: 40px;
  width: 8px;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--line-strong) 0 4px,
      transparent 4px 8px
    );
}
.roll-resource-label {
  position: relative;
  z-index: 1;
  margin-left: 24px;
  font: 700 12px/1 var(--mono);
  letter-spacing: 0;
}
.inline-edit-input {
  width: min(100%, 560px);
}
.inline-edit-input.multiline {
  min-height: 96px;
  white-space: pre-wrap;
}
.inline-category-editor {
  display: grid;
  gap: 10px;
  max-width: 560px;
}
.roll-version-table table.table tbody tr.selected { background: var(--green-soft); }
.roll-version-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.category-management-panel { display: grid; gap: 14px; }
.category-table table.table { min-width: 760px; }
.category-name-stack {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.category-table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.roll-category-checks {
  display: grid;
  gap: 8px;
  align-content: start;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 13px;
}
.inline-edit-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Tables + inspector ─────────────────────────────────────────────────── */
.workbench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.workbench.with-inspector { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.table-wrap { border: 1px solid var(--line); border-radius: var(--panel-radius); overflow: hidden; background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 650;
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-strong);
}
table.table tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tbody tr:hover { background: var(--soft); }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table .col-name { font-weight: 650; }

.inspector { border: 1px solid var(--line); border-radius: var(--panel-radius); background: var(--surface); padding: 16px; min-height: 0; }
.inspector.active { box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.job-inspector {
  align-self: start;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.job-inspector-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.job-error-text { color: var(--red); }
.job-detail-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.job-detail-section h4 { margin: 0 0 8px; font-size: 13px; line-height: 18px; font-weight: 720; }
.job-empty-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.job-parameter-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.job-parameter-table th,
.job-parameter-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.job-parameter-table th { color: var(--muted); background: var(--soft); font-weight: 650; }
.job-parameter-table tr:last-child td { border-bottom: 0; }
.job-parameter-table th:first-child,
.job-parameter-table td:first-child { width: 38%; }
.job-media-row { display: flex; flex-wrap: wrap; gap: 10px; }
.job-media-card { display: grid; gap: 6px; margin: 0; }
.job-media-card figcaption { color: var(--muted); font-size: 12px; line-height: 16px; }
.job-media-thumb { display: block; width: 140px; aspect-ratio: 1; border: 0; border-radius: 10px; padding: 0; overflow: hidden; background: var(--soft); cursor: zoom-in; }
.job-media-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 1100px) {
  .workbench.with-inspector { grid-template-columns: minmax(0, 1fr); }
  .job-inspector { position: static; max-height: none; }
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  padding: 12px 2px;
}
.page-btn { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 12px; font-weight: 650; color: var(--text); }
.page-number {
  min-width: 32px;
  padding: 0 10px;
}
.page-number.active {
  border-color: var(--text);
  background: var(--text);
  color: white;
  opacity: 1;
}
.page-btn:hover:not([disabled]) { background: var(--soft); }
.page-btn[disabled] { opacity: .4; pointer-events: none; }
.page-number.active[disabled] { opacity: 1; }
.page-info { color: var(--tertiary); font-size: 12px; }

/* ── Menus / overlays / modal / toast ───────────────────────────────────── */
.menu { min-width: 160px; border: 1px solid var(--line); border-radius: var(--control-radius); background: white; box-shadow: var(--shadow); padding: 6px; }
.menu-item { display: flex; width: 100%; height: 36px; align-items: center; gap: 8px; border: 0; border-radius: 8px; padding: 0 10px; background: transparent; font-size: 13px; text-align: left; }
.menu-item:hover { background: var(--soft); }
.menu-item.danger { color: var(--red); }

.modal-scrim {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center;
  background: rgb(0 0 0 / 32%); padding: 24px;
}
.modal-scrim.active { display: flex; }
.modal {
  width: min(480px, 100%);
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: var(--panel-radius);
  background: white;
  box-shadow: var(--shadow);
  padding: 20px;
}
.modal:has(.modal-form-wide) { width: min(620px, calc(100vw - 48px)); }
.modal:has(.image-preview) { width: auto; max-width: calc(100vw - 48px); padding: 12px; }
.modal-form { width: 100%; min-width: 0; }
.modal h3 { font-size: 18px; line-height: 24px; font-weight: 720; }
.modal .modal-body { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 21px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; }
.toast {
  min-width: 220px; max-width: 360px; border: 1px solid var(--line);
  border-radius: 12px; background: white; box-shadow: var(--shadow);
  padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center;
}
.toast.success { border-color: rgb(47 125 50 / 28%); }
.toast.error { border-color: rgb(217 45 32 / 28%); }
.toast .toast-action { margin-left: auto; color: var(--blue); font-weight: 650; background: none; border: 0; }

/* ── Empty / loading / error states ─────────────────────────────────────── */
.state { display: grid; place-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
.state h4 { font-size: 15px; font-weight: 700; }
.state p { color: var(--muted); font-size: 13px; max-width: 420px; }
.state.error h4 { color: var(--red); }

.skeleton-list { display: grid; gap: 10px; padding: 8px 0; }
.skeleton-row { height: 44px; border-radius: 10px; background: linear-gradient(90deg, var(--soft) 25%, var(--soft-strong) 37%, var(--soft) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: var(--panel-radius); padding: 14px; }
.stat .stat-label { color: var(--muted); font-size: 12px; }
.stat .stat-value { font-size: 22px; font-weight: 720; margin-top: 4px; }
