.image-workbench-page {
  --image-workbench-bg: var(--bg-base);
  --image-workbench-panel: var(--bg-panel);
  --image-workbench-panel-soft: var(--bg-inset);
  --image-workbench-border: var(--border-weak);
  --image-workbench-border-strong: var(--border-subtle);
  --image-workbench-text: var(--fg-body);
  --image-workbench-muted: var(--fg-muted);
  --image-workbench-accent: var(--accent);
  --image-workbench-accent-soft: var(--accent-muted, rgba(var(--accent-rgb), 0.13));
  --image-workbench-canvas: var(--bg-inset);
  display: grid;
  grid-template-rows: 46px 52px minmax(0, 1fr) 42px;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-left: 82px;
  background: var(--image-workbench-bg);
  color: var(--image-workbench-text);
  font-family: var(--font-sans);
}

.image-workbench-topbar,
.image-workbench-subbar,
.token-usage-topbar {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--image-workbench-border);
  background: var(--bg-surface, var(--image-workbench-panel));
  color: var(--image-workbench-text);
}

.image-workbench-topbar,
.token-usage-topbar {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), transparent 44%),
    var(--bg-surface, var(--image-workbench-panel));
}

.image-workbench-subbar {
  justify-content: space-between;
}

.image-workbench-back-to-more,
.image-workbench-icon-btn,
.image-workbench-mode-tabs button,
.image-workbench-tool-strip button,
.image-workbench-segmented button,
.image-workbench-url-row button,
.image-workbench-actions button,
.image-workbench-count button,
.image-workbench-chip-grid button,
.image-workbench-direction-pad button,
.token-usage-tool-strip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  gap: 7px;
  border: 1px solid var(--image-workbench-border-strong);
  border-radius: var(--radius-xs);
  background: var(--image-workbench-panel-soft);
  color: var(--image-workbench-muted);
  box-shadow: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.image-workbench-back-to-more {
  flex: 0 0 auto;
  padding: 0 12px;
  color: var(--image-workbench-text);
}

.image-workbench-icon-btn {
  width: 34px;
  padding: 0;
  background: transparent;
}

.image-workbench-back-to-more:hover,
.image-workbench-icon-btn:hover,
.image-workbench-mode-tabs button:hover,
.image-workbench-tool-strip button:hover,
.image-workbench-segmented button:hover,
.image-workbench-url-row button:hover,
.image-workbench-actions button:hover,
.image-workbench-count button:hover,
.image-workbench-chip-grid button:hover,
.image-workbench-direction-pad button:hover,
.token-usage-tool-strip button:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: var(--bg-hover);
  color: var(--image-workbench-text);
  transform: translateY(-1px);
}

.image-workbench-mode-tabs button.is-active,
.image-workbench-tool-strip button.is-active,
.image-workbench-segmented button.is-active,
.image-workbench-count button.is-active,
.image-workbench-chip-grid button.is-active,
.image-workbench-direction-pad button.is-active,
.token-usage-tool-strip button.is-active {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: var(--image-workbench-accent-soft);
  color: var(--image-workbench-accent);
}

.image-workbench-tool-strip,
.token-usage-tool-strip {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.image-workbench-tool-strip::-webkit-scrollbar,
.token-usage-tool-strip::-webkit-scrollbar {
  display: none;
}

.image-workbench-tool-strip button,
.token-usage-tool-strip button {
  flex: 0 0 auto;
  padding: 0 10px;
  white-space: nowrap;
}

.image-workbench-subbar > strong,
.token-usage-title {
  flex: 0 0 auto;
  color: var(--image-workbench-text);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.image-workbench-mode-tabs,
.image-workbench-segmented,
.image-workbench-count > div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.image-workbench-camera-summary {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--image-workbench-muted);
  font-size: 12px;
  font-weight: 700;
}

.image-workbench-camera-summary strong {
  color: var(--image-workbench-accent);
}

.image-workbench-layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(238px, 280px);
  min-height: 0;
  gap: 14px;
  padding: 14px 16px;
  overflow: hidden;
}

.image-workbench-layout--camera,
.image-workbench-layout--inpaint {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.image-workbench-layout--inpaint {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(220px, 280px);
}

.image-workbench-panel {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 0;
  gap: 12px;
  overflow: auto;
  scrollbar-color: rgba(var(--accent-rgb), 0.34) transparent;
}

.image-workbench-control-card,
.image-workbench-right-note {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--image-workbench-border);
  border-radius: var(--radius-sm);
  background: var(--image-workbench-panel);
  box-shadow: none;
}

