/* Shared Studio theme tokens and the small, explicit theme control. */
.studio-theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 40px;
  padding: 0;
  border: 1px solid var(--studio-line-strong, var(--studio-admin-line-strong));
  border-radius: 999px;
  color: var(--studio-ink, var(--studio-admin-ink));
  background: var(--studio-surface, var(--studio-admin-surface));
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.studio-theme-toggle:hover {
  border-color: var(--studio-mint, var(--studio-admin-mint));
  color: var(--studio-mint-dark, var(--studio-admin-mint-dark));
  background: var(--studio-surface-soft, var(--studio-admin-surface-soft));
  transform: translateY(-1px);
}
.studio-theme-toggle:focus-visible {
  outline: 3px solid var(--studio-gold, var(--studio-admin-gold));
  outline-offset: 3px;
}
.studio-theme-toggle [data-studio-theme-icon] { display: block; }
.studio-theme-control { display: flex; align-items: center; }
#header .studio-theme-control { flex: 0 0 auto; }
#user-tools + .studio-theme-control { margin-left: 0; }

html[data-studio-theme="dark"] {
  color-scheme: dark;

  --studio-ink: #efe5d6;
  --studio-ink-soft: #d1c3b1;
  --studio-paper: #11130f;
  --studio-surface: #1c130e;
  --studio-surface-soft: #2a2018;
  --studio-line: rgba(214, 194, 165, .24);
  --studio-line-strong: rgba(226, 207, 179, .46);
  --studio-mint: #83d8bd;
  --studio-mint-dark: #8bdcc0;
  --studio-gold: #d6a65f;
  --studio-red: #e38a7d;
  --studio-muted: #b4a695;
  --studio-shadow: 0 16px 40px rgba(0, 0, 0, .30);

  --studio-admin-ink: #efe5d6;
  --studio-admin-ink-soft: #d1c3b1;
  --studio-admin-paper: #11130f;
  --studio-admin-surface: #1c130e;
  --studio-admin-surface-soft: #2a2018;
  --studio-admin-line: rgba(214, 194, 165, .24);
  --studio-admin-line-strong: rgba(226, 207, 179, .46);
  --studio-admin-mint: #83d8bd;
  --studio-admin-mint-dark: #8bdcc0;
  --studio-admin-gold: #d6a65f;
  --studio-admin-red: #e38a7d;
  --studio-admin-muted: #b4a695;

  --body-fg: #d1c3b1;
  --body-bg: #11130f;
  --body-quiet-color: #b4a695;
  --body-medium-color: #d1c3b1;
  --body-loud-color: #efe5d6;
  --header-color: #efe5d6;
  --header-branding-color: #efe5d6;
  --header-bg: #0c0907;
  --header-link-color: #8bdcc0;
  --breadcrumbs-fg: #b4a695;
  --breadcrumbs-link-fg: #8bdcc0;
  --breadcrumbs-bg: #18100c;
  --link-fg: #8bdcc0;
  --link-hover-color: #b6efda;
  --link-selected-fg: #efe5d6;
  --hairline-color: rgba(214, 194, 165, .24);
  --border-color: rgba(226, 207, 179, .46);
  --error-fg: #e38a7d;
  --message-success-bg: rgba(28, 88, 62, .46);
  --message-warning-bg: rgba(112, 74, 19, .46);
  --message-error-bg: rgba(113, 36, 31, .46);
  --darkened-bg: #2a2018;
  --selected-bg: #20382e;
  --selected-row: #183b34;
  --button-bg: #0b2528;
  --button-hover-bg: #123a3c;
  --default-button-bg: #0b2528;
  --default-button-hover-bg: #123a3c;
  --close-button-bg: #2e2923;
  --close-button-hover-bg: #40372e;
  --delete-button-bg: #713b36;
  --delete-button-hover-bg: #8f4b43;
}

html[data-studio-theme="dark"] body,
html[data-studio-theme="dark"] .studio-content-shell,
html[data-studio-theme="dark"] #main,
html[data-studio-theme="dark"] .studio-admin-stage {
  color: var(--studio-ink);
  background-color: var(--studio-paper);
}

