/* Shared button materials. Geometry and interaction belong to each feature. */
:root {
  --xz-button-from: #b8a8ff;
  --xz-button-to: #9179df;
  --xz-button-ink: #1b1430;
  --xz-button-glow: color-mix(in srgb, #9e86ef 23%, transparent);
  --xz-button-highlight: #ffffff24;
  --xz-button-surface: color-mix(in srgb, var(--surface-raised) 86%, var(--soft));
  --xz-button-surface-hover: color-mix(in srgb, var(--surface-raised) 76%, var(--soft));
  --xz-button-line: color-mix(in srgb, var(--soft) 25%, transparent);
  --xz-button-shadow: #00000024;
  --xz-button-radius: 10px;
}
html[data-theme="light"] {
  --xz-button-from: #794bcf;
  --xz-button-to: #6039b6;
  --xz-button-ink: #ffffff;
  --xz-button-glow: #7852ce2b;
  --xz-button-highlight: #ffffffb3;
  --xz-button-surface: #ffffff;
  --xz-button-surface-hover: #f4f0fd;
  --xz-button-line: #dcd7e8;
  --xz-button-shadow: #38216f10;
}
html[data-theme="cyan"] {
  --xz-button-from: #58e1e9;
  --xz-button-to: #1ab8cb;
  --xz-button-ink: #062e38;
  --xz-button-glow: #17bdce29;
  --xz-button-highlight: #d9faff24;
  --xz-button-surface: #27333e;
  --xz-button-surface-hover: #324350;
  --xz-button-line: #829bac40;
  --xz-button-shadow: #00000020;
}

/* A shared, raised surface for regular actions; no dimensions are changed. */
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .quiet-button,.xz-image-quiet,.ac-secondary,.xb-button,.login-button,
  .payment-button,.unifiedhistory-filter-toggle,.unifiedhistory-page-button,
  .creation-history-pagination button,.history-selection-actions button
),
html[data-theme] body :is(.auth-tabs,.workspace-history-tabs,.xc-tabs) > button {
  border-color: var(--xz-button-line);
  border-radius: var(--xz-button-radius);
  color: var(--text);
  background: linear-gradient(165deg,var(--xz-button-surface),var(--surface));
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 2px 6px var(--xz-button-shadow);
  font-weight: 500;
  transition: background .16s ease,border-color .16s ease,box-shadow .16s ease,color .16s ease;
}
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .quiet-button,.xz-image-quiet,.ac-secondary,.xb-button,.login-button,
  .payment-button,.unifiedhistory-filter-toggle,.unifiedhistory-page-button,
  .creation-history-pagination button,.history-selection-actions button
):hover:not(:disabled),
html[data-theme] body :is(.auth-tabs,.workspace-history-tabs,.xc-tabs) > button:hover:not(:disabled) {
  border-color: color-mix(in srgb,var(--violet) 45%,var(--xz-button-line));
  background: linear-gradient(165deg,var(--xz-button-surface-hover),var(--surface-raised));
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 3px 10px var(--xz-button-shadow);
}
html[data-theme] body :is(.auth-tabs,.workspace-history-tabs,.xc-tabs) > button:is([aria-selected="true"],.is-active),
html[data-theme] body .unifiedhistory-page-button:is([aria-current="page"],.is-active) {
  border-color: color-mix(in srgb,var(--violet) 50%,var(--xz-button-line));
  color: var(--text);
  background: linear-gradient(140deg,color-mix(in srgb,var(--violet) 21%,var(--surface-raised)),color-mix(in srgb,var(--violet) 8%,var(--surface)));
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 2px 7px var(--xz-button-shadow);
  font-weight: 600;
}

