:root {
  --page: #121212;
  --panel: #1c1c1d;
  --field: #161617;
  --white: #ecebe8;
  --soft: #cbc9c5;
  --quiet: #aaa9a5;
  --accent: #eae5dc;
  --accent-hover: #f6f2eb;
}

/* The page owns one grid so it stays aligned across the workspace. */
:is(.workroom, .account-page, .production-board) {
  isolation: isolate;
  --dot-size: 21px;
}

.workroom .workroom-main,
.workroom .workroom-main :is(.workroom-stage, .workroom-section, .showcase-section) {
  background: transparent;
}

:is(.workroom, .account-page, .production-board)::before,
:is(.workroom, .account-page, .production-board)::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-size: var(--dot-size) var(--dot-size);
}

:is(.workroom, .account-page, .production-board)::before {
  background-image: radial-gradient(circle, #f5f5f54a 0.45px, transparent 0.92px);
}

:is(.workroom, .account-page, .production-board)::after {
  opacity: 0;
  background-image: radial-gradient(circle, #fffB 0.52px, transparent 1px);
  mask-image: radial-gradient(circle 128px at var(--dot-pointer-x, 50%) var(--dot-pointer-y, 50%),
    black, transparent);
}

@media (any-hover: hover) and (any-pointer: fine) {
  html[data-dot-pointer] :is(.workroom, .account-page, .production-board)::after {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  :is(.workroom, .account-page, .production-board)::after {
    transition: opacity 140ms ease-out;
  }
}

@media (hover: none) {
  :is(.workroom, .account-page, .production-board)::before {
    opacity: .74;
  }
}

@media (forced-colors: active) {
  :is(.workroom, .account-page, .production-board)::before,
  :is(.workroom, .account-page, .production-board)::after {
    content: none;
  }
}

.workroom .workspace-welcome h1 {
  font-size: clamp(37px, 4.3vw, 50px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.24;
}

.workroom .workspace-welcome p { line-height: 1.65; }
.workroom .workspace-film img { filter: saturate(.87) brightness(.87); }
.workroom .workspace-film:hover img { transform: none; }

.workroom .stage-modes .stage-mode-option[aria-pressed="true"] {
  border-color: #424244;
  box-shadow: none;
}

.workroom .stage-composer {
  background-color: rgb(28 28 29 / 73%);
}

.workroom .stage-composer :is(.composer-prompt-title strong, .stage-media-heading strong, .stage-dropzone strong) {
  font-size: clamp(17px, 2.25vw, 20px);
  font-weight: 550;
}

.workroom .stage-composer :is(#story-idea, #media-prompt) {
  border-color: #323234;
  background-color: rgb(22 22 23 / 45%);
  line-height: 1.75;
}

.workroom .stage-composer .model-service-notice {
  background: #1f1f21;
}

.workroom .stage-composer .model-service-copy > span { line-height: 1.6; }

.account-page .account-hero h1,
.workroom .workroom-section-head .showcase-section-title {
  font-weight: 550;
}

body :is(.auth-modal, .create-modal, .billing-dialog) :is(h2, .dialog-head h2) {
  line-height: 1.38;
}

@media (max-width: 780px) {
  .workroom .workspace-welcome h1 { font-size: clamp(25px, 7.3vw, 36px); }
}

/* Administrative pages use a separate palette for dense tables and forms. */
body:has(.admin-shell) {
  --page: #171f29;
  --panel: #212b37;
  --field: #19222d;
  --control: #293747;
  --hover: #303f50;
  --divider: #344253;
  --control-edge: #4a5d70;
  --white: #ecf1f5;
  --soft: #c1cbd6;
  --quiet: #a5b3c3;
  --admin-rail: #141c25;
  --admin-highlight: #a5dfd1;
  --admin-selection: #294443;
  --admin-selection-edge: #456d68;
  --accent: #bbe5da;
  --accent-hover: #d4f2e9;
  --accent-ink: #173531;
  --accent-panel: var(--admin-selection);
}

.admin-shell {
  --admin-ink: var(--white);
  --admin-muted: var(--quiet);
}

.admin-shell :is(.admin-sidebar, .admin-topbar) {
  background: var(--admin-rail);
  border-color: var(--divider);
}

.admin-shell .admin-brand .brand-symbol {
  background: var(--admin-selection);
  color: var(--admin-highlight);
}

.admin-shell .admin-sidebar nav button { color: var(--soft); }
.admin-shell .admin-sidebar nav button:hover { background: var(--control); color: var(--white); }
.admin-shell .admin-sidebar nav button.active {
  background: var(--admin-selection);
  border-color: var(--admin-selection-edge);
  color: #dcf3ed;
}
.admin-shell .admin-sidebar .admin-nav-line { background: var(--admin-highlight); }

.admin-shell :is(.admin-page-head p, .admin-nav-kicker, .admin-section-header span,
  .admin-certificate-expiry > span, .admin-certificate-site span,
  .metric > :is(span, small), .admin-revenue-cards :is(span, small, em),
  .business-calendar-head > div > span, .calendar-order-note, .calendar-footnote,
  .calendar-orders-empty span, .admin-insight-head span, .platform-note,
  .platform-field small, .quota-policy-head p) {
  color: var(--quiet);
}

.admin-shell :is(.admin-certificate, .admin-metrics, .compact-revenue, .business-calendar,
  .admin-overview-bottom, .model-list, .admin-settings-hub > [role="tabpanel"],
  .admin-table-wrap, .admin-wechat-section, .platform-section) {
  background-color: var(--panel);
  border-color: var(--divider);
}

.admin-shell .admin-metrics > .metric { background: var(--panel); }
.admin-shell .admin-metrics > .metric-feature { background: #253842; }
.admin-shell .metric-feature > strong { color: #ddeeea; }
.admin-shell .metric-feature > svg { color: var(--admin-highlight); }
.admin-shell :is(.metric, .admin-revenue-cards > div, .calendar-layout, .calendar-orders,
  .calendar-weekday, .calendar-day, .calendar-blank, .calendar-footnote,
  .quota-default-table td, .quota-default-table tbody th, .package-quota-row,
  .settings-tablist, .platform-actions, .platform-system, .platform-extra-limits) {
  border-color: var(--divider);
}

.admin-shell :is(.compact-revenue .admin-revenue-cards > div:nth-child(2) strong,
  .calendar-day > strong.has-revenue, .calendar-daily-income.has-revenue,
  .calendar-month-summary strong.has-revenue, .quota-saved) {
  color: var(--admin-highlight);
}

.admin-shell :is(.calendar-orders, .calendar-blank, .calendar-day.future) { background: var(--field); }
.admin-shell .calendar-day { background: var(--panel); color: var(--soft); }
.admin-shell .calendar-day:hover { background: var(--hover); }
.admin-shell .calendar-day.selected {
  background: var(--admin-selection);
  box-shadow: inset 0 0 0 1px #79aaa1;
}
.admin-shell :is(.business-calendar h2, .calendar-day-number, .calendar-day b, .calendar-orders-head h3) {
  color: var(--white);
}
.admin-shell :is(.calendar-day-number em, .calendar-day.selected .calendar-day-number) {
  color: #bcebdd;
}

.admin-shell :is(.admin-table, .quota-default-table) th,
.admin-shell .calendar-weekday {
  background: #263443;
  color: #cedbe6;
}
.admin-shell .quota-default-table tbody th { background: var(--panel); }
.admin-shell .admin-table td { color: var(--soft); }
.admin-shell .admin-table tbody tr:nth-child(even) td { background-color: #232f3c; }
.admin-shell .admin-table tr:hover td { background-color: var(--hover); color: var(--white); }

.admin-shell :is(.admin-status-filter, .admin-search, .calendar-navigation input,
  .calendar-navigation button, .calendar-order-pages button, .quota-user-pages button,
  .admin-settings-hub .secondary-button, .quota-user-search,
  input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea) {
  background-color: var(--field);
  border-color: var(--control-edge);
  color: var(--white);
}
.admin-shell :is(input, textarea)::placeholder { color: var(--quiet); }
.admin-shell .admin-search input { background: transparent; }
.admin-shell :is(.settings-tablist button[aria-selected="true"], .quota-user-list > button.selected) {
  background-color: var(--admin-selection);
  border-color: var(--admin-selection-edge);
  color: #dcf3ed;
}
.admin-shell :is(.settings-tablist button, .quota-user-list > button):hover:not(:disabled) {
  background-color: var(--hover);
  color: var(--white);
}
.admin-shell :is(.calendar-navigation, .calendar-order-pages, .quota-user-pages) button:hover:not(:disabled),
.admin-shell .admin-settings-hub .secondary-button:hover:not(:disabled) {
  background: var(--hover);
  border-color: #677c91;
  color: var(--white);
}

.admin-shell :is(.status-done, .status-active).status-pill {
  background: #264440;
  border-color: #49736b;
  color: #bcebdd;
}
.admin-shell :is(.status-processing, .status-queued).status-pill {
  background: #273f56;
  border-color: #4c6c8a;
  color: #c3e1ff;
}
.admin-shell :is(.status-failed, .status-disabled).status-pill {
  background: #492f39;
  border-color: #784b5b;
  color: #ffc9d1;
}
.admin-shell :is(.status-cancelled, .status-hidden, .status-deleted).status-pill {
  background: #323e4c;
  border-color: #536477;
  color: #cbd6e1;
}
.admin-shell .certificate-valid :is(.admin-certificate-icon, .admin-certificate-state strong) {
  color: var(--admin-highlight);
}
.admin-shell .certificate-valid .admin-certificate-icon { background: var(--admin-selection); }
body:has(.admin-shell) .admin-detail-dialog {
  background: var(--panel);
  border-color: var(--control-edge);
}
