:root {
  color-scheme: light;
  --bg: #f0f4f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #f0f7ff;
  --line: #d8e3ef;
  --line-strong: #b6c7da;
  --text: #1e293b;
  --muted: #64748b;
  --muted-strong: #334155;
  --brand-navy: #001c6d;
  --brand-accent: #10b981;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eff6ff;
  --veo: #047857;
  --veo-soft: #ecfdf5;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --success: #047857;
  --success-soft: #ecfdf5;
  --focus: #93c5fd;
  --shadow: 0 14px 38px rgb(0 28 109 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 20;
  transform: translateY(-140%);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: calc(100% - clamp(32px, 4vw, 64px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(210px, auto) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.identity-block {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

#currentUserIdentity {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-error {
  flex-basis: 100%;
  color: var(--danger);
  font-size: 13px;
  font-weight: 750;
  text-align: right;
}

.workspace-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.workspace-gate > div {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.workspace-gate strong {
  color: var(--text);
  font-size: 18px;
}

.auth-page {
  background: var(--surface-soft);
}

.auth-layout {
  width: min(100% - 32px, 440px);
  min-height: 100dvh;
  display: grid;
  align-items: center;
  margin: 0 auto;
  padding: 28px 0;
}

.auth-panel {
  display: grid;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-header {
  display: grid;
  gap: 8px;
}

.auth-header h1 {
  font-size: 28px;
}

.auth-header > p:last-child,
.provider-login-section > p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-form,
.provider-login-list {
  display: grid;
  gap: 14px;
}

.auth-submit {
  margin-top: 2px;
}

.auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 2px;
}

.provider-login-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.provider-login-section > p.error {
  color: var(--danger);
}

.provider-login-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.provider-login-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--brand-navy);
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.35;
}

.status-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  background: var(--success-soft);
  color: var(--success);
  border-color: #96d4b7;
}

.status-pill.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f0aaa4;
}

.points-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #f0c36a;
  border-radius: 999px;
  background: #fff8e6;
  color: #854d0e;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.points-pill:hover {
  border-color: #dca63e;
  background: #fff1c7;
  color: #713f12;
}

.points-history-dialog {
  width: min(480px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: -16px 0 34px rgb(18 26 36 / 12%);
}

.points-history-dialog::backdrop {
  background: rgb(18 26 36 / 28%);
}

.points-history-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.points-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 22px 24px 18px;
}

.points-history-header h2 {
  margin-top: 3px;
  font-size: 22px;
}

.points-history-close {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 24px;
  line-height: 1;
}

.points-history-close:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.points-history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 16px 24px;
}

.points-history-summary > div {
  min-width: 0;
  display: grid;
  gap: 5px;
  text-align: center;
}

.points-history-summary > div + div {
  border-left: 1px solid var(--line);
}

.points-history-summary span,
.points-history-item-meta,
.points-history-reference,
.points-history-footer,
.points-history-toolbar p {
  color: var(--muted);
  font-size: 12px;
}

.points-history-summary strong {
  font-size: 18px;
}

.points-debit {
  color: var(--danger);
}

.points-credit {
  color: var(--success);
}

.points-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px 10px;
}

.points-history-toolbar p {
  margin: 0;
  font-weight: 750;
}

.points-history-toolbar .ghost-button,
.points-history-footer .ghost-button {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
}

.points-history-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 24px 10px;
  border: 1px solid #f0aaa4;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
}

.points-history-error button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 2px;
  font-weight: 850;
}

.points-history-state {
  margin: auto;
  color: var(--muted);
  padding: 28px 24px;
  text-align: center;
}

.points-history-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0 24px;
}

.points-history-item {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.points-history-item-heading,
.points-history-item-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.points-history-item-heading strong,
.points-history-item-heading span {
  font-size: 14px;
  font-weight: 850;
}

.points-history-item p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.points-history-item .points-history-reference {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.points-history-item .points-history-model {
  color: var(--text);
  font-weight: 700;
}

.points-history-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px 24px;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.control-panel,
.result-panel,
.history-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 22px;
  padding: 24px;
}

.result-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.history-panel {
  display: grid;
  gap: 16px;
  margin-top: 22px;
  padding: 22px;
}

.panel-heading,
.result-header,
.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading p,
.result-header p,
.history-header p,
.submit-row p,
.field small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.inline-alert {
  border: 1px solid #f0aaa4;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px 14px;
  font-weight: 750;
  line-height: 1.45;
}

.form-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.provider-section {
  border-top: 0;
  padding-top: 0;
}

.provider-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.provider-selector legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.provider-option {
  min-width: 0;
}

.provider-option input {
  position: absolute;
  opacity: 0;
}

.provider-option span {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 14px 16px;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.provider-option strong {
  color: var(--text);
  font-size: 16px;
}

.provider-option small {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.provider-option input[value="seedance"]:checked + span {
  border-color: #8db4ff;
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgb(21 94 239 / 10%);
}

.provider-option input[value="veo"]:checked + span {
  border-color: #78beb7;
  background: var(--veo-soft);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 10%);
}

.provider-badge {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #9ab9f3;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.provider-badge[data-provider="veo"] {
  border-color: #82c4bd;
  background: var(--veo-soft);
  color: var(--veo);
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-group legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.segmented-option input {
  position: absolute;
  opacity: 0;
}

.segmented-option span {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 13px 14px;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.segmented-option strong {
  color: var(--text);
  font-size: 15px;
}

.segmented-option small {
  font-size: 13px;
}

.segmented-option input:checked + span {
  background: var(--primary-soft);
  border-color: #8db4ff;
  color: var(--primary);
  box-shadow: 0 0 0 3px rgb(21 94 239 / 10%);
}

.segmented-option input:disabled + span {
  cursor: not-allowed;
  opacity: 0.46;
}

.field,
.upload-box {
  display: grid;
  gap: 8px;
}

.field > span,
.upload-box > span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.field-label-row {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-translation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#promptTranslationStatus {
  color: var(--success);
  font-size: 12px;
  font-weight: 750;
}

#seedancePromptStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.seedance-prompt-button {
  min-height: 34px;
  border: 1px solid #8fb0ff;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 800;
}

.seedance-prompt-button:hover:not(:disabled) {
  border-color: var(--primary);
  background: #dce7ff;
}

.seedance-prompt-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.seedance-prompt-review {
  display: grid;
  gap: 12px;
  border: 1px solid #b8cbfa;
  border-radius: 8px;
  background: #f7f9ff;
  padding: 14px;
}

.seedance-prompt-review-heading,
.seedance-prompt-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.seedance-prompt-review-heading > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.seedance-prompt-review-heading strong {
  color: var(--text);
  font-size: 14px;
}

.seedance-prompt-review-heading small {
  color: var(--muted);
  line-height: 1.4;
}

.seedance-prompt-review textarea {
  min-height: 180px;
  background: #fff;
}

.seedance-prompt-checks {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.seedance-prompt-checks li::before {
  content: "✓";
  margin-right: 7px;
  color: var(--success);
  font-weight: 900;
}

.seedance-prompt-review-actions {
  justify-content: flex-end;
}

.seedance-prompt-review-actions .primary-button {
  width: auto;
  min-height: 38px;
  padding: 8px 16px;
}

.prompt-translate-button {
  min-height: 34px;
  border: 1px solid #82c4bd;
  border-radius: 6px;
  background: var(--veo-soft);
  color: var(--veo);
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 800;
}

.prompt-translate-button:hover:not(:disabled) {
  border-color: var(--veo);
  background: #dff4f0;
}

.video-analysis-workspace {
  width: 100%;
  min-width: 0;
}

.video-prompt-panel {
  min-height: 0;
  display: grid;
  gap: 18px;
}

.video-prompt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 4px 0;
}

.video-prompt-header h2,
.video-prompt-result-heading h3 {
  margin: 3px 0 0;
  letter-spacing: 0;
}

.video-prompt-header > div > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.video-prompt-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e3e9f0;
  padding: 4px;
}

.video-prompt-tabs button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.video-prompt-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(18 26 36 / 12%);
}

.video-prompt-content {
  min-height: 0;
}

.video-prompt-create-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: 18px;
}