.image-workbench-section-title,
.image-workbench-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
}

.image-workbench-panel h3,
.image-workbench-section-title h3 {
  margin: 0;
  color: var(--image-workbench-text);
  font-size: 13px;
  font-weight: 750;
}

.image-workbench-section-title span,
.image-workbench-count > span,
.image-workbench-select > span,
.image-workbench-upload span,
.image-workbench-empty span,
.image-workbench-status p,
.image-workbench-status em,
.image-workbench-right-note span,
.image-workbench-range span,
.image-workbench-range em {
  color: var(--image-workbench-muted);
  font-size: 12px;
  line-height: 1.45;
}

.image-workbench-panel input[type="file"] {
  display: none;
}

.image-workbench-upload-shell {
  position: relative;
  min-width: 0;
}

.image-workbench-upload,
.image-workbench-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  min-height: 132px;
  padding: 16px;
  border: 1px dashed rgba(var(--accent-rgb), 0.46);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), transparent),
    var(--bg-inset);
  color: var(--image-workbench-text);
  text-align: center;
  cursor: pointer;
}

.image-workbench-upload--tile {
  min-height: 116px;
}

.image-workbench-upload img,
.image-workbench-reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-workbench-upload img {
  max-height: 168px;
  border-radius: var(--radius-xs);
}

.image-workbench-upload > .anticon,
.image-workbench-empty > .anticon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--image-workbench-accent-soft);
  color: var(--image-workbench-accent);
  font-size: 20px;
}

.image-workbench-upload strong,
.image-workbench-empty strong {
  color: var(--image-workbench-text);
  font-size: 13px;
  font-weight: 750;
}

.image-workbench-upload-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 90, 95, 0.34);
  border-radius: var(--radius-xs);
  background: rgba(255, 90, 95, 0.14);
  color: #ff9a9d;
  cursor: pointer;
}

.image-workbench-reference-grid,
.image-workbench-canvas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.image-workbench-reference-thumb {
  position: relative;
  min-height: 118px;
  overflow: hidden;
  border: 1px solid var(--image-workbench-border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.image-workbench-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.image-workbench-url-row label,
.image-workbench-select select,
.image-workbench-prompt textarea,
.image-workbench-camera-prompt textarea,
.token-limit-row input,
.script-input-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--image-workbench-border-strong);
  border-radius: var(--radius-xs);
  background-color: var(--bg-inset);
  color: var(--image-workbench-text);
  font: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.image-workbench-url-row label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
}

.image-workbench-url-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  outline: none;
}

.image-workbench-url-row button {
  padding: 0 12px;
}

textarea.image-workbench-prompt,
.image-workbench-camera-prompt textarea {
  min-height: 104px;
  padding: 10px;
  resize: vertical;
}

.image-workbench-camera-prompt textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.image-workbench-select {
  display: grid;
  gap: 8px;
}

.image-workbench-select select {
  width: 100%;
  height: 38px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--fg-body);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.image-workbench-select select:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
}

.image-workbench-select select:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.image-workbench-range {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.image-workbench-range input {
  width: 100%;
  accent-color: var(--image-workbench-accent);
}

.image-workbench-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.image-workbench-chip-grid button {
  min-height: 32px;
}

.image-workbench-direction-pad {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(3, 34px);
  justify-content: center;
  gap: 8px;
}

.image-workbench-direction-pad button:nth-child(1) {
  grid-column: 2;
}

.image-workbench-direction-pad button:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.image-workbench-direction-pad button:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.image-workbench-direction-pad button:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}

.image-workbench-direction-pad button:nth-child(5) {
  grid-column: 2;
  grid-row: 3;
}

.image-workbench-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border: 1px solid var(--image-workbench-border-strong);
  border-radius: 999px;
  background: var(--bg-inset);
  cursor: pointer;
}

.image-workbench-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--image-workbench-muted);
  transition: transform 140ms ease, background 140ms ease;
}

.image-workbench-toggle.is-active {
  background: var(--image-workbench-accent-soft);
}

.image-workbench-toggle.is-active::after {
  background: var(--image-workbench-accent);
  transform: translateX(18px);
}

.image-workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-workbench-actions button {
  min-height: 38px;
  padding: 0 14px;
}

.image-workbench-actions .image-workbench-primary {
  border-color: var(--image-workbench-accent);
  background: var(--image-workbench-accent);
  color: #061014;
}

.image-workbench-canvas {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--image-workbench-border);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle, rgba(var(--accent-rgb), 0.18) 1px, transparent 1.4px),
    var(--image-workbench-canvas);
  background-size: 22px 22px;
}

