/*
  Crumbs site-wide color settings
  --------------------------------
  AI / maintainer instructions:
  - To recolor the site, edit the values in the first :root block only.
  - Keep every --theme-* variable name and the mapping rules below unchanged.
  - Return this entire file when making a palette change.
  - Keep text readable against the chosen surfaces. Match --theme-on-primary
    and --theme-on-secondary to the contrast needs of their button backgrounds.
  This file is loaded by every customer and admin page after page styles.
*/
[hidden] {
  display: none !important;
}

:root {
  --theme-color-scheme: dark;
  color-scheme: var(--theme-color-scheme);

  /* Core surfaces, from the page background up to dialogs and popovers. */
  --theme-page: #171717;
  --theme-page-raised: #171717;
  --theme-surface: #171717;
  --theme-surface-raised: #171717;
  --theme-surface-overlay: #171717;
  --theme-surface-inset: #171717;
  --theme-page-glow: none;

  /* Main brand and action colors. */
  --theme-primary: #F2F1EA;
  --theme-primary-hover: #F2F1EA;
  --theme-primary-active: #F2F1EA;
  --theme-on-primary: #171717;
  --theme-secondary: #171717;
  --theme-secondary-hover: #171717;
  --theme-on-secondary: #F2F1EA;
  --theme-accent: #F2F1EA;
  --theme-on-accent: #171717;

  /* Text colors. */
  --theme-text: #F2F1EA;
  --theme-text-secondary: #F2F1EA;
  --theme-text-muted: rgba(242, 241, 234, .72);
  --theme-text-subtle: rgba(242, 241, 234, .56);
  --theme-text-inverse: #171717;
  --theme-link: #F2F1EA;
  --theme-link-hover: #F2F1EA;

  /* Lines, focus rings, and disabled states. */
  --theme-border: rgba(242, 241, 234, .14);
  --theme-border-strong: rgba(242, 241, 234, .24);
  --theme-border-subtle: rgba(242, 241, 234, .08);
  --theme-focus: #F2F1EA;
  --theme-disabled-bg: #171717;
  --theme-disabled-text: rgba(242, 241, 234, .48);

  /* Feedback colors. */
  --theme-success: #F2F1EA;
  --theme-success-soft: #171717;
  --theme-warning: #f4c15d;
  --theme-warning-soft: #392c14;
  --theme-danger: #ff737d;
  --theme-danger-soft: #3b1c24;
  --theme-info: #68baff;
  --theme-info-soft: #142b40;

  /* Component-level colors: buttons, fields, navigation, and selection. */
  --theme-button-bg: var(--theme-primary);
  --theme-button-hover: var(--theme-primary-hover);
  --theme-button-text: var(--theme-on-primary);
  --theme-button-secondary-bg: var(--theme-surface-raised);
  --theme-button-secondary-hover: var(--theme-surface-overlay);
  --theme-field-bg: var(--theme-surface-inset);
  --theme-field-text: var(--theme-text);
  --theme-field-placeholder: var(--theme-text-muted);
  --theme-navigation-bg: color-mix(in srgb, var(--theme-page) 92%, transparent);
  --theme-selection-bg: var(--theme-primary);
  --theme-selection-text: var(--theme-on-primary);
  --theme-shadow-color: #0008;

  /* Extra semantic surface levels for pages with custom component styles. */
  --theme-card: var(--theme-surface-raised);
  --theme-card-hover: var(--theme-surface-overlay);
  --theme-card-inset: var(--theme-surface-inset);
  --theme-overlay: color-mix(in srgb, var(--theme-page) 88%, transparent);
  --theme-primary-soft: color-mix(in srgb, var(--theme-primary) 12%, var(--theme-page));
  --theme-primary-glow: color-mix(in srgb, var(--theme-primary) 22%, transparent);
  --theme-success-glow: color-mix(in srgb, var(--theme-success) 18%, transparent);

  /* Legacy aliases used by the existing standalone pages. */
  --bg: var(--theme-page);
  --panel: var(--theme-surface);
  --line: var(--theme-border);
  --muted: var(--theme-text-muted);
  --text: var(--theme-text);
  --fg: var(--theme-text);
  --edge: color-mix(in srgb, var(--theme-border) 70%, transparent);
  --accent: var(--theme-primary);
  --orange: var(--theme-primary);
  --green: var(--theme-success);
  --red: var(--theme-danger);

  /* Compatibility tokens used by the inbox page's older component styles. */
  --card-bg: var(--theme-card);
  --card-hover: var(--theme-card-hover);
  --border-bright: var(--theme-border-strong);
  --accent-glow: var(--theme-primary-glow);
  --green-glow: var(--theme-success-glow);
}