.video-prompt-create-input,
.video-prompt-create-output {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.video-prompt-create-output {
  min-height: 560px;
}

.video-prompt-card-heading {
  display: grid;
  gap: 5px;
}

.video-prompt-card-heading h3 {
  margin: 0;
}

.video-prompt-card-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.video-prompt-result-empty {
  min-height: 360px;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.video-prompt-result-empty strong {
  color: var(--text);
}

.video-prompt-result-empty p {
  max-width: 440px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.video-prompt-availability {
  border-left: 3px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.video-prompt-availability.ok {
  border-left-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.video-prompt-availability.error {
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.video-prompt-source-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 3px;
}

.video-prompt-source-tabs label {
  position: relative;
}

.video-prompt-source-tabs input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-prompt-source-tabs span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.video-prompt-source-tabs input:checked + span {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(18 26 36 / 8%);
}

.video-prompt-source-tabs input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.video-prompt-upload {
  min-height: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
  cursor: pointer;
  padding: 18px;
  text-align: center;
}

.video-prompt-upload:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.video-prompt-upload input {
  width: 1px;
  height: 1px;
  position: absolute;
  opacity: 0;
}

.video-prompt-upload strong {
  color: var(--text);
  font-size: 14px;
}

.video-prompt-upload span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-prompt-error {
  border: 1px solid #f0aaa4;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.video-prompt-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 2px;
}

.video-prompt-progress p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.video-prompt-spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: video-prompt-spin 0.9s linear infinite;
}

@keyframes video-prompt-spin {
  to { transform: rotate(360deg); }
}

.video-prompt-result {
  display: grid;
  gap: 22px;
}

.video-prompt-result-heading,
.video-prompt-result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.video-prompt-result-actions > button {
  flex: 1;
}

.video-prompt-metrics {
  margin: -12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.video-prompt-summary,
.video-prompt-negative {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  padding: 12px 14px;
}

.video-prompt-summary > span,
.video-prompt-negative > span,
.video-prompt-section-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.video-prompt-summary p,
.video-prompt-negative p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

.video-prompt-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.video-prompt-timeline li {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.video-prompt-timeline li:last-child {
  border-bottom: 1px solid var(--line);
}

.video-prompt-timeline strong {
  color: var(--primary);
  font-size: 12px;
}

.video-prompt-timeline p {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.video-prompt-style {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.video-prompt-style dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-prompt-style dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.video-prompt-history-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.video-prompt-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}

.video-prompt-history-toolbar div {
  display: grid;
  gap: 3px;
}

.video-prompt-history-toolbar small,
.video-prompt-history-detail-heading small {
  color: var(--muted);
}

.video-prompt-history-panel > .video-prompt-error {
  margin: 14px 20px 0;
}

.video-prompt-history-layout {
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
}

.video-prompt-history-list-pane {
  min-height: 0;
  max-height: 720px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 12px;
}

.video-prompt-history-state {
  color: var(--muted);
  padding: 48px 14px;
  text-align: center;
}

.video-prompt-history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.video-prompt-history-list button {
  width: 100%;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 11px;
  text-align: left;
}

.video-prompt-history-list button:hover,
.video-prompt-history-list button[aria-current="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.video-prompt-history-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-prompt-history-list small {
  color: var(--muted);
  line-height: 1.45;
}

.video-prompt-history-list .video-prompt-history-status {
  justify-self: start;
}

#loadMoreVideoPromptHistory {
  width: 100%;
  margin-top: 12px;
}

.video-prompt-history-detail {
  min-width: 0;
  overflow: visible;
  padding: 18px 20px 24px;
}

.video-prompt-history-detail-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 18px;
}

.video-prompt-history-detail-heading > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.video-prompt-history-detail-heading strong {
  overflow-wrap: anywhere;
}

#backVideoPromptHistory {
  display: none;
}

.video-prompt-history-status {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.video-prompt-history-status.succeeded,
.video-prompt-history-status.partially_succeeded {
  background: var(--success-soft);
  color: var(--success);
}

.video-prompt-history-status.failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.video-prompt-history-status.queued,
.video-prompt-history-status.running {
  background: var(--primary-soft);
  color: var(--primary);
}

.video-prompt-history-result {
  display: grid;
  gap: 20px;
}

.video-prompt-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.video-prompt-history-actions .danger {
  color: var(--danger);
}

.video-prompt-history-actions .primary-button {
  flex: 1;
}

@media (max-width: 900px) {
  .video-prompt-create-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .video-prompt-create-output {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .field-label-row {
    align-items: flex-start;
  }

  .field-label-row {
    flex-direction: column;
  }

  .prompt-translation-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .video-prompt-create-input,
  .video-prompt-create-output {
    padding: 18px;
  }

  .video-prompt-timeline li {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .video-prompt-history-layout {
    display: block;
    min-height: 520px;
  }

  .video-prompt-history-list-pane {
    height: auto;
    max-height: none;
    border-right: 0;
  }

  .video-prompt-history-detail {
    display: none;
    min-height: 520px;
  }

  .video-prompt-history-panel.detail-open .video-prompt-history-list-pane {
    display: none;
  }

  .video-prompt-history-panel.detail-open .video-prompt-history-detail {
    display: block;
  }

  #backVideoPromptHistory {
    display: inline-flex;
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.prompt-translate-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

textarea,
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

textarea:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:hover {
  border-color: var(--line-strong);
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(21 94 239 / 12%);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 148px;
  line-height: 1.6;
}

.frame-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.frame-grid.single {
  grid-template-columns: 1fr;
}

.upload-box {
  height: 180px;
  min-height: 180px;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px);
  grid-template-rows: auto 44px minmax(22px, 1fr);
  column-gap: 16px;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  align-content: start;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.upload-box > span,
.upload-box > input,
.upload-box > strong {
  grid-column: 1;
  min-width: 0;
}

.upload-box > span {
  grid-row: 1;
}

.upload-box:hover {
  border-color: var(--primary);
  background: #f9fbff;
}

.upload-box input {
  grid-row: 2;
  width: 100%;
  min-height: 44px;
}

.upload-box strong {
  grid-row: 3;
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.frame-preview {
  grid-column: 2;
  grid-row: 1 / 4;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9eef5;
}

.reference-image-fields {
  display: grid;
  gap: 12px;
}

.reference-media-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.reference-media-heading {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
}

.reference-media-heading strong {
  font-size: 14px;
}

.reference-media-heading small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.reference-upload-header,
.reference-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-upload-header > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.reference-upload-header strong,
.reference-list-header > span {
  font-size: 14px;
  font-weight: 800;
}

.reference-upload-header small,
.reference-empty,
.reference-image-details small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.reference-count {
  flex: 0 0 auto;
  min-width: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  padding: 5px 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.reference-count.over-limit {
  border-color: #f0aaa4;
  background: var(--danger-soft);
  color: var(--danger);
}

.reference-drop-zone {
  position: relative;
  min-height: 112px;
  display: grid;
  place-content: center;
  gap: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 18px;
  text-align: center;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

.reference-drop-zone:hover,
.reference-drop-zone.dragging,
.reference-drop-zone:focus-visible {
  border-color: var(--primary);
  background: var(--surface-tint);
}

.reference-drop-zone.disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.reference-drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.reference-drop-zone strong {
  color: var(--text);
  font-size: 15px;
}

.reference-drop-zone span {
  font-size: 13px;
}

.reference-list-header {
  min-height: 36px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.text-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 4px 0 4px 10px;
  font-size: 13px;
  font-weight: 800;
}

.text-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.58;
}

.reference-empty {
  padding: 10px 0;
  text-align: center;
}

.reference-image-list {
  display: grid;
}

.reference-image-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.reference-thumbnail {
  width: 64px;
  height: 64px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9eef5;
}

.reference-thumbnail img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.reference-thumbnail.generic {
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 760px) {
  .reference-media-fields {
    grid-template-columns: 1fr;
  }
}

.reference-image-details {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.reference-image-details strong {
  font-size: 14px;
}

.reference-image-details > span {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-image-actions {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  gap: 6px;
}

.reference-icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted-strong);
  padding: 0;
  font-size: 19px;
  font-weight: 800;
}

.reference-icon-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
}

.reference-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.model-field {
  min-width: 0;
}

#taskForm .settings-grid > .field {
  min-width: 0;
  grid-template-rows: auto 46px auto;
  align-content: start;
}

#taskForm .settings-grid > .field > :is(select, input[type="number"]) {
  height: 46px;
  min-height: 46px;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}

.toggles label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  padding: 8px 13px;
  font-weight: 800;
}

.toggles input {
  width: 18px;
  height: 18px;
}

.toggles label:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.62;
}

.submit-row {
  display: grid;
  gap: 8px;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 850;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.primary-button {
  width: 100%;
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.primary-button:active {
  opacity: 0.86;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--muted-strong);
  padding: 8px 13px;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.progress-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.progress-step {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.progress-step.active {
  background: var(--success-soft);
  border-color: #98d6b9;
  color: var(--success);
}

.progress-step.error {
  background: var(--danger-soft);
  border-color: #f0aaa4;
  color: var(--danger);
}

.result-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.result-list div {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.result-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.result-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.result-link {
  color: var(--primary);
  font-weight: 850;
}

.video-preview {
  width: 100%;
  margin-top: 16px;
  border-radius: 8px;
  background: #0b1220;
  aspect-ratio: 16 / 9;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.result-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.raw-output {
  min-height: 180px;
  max-height: 340px;
  margin: 16px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101923;
  color: #e6edf3;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.history-search {
  max-width: 520px;
}

.history-list {
  display: grid;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.history-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.history-main h3 {
  color: var(--text);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.history-title-row {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.history-title-row h3 {
  min-width: 0;
}

.history-meta,
.history-task,
.history-empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.history-task {
  overflow-wrap: anywhere;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.history-actions .ghost-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.history-actions .history-delete-button {
  border-color: #f0aaa4;
  color: var(--danger);
}

.history-actions .history-delete-button:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.history-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 850;
}

#workspaceTabs {
  position: relative;
  width: fit-content;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e3e9f0;
  padding: 4px;
}

.workspace-tab-menu {
  position: relative;
  min-width: 132px;
  display: flex;
  flex: 1 1 132px;
}

.workspace-tab-link {
  min-width: 132px;
  display: flex;
  flex: 1 1 132px;
}

#workspaceTabs [data-workspace-tab],
.workspace-tab-link > a,
.workspace-menu-trigger {
  flex: 1 1 132px;
  min-width: 132px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  padding: 8px 16px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.workspace-tab-link > a:hover,
.workspace-tab-link > a:focus-visible,
.workspace-menu-trigger:hover,
.workspace-menu-trigger:focus-visible {
  background: rgb(255 255 255 / 62%);
  color: var(--text);
}

#workspaceTabs [data-workspace-tab][aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(18 26 36 / 12%);
}

#ecommerceVisualWorkspaceTab.workspace-tab-active,
#videoWorkspaceMenuTab.workspace-tab-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(18 26 36 / 12%);
}

#ecommerceVisualWorkspaceTab {
  anchor-name: --ecommerce-visual-menu;
}

#videoWorkspaceMenuTab {
  anchor-name: --video-workspace-menu;
}

#ecommerceVisualWorkspaceTab::after,
#videoWorkspaceMenuTab::after,
#businessWorkspaceTab::after {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-left: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

#ecommerceVisualWorkspaceTab:has(+ #ecommerceVisualWorkspaceMenu:popover-open)::after,
#videoWorkspaceMenuTab:has(+ #videoWorkspaceMenu:popover-open)::after,
#businessWorkspaceTab[aria-expanded="true"]::after {
  transform: translateY(2px) rotate(225deg);
}

.workspace-nav-menu {
  position: fixed;
  position-anchor: --ecommerce-visual-menu;
  z-index: 220;
  inset: auto;
  top: calc(anchor(bottom) + 8px);
  left: anchor(left);
  margin: 0;
  width: 220px;
  padding: 6px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgb(15 23 42 / 18%);
}

.workspace-nav-menu:not(:popover-open) {
  display: none;
}

#videoWorkspaceMenu {
  position-anchor: --video-workspace-menu;
}

#workspaceTabs .workspace-nav-menu > a,
#workspaceTabs .workspace-nav-menu > button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

#workspaceTabs .workspace-nav-menu > a:hover,
#workspaceTabs .workspace-nav-menu > a:focus-visible,
#workspaceTabs .workspace-nav-menu > button:hover,
#workspaceTabs .workspace-nav-menu > button:focus-visible {
  background: #f1f5f9;
}

#workspaceTabs .workspace-nav-menu > [aria-current="page"] {
  color: var(--primary-strong);
  background: rgb(219 234 254 / 65%);
}

#imageWorkspace {
  min-width: 0;
}

#imageCanvasRoot {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

#imageCanvasRoot ~ * {
  display: none !important;
}

.image-canvas-bootstrap {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.image-canvas-bootstrap-error strong,
.image-canvas-bootstrap-error span {
  display: block;
}

.image-canvas-bootstrap-error button {
  justify-self: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

#imageWorkspaceShell {
  width: 100%;
  height: clamp(640px, calc(100dvh - 190px), 880px);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 270px) minmax(480px, 1fr) minmax(270px, 310px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

body.image-workspace-active {
  height: 100dvh;
  overflow: hidden;
}

body.image-workspace-active #workspaceApp {
  height: 100%;
}

body.image-workspace-active .app-shell {
  width: calc(100% - clamp(32px, 4vw, 64px));
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  margin: 0 auto;
  padding: 28px 0 48px;
}

body.image-workspace-active.image-canvas-project-active .app-shell {
  width: 100%;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
}

body.image-workspace-active.image-canvas-project-active .topbar {
  display: none;
}

body.image-workspace-active #imageWorkspace {
  min-height: 0;
  height: 100%;
}

body.image-workspace-active #imageWorkspaceShell {
  height: 100%;
  min-height: 0;
  max-height: none;
  box-shadow: 0 2px 8px rgb(18 26 36 / 8%);
}

body.image-workspace-active #imageCanvasRoot {
  height: 100%;
}

#imageHistorySidebar,
#imageSettingsSidebar,
#imageConversationPane {
  min-width: 0;
  min-height: 0;
}