html[data-studio-theme="dark"] .studio-sidebar,
html[data-studio-theme="dark"] .studio-admin-sidebar {
  color: #e7f0eb;
  background: #00131c;
}
html[data-studio-theme="dark"] .studio-brand,
html[data-studio-theme="dark"] .studio-admin-sidebar-brand {
  border-color: rgba(197, 225, 214, .16);
}
html[data-studio-theme="dark"] .studio-brand p,
html[data-studio-theme="dark"] .studio-admin-sidebar-brand p,
html[data-studio-theme="dark"] .studio-sidebar-foot,
html[data-studio-theme="dark"] .studio-admin-sidebar-foot {
  color: #b2c2bb;
}
html[data-studio-theme="dark"] .studio-nav-label,
html[data-studio-theme="dark"] .studio-admin-sidebar-label {
  color: #9cb3aa;
}
html[data-studio-theme="dark"] .studio-nav a,
html[data-studio-theme="dark"] .studio-admin-sidebar-nav a {
  color: #d2dfd9;
}
html[data-studio-theme="dark"] .studio-nav a:hover,
html[data-studio-theme="dark"] .studio-nav a.is-active,
html[data-studio-theme="dark"] .studio-admin-sidebar-nav a:hover,
html[data-studio-theme="dark"] .studio-admin-sidebar-nav a.is-active {
  color: #fff;
  background: rgba(105, 182, 155, .16);
}
html[data-studio-theme="dark"] .studio-nav a span,
html[data-studio-theme="dark"] .studio-admin-sidebar-nav a span {
  color: #9bd7bd;
}

html[data-studio-theme="dark"] .studio-topbar,
html[data-studio-theme="dark"] #header {
  color: var(--studio-ink);
  border-color: var(--studio-line);
  background: rgba(10, 7, 5, .86);
}
html[data-studio-theme="dark"] .studio-kicker,
html[data-studio-theme="dark"] .studio-inline-link,
html[data-studio-theme="dark"] .studio-back-link,
html[data-studio-theme="dark"] .studio-table-action,
html[data-studio-theme="dark"] #breadcrumbs a,
html[data-studio-theme="dark"] .breadcrumbs a,
html[data-studio-theme="dark"] #content-main .addlink,
html[data-studio-theme="dark"] #content-main .changelink,
html[data-studio-theme="dark"] #content-main .viewlink,
html[data-studio-theme="dark"] #nav-sidebar .module th a,
html[data-studio-theme="dark"] #nav-sidebar .module td a,
html[data-studio-theme="dark"] #user-tools a,
html[data-studio-theme="dark"] #user-tools a:link,
html[data-studio-theme="dark"] #user-tools a:visited,
html[data-studio-theme="dark"] .studio-user-menu button {
  color: var(--studio-mint-dark, var(--studio-admin-mint-dark));
}
html[data-studio-theme="dark"] .studio-user-menu,
html[data-studio-theme="dark"] .studio-row-meta,
html[data-studio-theme="dark"] .studio-lede,
html[data-studio-theme="dark"] .studio-record-copy small,
html[data-studio-theme="dark"] .studio-empty-state,
html[data-studio-theme="dark"] .studio-empty-inline,
html[data-studio-theme="dark"] .studio-detail-list dt,
html[data-studio-theme="dark"] .studio-detail-url,
html[data-studio-theme="dark"] .studio-field-help,
html[data-studio-theme="dark"] .studio-inline-filter label,
html[data-studio-theme="dark"] .studio-muted,
html[data-studio-theme="dark"] #user-tools,
html[data-studio-theme="dark"] .breadcrumbs,
html[data-studio-theme="dark"] .help,
html[data-studio-theme="dark"] p.help,
html[data-studio-theme="dark"] .quiet,
html[data-studio-theme="dark"] .mini {
  color: var(--studio-muted, var(--studio-admin-muted));
}

html[data-studio-theme="dark"] .studio-button-primary,
html[data-studio-theme="dark"] input.default,
html[data-studio-theme="dark"] .button.default,
html[data-studio-theme="dark"] input[type="submit"] {
  color: #efe5d6;
  border-color: #31565a;
  background: #0b2528;
}
html[data-studio-theme="dark"] .studio-button-primary:hover,
html[data-studio-theme="dark"] input.default:hover,
html[data-studio-theme="dark"] .button.default:hover,
html[data-studio-theme="dark"] input[type="submit"]:hover {
  background: #123a3c;
}
html[data-studio-theme="dark"] .studio-button-secondary {
  color: var(--studio-ink);
  border-color: var(--studio-line-strong);
}
html[data-studio-theme="dark"] .studio-button-secondary:hover {
  border-color: var(--studio-mint);
  background: rgba(117, 175, 151, .12);
}

