/* ScriptMart brand palette: ink navy, electric violet and fresh mint. */
:root,
html[data-theme="dark"] {
    --brand: #20c997;
    --accent: #6d5dfb;
    --market-cyan: #20c997;
    --market-blue: #6d5dfb;
    --admin-blue: #8b7dff;
    --admin-green: #20c997;
}

html[data-theme="dark"] body {
    background: radial-gradient(circle at 85% 2%, #362c70 0, transparent 28%), radial-gradient(circle at 2% 12%, #0c4036 0, transparent 25%), #07101d;
}

/* The mark contains a navy lower chevron, so it needs a light badge on dark surfaces. */
html[data-theme="dark"] :is(.brand-logo, .admin-brand-logo) {
    padding: 3px;
    border: 1px solid #ffffff73;
    border-radius: 12px;
    background: #f7f8ff;
    filter: drop-shadow(0 8px 16px #0006);
}

html[data-theme="dark"] .hero-copy h1 span {
    color: #54dcb9;
    -webkit-text-stroke: 0;
    text-shadow: 0 10px 34px #20c99722;
}

html[data-theme="dark"] ::placeholder { color: #9aa8bb; opacity: 1; }
html[data-theme="dark"] .policy-meta,
html[data-theme="dark"] .legal-sidebar nav a { color: #aab8cc; }
html[data-theme="dark"] .legal-sidebar nav a > span { color: #91a2b9; }

html[data-theme="dark"] :is(
    .client-flow small, .client-summary small, .client-app-identity p,
    .client-id-row span, .client-gateways > span, .client-detail-grid span,
    .client-card-foot > span, .gateway-identity p, .gateway-readiness small,
    .gateway-card-foot > span, .gateway-help-strip small, .gateway-section-head p,
    .environment-options small, .gateway-enable-control small,
    .gateway-encryption-note small, .inventory-stats small,
    .inventory-panel-head p, .inventory-product small
) { color: #96a5b9; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line, #26354a);
    border-radius: 10px;
    background: #ffffff0a;
    color: var(--text, #edf4ff);
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.theme-toggle:hover {
    border-color: var(--brand, #6f8dff);
    background: #ffffff12;
}

.theme-toggle:active { transform: translateY(1px); }
.theme-toggle:focus-visible { outline: 3px solid #6d5dfb45; outline-offset: 2px; }
.theme-toggle.compact { min-height: 32px; padding: 6px 9px; }
.theme-icon { width: 14px; text-align: center; font-size: 14px; }
.theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-sun { display: inline-block; }
[data-theme="light"] .theme-icon-moon { display: none; }

.admin-context-actions,
.admin-auth-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-auth-actions {
    position: fixed;
    top: 20px;
    right: 28px;
    z-index: 30;
}

.admin-auth-actions .admin-auth-back { position: static; }
.checkout-theme-toggle { position: fixed; top: 20px; right: 20px; z-index: 10; }

.brand-logo,
.admin-brand-logo {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
    filter: drop-shadow(0 7px 12px #6d5dfb2e);
}

.brand-accent { color: var(--market-cyan); }
.admin-brand-logo { width: 40px; height: 40px; flex-basis: 40px; }

.footer-intro > .brand {
    width: max-content;
    gap: 11px;
    color: var(--text);
    font-size: 18px;
    font-weight: 850;
    line-height: 1;
}

.footer-intro > .brand .brand-logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    filter: drop-shadow(0 8px 14px #6d5dfb35);
}

.mobile-nav-toggle,
.admin-mobile-nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--line, var(--admin-border));
    border-radius: 12px;
    background: #ffffff0a;
    color: inherit;
}

.mobile-nav-toggle > span,
.admin-mobile-nav-toggle > span {
    width: 17px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
}

.mobile-nav-toggle.is-open > span:first-child,
.admin-mobile-nav-toggle.is-open > span:first-child { transform: translateY(6px) rotate(45deg); }
.mobile-nav-toggle.is-open > span:nth-child(2),
.admin-mobile-nav-toggle.is-open > span:nth-child(2) { opacity: 0; }
.mobile-nav-toggle.is-open > span:last-child,
.admin-mobile-nav-toggle.is-open > span:last-child { transform: translateY(-6px) rotate(-45deg); }

/* Light is deliberately the default; dark is enabled only by an explicit saved choice. */
html[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel2: #f0f4f9;
    --line: #d8e0eb;
    --text: #172033;
    --muted: #627087;
    --brand: #5b4ee5;
    --accent: #159a78;
    --market-cyan: #5b4ee5;
    --market-blue: #159a78;
    --market-ink: #f5f7fb;
    --admin-bg: #f4f6fa;
    --admin-surface: #ffffff;
    --admin-border: #d9e0ea;
    --admin-text: #172033;
    --admin-muted: #657187;
    --admin-blue: #5b4ee5;
    --admin-green: #159a78;
}

html[data-theme="light"] body {
    color: var(--text);
    background: radial-gradient(circle at 85% 0, #e5e1ff 0, transparent 30%), radial-gradient(circle at 2% 12%, #d9f5ec 0, transparent 27%), var(--bg);
}

html[data-theme="light"] .theme-toggle {
    border-color: #ccd6e3;
    background: #fff;
    color: #263349;
    box-shadow: 0 5px 15px #24334b0d;
}

html[data-theme="light"] .theme-toggle:hover { border-color: #6680bb; background: #f5f8fc; }
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .nav a.active { background: #1720330a; color: #172033; }
html[data-theme="light"] .nav-cta { background: #172033 !important; color: #fff !important; }

html[data-theme="light"] :is(.hero-card, .panel, .card, .auth-card, .checkout-card) {
    border-color: var(--line);
    background: linear-gradient(160deg, #fff, #f7f9fc);
    box-shadow: 0 24px 55px #24334b14;
}

html[data-theme="light"] :is(.hero p, .section-lead, .page-head p, .features, .muted, .flow-step small, .summary-row span, .timeline small) { color: var(--muted); }
html[data-theme="light"] :is(.flow-step, .summary-row, th, td) { border-color: #dfe5ed; }
html[data-theme="light"] th { color: #6e7c91; }
html[data-theme="light"] code { color: #08735f; }
html[data-theme="light"] .btn.secondary { background: #fff; color: #263349; border-color: #cfd8e5; }
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea,
html[data-theme="light"] .filters input,
html[data-theme="light"] .filters select {
    border-color: #ced8e5;
    background: #fff;
    color: #172033;
}

html[data-theme="light"] .notice { background: #e8f8f3; color: #146e5c; border-color: #a9dfd0; }
html[data-theme="light"] .errors { background: #fff0f2; color: #ae3f51; border-color: #f2bdc6; }

/* Marketplace and buyer account */
html[data-theme="light"] .market-strip { border-color: #dce4ed; background: #ffffff8a; }
html[data-theme="light"] .strip-grid > div { border-color: #dce4ed; }
html[data-theme="light"] :is(.hero-copy > p, .section-heading p, .buyer-banner p, .trust-row, .strip-grid span) { color: #63728a; }
html[data-theme="light"] .hero-search { background: #fff; border-color: #ccd7e4; box-shadow: 0 18px 45px #24334b18; }
html[data-theme="light"] .hero-search input { color: #172033; }
html[data-theme="light"] .code-showcase {
    border-color: #c9d5e3;
    background: linear-gradient(155deg, #fff, #eef3f9);
    box-shadow: 0 34px 75px #24334b1f;
}
html[data-theme="light"] .window-bar { border-color: #dce3ec; color: #6f7e93; }
html[data-theme="light"] .code-showcase pre { color: #506079; }
html[data-theme="light"] .floating-stat { background: #fff; border-color: #9bd8ca; box-shadow: 0 18px 38px #24334b1f; }
html[data-theme="light"] .floating-stat span { color: #64748a; }
html[data-theme="light"] .catalog-filter :is(input, select) { background: #fff; border-color: #ccd7e4; color: #172033; }
html[data-theme="light"] .product-card {
    border-color: #d6dfe9;
    background: linear-gradient(160deg, #fff, #f7f9fc);
}
html[data-theme="light"] .product-card:hover { box-shadow: 0 24px 55px #24334b18; }
html[data-theme="light"] .product-visual,
html[data-theme="light"] .detail-visual { background: radial-gradient(circle at 70% 20%, #bcd1ed 0, transparent 35%), linear-gradient(145deg, #e8f0f8, #dce8f3); border-color: #cad7e5; }
html[data-theme="light"] .visual-category,
html[data-theme="light"] .visual-code { background: #ffffffdb; color: #52657b; }
html[data-theme="light"] :is(.product-meta, .product-body p, .product-foot small, .purchase-price small, .empty-state p, .pager) { color: #65758b; }
html[data-theme="light"] .stack-row span { background: #e9eef5; color: #4f6077; }
html[data-theme="light"] .product-foot { border-color: #dfe5ed; }
html[data-theme="light"] .pager a { border-color: #cbd6e3; color: #34445b; background: #fff; }
html[data-theme="light"] .buyer-banner,
html[data-theme="light"] .process-section,
html[data-theme="light"] .info-cta { border-color: #cad9e5; background: radial-gradient(circle at 90%, #d8ebe9 0, transparent 42%), #fff; }
html[data-theme="light"] .buyer-points span { border-color: #dce4ed; color: #425168; }
html[data-theme="light"] .detail-columns article,
html[data-theme="light"] .purchase-card,
html[data-theme="light"] .order-card,
html[data-theme="light"] .buyer-account-sidebar,
html[data-theme="light"] .buyer-settings-card,
html[data-theme="light"] .buyer-help-grid article,
html[data-theme="light"] .value-grid article,
html[data-theme="light"] .contact-direct,
html[data-theme="light"] .contact-form-card,
html[data-theme="light"] .contact-aside article,
html[data-theme="light"] .legal-help-card,
html[data-theme="light"] .policy-summary {
    border-color: #d4dee9;
    background: linear-gradient(155deg, #fff, #f6f8fb);
    box-shadow: 0 18px 45px #24334b0c;
}
html[data-theme="light"] .policy-summary.refund-summary { border-color: #e1c98b; background: linear-gradient(145deg, #fff9e9, #fff); }
html[data-theme="light"] :is(.detail-lead, .check-list li, .preline, .purchase-card > ul li, .purchase-note, .secure-note p, .auth-promo > p, .auth-benefits, .account-head p, .order-top > small, .order-number, .receipt-rows span, .license-panel > p, .pending-box, .buyer-page-head p, .value-grid p, .process-copy p, .process-list span, .contact-direct p, .contact-aside p, .response-note p, .legal-document p, .legal-document li, .footer-grid > div) { color: #64748a; }
html[data-theme="light"] .auth-code { background: #fff; border-color: #cdd9e5; }
html[data-theme="light"] .order-meta,
html[data-theme="light"] .receipt-rows > div,
html[data-theme="light"] .secure-note,
html[data-theme="light"] .legal-hero,
html[data-theme="light"] .legal-document > section { border-color: #dfe5ed; }
html[data-theme="light"] .pending-box { background: #edf2f7; }
html[data-theme="light"] .market-footer { background: #eaf0f6; border-color: #d5dee8; }
html[data-theme="light"] .footer-grid b { color: #263349; }
html[data-theme="light"] .footer-bottom { border-color: #d3dde8; color: #67768b; }
html[data-theme="light"] .legal-sidebar nav a:hover,
html[data-theme="light"] .legal-sidebar nav a.active { color: #172033; background: #dff2ed; }

/* Admin workspace */
html[data-theme="light"] .admin-body,
html[data-theme="light"] .admin-auth-body { background-color: var(--admin-bg); color: var(--admin-text); }
html[data-theme="light"] .admin-body { background-image: linear-gradient(#17203308 1px, transparent 1px), linear-gradient(90deg, #17203308 1px, transparent 1px); }
html[data-theme="light"] .admin-sidebar { background: #fffffff2; border-color: var(--admin-border); box-shadow: 8px 0 35px #24334b0b; }
html[data-theme="light"] .admin-sidebar-head,
html[data-theme="light"] .admin-sidebar-foot,
html[data-theme="light"] .admin-content .page-head { border-color: var(--admin-border); }
html[data-theme="light"] .admin-nav-label { color: #758197; }
html[data-theme="light"] .admin-nav a { color: #59677d; }
html[data-theme="light"] .admin-nav a:hover { color: #172033; background: #17203308; }
html[data-theme="light"] .admin-nav a.active { color: #263b72; background: linear-gradient(90deg, #5778d51a, #fff); border-color: #8099dc55; }
html[data-theme="light"] .admin-user { background: #f6f8fb; }
html[data-theme="light"] .admin-store-link:hover { color: #172033; }
html[data-theme="light"] .admin-context-bar { background: #ffffffe8; border-color: var(--admin-border); color: #657187; }
html[data-theme="light"] .admin-content :is(.panel, .card) { background: linear-gradient(160deg, #fff, #f7f9fc); border-color: var(--admin-border); box-shadow: 0 18px 45px #24334b0d; }
html[data-theme="light"] .admin-content table tbody tr:hover { background: #17203305; }
html[data-theme="light"] .admin-content .btn.secondary { background: #fff; color: #263349; }

html[data-theme="light"] :is(.inventory-stats > div, .inventory-panel, .gateway-provider-card, .gateway-help-strip > div, .client-flow, .client-summary > div, .client-card) {
    background: linear-gradient(150deg, #fff, #f6f8fb);
    border-color: var(--admin-border);
    box-shadow: 0 18px 45px #24334b0d;
}
html[data-theme="light"] :is(.inventory-table-head, .gateway-card-foot, .gateway-help-strip, .client-card-foot) { background: #eef3f8; border-color: #d9e1eb; }
html[data-theme="light"] .inventory-row { border-color: #e0e6ee; }
html[data-theme="light"] .inventory-row:hover { background: #17203305; }
html[data-theme="light"] .inventory-product-icon { background: linear-gradient(145deg, #e5ecff, #f6f8ff); }
html[data-theme="light"] :is(.gateway-readiness, .environment-options label > span, .gateway-enable-control, .client-id-row, .client-gateway-options label > span, .client-enable-control) { background: #f6f8fb; border-color: #d4dde8; }
html[data-theme="light"] .credential-progress { background: #dce3ec; }
html[data-theme="light"] .gateway-security-banner { background: linear-gradient(90deg, #e8f6f1, #f8fbfa); }
html[data-theme="light"] .secret-reveal-card { background: #fff8e8; }
html[data-theme="light"] .gateway-encryption-note,
html[data-theme="light"] .client-secret-status {
    border-color: #a8ddce;
    background: linear-gradient(90deg, #e8f7f2, #f7fbfa);
}
html[data-theme="light"] .gateway-encryption-note strong,
html[data-theme="light"] .client-secret-status strong { color: #164c40; }
html[data-theme="light"] .gateway-encryption-note small,
html[data-theme="light"] .client-secret-status small { color: #48695f; }
html[data-theme="light"] .gateway-encryption-note > span,
html[data-theme="light"] .client-secret-status > span {
    background: #d9f2ea;
    color: #08705a;
}

html[data-theme="light"] :is(.product-dialog, .gateway-dialog, .client-dialog) { background: #fff; color: var(--admin-text); border-color: #ccd7e4; box-shadow: 0 40px 100px #24334b33; }
html[data-theme="light"] :is(.product-dialog-head, .gateway-dialog-head, .client-dialog-head) { background: linear-gradient(140deg, #f2f6fc, #fff); }
html[data-theme="light"] :is(.product-form-section, .gateway-editor-section, .client-form-section) { border-color: #dfe5ed; }
html[data-theme="light"] :is(.product-form-section .field input, .product-form-section .field select, .product-form-section .field textarea, .secret-input, .client-form-section .field input, .client-form-section .field textarea, .client-secret-input, .input-prefix, .input-suffix) { background: #fff; color: #172033; border-color: #ccd7e4; }
html[data-theme="light"] .secret-input input { color: #172033; }
html[data-theme="light"] .product-upload { background: #f7f9fc; border-color: #c8d4e2; }
html[data-theme="light"] .visibility-options > label { background: #f7f9fc; border-color: #d2dce8; }
html[data-theme="light"] :is(.product-dialog-foot, .gateway-dialog-foot, .client-dialog-foot) { background: #eef3f8; }

/* Admin sign-in */
html[data-theme="light"] .admin-auth-body { background: radial-gradient(circle at 20% 15%, #dbe6ff, transparent 36%), radial-gradient(circle at 90% 90%, #dff3ed, transparent 35%), #f5f7fb; }
html[data-theme="light"] .admin-auth-shell { background: #fff; border-color: #d3dce7; box-shadow: 0 35px 85px #24334b20; }
html[data-theme="light"] .admin-auth-intro { background: linear-gradient(145deg, #edf3ff, #f8fbff); border-color: #d7e0eb; }
html[data-theme="light"] .admin-auth-intro:after { border-color: #7296ff29; box-shadow: 0 0 0 65px #7296ff0b, 0 0 0 130px #7296ff08; }
html[data-theme="light"] .admin-auth-copy > p,
html[data-theme="light"] .admin-auth-points span { color: #59677d; }
html[data-theme="light"] .admin-login-card .field input { background: #fff; border-color: #cbd6e3; }

/* Direct payment handoff page */
html[data-theme="light"] body:has(.secure-loader) { background: #f5f7fb; color: #172033; }
html[data-theme="light"] .secure-loader .merchant,
html[data-theme="light"] .secure-loader p { color: #65748a; }
html[data-theme="light"] .secure-loader .loader-line { background: #dbe3ed; }
html[data-theme="light"] .secure-loader .slow,
html[data-theme="light"] .noscript { background: #fff; border-color: #d4dee9; box-shadow: 0 20px 55px #24334b12; }
html[data-theme="light"] .secure-loader .actions button,
html[data-theme="light"] .noscript button { background: #fff; color: #263349; border-color: #cbd6e3; }
html[data-theme="light"] .secure-loader .actions .primary { background: #416fd5; border-color: #416fd5; color: #fff; }

/* High-contrast light-theme pass. Keep secondary copy comfortably above AA contrast. */
html[data-theme="light"] {
    --muted: #4d5e75;
    --admin-muted: #4d5d73;
}

html[data-theme="light"] body { color: #142039; }
html[data-theme="light"] ::placeholder { color: #6c788a; opacity: 1; }
html[data-theme="light"] .hero-copy h1 span { color: #176c5e; -webkit-text-stroke: 0; }
html[data-theme="light"] .market-pill { color: #08705d; }
html[data-theme="light"] .market-pill.subtle { border-color: #78bcae; background: #e6f4f0; }

html[data-theme="light"] :is(
    .hero-copy > p, .trust-row, .strip-grid span, .section-heading p, .buyer-banner p,
    .product-meta, .product-body p, .product-foot small, .purchase-price small, .empty-state p, .pager,
    .back-link, .detail-visual > span, .detail-visual > small, .detail-tags > span, .detail-lead,
    .check-list li, .preline, .purchase-card > ul li, .purchase-note, .secure-note p,
    .auth-promo > p, .auth-benefits, .auth-switch, .account-head p, .order-top > small,
    .order-number, .order-meta small, .receipt-head p, .receipt-rows span, .license-panel > p,
    .license-panel > small, .pending-box, .buyer-identity small, .buyer-page-head p,
    .buyer-stat-grid small, .buyer-stat-grid span, .buyer-activity-row div small,
    .buyer-activity-row > span:last-child, .buyer-dashboard-empty p, .buyer-help-grid small,
    .buyer-help-grid i, .buyer-license-card > p, .buyer-license-card > label,
    .buyer-license-meta small, .buyer-settings-head p, .buyer-form-note p,
    .info-hero > div > p, .legal-hero > p, .value-grid p, .process-copy p,
    .process-list span, .info-cta p, .contact-direct small, .contact-direct p,
    .form-head p, .contact-form-card .field span small, .form-submit > small,
    .contact-aside p, .response-note p, .policy-meta, .legal-sidebar nav a,
    .legal-sidebar nav a > span, .legal-help-card p, .policy-summary p,
    .legal-document p, .legal-document li, .footer-grid > div, .footer-trust, .footer-bottom,
    .admin-product-title small, .upload-field small
) { color: #4b5d74; }

html[data-theme="light"] .field :is(label, span),
html[data-theme="light"] .field > span { color: #3f5067; }
html[data-theme="light"] .visual-category { color: #374960; }
html[data-theme="light"] .code-showcase code b { color: #6b3db4; }
html[data-theme="light"] .code-showcase code em { color: #176e93; }
html[data-theme="light"] .code-showcase code strong { color: #08705d; }
html[data-theme="light"] .floating-stat span { color: #475a72; }
html[data-theme="light"] .footer-grid a { color: #465970; }
html[data-theme="light"] .footer-grid a:hover { color: #08705d; }

html[data-theme="light"] :is(
    .buyer-stat-grid article, .buyer-dashboard-panel, .buyer-help-grid > a,
    .buyer-license-card, .buyer-settings-card
) {
    border-color: #d3dde8;
    background: linear-gradient(155deg, #fff, #f5f8fb);
    box-shadow: 0 15px 38px #24334b0c;
}

html[data-theme="light"] :is(.buyer-identity, .buyer-panel-head, .buyer-activity-row, .buyer-settings-head) { border-color: #dce4ed; }
html[data-theme="light"] .buyer-activity-row:hover { background: #17203305; }
html[data-theme="light"] .buyer-account-nav a { color: #41546d; }
html[data-theme="light"] .buyer-account-nav a > span { background: #edf2f7; color: #43566f; }
html[data-theme="light"] .buyer-account-nav a small { color: #586a80; }
html[data-theme="light"] .buyer-account-nav a:hover,
html[data-theme="light"] .buyer-account-nav a.active { border-color: #75b8aa; background: #e5f4ef; color: #123b36; }
html[data-theme="light"] .buyer-safety-note,
html[data-theme="light"] .buyer-form-note { border-color: #d9e2eb; background: #f1f5f8; }
html[data-theme="light"] .buyer-license-meta span { background: #edf2f7; }

html[data-theme="light"] .order-status { color: #4c5d72; border-color: #aab7c7; }
html[data-theme="light"] :is(.order-status.paid, .order-status.successful, .badge.successful, .badge.enabled) { color: #09644f; border-color: #68bca7; background: #e5f6f0; }
html[data-theme="light"] :is(.order-status.pending, .badge.pending) { color: #805500; border-color: #d6ad51; background: #fff7df; }
html[data-theme="light"] :is(.order-status.failed, .order-status.cancelled, .order-status.refunded, .badge.failed, .badge.refunded) { color: #a53145; border-color: #e0a4ae; background: #fff0f2; }

html[data-theme="light"] :is(
    .admin-nav-label, .admin-nav a, .admin-nav-icon, .admin-store-link, .admin-signout,
    .admin-context-bar, .admin-auth-back, .admin-auth-copy > p, .admin-auth-points span,
    .admin-auth-footnote, .admin-login-note, .inventory-stats span, .inventory-stats small,
    .inventory-panel-head p, .inventory-live, .inventory-table-head, .inventory-product small,
    .inventory-price small, .inventory-sales small, .inventory-release small, .inventory-icon-btn,
    .inventory-empty p, .product-dialog-head p, .dialog-close, .product-form-section-head p,
    .product-form-section .field i, .input-prefix b, .input-suffix b, .product-upload small,
    .product-upload > b, .visibility-options small, .gateway-summary-pill,
    .gateway-security-banner p, .gateway-identity p, .gateway-status, .gateway-metric span,
    .gateway-mode, .gateway-readiness small, .gateway-card-foot > span, .gateway-card-foot b,
    .gateway-help-strip small, .gateway-section-head p, .environment-options small,
    .credential-label label, .secret-input > span, .credential-clear,
    .gateway-enable-control small, .gateway-encryption-note small, .client-flow small,
    .client-summary span, .client-summary small, .client-app-identity p, .client-status,
    .client-id-row span, .client-gateways > span, .client-detail-grid span,
    .client-gateways b, .client-card-foot > span, .client-empty p,
    .client-dialog-head p, .client-section-head p, .client-form-section .field i,
    .client-form-section .field > small, .client-gateway-options small,
    .client-secret-input > span, .client-secret-status small, .client-enable-control small
) { color: #4a5b72; }

html[data-theme="light"] :is(.gateway-status.enabled, .client-status.enabled, .gateway-security-state, .package-state, .credential-label .stored) { color: #09634f; }
html[data-theme="light"] .catalog-status.draft { color: #526176; }
html[data-theme="light"] .gateway-summary-pill { background: #fff; border-color: #ccd7e4; }
html[data-theme="light"] .client-gateways b { background: #e9eef5; }
html[data-theme="light"] .client-id-row code { color: #345da8; }
html[data-theme="light"] .admin-auth-kicker,
html[data-theme="light"] .admin-login-card .eyebrow { color: #315aa8; }
html[data-theme="light"] .secure-note b { color: #304259; }
html[data-theme="light"] .gateway-summary-pill strong { color: #18253a; }
html[data-theme="light"] .inventory-icon-btn:hover,
html[data-theme="light"] .dialog-close:hover { color: #213149; border-color: #9cabc0; background: #e9eef5; }
html[data-theme="light"] .product-upload:hover { border-color: #6e8abc; background: #eef3f8; }

/* Apply the logo palette consistently to primary interaction and active states. */
.btn,
.hero-search button {
    background: linear-gradient(125deg, #6d5dfb, #20c997);
    color: #0d1527;
}

.brand-accent,
.market-pill,
.arrow-link { color: var(--market-cyan); }

.admin-content .btn,
.admin-login-card .btn {
    background: linear-gradient(125deg, #7768ff, #20c997);
    color: #0d1527;
}

.admin-nav a.active {
    background: linear-gradient(90deg, #6d5dfb26, #20c9970b);
    border-color: #8377ff4d;
    box-shadow: inset 3px 0 #7b6cff;
}

.admin-nav a.active .admin-nav-icon { color: #958aff; }

html[data-theme="light"] .hero-copy h1 span { color: #5b4ee5; }
html[data-theme="light"] .market-pill { color: #5145ce; }
html[data-theme="light"] .market-pill.subtle { border-color: #a69ef2; background: #eeecff; }
html[data-theme="light"] .code-showcase code b { color: #5b4ee5; }
html[data-theme="light"] .code-showcase code em { color: #147e64; }
html[data-theme="light"] .code-showcase code strong { color: #0d8063; }
html[data-theme="light"] .floating-stat { border-color: #afa8f3; }
html[data-theme="light"] .product-card:hover { border-color: #8176e8; }
html[data-theme="light"] .product-visual,
html[data-theme="light"] .detail-visual {
    background: radial-gradient(circle at 72% 20%, #d8d3ff 0, transparent 35%), radial-gradient(circle at 18% 85%, #d2f1e8 0, transparent 33%), linear-gradient(145deg, #f3f1ff, #eef8f5);
}
html[data-theme="light"] .buyer-banner,
html[data-theme="light"] .process-section,
html[data-theme="light"] .info-cta {
    border-color: #d1cdef;
    background: radial-gradient(circle at 90%, #e3deff 0, transparent 42%), radial-gradient(circle at 5%, #daf3eb 0, transparent 34%), #fff;
}
html[data-theme="light"] .buyer-account-nav a:hover,
html[data-theme="light"] .buyer-account-nav a.active {
    border-color: #9d94ef;
    background: #eeecff;
    color: #342d8c;
}
html[data-theme="light"] .legal-sidebar nav a:hover,
html[data-theme="light"] .legal-sidebar nav a.active {
    border-color: #a9a2ef;
    background: #efedff;
    color: #2f286f;
}
html[data-theme="light"] .admin-nav a.active {
    color: #352d91;
    background: linear-gradient(90deg, #e9e6ff, #effaf6);
    border-color: #a49cf0;
}
html[data-theme="light"] .admin-auth-body {
    background: radial-gradient(circle at 20% 15%, #e4e0ff, transparent 36%), radial-gradient(circle at 90% 90%, #d9f4eb, transparent 35%), #f5f7fb;
}
html[data-theme="light"] .admin-auth-intro { background: linear-gradient(145deg, #f0eeff, #f5fbf9); }
html[data-theme="light"] .admin-auth-kicker,
html[data-theme="light"] .admin-login-card .eyebrow { color: #5145ce; }

input:focus,
select:focus,
textarea:focus { box-shadow: 0 0 0 3px #6d5dfb18; }

/* Consistent dropdown chevron with enough breathing room from the right edge. */
select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 46px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M2 2l5 5 5-5' stroke='%23aebbd0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    background-size: 14px 9px !important;
}

html[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M2 2l5 5 5-5' stroke='%2333445b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

@media (max-width: 720px) {
    body { overflow-x: hidden; }
    .theme-toggle-label { display: none; }
    .admin-context-actions { gap: 8px; }
    .admin-context-actions > span { display: none; }
    .admin-auth-actions { top: 14px; right: 16px; }

    .admin-secure-dot { display: none; }
    .admin-mobile-nav-toggle { display: inline-flex; }
    .admin-sidebar .admin-nav,
    .admin-sidebar .admin-sidebar-foot { display: none; }
    .admin-sidebar.is-open .admin-nav { display: grid; }
    .admin-sidebar.is-open .admin-sidebar-foot { display: flex; }
    .admin-sidebar-head { border-bottom: 0; padding-bottom: 0; }
    .admin-sidebar.is-open .admin-sidebar-head { padding-bottom: 14px; border-bottom: 1px solid var(--admin-border); }
    .admin-brand-logo { width: 36px; height: 36px; flex-basis: 36px; }

    .client-flow strong { font-size: 12px; }
    .client-flow small,
    .client-summary small,
    .client-app-identity p,
    .client-id-row span,
    .client-gateways > span,
    .client-detail-grid span,
    .client-gateways b,
    .client-card-foot > span,
    .gateway-identity p,
    .gateway-readiness small,
    .gateway-card-foot > span,
    .gateway-help-strip small { font-size: 10px; line-height: 1.45; }

    .client-summary span,
    .client-status,
    .gateway-status,
    .gateway-security-state { font-size: 10px; }

    .gateway-card-foot .btn { min-height: 40px; font-size: 11px; }
    .client-section-head p,
    .client-form-section .field i,
    .client-form-section .field > small,
    .client-gateway-options small,
    .client-enable-control small,
    .gateway-section-head p,
    .environment-options small,
    .credential-label span,
    .credential-clear,
    .gateway-enable-control small,
    .gateway-encryption-note small { font-size: 10px; line-height: 1.45; }
}

@media (max-width: 680px) {
    .marketplace-nav {
        position: relative;
        align-items: center;
        padding: 14px 0;
        z-index: 40;
    }

    .marketplace-nav .brand { gap: 8px; font-size: 16px; }
    .marketplace-nav .brand-logo { width: 36px; height: 36px; flex-basis: 36px; }
    .mobile-nav-toggle { display: inline-flex; }

    .marketplace-nav .nav {
        display: none;
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: 0;
        max-width: none;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: color-mix(in srgb, var(--panel) 96%, transparent);
        box-shadow: 0 22px 55px #0c17252e;
        backdrop-filter: blur(18px);
    }

    .marketplace-nav .nav.is-open { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
    .marketplace-nav .nav > a,
    .marketplace-nav .nav > form,
    .marketplace-nav .nav > .theme-toggle { width: 100%; margin: 0; }
    .marketplace-nav .nav > a,
    .marketplace-nav .nav .link-button,
    .marketplace-nav .nav > .theme-toggle { min-height: 44px; justify-content: center; text-align: center; }
    .marketplace-nav .nav > form .link-button { width: 100%; }
    .marketplace-nav .nav > .theme-toggle { grid-column: 1 / -1; }
    .marketplace-nav .theme-toggle-label { display: inline; }
}

@media (max-width: 560px) {
    .admin-auth-actions { left: 18px; right: 18px; justify-content: flex-end; }
    .admin-auth-actions .admin-auth-back { margin-right: auto; }
    .admin-auth-intro { padding-top: 78px; }
    .admin-auth-intro .admin-brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
    .admin-auth-intro .admin-brand { gap: 9px; }
    .admin-auth-intro .admin-brand b { font-size: 14px; }
    .checkout-theme-toggle { top: 12px; right: 12px; }

    .hero-copy h1 { font-size: clamp(40px, 13vw, 50px); }
    .hero-copy > p { font-size: 16px; }
    .hero-search { padding: 7px; }
    .hero-search input { min-width: 0; padding: 12px 13px; }
    .hero-search button { min-height: 48px; }
    .floating-stat { max-width: calc(100% - 24px); }
    .footer-grid { gap: 28px 20px; }
    .footer-intro > .brand { gap: 9px; font-size: 17px; }
    .footer-intro > .brand .brand-logo { width: 44px; height: 44px; flex-basis: 44px; }
    .footer-bottom { margin-top: 28px; }
}