/* Primary actions have a distinct satin material and legible theme-specific ink. */
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.message-edit-confirm,.send-button
),
html[data-theme] body .workbench #chat-command-center .send-button,
html[data-theme] body .workbench .floating-dock :is(.send-button,.xz-image-primary) {
  color: var(--xz-button-ink);
  border: 1px solid color-mix(in srgb,var(--xz-button-from) 72%,#ffffff);
  border-radius: 12px;
  background: linear-gradient(180deg,#ffffff16,transparent 46%),linear-gradient(125deg,var(--xz-button-from),var(--xz-button-to));
  box-shadow: inset 0 1px 0 #ffffff45,inset 0 -1px 0 #00000016,0 3px 9px var(--xz-button-glow);
  font-weight: 650;
  text-shadow: none;
  transition: background .16s ease,border-color .16s ease,box-shadow .16s ease,filter .16s ease;
}
html[data-theme] body .billing-entry .billing-subscribe { border-radius: 999px; }
html[data-theme] body .workspace-history-tabs > button { padding-inline: 12px; padding-block: 8px; border-radius: 10px; }
html[data-theme] body .workspace-history-tabs > button[aria-selected="true"]::after { left: 12px; right: 12px; }
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.message-edit-confirm,.send-button
):hover:not(:disabled),
html[data-theme] body .workbench #chat-command-center .send-button:hover:not(:disabled),
html[data-theme] body .workbench .floating-dock :is(.send-button,.xz-image-primary):hover:not(:disabled) {
  background: linear-gradient(180deg,#ffffff24,transparent 55%),linear-gradient(125deg,var(--xz-button-from),var(--xz-button-to));
  box-shadow: inset 0 1px 0 #ffffff66,inset 0 -1px 0 #00000012,0 4px 13px var(--xz-button-glow);
  filter: brightness(1.045);
  transform: none;
}
html[data-theme] body :is(.primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.message-edit-confirm,.send-button):active:not(:disabled) {
  box-shadow: inset 0 2px 4px #00000020,0 1px 4px var(--xz-button-glow);
  filter: brightness(.97);
}

/* Fine icon actions, model menus and billing retain their existing layout. */
html[data-theme] body .workbench :is(.theme-toggle,.billing-balance,.message-tool-button,.message-edit-button,.message-version-button,.icon-button,.history-more) {
  border-radius: 10px;
  transition: color .16s ease,background .16s ease,box-shadow .16s ease,border-color .16s ease;
}
html[data-theme] body .workbench :is(.theme-toggle,.billing-balance,.message-tool-button,.message-edit-button,.message-version-button,.icon-button,.history-more):hover:not(:disabled) {
  color: var(--text);
  background: linear-gradient(150deg,var(--xz-button-surface),var(--surface));
  border-color: var(--xz-button-line);
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 2px 6px var(--xz-button-shadow);
}
html[data-theme] body .billing-entry {
  background: linear-gradient(155deg,var(--surface-raised),var(--surface));
  border-color: var(--xz-button-line);
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 3px 12px var(--xz-button-shadow);
}
html[data-theme] body .billing-entry .billing-balance { border-radius: 999px; }
html[data-theme] body .workbench .new-chat-button {
  border-color: color-mix(in srgb,var(--violet) 32%,var(--xz-button-line));
  border-radius: 11px;
  background: linear-gradient(135deg,color-mix(in srgb,var(--violet) 17%,var(--surface-raised)),var(--surface));
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 2px 7px var(--xz-button-shadow);
}
html[data-theme] body .workbench .prompt-card {
  background: linear-gradient(145deg,var(--xz-button-surface),var(--surface));
  border-color: var(--xz-button-line);
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 3px 12px var(--xz-button-shadow);
}
html[data-theme] body .workbench .prompt-card:hover:not(:disabled) {
  background: linear-gradient(145deg,color-mix(in srgb,var(--violet) 10%,var(--xz-button-surface)),var(--surface));
  border-color: color-mix(in srgb,var(--violet) 42%,var(--xz-button-line));
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 6px 18px var(--xz-button-shadow);
}
html[data-theme] body .workbench .prompt-icon {
  color: var(--violet);
  background: linear-gradient(145deg,color-mix(in srgb,var(--violet) 18%,var(--surface-raised)),color-mix(in srgb,var(--violet) 7%,var(--surface)));
  border-color: color-mix(in srgb,var(--violet) 28%,var(--xz-button-line));
  box-shadow: inset 0 1px 0 var(--xz-button-highlight);
}

/* Destructive, loading, focus, and disabled states remain unambiguous. */
html[data-theme] body.xa-admin .xa-button {
  color: var(--text);
  border-color: var(--xz-button-line);
  border-radius: 9px;
  background: linear-gradient(155deg,var(--xz-button-surface),var(--surface));
  box-shadow: inset 0 1px 0 var(--xz-button-highlight),0 2px 6px var(--xz-button-shadow);
  transition: background .16s ease,border-color .16s ease,box-shadow .16s ease;
}
html[data-theme] body.xa-admin .xa-button:hover:not(:disabled) {
  color: var(--text);
  border-color: color-mix(in srgb,var(--violet) 42%,var(--xz-button-line));
  background: linear-gradient(155deg,var(--xz-button-surface-hover),var(--surface-raised));
}
html[data-theme] body.xa-admin .xa-button.is-primary {
  color: var(--xz-button-ink);
  border-color: color-mix(in srgb,var(--xz-button-from) 72%,#ffffff);
  background: linear-gradient(180deg,#ffffff16,transparent 46%),linear-gradient(125deg,var(--xz-button-from),var(--xz-button-to));
  box-shadow: inset 0 1px 0 #ffffff45,inset 0 -1px 0 #00000016,0 3px 9px var(--xz-button-glow);
  font-weight: 650;
}
html[data-theme] body.xa-admin .xa-button.is-primary:hover:not(:disabled) { filter: brightness(1.045); }
html[data-theme] body.xa-admin .xa-button.is-danger { color: var(--danger); border-color: color-mix(in srgb,var(--danger) 35%,var(--line)); background: color-mix(in srgb,var(--danger) 7%,var(--surface)); }
html[data-theme] body.xa-admin .xa-button:disabled { opacity: .42; box-shadow: none; filter: saturate(.55); }
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog) :is(.is-danger,.danger-button,.stop-button) {
  color: var(--danger);
  border-color: color-mix(in srgb,var(--danger) 35%,var(--line));
  background: linear-gradient(145deg,color-mix(in srgb,var(--danger) 9%,var(--surface)),var(--surface));
}
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog) :is(.is-danger,.danger-button,.stop-button):hover:not(:disabled) {
  background: color-mix(in srgb,var(--danger) 14%,var(--surface));
  border-color: color-mix(in srgb,var(--danger) 60%,var(--line));
}
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog) :is(
  .primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.send-button,
  .quiet-button,.xz-image-quiet,.ac-secondary,.xb-button,.login-button
):disabled {
  opacity: .42;
  filter: saturate(.55);
  box-shadow: none;
  transform: none;
}
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog) :is(
  .primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.send-button,
  .quiet-button,.xz-image-quiet,.ac-secondary,.xb-button,.login-button,.theme-toggle
):focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell) button {
    transition: none;
  }
}