html[data-studio-theme="dark"] .studio-stat-card,
html[data-studio-theme="dark"] .studio-panel,
html[data-studio-theme="dark"] .studio-form-card,
html[data-studio-theme="dark"] .studio-action-panel,
html[data-studio-theme="dark"] .studio-preview-card,
html[data-studio-theme="dark"] .studio-filterbar,
html[data-studio-theme="dark"] .studio-notice,
html[data-studio-theme="dark"] .studio-board-column,
html[data-studio-theme="dark"] .studio-board-card,
html[data-studio-theme="dark"] .studio-table-panel,
html[data-studio-theme="dark"] .studio-admin-stage .module,
html[data-studio-theme="dark"] .studio-admin-stage .inline-group,
html[data-studio-theme="dark"] .studio-admin-stage .submit-row,
html[data-studio-theme="dark"] .studio-admin-stage .form-row,
html[data-studio-theme="dark"] .studio-admin-stage #changelist-filter,
html[data-studio-theme="dark"] body.login #content-main {
  border-color: var(--studio-line);
  background: rgba(25, 14, 9, .72);
  box-shadow: var(--studio-shadow, 0 16px 40px rgba(0, 0, 0, .30));
}
html[data-studio-theme="dark"] .studio-panel-heading,
html[data-studio-theme="dark"] .studio-detail-subsection,
html[data-studio-theme="dark"] .studio-form-actions,
html[data-studio-theme="dark"] .studio-followup-column,
html[data-studio-theme="dark"] .studio-note,
html[data-studio-theme="dark"] .studio-record-row,
html[data-studio-theme="dark"] .studio-table th,
html[data-studio-theme="dark"] .studio-table td,
html[data-studio-theme="dark"] #result_list thead th,
html[data-studio-theme="dark"] #result_list tbody td,
html[data-studio-theme="dark"] #result_list tbody th,
html[data-studio-theme="dark"] .form-row {
  border-color: var(--studio-line);
}
html[data-studio-theme="dark"] .studio-panel-heading,
html[data-studio-theme="dark"] .studio-table th,
html[data-studio-theme="dark"] #result_list thead th,
html[data-studio-theme="dark"] .module h2,
html[data-studio-theme="dark"] .module caption,
html[data-studio-theme="dark"] .inline-group h2,
html[data-studio-theme="dark"] #content-related h2,
html[data-studio-theme="dark"] #changelist-filter h2 {
  color: var(--studio-ink);
  background: rgba(42, 32, 24, .86);
}
html[data-studio-theme="dark"] .studio-record-row:hover,
html[data-studio-theme="dark"] .studio-table tbody tr:hover,
html[data-studio-theme="dark"] #result_list tbody tr:hover {
  background: rgba(123, 166, 143, .10);
}
html[data-studio-theme="dark"] .studio-record-copy strong,
html[data-studio-theme="dark"] .studio-empty-state strong,
html[data-studio-theme="dark"] .studio-detail-copy h3,
html[data-studio-theme="dark"] .studio-detail-list dd,
html[data-studio-theme="dark"] .studio-followup-row strong,
html[data-studio-theme="dark"] .studio-table-primary,
html[data-studio-theme="dark"] .studio-preview-card h2,
html[data-studio-theme="dark"] .studio-panel-heading h2,
html[data-studio-theme="dark"] .studio-action-panel h2,
html[data-studio-theme="dark"] .studio-detail-heading h1,
html[data-studio-theme="dark"] .studio-page-intro h1,
html[data-studio-theme="dark"] #content h1,
html[data-studio-theme="dark"] #content h2,
html[data-studio-theme="dark"] #content h3 {
  color: var(--studio-ink);
}