/* Global page defaults and common controls. */
html, body { background: var(--theme-page-glow), var(--theme-page); color: var(--theme-text); }
::selection { background: var(--theme-selection-bg); color: var(--theme-selection-text); }
a { color: inherit; }
a:hover { color: var(--theme-link-hover); }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline-color: var(--theme-focus);
}
input, textarea, select {
  background-color: var(--theme-field-bg);
  color: var(--theme-field-text);
  border-color: var(--theme-border);
}
input::placeholder, textarea::placeholder { color: var(--theme-field-placeholder); }

/* Store and cart utility classes. */
.bg-page { background-color: var(--theme-page); }
.bg-surface { background-color: var(--theme-surface); }
.bg-surfaceElevated { background-color: var(--theme-surface-raised); }
.text-textPrimary, .text-white { color: var(--theme-text); }
.text-textSecondary, .text-muted { color: var(--theme-text-secondary); }
.border-border { border-color: var(--theme-border); }
.border-border\/40 { border-color: color-mix(in srgb, var(--theme-border) 40%, transparent); }
.border-border\/60 { border-color: color-mix(in srgb, var(--theme-border) 60%, transparent); }
.border-border\/70 { border-color: color-mix(in srgb, var(--theme-border) 70%, transparent); }
.border-border\/80 { border-color: color-mix(in srgb, var(--theme-border) 80%, transparent); }
.bg-white { background-color: var(--theme-button-bg); }
.text-black { color: var(--theme-button-text); }
.hover\:bg-\[\#eaeaea\]:hover, .hover\:bg-neutral-200:hover { background-color: var(--theme-button-hover); }
.hover\:text-white:hover { color: var(--theme-text); }
.focus-visible\:ring-white\/80:focus-visible { --tw-ring-color: color-mix(in srgb, var(--theme-focus) 80%, transparent); }
/* Existing generated utility classes with literal neutrals mapped to theme tokens. */
[class~="bg-[#0c0c0c]"], [class~="bg-[#101010]"] { background-color: var(--theme-surface-inset); }
[class~="bg-[#151515]"], [class~="bg-[#161616]"], [class~="bg-[#1b1b1b]"],
[class~="bg-[#1c1c1c]"], [class~="bg-[#202020]"] { background-color: var(--theme-surface); }
[class~="bg-black"] { background-color: var(--theme-page); }
[class~="bg-black/40"], [class~="bg-black/50"], [class~="bg-black/60"],
[class~="bg-black/75"], [class~="bg-black/80"] { background-color: color-mix(in srgb, var(--theme-page) 85%, transparent); }
[class~="bg-white/5"], [class~="bg-white/10"], [class~="bg-white/90"] { background-color: color-mix(in srgb, var(--theme-surface-raised) 88%, transparent); }
[class~="border-[#383838]"], [class~="border-white/5"], [class~="border-white/10"], [class~="border-white/20"] { border-color: var(--theme-border); }
[class~="text-accentGold"], [class~="border-accentGold/20"] { color: var(--theme-warning); border-color: color-mix(in srgb, var(--theme-warning) 24%, transparent); }
[class~="text-accentRed"] { color: var(--theme-danger); }
[class~="bg-green-400"], [class~="bg-[#27c93f]"] { background-color: var(--theme-success); }
[class~="bg-green-500/10"] { background-color: color-mix(in srgb, var(--theme-success) 10%, transparent); }

/* Landing and sign-in legacy page components. */
.formfolio-brand, .nav-button, .hero-copy, .footer-brand, .footer-links a:hover { color: var(--theme-text); }
.primary-button, .nav-button.primary, .auth-session-btn.primary {
  background: var(--theme-button-bg);
  border-color: var(--theme-button-bg);
  color: var(--theme-button-text);
}
.primary-button:hover, .nav-button.primary:hover, .auth-session-btn.primary:hover {
  background: var(--theme-button-hover);
  border-color: var(--theme-button-hover);
}
.auth-session-bar { background: color-mix(in srgb, var(--theme-success) 9%, var(--theme-page)); border-color: color-mix(in srgb, var(--theme-success) 30%, transparent); }
.auth-session-info strong { color: var(--theme-success); }

/* Account and login controls. */
.auth-overlay { background-color: var(--theme-page); color: var(--theme-text); }
.auth-card { background: var(--theme-surface); border-color: var(--theme-border); color: var(--theme-text); }
.auth-input, .auth-card input, .auth-card textarea, .auth-card select {
  background-color: var(--theme-field-bg); border-color: var(--theme-border); color: var(--theme-field-text);
}
.auth-input::placeholder, .auth-card input::placeholder { color: var(--theme-field-placeholder); }
.auth-submit { background: var(--theme-button-bg); border-color: var(--theme-button-bg); color: var(--theme-button-text); }
.auth-submit:hover { background: var(--theme-button-hover); border-color: var(--theme-button-hover); }
.auth-link, .auth-card a { color: var(--theme-link); }
.auth-link:hover, .auth-card a:hover { color: var(--theme-link-hover); }
.auth-google, .auth-password-toggle { background-color: var(--theme-button-secondary-bg); border-color: var(--theme-border); color: var(--theme-text); }
.auth-google:hover, .auth-password-toggle:hover { background-color: var(--theme-button-secondary-hover); border-color: var(--theme-border-strong); }
.auth-divider, .auth-copy, .auth-hint { color: var(--theme-text-muted); }
.auth-feedback.is-error { background: var(--theme-danger-soft); border-color: var(--theme-danger); color: var(--theme-text); }

/* Portfolio editor legacy components and its editor-layout drawer. */
.studio-app, .shell.studio-app { color: var(--theme-text); }
.studio-topbar, .studio-sidebar, .studio-main .editor,
.studio-main .preview-wrap, .ed-drawer, .sheet {
  color: var(--theme-text);
}
.studio-sidebar, .studio-topbar { background-color: var(--theme-page); border-color: var(--theme-border); }
.studio-main .editor, .ed-drawer, .sheet { background-color: var(--theme-surface); border-color: var(--theme-border); }
.studio-main .editor :is(input, textarea, select), .ed-drawer :is(input, textarea, select) {
  background-color: var(--theme-field-bg); color: var(--theme-field-text); border-color: var(--theme-border);
}
.studio-app .btn.primary, .studio-app .sidebar-item.active,
.studio-app .editor-tab.active, .ed-drawer .ed-save {
  background-color: var(--theme-button-bg); border-color: var(--theme-button-bg); color: var(--theme-button-text);
}
.studio-app :is(.btn, .sidebar-item, .editor-tab):hover { border-color: var(--theme-primary-hover); }
.studio-app :is(.eyebrow, .section-chip, .subhead, .group summary::after) { color: var(--theme-primary); }
.studio-app :is(.editor-tab.active, .sidebar-item.active, .btn.primary, .switch input:checked + i,
  .arrange-sel button[aria-pressed="true"], .mk-seg button.active) {
  background-color: var(--theme-primary); border-color: var(--theme-primary); color: var(--theme-on-primary);
}
.studio-app :is(input, textarea, select, button):focus-visible { outline-color: var(--theme-focus); }
.studio-app :is(input, textarea, select):focus { border-color: var(--theme-focus); }
.studio-app input[type="range"], .studio-app input[type="checkbox"] { accent-color: var(--theme-primary); }
.studio-app .toast, .studio-app .sheet, .studio-app .ed-drawer { box-shadow: 0 18px 50px var(--theme-shadow-color); }

/* Receipt page. */
.receipt-panel, .receipt-panel .receipt { color: var(--theme-text); }
@media screen {
  body:has(.receipt-panel) { background: var(--theme-page-glow), var(--theme-page); color: var(--theme-text); }
  body:has(.receipt-panel) .card, body:has(.receipt-panel) .receipt { background: var(--theme-surface); border-color: var(--theme-border); }
  body:has(.receipt-panel) .muted, body:has(.receipt-panel) .receipt dt,
  body:has(.receipt-panel) .receipt-panel>p { color: var(--theme-text-muted); }
  body:has(.receipt-panel) .receipt a { color: var(--theme-link); }
  body:has(.receipt-panel) .actions button { background: var(--theme-button-bg); color: var(--theme-button-text); }
  body:has(.receipt-panel) .actions a.button.secondary { background: var(--theme-button-secondary-bg); border-color: var(--theme-border); color: var(--theme-text); }
  body:has(.receipt-panel) .status { color: var(--theme-success); }
}

/* Inbox surface, message cards, and status colors. */
body:has(.inbox-shell) { background: var(--theme-page-glow), var(--theme-page); color: var(--theme-text); }
.inbox-shell, .inbox-header, .inbox-title-group, .message-detail { color: var(--theme-text); }
.inbox-shell :is(.filter-bar, .list-pane, .detail-pane, .site-link-card, .message-item) {
  background-color: var(--theme-card); border-color: var(--theme-border);
}
.inbox-shell :is(.message-item:hover, .message-item.active) { background-color: var(--theme-card-hover); border-color: var(--theme-primary); }
.inbox-shell :is(.muted, .hint, .message-time, .msg-time, .msg-preview, .meta-label, .detail-empty) { color: var(--theme-text-muted); }
.inbox-shell :is(.message-item.unread .msg-title, .inbox-accent, .msg-url-chip) { color: var(--theme-primary); }
.inbox-shell :is(.message-item.active) { background-color: var(--theme-primary-soft); border-color: color-mix(in srgb, var(--theme-primary) 38%, transparent); }
.inbox-shell .msg-url-chip { background: var(--theme-primary-soft); border-color: color-mix(in srgb, var(--theme-primary) 25%, transparent); }
.inbox-shell .site-link-card { background: linear-gradient(145deg, var(--theme-surface-raised), var(--theme-surface)); box-shadow: 0 10px 30px var(--theme-shadow-color), 0 0 0 1px var(--theme-primary-glow); }
.inbox-shell .status-badge { background: var(--theme-success-soft); border-color: color-mix(in srgb, var(--theme-success) 32%, transparent); color: var(--theme-success); }
.inbox-shell .message-body { color: var(--theme-text-secondary); }
.inbox-shell :is(.inbox-title-group h1, .detail-title-group h2, .empty-state h3, .message-item.unread .msg-title) { color: var(--theme-text); }
.inbox-shell .empty-icon, .inbox-shell .detail-empty svg { stroke: var(--theme-border-strong); }
.inbox-shell :is(button, .btn) { border-color: var(--theme-border); }
.inbox-shell .btn { background: var(--theme-button-secondary-bg); color: var(--theme-text); }
.inbox-shell .btn:hover { background: var(--theme-button-secondary-hover); border-color: var(--theme-border-strong); color: var(--theme-text); }
.inbox-shell .btn.primary { background: var(--theme-button-bg); border-color: var(--theme-button-bg); color: var(--theme-button-text); }
.inbox-shell .btn.danger { color: var(--theme-danger); }

/* Catalog administration page. These selectors override its local literals. */
body:has(.admin) { background: var(--theme-page-glow), var(--theme-page); color: var(--theme-text); }
.admin { color: var(--theme-text); }
.admin .mark { background: linear-gradient(145deg, var(--theme-primary-hover), var(--theme-primary-active)); color: var(--theme-button-text); }
.admin .button { background: var(--theme-button-secondary-bg); border-color: var(--theme-border); color: var(--theme-text); }
.admin .button:hover { background: var(--theme-button-secondary-hover); border-color: var(--theme-border-strong); }
.admin .button.primary { background: var(--theme-button-bg); border-color: var(--theme-button-bg); color: var(--theme-button-text); }
.admin .button.primary:hover { background: var(--theme-button-hover); border-color: var(--theme-button-hover); }
.admin .button.danger { color: var(--theme-danger); }
.admin .notice { background: var(--theme-warning-soft); border-color: color-mix(in srgb, var(--theme-warning) 35%, transparent); color: var(--theme-text-secondary); }
.admin .notice strong { color: var(--theme-text); }
.admin .status { color: var(--theme-success); }
.admin .panel { background: linear-gradient(145deg, var(--theme-surface-raised), var(--theme-surface)); border-color: var(--theme-border); box-shadow: 0 18px 50px var(--theme-shadow-color); }
.admin .panel-head { border-color: var(--theme-border); }
.admin .template-row { border-color: var(--theme-border-subtle); }
.admin .field label { color: var(--theme-text-secondary); }
.admin .field :is(input, textarea, select) { background: var(--theme-field-bg); border-color: var(--theme-border); color: var(--theme-field-text); }
.admin .field :is(input, textarea, select):focus { border-color: var(--theme-focus); outline-color: var(--theme-focus); }
.admin .mockup-stage { background: var(--theme-page-raised); border-color: var(--theme-border); }
.admin .mockup-viewport { background: var(--theme-surface); border-color: var(--theme-border-strong); }
.admin .mockup-tabs .button[aria-pressed="true"] { border-color: var(--theme-primary); color: var(--theme-primary-hover); }
.admin :is(.brand p, .count, .template-meta, .empty, .hint, .footer-note) { color: var(--theme-text-muted); }
