/* Shared visual finish. Existing layouts, visibility and interactions own geometry. */
:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --ui-ink: #223547;
  --ui-secondary: #50667a;
  --ui-muted: #617488;
  --ui-blue: #155b9b;
  --ui-blue-hover: #0c4b85;
  --ui-blue-rgb: 21, 91, 155;
  --ui-line: rgba(89, 126, 160, .17);
  --ui-divider: rgba(89, 126, 160, .105);
  --ui-clear: linear-gradient(155deg, rgba(255,255,255,.72), rgba(255,255,255,.20) 48%, rgba(215,234,250,.26));
  --ui-selected: linear-gradient(145deg, rgba(246,252,255,.91), rgba(187,221,252,.37) 57%, rgba(222,240,255,.59));
  --ui-primary: linear-gradient(150deg, rgba(248,253,255,.91), rgba(192,226,254,.48) 58%, rgba(157,204,244,.35));
  --ui-surface: linear-gradient(145deg, rgba(255,255,255,.95), rgba(250,253,255,.86));
  --ui-rim: inset 0 1px 0 rgba(255,255,255,.98), inset 0 -1px 0 rgba(58,111,163,.12), 0 0 0 .5px rgba(79,124,166,.16);
  --ui-control-shadow: var(--ui-rim), 0 5px 12px -8px rgba(33,79,121,.24);
  --ui-panel-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(89,126,160,.14), 0 14px 32px -25px rgba(36,73,108,.24);
  --ui-field-radius: 16px;
  --ui-success: #176741;
  --ui-success-bg: #edf7f1;
  --ui-warning: #895719;
  --ui-warning-bg: #fff7e9;
  --ui-danger: #a73138;
  --ui-danger-bg: #fff0f1;
}

html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) {
  --ink: var(--ui-ink);
  --ink-soft: var(--ui-secondary);
  --ink-dim: var(--ui-muted);
  --accent-ink: var(--ui-blue);
  --text-main: var(--ui-ink);
  --text-muted: var(--ui-secondary);
  --text-secondary: var(--ui-secondary);
  --text-dim: var(--ui-muted);
  --g-ink: var(--ui-ink);
  --g-ink-soft: var(--ui-secondary);
  --g-ink-dim: var(--ui-muted);
  --g-accent: var(--ui-blue);
  --g-accent-hover: var(--ui-blue-hover);
  --g-accent-rgb: var(--ui-blue-rgb);
  --g-hairline: var(--ui-line);
  --g-card-bg: var(--ui-surface);
  --g-card-shadow: var(--ui-panel-shadow);
  --g-glass-bg: var(--ui-clear);
  --g-glass-strong-bg: var(--ui-selected);
  --g-glass-shadow: var(--ui-control-shadow);
  --g-btn-bg: var(--ui-primary);
  --c-ink: var(--ui-ink);
  --c-ink-soft: var(--ui-secondary);
  --c-ink-muted: var(--ui-muted);
  --glass-clear: var(--ui-clear);
  --glass-blue: var(--ui-primary);
  --glass-card: var(--ui-surface);
  --glass-card-shadow: var(--ui-panel-shadow);
  font-family: var(--ui-font);
  color: var(--ui-ink);
  -webkit-font-smoothing: antialiased;
}