#imageHistorySidebar,
#imageSettingsSidebar {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  background: var(--surface-soft);
  padding: 18px;
  scrollbar-gutter: stable;
}

#imageHistorySidebar {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  border-right: 1px solid var(--line);
}

#imageSettingsSidebar {
  border-left: 1px solid var(--line);
}

.image-sidebar-header,
.image-conversation-header,
.image-conversation-actions,
.image-composer-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-sidebar-header,
.image-conversation-header,
.image-composer-footer {
  justify-content: space-between;
}

.image-sidebar-header h2,
.image-conversation-header h2 {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-drawer-close {
  display: none;
}

#newImageConversation {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.image-history-search {
  gap: 5px;
}

.image-history-search > span {
  font-size: 12px;
}

#imageHistoryList {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#imageHistoryEmpty {
  align-self: start;
  color: var(--muted);
  padding: 18px 4px;
  font-size: 13px;
  line-height: 1.5;
}

.image-history-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 7px;
  text-align: left;
}

.image-history-item:hover {
  background: #eaf0f6;
}

.image-history-item[aria-current="true"] {
  border-color: #a9c6fa;
  background: var(--primary-soft);
}

.image-history-item > img,
.image-history-placeholder {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #e4ebf2;
  object-fit: cover;
}

.image-history-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.image-history-item > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.image-history-item strong,
.image-history-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-history-item strong {
  font-size: 13px;
}