.image-workbench-canvas > img,
.image-workbench-canvas-grid img,
.image-workbench-inpaint-stage img,
.image-workbench-camera-stage img,
.resolution-upscale-video-stage video {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  border: 1px solid var(--image-workbench-border-strong);
  border-radius: var(--radius-sm);
  background: #060808;
  object-fit: contain;
}

.image-workbench-canvas-grid {
  width: min(100%, 740px);
}

.image-workbench-inpaint-stage,
.image-workbench-camera-stage,
.resolution-upscale-video-stage {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 920px);
}

.image-workbench-inpaint-stage span,
.image-workbench-camera-stage span,
.resolution-upscale-video-stage span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--image-workbench-border-strong);
  border-radius: 999px;
  background: var(--bg-panel);
  color: var(--image-workbench-muted);
  font-size: 12px;
  font-weight: 700;
}

.image-workbench-empty--button {
  width: min(100%, 420px);
}

.image-workbench-switch-row button {
  position: relative;
  width: 42px;
  height: 22px;
  border: 1px solid var(--image-workbench-border-strong);
  border-radius: 999px;
  background: var(--image-workbench-accent-soft);
}

.image-workbench-switch-row button::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--image-workbench-accent);
}

.image-workbench-count {
  display: grid;
  gap: 8px;
}

.image-workbench-right-note {
  align-content: start;
}

.image-workbench-right-note > .anticon {
  color: var(--image-workbench-accent);
  font-size: 20px;
}

.image-workbench-right-note strong {
  color: var(--image-workbench-text);
}

.image-workbench-status {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 0 16px;
  border-top: 1px solid var(--image-workbench-border);
  background: var(--bg-surface, var(--image-workbench-panel));
}

.image-workbench-status span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--image-workbench-accent-soft);
  color: var(--image-workbench-accent);
  font-size: 11px;
  font-weight: 750;
}

.image-workbench-status p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-workbench-status em {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-style: normal;
  white-space: nowrap;
}

.script-token-page {
  width: 100%;
  min-height: 100%;
  overflow: auto;
  padding: 24px 0 64px;
  background: var(--bg-base);
  color: var(--fg-body);
}

.script-token-page__scroll {
  display: grid;
  gap: 20px;
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 24px;
}

.script-token-hero,
.script-score-panel,
.token-panel,
.script-card,
.script-empty-card,
.script-loading-card,
.script-input-card,
.script-score-summary,
.token-distribution-card,
.token-member-card {
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  box-shadow: none;
}

.script-token-hero {
  display: grid;
  gap: 10px;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.12), transparent 58%),
    var(--bg-panel);
}

.script-token-hero h1,
.script-token-section-head h2,
.script-card h3,
.token-member-stack h3 {
  margin: 0;
  color: var(--fg-body);
}

.script-token-hero h1 {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.12;
}

.script-token-hero p,
.script-score-summary p,
.script-accordion p,
.script-accordion div,
.token-stat-grid article span,
.token-stat-grid article em,
.token-distribution-card > div:first-child span,
.token-legend span,
.token-member-usage small,
.token-detail-grid em,
.token-limit-row span {
  color: var(--fg-muted);
  line-height: 1.6;
}

.script-token-badge,
.script-score-count,
.token-avatar,
.token-legend b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 999px;
  background: var(--accent);
  color: #061014;
  font-size: 12px;
  font-weight: 750;
}

.script-token-badge--soft,
.script-score-count {
  background: var(--accent-muted, rgba(var(--accent-rgb), 0.13));
  color: var(--accent);
}

.script-score-panel,
.token-panel,
.script-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.script-token-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.script-input-card {
  overflow: hidden;
}

.script-input-card__bar,
.script-input-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-inset);
}

.script-input-card__bar {
  border-bottom: 1px solid var(--border-weak);
}

.script-input-card__footer {
  justify-content: flex-start;
  border-top: 1px solid var(--border-weak);
}

.script-input-card__footer input {
  display: none;
}

.script-input-card textarea {
  min-height: 280px;
  padding: 14px;
  border: 0;
  border-radius: 0;
  resize: vertical;
}

.script-input-card__footer button,
.script-action-row button,
.token-range-tabs button,
.token-limit-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--fg-body);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.script-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.script-action-primary {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #061014 !important;
}

.script-action-row button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.script-loading-card,
.script-empty-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 20px;
  text-align: center;
}

.script-loading-card__pixels {
  display: flex;
  gap: 6px;
}

.script-loading-card__pixels span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

