/* OZPrint Balanced Theme 1.0.0 — 2026-10-23
 * Load after studio.min.css and theme.min.css.
 * Screen-only: preserve the existing print styles and email document preview.
 */
@media screen {
  :root {
    --theme-bg: #0c131b;
    --theme-surface: #14202c;
    --theme-surface-2: #1c2b39;
    --theme-surface-soft: #111c26;
    --theme-ink: #edf3f7;
    --theme-muted: #adbfce;
    --theme-line: #314554;
    --theme-header: rgba(12, 19, 27, .96);
    --theme-service: #101c26;
    --theme-shadow: 0 18px 42px rgba(0, 0, 0, .18);
    --theme-soft-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    --theme-teal: #52d6c5;
    --theme-teal-strong: #82e4d7;
    --theme-gold: #e5bb73;
    --theme-input: #0e1822;
    --theme-input-border: #627d90;
    --oz-accent-surface: #153b3d;
    --oz-accent-border: #367c78;
    --oz-on-accent: #082b29;
    --oz-hover: #1b303c;
    --oz-placeholder: #9bafbf;
    --oz-success-bg: #16352b;
    --oz-success-text: #a5e8c3;
    --oz-success-line: #37674f;
    --oz-error-bg: #38252c;
    --oz-error-text: #ffc1c7;
    --oz-error-line: #86515e;
    --oz-warning-bg: #342e23;
    --oz-warning-text: #f0d397;
    --oz-warning-line: #89704a;
  }

  html[data-theme="light"] {
    --theme-bg: #e2e9eb;
    --theme-surface: #f0f4f3;
    --theme-surface-2: #d8e3e5;
    --theme-surface-soft: #e7eeef;
    --theme-ink: #19343d;
    --theme-muted: #4e6570;
    --theme-line: #bdcdd1;
    --theme-header: rgba(230, 238, 239, .97);
    --theme-service: #d5e1e4;
    --theme-shadow: 0 18px 42px rgba(33, 62, 70, .10);
    --theme-soft-shadow: 0 8px 24px rgba(33, 62, 70, .06);
    --theme-teal: #086e66;
    --theme-teal-strong: #07574f;
    --theme-gold: #79551a;
    --theme-input: #f6f8f6;
    --theme-input-border: #798f99;
    --oz-accent-surface: #d3e9e4;
    --oz-accent-border: #73a79c;
    --oz-on-accent: #ffffff;
    --oz-hover: #dfeae9;
    --oz-placeholder: #5a717b;
    --oz-success-bg: #dbeee1;
    --oz-success-text: #205c3b;
    --oz-success-line: #8cb99e;
    --oz-error-bg: #f3e2e3;
    --oz-error-text: #8b303e;
    --oz-error-line: #c7909a;
    --oz-warning-bg: #eee5ce;
    --oz-warning-text: #704f17;
    --oz-warning-line: #b69a61;
  }

  /* Both generations of OZPrint components use the same palette. */
  :root, html[data-theme="light"] {
    --bg: var(--theme-bg);
    --card: var(--theme-surface);
    --raised: var(--theme-surface-2);
    --ink: var(--theme-ink);
    --muted: var(--theme-muted);
    --teal: var(--theme-teal);
    --teal-dark: var(--theme-teal-strong);
    --accent: var(--theme-gold);
    --line: var(--theme-line);
    --border: var(--theme-line);
    --white: var(--theme-surface);
    --shadow: var(--theme-soft-shadow);
  }

  html, html[data-theme] body {
    background: var(--theme-bg);
    color: var(--theme-ink);
  }
  html[data-theme] .service-bar {
    background: var(--theme-service);
    border-color: var(--theme-line);
    color: var(--theme-muted);
  }
  html[data-theme] .header {
    background: var(--theme-header);
    border-bottom-color: var(--theme-line);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .05);
  }
  html[data-theme] .nav nav > a:not(.primary),
  html[data-theme] .account-menu summary { color: var(--theme-muted); }
  html[data-theme] .nav nav > a:not(.primary):hover,
  html[data-theme] .nav nav > a[aria-current="page"] { color: var(--theme-teal); }

  html[data-theme] .card,
  html[data-theme] .stat,
  html[data-theme] .gallery-card,
  html[data-theme] .account-dropdown,
  html[data-theme] .gallery-dialog,
  html[data-theme] .cookie-banner {
    background: var(--theme-surface);
    border-color: var(--theme-line);
    color: var(--theme-ink);
    box-shadow: var(--theme-soft-shadow);
  }
  html[data-theme] .account-dropdown a,
  html[data-theme] .account-dropdown .text-button { color: var(--theme-ink); }
  html[data-theme] .account-dropdown a:hover,
  html[data-theme] .account-dropdown .text-button:hover {
    background: var(--oz-hover); color: var(--theme-teal);
  }

  /* Fix the legacy white dashboard cards, including before theme.js runs. */
  html .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html .metrics > div {
    min-width: 0;
    background: var(--theme-surface);
    color: var(--theme-ink);
    border: 1px solid var(--theme-line);
    border-top: 3px solid var(--theme-teal);
    box-shadow: var(--theme-soft-shadow);
  }
  html .metrics > div:nth-child(2) { border-top-color: var(--theme-gold); }
  html .metrics > div:nth-child(3) { border-top-color: var(--theme-input-border); }
  html .metrics > div:nth-child(4) { border-top-color: var(--oz-warning-line); }
  html .metrics strong { color: var(--theme-ink); font-variant-numeric: tabular-nums; }
  html .metrics span { display: block; margin-top: 7px; color: var(--theme-muted); }
  html[data-theme] .admin-nav a {
    background: var(--theme-surface-soft);
    border-color: var(--theme-line); color: var(--theme-muted);
  }
  html[data-theme] .admin-nav a.active,
  html[data-theme] .admin-nav a[aria-current="page"],
  html[data-theme] .admin-nav a:hover {
    background: var(--oz-accent-surface);
    border-color: var(--oz-accent-border); color: var(--theme-teal);
  }
  html[data-theme] .admin-nav a[aria-current="page"] { font-weight: 700; }

  html[data-theme] .primary,
  html[data-theme] .nav .nav-cta {
    color: var(--oz-on-accent);
    background: var(--theme-teal); border-color: var(--theme-teal);
    box-shadow: none;
  }
  html[data-theme] .primary:hover {
    background: var(--theme-teal-strong); border-color: var(--theme-teal-strong);
    color: var(--oz-on-accent);
  }
  html[data-theme] .secondary,
  html[data-theme] .light-btn,
  html[data-theme] .chip {
    background: var(--theme-surface-soft);
    border-color: var(--theme-input-border); color: var(--theme-ink);
    box-shadow: none;
  }
  html[data-theme] .secondary:hover,
  html[data-theme] .light-btn:hover,
  html[data-theme] .chip:hover,
  html[data-theme] .chip[aria-pressed="true"] {
    background: var(--oz-accent-surface);
    border-color: var(--oz-accent-border); color: var(--theme-teal);
  }
  html[data-theme] .theme-toggle {
    min-height: 40px; border-color: var(--theme-input-border);
    background: var(--theme-surface-2); color: var(--theme-muted);
  }
  html[data-theme] .theme-toggle::before {
    top: 50%; margin-top: -13.5px;
    background: var(--theme-surface); border-color: var(--theme-line);
  }
  html[data-theme] .skip-link { background: var(--theme-teal); color: var(--oz-on-accent); }

  html[data-theme] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  html[data-theme] select, html[data-theme] textarea {
    background: var(--theme-input); border-color: var(--theme-input-border);
    color: var(--theme-ink); box-shadow: none;
  }
  html[data-theme] input::placeholder, html[data-theme] textarea::placeholder {
    color: var(--oz-placeholder); opacity: 1;
  }
  html[data-theme] :is(input, select, textarea):focus {
    outline: 2px solid var(--theme-teal); outline-offset: 2px; box-shadow: none;
  }
  html[data-theme] .field :is(input, select, textarea)[aria-invalid="true"] {
    border-color: var(--oz-error-text);
  }
  html[data-theme] .help { color: var(--theme-muted); }
  html[data-theme] .offer-option, html[data-theme] .file-row {
    background: var(--theme-surface-soft); border-color: var(--theme-line);
    color: var(--theme-ink);
  }
  html[data-theme] .offer-option:has(input:checked), html[data-theme] .file-row.active {
    background: var(--oz-accent-surface); border-color: var(--oz-accent-border);
  }
  html[data-theme] .dropzone {
    background: var(--oz-accent-surface); border-color: var(--oz-accent-border);
  }
  html[data-theme] .dropzone.dragging { border-color: var(--theme-teal); }
  html[data-theme] .model-viewer {
    background: radial-gradient(ellipse at 50% 42%, var(--theme-surface-2), var(--theme-surface-soft));
    border-color: var(--theme-line);
  }
  html[data-theme] .viewer-loading { background: var(--theme-surface-soft); color: var(--theme-teal); }
  html[data-theme] .geometry-info { background: var(--theme-surface-2); }
  html[data-theme] .security-secret {
    background: var(--theme-surface-soft); border-color: var(--theme-line); color: var(--theme-teal);
  }
  html[data-theme] .metric-bar { background: var(--theme-surface-2); }

  html[data-theme] th {
    background: var(--theme-surface-2) !important;
    color: var(--theme-muted) !important;
  }
  html[data-theme] tbody tr:hover { background: var(--oz-hover); }
  html[data-theme] .badge {
    background: var(--oz-accent-surface); color: var(--theme-teal);
    border: 1px solid var(--oz-accent-border);
  }
  html[data-theme] .alert.success {
    background: var(--oz-success-bg); color: var(--oz-success-text); border-color: var(--oz-success-line);
  }
  html[data-theme] .alert.error {
    background: var(--oz-error-bg); color: var(--oz-error-text); border-color: var(--oz-error-line);
  }
  html[data-theme] .alert.warning, html[data-theme] .notice {
    background: var(--oz-warning-bg); color: var(--oz-warning-text); border-color: var(--oz-warning-line);
  }
  html[data-theme] :is(.alert, .notice) :is(p, strong, a, li) { color: inherit; }
  html[data-theme] :is(.alert, .notice) a { text-decoration: underline; }

  html[data-theme] .service-card {
    background: linear-gradient(145deg, var(--theme-surface), var(--theme-surface-soft));
    border-color: var(--theme-line); color: var(--theme-ink); box-shadow: var(--theme-soft-shadow);
  }
  html[data-theme] .service-card:hover { border-color: var(--oz-accent-border); }
  html[data-theme] .gallery-section {
    background: var(--theme-surface-soft); border-block-color: var(--theme-line);
  }
  html[data-theme] .gallery-dialog > img { background: var(--theme-surface-2); }
  html[data-theme] .material-teaser {
    background: var(--theme-surface); border-color: var(--theme-line);
    box-shadow: var(--theme-soft-shadow);
  }
  html[data-theme] .idea-banner {
    background: linear-gradient(115deg, var(--oz-accent-surface), var(--theme-surface-soft));
    border-color: var(--oz-accent-border); box-shadow: var(--theme-soft-shadow);
  }
  html[data-theme] .idea-banner p { color: var(--theme-muted); }
  html[data-theme] :is(.service-icon, .process-icon, .step-number, .material-category) {
    background: var(--oz-accent-surface); border-color: var(--oz-accent-border); color: var(--theme-teal);
  }
  html[data-theme] .usp-strip small, html[data-theme] .hero-footnote { color: var(--theme-muted); }

  /* Image overlays and the intentionally dark quote/contact panels keep light ink. */
  html[data-theme] .hero-visual { color: #f2f7f8; }
  html[data-theme] .hero-product-caption strong,
  html[data-theme] .hero-visual .round-link,
  html[data-theme] .mini-pill,
  html[data-theme] .dialog-close,
  html[data-theme] .image-arrow { color: #f2f7f8; }
  html[data-theme] .hero-product-caption .eyebrow { color: #e5bb73; }
  html[data-theme] .hero-product-caption span { color: #c2d1dd; }
  html[data-theme] .dialog-close { background: #142a35; border-color: #7893a1; }
  html[data-theme] .hero-visual .round-link:hover,
  html[data-theme] .dialog-close:hover { color: #82e4d7; background: #17383b; }
  html[data-theme] .estimate-card,
  html[data-theme] .contact-intro {
    --ink: #f2f7f8; --muted: #c4d6dc; --teal: #82e4d7; --accent: #e5bb73;
    background: linear-gradient(145deg, #183e40, #172b38);
    border-color: #54747a; color: #f2f7f8;
  }
  html[data-theme] :is(.estimate-card, .contact-intro) :is(h2, strong, .contact-email) { color: #f2f7f8; }
  html[data-theme] :is(.estimate-card, .contact-intro) :is(p, .help, .muted, .contact-personal),
  html[data-theme] .estimate-metrics span,
  html[data-theme] .price-breakdown dt,
  html[data-theme] .contact-intro .contact-location,
  html[data-theme] .contact-intro .contact-detail-label { color: #c4d6dc; }
  html[data-theme] :is(.estimate-card, .contact-intro) .eyebrow,
  html[data-theme] .estimate-range, html[data-theme] .contact-monogram { color: #82e4d7; }
  html[data-theme] .estimate-card .price-breakdown { color: #edf3f7; }
  html[data-theme] .estimate-card::before { background: #e5bb73; }

  html[data-theme] .footer {
    background: var(--theme-service); border-top-color: var(--theme-line); color: var(--theme-muted);
  }
  html[data-theme] .footer-grid h3 { color: var(--theme-ink); }
  html[data-theme] .footer-grid a,
  html[data-theme] .footer-grid p,
  html[data-theme] .footer-brand .small,
  html[data-theme] .footer-bottom { color: var(--theme-muted); }
  html[data-theme] .footer-bottom { border-top-color: var(--theme-line); }
  html[data-theme] .footer-grid a:hover { color: var(--theme-teal); }
  html[data-theme] .footer-domain { color: var(--theme-gold) !important; }
  html[data-theme="light"] .footer .brand-lockup .logo-dark { display: none !important; }
  html[data-theme="light"] .footer .brand-lockup .logo-light { display: block !important; }
  html[data-theme="light"] .domain-suffix {
    background: #eee5ce; border-color: #b69a61; color: var(--theme-gold);
  }

  /* Prevent long project text/search fields from widening mobile admin pages. */
  html .account-grid > *, html .detail-layout > * { min-width: 0; }
  html .search input { min-width: 0; }
  html .search .btn { flex: 0 0 auto; }
  html .table-wrap { max-width: 100%; }
}

@media screen and (max-width: 1080px) {
  html[data-theme] .nav nav {
    background: var(--theme-surface); border-color: var(--theme-line); box-shadow: var(--theme-shadow);
  }
}
@media screen and (max-width: 720px) {
  html .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html .card .section-heading { align-items: stretch; flex-direction: column; gap: 18px; }
  html .card .section-heading .search { width: 100%; max-width: none; }
}
@media screen and (max-width: 480px) {
  html[data-theme] .theme-toggle::before { margin-top: -12.5px; }
}