.image-history-item small,
#imageHistoryStorage {
  color: var(--muted);
  font-size: 11px;
}

#imageHistoryLoadMore {
  width: 100%;
}

#imageConversationPane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface);
}

.image-conversation-header {
  width: 100%;
  min-width: 0;
  min-height: 58px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}

.image-conversation-header > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.image-conversation-header .eyebrow {
  margin-bottom: 2px;
  font-size: 10px;
}

.image-conversation-actions {
  flex: 0 0 auto;
}

.image-conversation-actions .ghost-button {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 12px;
}

#imageHistoryToggle,
#imageSettingsToggle,
#imageUploadButton,
#imageSettingsClose,
#imageHistoryClose,
#regionUndo,
#regionClear,
#regionFullscreen {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
}

#imageMessages {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 20px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

#imageConversationEmpty {
  min-height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.image-message {
  min-width: 0;
  max-width: min(90%, 960px);
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.image-message-assistant {
  max-width: min(100%, 1180px);
}

.image-message-user {
  justify-self: end;
  border-color: #aec8f7;
  background: var(--primary-soft);
}

.image-message-user small,
.image-message-assistant > p {
  color: var(--muted);
  font-size: 12px;
}

.image-message-references {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.image-message-references img {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
}

.image-message-assistant.pending {
  color: var(--muted-strong);
  border-style: dashed;
}

.image-message-assistant.error {
  border-color: #f0aaa4;
  background: var(--danger-soft);
  color: var(--danger);
}

.image-message-assistant > img {
  width: 100%;
  max-height: min(520px, 58dvh);
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9eef5;
  object-fit: contain;
}

.image-asset-status {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 3px 8px;
  font-weight: 800;
}

.image-save-warning {
  border-left: 3px solid #d97706;
  background: #fff8e6;
  color: #854d0e !important;
  padding: 8px 10px;
}

.image-message .result-actions {
  flex-wrap: wrap;
  margin-top: 0;
}

.image-message .result-actions a,
.image-message .result-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  font-size: 12px;
  text-decoration: none;
}

#imageComposer {
  min-width: 0;
  max-height: min(55dvh, 560px);
  display: grid;
  gap: 10px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 16px 14px;
  scrollbar-gutter: stable;
}

#imageComposer.dragging {
  background: var(--surface-tint);
  box-shadow: inset 0 0 0 2px var(--focus);
}

#imageComposer.region-mode-active {
  max-height: min(76dvh, 820px);
}

#imageComposer > .reference-upload-header {
  align-items: center;
}

#imageComposer > .reference-upload-header > div {
  min-width: 0;
}

#imageAttachmentLimit {
  display: block;
  overflow-wrap: anywhere;
}

#imageAttachments {
  min-width: 0;
  max-height: 152px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
}