.script-result-stack,
.script-list,
.token-member-stack {
  display: grid;
  gap: 12px;
}

.script-score-summary {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.script-score-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 50%;
  background: var(--bg-inset);
}

.script-score-ring strong {
  color: var(--accent);
  font-size: 40px;
}

.script-score-ring span {
  color: var(--fg-muted);
  font-size: 12px;
}

.script-score-ring em {
  position: absolute;
  bottom: -10px;
  left: 50%;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #061014;
  font-style: normal;
  transform: translateX(-50%);
}

.script-score-summary h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.script-score-meta,
.token-range-tabs,
.token-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.score-dimension-grid,
.token-stat-grid,
.token-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.token-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.score-dimension-card,
.token-stat-grid article,
.token-detail-grid span,
.token-limit-row {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
}

.score-dimension-card > div,
.token-distribution-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
}

.score-bar,
.token-distribution-bar {
  position: relative;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.token-distribution-bar {
  display: flex;
  height: 24px;
}

.score-bar span,
.score-bar i {
  display: block;
  height: 100%;
}

.tone-good {
  color: #63e6a4;
}

.tone-warn {
  color: #f6c453;
}

.tone-orange {
  color: #ffb37b;
}

.tone-bad {
  color: #ff9a9d;
}

.tone-bg-good {
  background: #22c55e;
}

.tone-bg-warn {
  background: #f59e0b;
}

.tone-bg-orange {
  background: #f97316;
}

.tone-bg-bad {
  background: #ef4444;
}

.script-accordion {
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  overflow: hidden;
}

.script-accordion button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--fg-body);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.script-accordion p,
.script-accordion div {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 13px;
}

.script-accordion--guide div {
  border-top: 1px solid var(--border-weak);
  padding-top: 12px;
  background: var(--bg-panel);
}

.token-usage-page {
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0 0 0 82px;
}

.token-usage-page.script-token-page {
  background: var(--bg-base);
}

.token-usage-page .script-token-page__scroll {
  width: min(100%, 1180px);
  overflow: auto;
  padding: 18px 24px 64px;
}

.token-panel,
.token-distribution-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.token-stat-grid article strong,
.token-detail-grid strong,
.token-member-info strong {
  color: var(--fg-body);
}

.token-stat-grid article strong {
  font-size: 26px;
}

.token-distribution-card {
  padding: 14px;
}

.token-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border-weak);
  border-radius: 999px;
  background: var(--bg-inset);
  font-size: 11px;
}

.token-avatar,
.token-legend b {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 8px;
}

.token-member-card {
  overflow: hidden;
}

.token-member-card__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.token-member-info {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.token-member-info strong {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.token-member-info em {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--fg-muted);
  font-size: 10px;
  font-style: normal;
}

.token-member-usage {
  display: grid;
  justify-items: end;
  min-width: 112px;
  gap: 3px;
  font-size: 14px;
  font-weight: 750;
}

.token-member-card__body {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border-weak);
}

.token-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.token-limit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.token-limit-row input {
  width: 120px;
  height: 34px;
  padding: 0 10px;
}


@media (max-width: 1180px) {
  .image-workbench-page,
  .token-usage-page {
    padding-left: 20px;
  }

  .image-workbench-layout,
  .image-workbench-layout--inpaint,
  .image-workbench-layout--camera,
  .resolution-upscale-layout {
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  }

  .image-workbench-panel--right {
    display: none;
  }
}

@media (max-width: 860px) {
  .image-workbench-page {
    grid-template-rows: auto auto auto 42px;
    height: auto;
    min-height: 100%;
    overflow: auto;
    padding: 0 12px 72px;
  }

  .image-workbench-topbar,
  .image-workbench-subbar,
  .token-usage-topbar {
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  .image-workbench-layout,
  .image-workbench-layout--inpaint,
  .image-workbench-layout--camera,
  .resolution-upscale-layout {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    padding: 12px 0;
  }

  .image-workbench-panel {
    overflow: visible;
  }

  .image-workbench-canvas {
    min-height: 360px;
  }

  .image-workbench-status {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }

  .token-usage-page {
    height: auto;
    min-height: 100%;
    overflow: auto;
    padding: 0 12px 72px;
  }

  .token-usage-page .script-token-page__scroll,
  .script-token-page__scroll {
    padding-inline: 12px;
  }

  .score-dimension-grid,
  .token-stat-grid,
  .token-detail-grid,
  .script-score-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .token-member-card__head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .token-member-usage {
    grid-column: 1 / -1;
    justify-items: start;
  }
}