html[data-studio-theme="dark"] .studio-record-mark {
  color: #083029;
  background: #9bdcc0;
}
html[data-studio-theme="dark"] .studio-record-mark-soft {
  color: #a8dfc5;
  background: rgba(94, 145, 117, .28);
}
html[data-studio-theme="dark"] .studio-notice-info,
html[data-studio-theme="dark"] .studio-message-success {
  border-color: rgba(122, 209, 171, .42);
  color: #b6e8d0;
  background: rgba(23, 89, 62, .40);
}
html[data-studio-theme="dark"] .studio-notice-warning,
html[data-studio-theme="dark"] .studio-demo-banner,
html[data-studio-theme="dark"] .studio-admin-demo-banner,
html[data-studio-theme="dark"] .studio-message-warning {
  border-color: rgba(214, 166, 95, .52);
  color: #efd09b;
  background: rgba(99, 65, 18, .42);
}
html[data-studio-theme="dark"] .studio-notice-muted,
html[data-studio-theme="dark"] .studio-message-info {
  border-color: var(--studio-line);
  color: var(--studio-ink-soft);
  background: rgba(42, 32, 24, .58);
}
html[data-studio-theme="dark"] .studio-message-error,
html[data-studio-theme="dark"] .studio-form-errors,
html[data-studio-theme="dark"] .errornote {
  border-color: rgba(227, 138, 125, .54);
  color: #f0b0a5;
  background: rgba(103, 37, 32, .42);
}
html[data-studio-theme="dark"] .studio-status {
  color: #d8cbb9;
  background: rgba(87, 79, 67, .48);
}
html[data-studio-theme="dark"] .studio-status-new,
html[data-studio-theme="dark"] .studio-status-draft {
  color: #f1cd8a;
  background: rgba(123, 81, 17, .44);
}
html[data-studio-theme="dark"] .studio-status-contacted,
html[data-studio-theme="dark"] .studio-status-in_progress,
html[data-studio-theme="dark"] .studio-status-preview {
  color: #a9dce7;
  background: rgba(26, 79, 91, .46);
}
html[data-studio-theme="dark"] .studio-status-qualified,
html[data-studio-theme="dark"] .studio-status-approved,
html[data-studio-theme="dark"] .studio-status-published {
  color: #a7e5c4;
  background: rgba(29, 91, 63, .44);
}
html[data-studio-theme="dark"] .studio-status-closed,
html[data-studio-theme="dark"] .studio-status-done,
html[data-studio-theme="dark"] .studio-status-paused {
  color: #c0b7a8;
  background: rgba(71, 66, 58, .46);
}

html[data-studio-theme="dark"] .studio-control,
html[data-studio-theme="dark"] .studio-admin-stage input[type="text"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="password"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="email"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="url"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="number"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="date"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="datetime-local"],
html[data-studio-theme="dark"] .studio-admin-stage input[type="file"],
html[data-studio-theme="dark"] .studio-admin-stage select,
html[data-studio-theme="dark"] .studio-admin-stage textarea,
html[data-studio-theme="dark"] #nav-filter,
html[data-studio-theme="dark"] body.login input[type="text"],
html[data-studio-theme="dark"] body.login input[type="password"] {
  color: var(--studio-ink);
  border-color: var(--studio-line-strong);
  background: #17110d;
  color-scheme: dark;
}
html[data-studio-theme="dark"] .studio-control:disabled {
  color: var(--studio-muted);
  background: rgba(42, 32, 24, .72);
}
html[data-studio-theme="dark"] .studio-table,
html[data-studio-theme="dark"] #result_list tbody td,
html[data-studio-theme="dark"] #result_list tbody th {
  color: var(--studio-ink-soft);
}
html[data-studio-theme="dark"] .studio-table th,
html[data-studio-theme="dark"] .studio-table td {
  background: rgba(24, 14, 9, .36);
}
html[data-studio-theme="dark"] .studio-table code,
html[data-studio-theme="dark"] code {
  color: var(--studio-ink-soft);
  background: rgba(42, 32, 24, .80);
}

html[data-studio-theme="dark"] .studio-admin-stage .module caption a.section,
html[data-studio-theme="dark"] .studio-admin-stage .module caption a.section:link,
html[data-studio-theme="dark"] .studio-admin-stage .module caption a.section:visited,
html[data-studio-theme="dark"] #content-related .actionlist,
html[data-studio-theme="dark"] #content-related .actionlist li {
  color: var(--studio-ink-soft);
}
html[data-studio-theme="dark"] #nav-sidebar,
html[data-studio-theme="dark"] #nav-sidebar .module,
html[data-studio-theme="dark"] #nav-sidebar .module caption {
  border-color: var(--studio-line);
  background: rgba(20, 13, 9, .58);
}
html[data-studio-theme="dark"] #nav-sidebar .current-model {
  background: rgba(70, 122, 98, .28);
}
html[data-studio-theme="dark"] .breadcrumbs {
  border-color: var(--studio-line);
  background: rgba(22, 14, 10, .74);
}
html[data-studio-theme="dark"] .messagelist li {
  border-color: var(--studio-line);
  color: var(--studio-ink-soft);
  background: rgba(25, 14, 9, .72);
}
html[data-studio-theme="dark"] .studio-skip-link,
html[data-studio-theme="dark"] .skip-to-content-link {
  color: #efe5d6;
  background: #00131c;
}

@media (prefers-reduced-motion: reduce) {
  .studio-theme-toggle { transition: none; }
}

@media (max-width: 560px) {
  .studio-topbar-meta {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }
}