#imageAttachments:empty {
  display: none;
}

#imageAttachments .reference-image-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 6px;
}

#imageAttachments .reference-thumbnail {
  width: 46px;
  height: 46px;
  display: block;
  border-radius: 4px;
  object-fit: cover;
}

#imageAttachments .reference-thumbnail.generic {
  display: grid;
  place-items: center;
}

#imageAttachments .reference-image-details {
  min-width: 0;
}

#imageAttachments .reference-image-details strong,
#imageAttachments .reference-image-details span {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#imageAttachments .reference-image-actions {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  gap: 3px;
}

#imageAttachments .reference-icon-button {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

#regionEditor {
  min-width: 0;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 10px;
}

.region-editor-toolbar,
.region-tool-group,
.region-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.region-editor-toolbar {
  justify-content: space-between;
}

.region-tool-group {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.region-tool-button {
  min-width: 78px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-strong);
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 750;
}

.region-tool-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

#regionEditor [aria-pressed="true"] {
  border-color: #8db4ff;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.region-tool-icon {
  color: #e5484d;
  font-size: 13px;
}

.region-box-icon {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.region-text-icon {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: #2563eb;
  font-size: 10px;
  font-weight: 900;
}

.region-marker-count {
  min-width: 64px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.region-editor-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.region-annotation-editor {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto 34px;
  gap: 8px;
  align-items: center;
  border: 1px solid #9bbcf4;
  border-radius: 6px;
  background: #f4f8ff;
  padding: 8px;
}

.region-annotation-position {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#regionAnnotationInput {
  min-width: 0;
  height: 36px;
}

#regionAnnotationSave {
  min-height: 36px;
  white-space: nowrap;
}

#regionStage {
  position: relative;
  width: min(100%, 820px);
  max-width: 100%;
  height: clamp(360px, 50dvh, 620px);
  display: grid;
  place-items: center;
  overflow: hidden;
  justify-self: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #18212b;
  outline: none;
}

#regionStage:focus-visible {
  box-shadow: 0 0 0 3px var(--focus);
}

#regionTargetImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#regionOverlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

#regionStage[data-region-tool="point"] #regionOverlay {
  cursor: cell;
}

#regionStage[data-region-tool="annotation"] #regionOverlay {
  cursor: text;
}

.region-empty-state {
  max-width: 260px;
  color: #aeb8c4;
  padding: 24px;
  font-size: 13px;
  text-align: center;
}

.region-empty-state.hidden {
  display: none;
}

.region-marker {
  z-index: 1;
  display: grid;
  place-items: center;
  color: #f04438;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.region-point {
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f04438;
  color: #fff;
  box-shadow: 0 1px 4px rgb(18 26 36 / 35%);
}

.region-box {
  align-content: start;
  justify-content: start;
  background: rgb(240 68 56 / 10%);
  padding: 3px;
}

.region-box-draft {
  border: 2px dashed #ff7a70;
  background: rgb(240 68 56 / 14%);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 65%);
}

.region-annotation-marker {
  z-index: 2;
  max-width: min(250px, 56%);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  transform: translate(0, calc(-100% - 8px));
  border: 1px solid #7aa7ed;
  border-radius: 5px;
  background: rgb(255 255 255 / 96%);
  color: #173b74;
  padding: 6px 8px;
  box-shadow: 0 2px 8px rgb(18 26 36 / 22%);
  font-size: 12px;
  line-height: 1.35;
}

.region-annotation-marker strong {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
}

.region-annotation-marker span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.region-annotation-marker.align-right {
  transform: translate(-100%, calc(-100% - 8px));
}

.region-annotation-marker.below {
  transform: translate(0, 8px);
}

.region-annotation-marker.align-right.below {
  transform: translate(-100%, 8px);
}

.region-annotation-marker.pending {
  border-style: dashed;
  opacity: 0.86;
}

.region-marker-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.region-marker-panel > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

#regionMarkerList {
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
}

.region-marker-chip {
  flex: 0 0 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted-strong);
  padding: 5px 8px;
  font-size: 12px;
}

.region-marker-chip:hover {
  border-color: #f2a29c;
  color: var(--danger);
}

.region-marker-chip strong {
  color: #e5484d;
}

.region-marker-chip.annotation strong {
  color: #2563eb;
}

.region-marker-chip.annotation span:nth-child(2) {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.region-marker-list-empty {
  color: var(--muted);
  padding: 5px 0;
  font-size: 12px;
}

body.region-editor-expanded {
  overflow: hidden;
}

#regionEditor.is-expanded {
  position: fixed;
  inset: 12px;
  z-index: 1200;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border-color: var(--line-strong);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 18px 60px rgb(18 26 36 / 28%);
}

#regionEditor.is-expanded .region-editor-toolbar {
  grid-row: 1;
}

#regionEditor.is-expanded .region-editor-hint {
  grid-row: 2;
}

#regionEditor.is-expanded .region-annotation-editor {
  grid-row: 3;
}

#regionEditor.is-expanded #regionStage {
  grid-row: 4;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  max-height: none;
}

#regionEditor.is-expanded .region-marker-panel {
  grid-row: 5;
}

@media (max-width: 680px) {
  .region-editor-toolbar {
    flex-wrap: wrap;
  }

  .region-tool-group,
  .region-toolbar-actions {
    width: 100%;
  }

  .region-tool-button {
    flex: 1;
    min-width: 0;
  }

  .region-toolbar-actions {
    justify-content: flex-end;
  }

  .region-marker-count {
    margin-right: auto;
    text-align: left;
  }

  .region-annotation-editor {
    grid-template-columns: minmax(0, 1fr) auto 34px;
  }

  .region-annotation-position {
    grid-column: 1 / -1;
  }

  .region-marker-panel {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #regionEditor.is-expanded {
    inset: 0;
    border: 0;
    border-radius: 0;
  }
}

.image-prompt-field {
  gap: 5px;
}

#imagePrompt {
  min-height: 44px;
  max-height: 220px;
  resize: none;
}

.image-composer-footer small {
  color: var(--muted);
  font-size: 11px;
}

#imageSendButton {
  flex: 0 0 44px;
  width: 44px;
  min-height: 40px;
  padding: 0;
  font-size: 20px;
}

#imageModeGroup {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

#imageModeGroup .segmented-option span {
  min-height: 54px;
  padding: 9px 10px;
}

.image-current-section {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

#imageCurrentAsset {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

#imageCurrentAsset img {
  width: 100%;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9eef5;
  object-fit: contain;
}

#imageSettingsPanel {
  grid-template-columns: 1fr;
  gap: 10px;
}

.image-provider-hint {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

#imageModel[readonly] {
  background: #eef2f7;
  color: var(--muted-strong);
}