/* Clear controls have a bright upper rim and a quiet blue lower edge. */
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) .btn,
html body.admin-theme.style-glass .shop-v2 .btn {
  font-family: inherit;
  font-weight: 550;
  letter-spacing: 0;
  box-shadow: var(--ui-control-shadow);
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) .btn-primary,
html body.admin-theme.style-glass .shop-v2 .btn-primary {
  color: var(--ui-blue-hover);
  background: var(--ui-primary);
  box-shadow: var(--ui-control-shadow);
  font-weight: 600;
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) .btn-primary:hover:not(:disabled),
html body.admin-theme.style-glass .shop-v2 .btn-primary:hover:not(:disabled) {
  color: var(--ui-blue-hover);
  background: var(--ui-selected);
  box-shadow: var(--ui-rim), 0 7px 15px -9px rgba(33,79,121,.28);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(.btn-secondary, .btn-ghost) {
  color: var(--ui-secondary);
  background: var(--ui-clear);
}
html body.admin-theme.style-glass .shop-v2 .btn-sm {
  min-height: 34px;
  font-size: 12px;
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) .btn-danger,
html body.admin-theme.style-glass .shop-v2 .btn-danger {
  color: var(--ui-danger);
  background: var(--ui-danger-bg);
  box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(167,49,56,.15);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) .btn-danger:hover:not(:disabled) {
  color: var(--ui-danger);
  background: #ffe7e9;
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) .btn:disabled,
html body.admin-theme.style-glass .shop-v2 .btn:disabled {
  background: #edf2f6;
  color: #6c7d8c;
  box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(89,126,160,.1);
  opacity: .75;
  transform: none;
}

/* Reading surfaces do not blur or refract the entire page beneath them. */
html body[data-liquid-glass] :is(.panel, .product, .help-body section, .state-box, .ticket),
html body.admin-theme.style-glass :is(.content-section, .stat-card),
html body.redeem-page.style-glass :is(.tab-panel, .result-shell) {
  background: var(--ui-surface);
  box-shadow: var(--ui-panel-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html body[data-liquid-glass] .product {
  border-color: rgba(95,137,173,.15);
}
html body[data-liquid-glass] .product.featured {
  border-color: rgba(62,126,184,.30);
  box-shadow: var(--ui-panel-shadow), inset 0 0 0 .5px rgba(62,126,184,.06);
}
html body[data-liquid-glass] .product .cover {
  border-bottom-color: var(--ui-divider);
}
html body[data-liquid-glass] .product .features {
  color: var(--ui-secondary);
  line-height: 1.75;
}
html body[data-liquid-glass] .product .product-foot {
  border-top-color: var(--ui-divider);
}
html body[data-liquid-glass] :is(.product .price, .buy-card .price, .co-sum .due strong, .pay-summary .amount strong) {
  color: var(--ui-blue);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}
html body[data-liquid-glass] :is(.product h2, .product h3) {
  font-weight: 600;
  letter-spacing: -.015em;
}
html body[data-liquid-glass] .product .more {
  background: var(--ui-primary);
  color: var(--ui-blue-hover);
  box-shadow: var(--ui-control-shadow);
  font-weight: 550;
}

/* Same field material on checkout, customer account, redemption and admin. */
html body[data-liquid-glass] .field :is(input, textarea, select),
html body.admin-theme.style-glass :is(.form-control, .search-input),
html body.admin-theme.style-glass .shop-v2 .form-control,
html body.admin-theme.style-glass :is(.modal, .auth-card) .form-control,
html body.redeem-page.style-glass :is(.form-input, .inline-code-input) {
  color: var(--ui-ink);
  background: rgba(255,255,255,.8);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-field-radius);
  box-shadow: inset 0 1px 3px rgba(36,73,108,.025), 0 1px 0 rgba(255,255,255,.9);
  font-family: inherit;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
html body[data-liquid-glass] .field :is(input, textarea, select):focus,
html body.admin-theme.style-glass .form-control:focus,
html body.admin-theme.style-glass .shop-v2 .form-control:focus,
html body.admin-theme.style-glass :is(.modal, .auth-card) .form-control:focus,
html body.redeem-page.style-glass .form-input:focus {
  background: #fff;
  border-color: rgba(var(--ui-blue-rgb), .58);
  box-shadow: 0 0 0 3px rgba(var(--ui-blue-rgb), .10);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(input, textarea)::placeholder {
  color: var(--ui-muted);
  opacity: 1;
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--ui-blue);
}
html body.admin-theme.style-glass .shop-v2 .form-group label,
html body.redeem-page.style-glass .form-group label,
html body[data-liquid-glass] .field {
  color: var(--ui-ink);
  font-weight: 500;
}
html body.admin-theme.style-glass .shop-v2 :is(.form-text, .shop-muted),
html body.redeem-page.style-glass :is(.field-hint, .panel-head p),
html body[data-liquid-glass] :is(.hint, .muted, .dim) {
  color: var(--ui-muted);
  line-height: 1.7;
}

/* Selected navigation is distinct without moving the content or label. */
html body[data-liquid-glass] .shop-header nav a[aria-current="page"],
html body.admin-theme.style-glass .desktop-nav-link.active,
html body.admin-theme.style-glass .sidebar-link.active,
html body.admin-theme.style-glass .shop-v2 .filter-tab.active,
html body.redeem-page.style-glass .top-tab.active {
  color: var(--ui-blue-hover);
  background: var(--ui-selected);
  box-shadow: var(--ui-control-shadow);
  font-weight: 600;
}
html body.admin-theme.style-glass .shop-v2 .filter-tab:not(.active) {
  color: var(--ui-secondary);
}
html body.redeem-page.style-glass .top-tab.active .control-icon {
  color: var(--ui-blue);
  background: rgba(var(--ui-blue-rgb),.075);
}
html body.redeem-page.style-glass :is(.hero-header h1, .panel-head h2, .result-title) {
  font-weight: 600;
  letter-spacing: -.025em;
}
html body.redeem-page.style-glass :is(.spots-row, .panel-meta-pill) {
  color: var(--ui-secondary);
}

/* Administrative data is quiet but has clear headings, dividers and statuses. */
html body.admin-theme.style-glass :is(.page-header h2, .section-header h3, .modal-header h3) {
  color: var(--ui-ink);
  font-weight: 600;
  letter-spacing: -.02em;
}
html body.admin-theme.style-glass .shop-v2 .shop-section-head {
  border-bottom-color: var(--ui-divider);
}
html body.admin-theme.style-glass .shop-v2 :is(.data-table th, .shop-table-wrap th),
html body.admin-theme.style-glass .data-table thead th {
  color: var(--ui-secondary);
  background: rgba(227,239,249,.47);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--ui-divider);
}
html body.admin-theme.style-glass .shop-v2 :is(.data-table td, .shop-table-wrap td),
html body.admin-theme.style-glass .data-table tbody td {
  color: var(--ui-ink);
  border-bottom-color: var(--ui-divider);
  font-variant-numeric: tabular-nums;
}
html body.admin-theme.style-glass .data-table tbody tr:hover {
  background: rgba(222,237,249,.25);
}
html body.admin-theme.style-glass .shop-v2 :is(.shop-check, .mail-readiness, .payment-readiness) {
  color: var(--ui-secondary);
}
html body.admin-theme.style-glass .shop-v2 :is(.shop-form-footer, .mail-outbox-head, .shop-pagination) {
  border-color: var(--ui-divider);
}
html body.admin-theme.style-glass .shop-v2 :is(.shop-blank, .empty-state) {
  background: rgba(238,245,250,.6);
  border-color: var(--ui-divider);
  color: var(--ui-secondary);
}
html body.admin-theme.style-glass .auth-card {
  background: var(--ui-surface);
  box-shadow: var(--ui-panel-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html body.admin-theme.style-glass :is(.modal-content, .shop-v2 .modal-content) {
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(244,250,255,.96));
  border-color: rgba(255,255,255,.95);
}

/* Closed overlays must also leave the keyboard and accessibility tree. */
html body.admin-theme.style-glass .modal-overlay:not(.show) {
  visibility: hidden;
}
html body.admin-theme.style-glass .modal-overlay.show {
  visibility: visible;
}

/* Meaningful feedback colors are shared; status text is always retained. */
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(.status-active, .badge-success, .status.paid, .status.delivered) {
  color: var(--ui-success);
  background: var(--ui-success-bg);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(.status-full, .badge-warn, .status.pending) {
  color: var(--ui-warning);
  background: var(--ui-warning-bg);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(.status-error, .badge-error, .status.refunded) {
  color: var(--ui-danger);
  background: var(--ui-danger-bg);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(.status-banned, .badge-neutral, .status.cancelled) {
  color: var(--ui-secondary);
  background: #edf2f6;
}
html body[data-liquid-glass] :is(.confirm-check, .co-notes, .callout) {
  border-color: var(--ui-divider);
}
html body[data-liquid-glass] .method:has(input:checked) {
  background: var(--ui-selected);
  border-color: rgba(var(--ui-blue-rgb),.45);
  box-shadow: var(--ui-control-shadow);
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid #2874b3;
  outline-offset: 3px;
}
html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) svg.lucide {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  html body[data-liquid-glass] .field :is(input, textarea, select),
  html body.admin-theme.style-glass .form-control,
  html body.admin-theme.style-glass .shop-v2 .form-control,
  html body.admin-theme.style-glass :is(.modal, .auth-card) .form-control,
  html body.redeem-page.style-glass .form-input {
    font-size: 16px;
  }
  html body.admin-theme.style-glass .shop-v2 .btn-sm { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html body:is(.admin-theme.style-glass, .redeem-page.style-glass, [data-liquid-glass]) :is(.btn, input, textarea, select) {
    transition: none;
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root {
    --ui-clear: #fff;
    --ui-selected: #e8f3fc;
    --ui-primary: #e4f1fc;
    --ui-surface: #fff;
  }
}