.image-watermark-setting {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
}

.image-watermark-setting input {
  width: 18px;
  height: 18px;
}

#imageWorkspaceShell.settings-collapsed {
  grid-template-columns: minmax(240px, 270px) minmax(0, 1fr) 0;
}

#imageWorkspaceShell.history-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) minmax(270px, 310px);
}

#imageWorkspaceShell.settings-collapsed #imageSettingsSidebar,
#imageWorkspaceShell.history-collapsed #imageHistorySidebar {
  display: none;
}

#imageDrawerBackdrop {
  display: none;
}

.image-delete-dialog {
  width: min(440px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}

.image-delete-dialog::backdrop {
  background: rgb(18 26 36 / 52%);
}

.image-delete-dialog form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.image-delete-dialog p {
  color: var(--muted-strong);
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.danger-button {
  min-height: 44px;
  border: 1px solid #d92d20;
  border-radius: 8px;
  background: #d92d20;
  color: #fff;
  padding: 9px 14px;
  font-weight: 850;
}

.danger-button:hover:not(:disabled) {
  background: var(--danger);
}

.admin-page {
  min-height: 100dvh;
  background: #f7f9fc;
}

.admin-app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.admin-brand {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding: 16px 22px;
}

.admin-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.admin-navigation {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 20px 12px;
}

.admin-nav-item {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 4px;
  border-radius: 6px;
  color: var(--muted-strong);
  padding: 12px 13px;
  text-decoration: none;
}

.admin-nav-item strong {
  color: inherit;
  font-size: 14px;
  line-height: 1.25;
}

.admin-nav-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.admin-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.admin-nav-item.active::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  content: "";
}

.admin-sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
}

.admin-profile {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.admin-profile > span:last-child {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.admin-profile strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-profile small {
  color: var(--muted);
  font-size: 11px;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.admin-main {
  min-width: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  padding: 8px 24px;
}

.admin-topbar-title {
  font-size: 14px;
  font-weight: 800;
}

.admin-content {
  min-width: 0;
  overflow: auto;
  padding: 24px clamp(18px, 2.4vw, 36px) 44px;
}

.admin-section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.admin-section-heading {
  min-height: 62px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.admin-section-heading h2 {
  margin: 0 0 5px;
  font-size: 24px;
  line-height: 1.25;
}

.admin-section-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-settings-form {
  width: min(100%, 920px);
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.admin-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.admin-storage-status {
  display: grid;
  gap: 4px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-soft);
  padding: 13px 15px;
}

.admin-storage-status strong {
  font-size: 14px;
}

.admin-storage-status span {
  color: var(--muted);
  font-size: 12px;
}

.admin-storage-status.success {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.admin-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.admin-settings-actions button {
  width: auto;
  min-width: 150px;
}

.admin-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-action {
  width: auto;
  min-height: 38px;
  padding: 7px 13px;
  white-space: nowrap;
}

.admin-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-filter-tabs {
  display: flex;
  gap: 4px;
}

.admin-filter-tabs button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 750;
}

.admin-filter-tabs button:hover {
  background: var(--surface);
}

.admin-filter-tabs button.active {
  border-color: #96b6ff;
  background: var(--surface);
  color: var(--primary);
}

.admin-subsection-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 4px;
}

.admin-subsection-tabs button {
  min-width: 116px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-strong);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.admin-subsection-tabs button:hover {
  background: rgb(255 255 255 / 70%);
  color: var(--ink);
}

.admin-subsection-tabs button[aria-selected="true"] {
  border-color: #96b6ff;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgb(15 23 42 / 6%);
}

.admin-business-tools-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
}

.admin-business-tools-panel[hidden] {
  display: none;
}

.admin-search {
  width: min(320px, 100%);
}

.admin-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 8px 12px;
}

.admin-filter-form {
  min-width: 0;
  display: grid;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 14px;
}

.admin-user-filters {
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(140px, 180px) auto;
}

.admin-managed-user-filters {
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, 170px)) auto;
}

.admin-business-tool-access-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
}

.admin-business-tool-table .admin-inline-select {
  width: min(340px, 100%);
  min-width: 220px;
}

.admin-inline-select,
.admin-inline-number {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 7px 9px;
}

.admin-inline-number {
  width: 96px;
  font-variant-numeric: tabular-nums;
}

.admin-resource-filters {
  grid-template-columns: minmax(170px, 0.8fr) repeat(2, minmax(140px, 0.55fr)) minmax(220px, 1.2fr) auto;
}

.admin-prompt-filters {
  grid-template-columns:
    minmax(170px, 0.75fr)
    repeat(2, minmax(140px, 0.55fr))
    minmax(240px, 1.2fr)
    auto
    auto;
}

.admin-resource-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-strong);
  padding: 0 2px 12px;
  font-size: 12px;
}

.admin-resource-summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.admin-resource-grid {
  min-height: 240px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  align-items: start;
  gap: 14px;
}

.admin-resource-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-resource-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
}

.admin-resource-preview img,
.admin-resource-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.admin-resource-body {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.admin-resource-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-resource-type {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
}

.admin-resource-title {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-resource-meta,
.admin-resource-date {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-resource-actions {
  display: flex;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.admin-resource-empty {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.admin-transaction-filters {
  grid-template-columns: minmax(200px, 1fr) minmax(140px, 0.65fr) minmax(280px, 1.2fr) minmax(150px, 0.72fr) minmax(150px, 0.72fr) auto auto;
}

.admin-date-range {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-filter-form .field {
  min-width: 0;
}

.admin-filter-form .field > span {
  font-size: 12px;
}

.admin-filter-form input,
.admin-filter-form select {
  min-width: 0;
  min-height: 38px;
  padding-block: 7px;
}

.filter-action {
  width: auto;
  min-height: 38px;
  padding: 7px 13px;
  white-space: nowrap;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 14px 0;
}

.admin-token-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.admin-summary-item {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  border-left: 1px solid var(--line);
  padding: 0 14px;
}

.admin-summary-item:first-child {
  border-left: 0;
}

.admin-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.admin-summary-item strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.admin-table-wrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 12px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 13px;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f7f9fc;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover td,
.admin-table tbody tr.selected td {
  background: #f6f9ff;
}

.admin-ledger-table {
  min-width: 1440px;
}

.token-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-provider-table {
  min-width: 1240px;
}

.admin-managed-user-table {
  min-width: 1040px;
}

.admin-group-table {
  min-width: 760px;
}

.admin-prompt-table {
  min-width: 1160px;
}

.admin-prompt-text {
  max-width: 440px;
  max-height: 7.5em;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.admin-prompt-engine {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.admin-group-memberships {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-subsection {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.admin-subsection-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.admin-subsection-heading h3,
.admin-subsection-heading p {
  margin: 0;
}

.admin-subsection-heading h3 {
  margin-bottom: 4px;
  font-size: 17px;
}

.admin-subsection-heading p {
  color: var(--muted);
  font-size: 12px;
}

.admin-compact-search {
  width: min(360px, 100%);
  flex: 0 1 360px;
}

.admin-group-picker {
  display: grid;
  gap: 9px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.admin-group-picker legend {
  padding: 0 5px;
  font-size: 12px;
  font-weight: 800;
}

#managedUserGroupOptions,
#managedUserProviderOptions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

#providerMediaTypes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.admin-provider-capability-picker > .admin-form-help {
  margin-bottom: 4px;
}

.admin-provider-capability-picker .admin-group-option:has(input:disabled) {
  color: var(--muted);
  opacity: 0.55;
}

.admin-group-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.admin-group-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-access-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-access-picker legend {
  grid-column: 1 / -1;
}

.admin-access-picker .admin-switch,
.admin-provider-access-picker .admin-switch {
  border-block: 0;
  padding: 4px 0;
}

.admin-provider-access-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  font-size: 12px;
}

.admin-provider-access-option input {
  grid-row: 1 / span 2;
}

.admin-provider-access-option span,
.admin-provider-access-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-provider-access-option small,
.admin-user-access small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.workspace-access-empty {
  width: min(620px, calc(100% - 40px));
  margin: clamp(80px, 18vh, 180px) auto 0;
  text-align: center;
}

.workspace-access-empty h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.workspace-access-empty p {
  margin: 0;
  color: var(--muted);
}

.points-value,
.positive-points,
.negative-points {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.positive-points {
  color: var(--success);
}

.negative-points {
  color: var(--danger);
}

.reference-cell {
  max-width: 210px;
  overflow: hidden;
  color: var(--primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-id-cell,
.model-name-cell,
.reason-cell,
.provider-url-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-name-cell {
  max-width: 200px;
  font-weight: 700;
}

.provider-url-cell {
  max-width: 320px;
  color: var(--muted-strong);
}

.admin-link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 4px 0;
  font-size: 12px;
  font-weight: 800;
}

.admin-link-button:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.admin-link-button.danger {
  color: var(--danger);
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  background: #edf1f5;
  color: var(--muted-strong);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.admin-badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.admin-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.admin-badge.info {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.compact-button {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 12px;
}

.empty-table-cell {
  color: var(--muted);
  padding-block: 40px !important;
  text-align: center !important;
}

.admin-table-footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 13px;
  font-size: 12px;
}

.admin-table-note {
  text-align: right;
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pagination span {
  min-width: 78px;
  text-align: center;
}

.admin-details-panel {
  border: 1px solid #a9c2fb;
  border-radius: 6px;
  background: var(--surface);
}

.admin-details-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #f8faff;
  padding: 12px 14px;
}

.admin-details-panel h3 {
  margin: 3px 0 0;
  font-size: 14px;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 4px 14px 14px;
}

.admin-detail-grid > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid #edf1f5;
  padding: 10px 12px 10px 0;
}

.admin-detail-grid dt {
  color: var(--muted);
  font-size: 11px;
}

.admin-detail-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
}

.admin-drawer {
  width: min(420px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 0;
  box-shadow: -16px 0 34px rgb(18 26 36 / 12%);
}

.admin-drawer::backdrop {
  background: rgb(18 26 36 / 26%);
}

.admin-drawer.admin-login-link-dialog {
  width: min(720px, calc(100vw - 24px));
  height: fit-content;
  max-height: calc(100dvh - 24px);
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-drawer.admin-login-link-dialog form {
  min-height: 0;
}

.admin-login-link-dialog .field {
  min-width: 0;
}

.admin-drawer form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 22px;
}

.admin-drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.admin-drawer-header h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.admin-close-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 24px;
  line-height: 1;
}

.admin-close-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.admin-current-value {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.admin-current-value span,
.admin-current-value small,
.admin-form-help {
  color: var(--muted);
  font-size: 12px;
}

.admin-current-value strong {
  font-size: 32px;
  line-height: 1.2;
}

.admin-form-help {
  margin: 0;
  line-height: 1.55;
}

.admin-field-help {
  margin: -10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.admin-switch {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-block: 1px solid var(--line);
  color: var(--muted-strong);
  padding: 10px 0;
  font-size: 13px;
  font-weight: 750;
}

.admin-switch input {
  width: 18px;
  height: 18px;
}

.admin-drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: auto;
  padding-top: 16px;
}

.admin-prompt-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-prompt-library-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.admin-prompt-library-card.deleted {
  opacity: 0.64;
}

.admin-prompt-library-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.admin-prompt-library-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-prompt-library-card-body {
  padding: 14px;
}

.admin-prompt-library-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.admin-prompt-library-card h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.admin-prompt-library-card p {
  height: 42px;
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 11px;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
  line-height: 1.7;
}

.admin-prompt-library-card-tags {
  min-height: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-prompt-library-card-tags span {
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  padding: 3px 6px;
  font-size: 10px;
}

.admin-prompt-library-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.admin-prompt-library-card-actions button {
  min-height: 30px;
}

.admin-prompt-library-empty {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}

.admin-prompt-library-drawer {
  width: min(580px, 100vw);
}

.prompt-library-meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-prompt-assets {
  display: grid;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
}

.admin-prompt-assets legend {
  padding: 0 5px;
  font-size: 12px;
  font-weight: 800;
}

.admin-prompt-cover-preview {
  width: 100%;
  min-height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
}

.admin-prompt-cover-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.admin-prompt-reference-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.admin-prompt-reference-item {
  position: relative;
  min-width: 0;
}

.admin-prompt-reference-item img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
}

.admin-prompt-reference-item button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: rgb(255 255 255 / 92%);
  color: var(--danger);
  padding: 0;
  box-shadow: 0 2px 8px rgb(0 0 0 / 12%);
}

.inline-alert.success {
  border-color: #96d4b7;
  background: var(--success-soft);
  color: var(--success);
}

.admin-dialog-submit {
  width: auto;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 980px) {
  .workspace,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 16px;
  }

  .topbar-actions {
    grid-column: 2;
    grid-row: 1;
    width: auto;
  }

  #workspaceTabs {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .identity-block {
    margin-left: auto;
  }

  .topbar-error {
    text-align: left;
  }

}

@media (max-width: 1080px) {
  #imageWorkspaceShell,
  #imageWorkspaceShell.settings-collapsed,
  #imageWorkspaceShell.history-collapsed {
    height: calc(100dvh - 170px);
    min-height: 560px;
    grid-template-columns: minmax(0, 1fr);
  }

  #imageWorkspaceShell.settings-collapsed #imageSettingsSidebar,
  #imageWorkspaceShell.history-collapsed #imageHistorySidebar {
    display: grid;
  }

  #imageHistorySidebar,
  #imageSettingsSidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 42;
    width: min(86vw, 330px);
    border: 0;
    box-shadow: 0 18px 48px rgb(18 26 36 / 28%);
    transition: transform 180ms ease;
  }

  #imageHistorySidebar {
    left: 0;
    transform: translateX(-105%);
  }

  #imageSettingsSidebar {
    right: 0;
    transform: translateX(105%);
  }

  #imageWorkspaceShell.history-open #imageHistorySidebar,
  #imageWorkspaceShell.settings-open #imageSettingsSidebar {
    transform: translateX(0);
  }

  .image-drawer-close {
    display: grid;
  }

  #imageDrawerBackdrop:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 41;
    display: block;
    border: 0;
    background: rgb(18 26 36 / 48%);
    padding: 0;
  }

  .image-conversation-header {
    flex-wrap: wrap;
  }

  #imageMessages {
    padding: 16px;
  }

  #imageAttachments {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .admin-managed-user-filters,
  .admin-business-tool-access-form,
  .admin-transaction-filters {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .admin-resource-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-prompt-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  .app-shell {
    width: calc(100% - 20px);
    padding-top: 18px;
  }

  .admin-topbar {
    min-height: 56px;
    padding: 8px 12px;
  }

  .admin-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-sidebar {
    position: static;
    min-height: 0;
    height: auto;
    grid-template-rows: auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-brand {
    min-height: 64px;
    padding: 10px 14px;
  }

  .admin-brand h1 {
    font-size: 20px;
  }

  .admin-navigation {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 7px;
  }

  .admin-nav-item {
    gap: 0;
    padding: 9px 5px;
    text-align: center;
  }

  .admin-nav-item span,
  .admin-nav-item.active::before,
  .admin-sidebar-footer {
    display: none;
  }

  .admin-main {
    min-height: 0;
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .admin-content {
    padding: 16px 10px 28px;
  }

  .admin-section-heading,
  .admin-subsection-heading,
  .admin-toolbar,
  .admin-table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-section-heading h2 {
    font-size: 21px;
  }

  .admin-section-heading .compact-action,
  .admin-search {
    width: 100%;
  }

  .admin-filter-tabs {
    overflow-x: auto;
  }

  .admin-subsection-tabs {
    width: 100%;
  }

  .admin-subsection-tabs button {
    min-width: 108px;
    flex: 1 0 auto;
  }

  .admin-user-filters,
  .admin-managed-user-filters,
  .admin-business-tool-access-form,
  .admin-resource-filters,
  .admin-prompt-filters,
  .admin-transaction-filters,
  .admin-date-range,
  .admin-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-settings-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .admin-settings-actions button {
    width: 100%;
  }

  .admin-heading-actions,
  .admin-subsection-heading .compact-action {
    width: 100%;
  }

  .admin-heading-actions > * {
    flex: 1;
  }

  #managedUserGroupOptions {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 0;
  }

  .admin-summary-item:nth-child(3) {
    border-left: 1px solid var(--line);
  }

  .admin-summary-item:nth-child(odd) {
    border-left: 0;
  }

  .admin-drawer {
    width: 100vw;
  }

  .admin-drawer form {
    padding: 18px;
  }

  h1 {
    font-size: 25px;
  }

  .auth-layout {
    width: min(100% - 20px, 440px);
    align-items: start;
    padding: 10px 0;
  }

  .auth-panel {
    gap: 17px;
    padding: 20px 18px;
    box-shadow: none;
  }

  .auth-header {
    gap: 5px;
  }

  .auth-header h1 {
    font-size: 24px;
  }

  .auth-form,
  .provider-login-list {
    gap: 11px;
  }

  .provider-login-section {
    gap: 9px;
    padding-top: 14px;
  }

  .topbar-actions {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-actions .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .identity-block {
    justify-items: start;
    margin-left: 0;
  }

  .topbar-error {
    grid-column: 1 / -1;
  }

  #workspaceTabs {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
  }

  #workspaceTabs [data-workspace-tab],
  .workspace-menu-trigger {
    flex-basis: 0;
    min-width: 0;
    padding-inline: 8px;
  }

  .workspace-tab-menu {
    min-width: 0;
    flex-basis: 0;
  }

  .workspace-tab-link,
  .workspace-tab-link > a {
    min-width: 0;
    flex-basis: 0;
  }

  .points-history-dialog {
    width: 100vw;
  }

  .points-history-header,
  .points-history-toolbar,
  .points-history-footer {
    padding-inline: 18px;
  }

  .points-history-summary {
    padding-inline: 12px;
  }

  .points-history-list {
    padding-inline: 18px;
  }

  .control-panel,
  .result-panel {
    padding: 18px;
  }

  .mode-group,
  .frame-grid,
  .progress-track {
    grid-template-columns: 1fr;
  }

  .provider-selector {
    grid-template-columns: 1fr;
  }

  .provider-option span {
    min-height: 68px;
    padding: 11px 12px;
  }

  .panel-heading .provider-badge {
    margin-top: 2px;
  }

  #imageModeGroup {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #imageModeGroup .segmented-option span {
    min-height: 58px;
    padding: 9px 10px;
  }

  .image-message {
    max-width: 96%;
    padding: 11px 12px;
  }

  #imageComposer {
    gap: 12px;
    padding: 14px;
  }

  #imageAttachments {
    max-height: 210px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #imageAttachments .reference-image-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 7px;
  }

  #imageAttachments .reference-thumbnail {
    width: 44px;
    height: 44px;
  }

  #imageSettingsPanel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #imageSettingsPanel > .field:first-child,
  #imageSettingsPanel > label:last-child,
  #imageSettingsPanel > .image-provider-hint {
    grid-column: 1 / -1;
  }

  .segmented-option span {
    min-height: 66px;
  }

  .frame-grid {
    grid-template-columns: 1fr;
  }

  .upload-box {
    grid-template-columns: minmax(0, 1fr) 112px;
    column-gap: 10px;
  }

  .panel-heading,
  .result-header,
  .history-header,
  .history-item {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .history-actions {
    justify-content: flex-start;
  }

  .reference-upload-header {
    align-items: flex-start;
  }

  .reference-image-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .reference-thumbnail {
    width: 56px;
    height: 56px;
  }

  .reference-image-actions {
    grid-column: 2;
    grid-template-columns: repeat(3, 40px);
  }

  .reference-icon-button {
    width: 40px;
    height: 40px;
  }
}
