/* Automation Station — design system
   Shared tokens: app-bg, glass-panel, btn, field, chip, coupon-card, nav-tab
   Shared tokens: app-bg, glass-panel, btn, field, chip, coupon-card, nav-tab
*/
/* =====================================================================
   CVS Automation Hub — Refined Dark Design System
   Glassmorphism · gradients · depth · smooth transitions
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Surfaces */
    --cvs-bg: #070b16;
    --cvs-bg-2: #0b1224;
    --surface: rgba(17, 25, 47, 0.55);
    --surface-strong: rgba(20, 30, 56, 0.78);
    --surface-sunken: rgba(7, 12, 24, 0.6);
    --border: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(148, 163, 184, 0.22);
    --border-glow: rgba(34, 211, 238, 0.35);

    /* Text */
    --text: #e8eef9;
    --text-muted: #94a3b8;
    --text-faint: #8090a6;

    /* Accents */
    --accent: #22d3ee;
    --accent-2: #2dd4bf;
    --accent-3: #6366f1;
    --danger: #f43f5e;
    --success: #34d399;
    --warning: #fbbf24;

    /* Shadows */
    --shadow-soft: 0 4px 24px -8px rgba(0, 0, 0, 0.55);
    --shadow-lift: 0 18px 50px -18px rgba(0, 0, 0, 0.75);
    --glow-accent: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 12px 40px -12px rgba(34, 211, 238, 0.35);

    --radius: 16px;
    --radius-lg: 22px;
}

/* ----- Base ----- */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--cvs-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Ambient animated background glows — applied to the app shell */
.app-bg {
    position: relative;
    min-height: 100vh;
    background:
        radial-gradient(60rem 60rem at 12% -10%, rgba(34, 211, 238, 0.12), transparent 60%),
        radial-gradient(50rem 50rem at 110% 10%, rgba(99, 102, 241, 0.14), transparent 55%),
        radial-gradient(70rem 50rem at 50% 120%, rgba(45, 212, 191, 0.10), transparent 60%),
        var(--cvs-bg);
    background-attachment: fixed;
}

.app-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
    z-index: 0;
}

/* Stack shell children above the background grid — never clobber the
   skip link's fixed positioning (it must stay visually hidden until focus). */
.app-bg > *:not(dialog):not(.skip-link) { position: relative; z-index: 1; }

/* ----- Scrollbar ----- */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.4), rgba(99, 102, 241, 0.4));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.7), rgba(99, 102, 241, 0.7));
    background-clip: content-box;
}

/* ----- Typography helpers ----- */
.gradient-text {
    background: linear-gradient(120deg, #67e8f9 0%, #2dd4bf 45%, #818cf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.section-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-faint);
}

/* ----- Glass surfaces ----- */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.glass-panel-flat {
    background: var(--surface);
    backdrop-filter: blur(12px) saturate(130%);
    -webkit-backdrop-filter: blur(12px) saturate(130%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.glass-card {
    position: relative;
    background: linear-gradient(160deg, rgba(20, 30, 56, 0.7) 0%, rgba(12, 19, 38, 0.6) 100%);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
    overflow: hidden;
}

.glass-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(34, 211, 238, 0.4), transparent 40%, transparent 60%, rgba(99, 102, 241, 0.3));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-lift), 0 0 32px -12px rgba(34, 211, 238, 0.45);
}

.glass-card:hover::before { opacity: 1; }

/* Sunken inner panel (for nested content) */
.sunken {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 12px;
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 700;
    border-radius: 12px;
    padding: 0.625rem 1.1rem;
    font-size: 0.9rem;
    transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease, opacity 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.2;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    color: #04111a;
    background: linear-gradient(135deg, #67e8f9 0%, #2dd4bf 100%);
    box-shadow: 0 8px 24px -10px rgba(34, 211, 238, 0.7);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 12px 30px -8px rgba(34, 211, 238, 0.85);
    transform: translateY(-1px);
}

.btn-indigo {
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 8px 24px -10px rgba(99, 102, 241, 0.7);
}
.btn-indigo:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px -8px rgba(99, 102, 241, 0.85); }

.btn-success {
    color: #04130d;
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 8px 24px -10px rgba(52, 211, 153, 0.7);
}
.btn-success:hover:not(:disabled) { transform: translateY(-1px); }

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    box-shadow: 0 8px 24px -10px rgba(244, 63, 94, 0.65);
}
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px -8px rgba(244, 63, 94, 0.8); }

.btn-ghost {
    color: var(--text);
    background: rgba(148, 163, 184, 0.08);
    border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: rgba(148, 163, 184, 0.16); border-color: var(--border-glow); }

.btn-outline-danger {
    color: #fda4af;
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.35);
}
.btn-outline-danger:hover:not(:disabled) { background: rgba(244, 63, 94, 0.18); border-color: rgba(244, 63, 94, 0.6); }

/* ----- Fields ----- */
.field {
    width: 100%;
    background: rgba(7, 12, 24, 0.6);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 0.7rem 0.95rem;
    color: var(--text);
    font-size: 0.92rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
}
.field::placeholder { color: var(--text-faint); }
.field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
    background: rgba(7, 12, 24, 0.8);
}
select.field option { background: #0b1224; color: var(--text); }

/* ----- Chips / pills (legacy CEP theme.css) ----- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: rgba(148, 163, 184, 0.07);
    color: var(--text-muted);
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
}
.chip:hover { color: var(--text); border-color: var(--border-glow); background: rgba(148, 163, 184, 0.12); }
.chip[data-active="true"] {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(99, 102, 241, 0.18));
    border-color: var(--accent);
    color: #a5f3fc;
    box-shadow: 0 0 18px -6px rgba(34, 211, 238, 0.5);
}

/* Wallet value chips — legacy MyWalletView rose/indigo active */
#wallet-chip-row,
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.chip.wallet-value-chip {
    padding: 0.45rem 1rem;
    font-size: 0.84rem;
    letter-spacing: 0.01em;
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.28);
    color: #cbd5e1;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.chip.wallet-value-chip:hover {
    color: #f1f5f9;
    border-color: rgba(244, 63, 94, 0.45);
    background: rgba(244, 63, 94, 0.08);
}
.chip.wallet-value-chip[data-active="true"] {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.22), rgba(99, 102, 241, 0.22));
    border-color: rgba(244, 63, 94, 0.65);
    color: #fecdd3;
    box-shadow: 0 0 22px -8px rgba(244, 63, 94, 0.55),
                0 0 18px -10px rgba(99, 102, 241, 0.45);
}
.chip.wallet-value-chip .wallet-chip-count {
    opacity: 0.65;
    font-weight: 600;
    font-size: 0.78em;
}
.chip.wallet-value-chip[data-active="true"] .wallet-chip-count {
    opacity: 0.9;
}

/* Generic value chips (accounts etc.) */
button.chip-val {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
}
button.chip-val:hover {
    border-color: rgba(34, 211, 238, 0.5);
    color: #a5f3fc;
    background: rgba(34, 211, 238, 0.1);
}
button.chip-val.active {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(34, 211, 238, 0.15));
    border-color: rgba(52, 211, 153, 0.5);
    color: #6ee7b7;
    box-shadow: 0 0 16px -6px rgba(52, 211, 153, 0.5);
}

/* ----- Badges ----- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid currentColor;
}

/* ----- Dividers ----- */
.hr-soft {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
    border: 0;
}

/* ----- Toggle switch ----- */
.toggle {
    position: relative;
    display: inline-flex;
    height: 2.25rem;
    width: 4rem;
    align-items: center;
    border-radius: 999px;
    transition: background 0.25s ease;
    cursor: pointer;
    border: 1px solid var(--border-strong);
}
.toggle[data-on="true"] {
    background: linear-gradient(135deg, #34d399, #10b981);
    border-color: transparent;
    box-shadow: 0 0 18px -6px rgba(52, 211, 153, 0.7);
}
.toggle[data-on="false"] { background: rgba(148, 163, 184, 0.12); }
.toggle .toggle-knob {
    display: inline-block;
    height: 1.75rem;
    width: 1.75rem;
    transform: translateX(0.15rem);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.toggle[data-on="true"] .toggle-knob { transform: translateX(2rem); }

/* ----- Animations ----- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(34, 211, 238, 0); }
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animate-fade-up { animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.animate-fade-in { animation: fadeIn 0.4s ease both; }
.animate-floaty { animation: floaty 5s ease-in-out infinite; }
.animate-pulse-glow { animation: pulseGlow 2s ease-out infinite; }

/* Stagger helper for grids */
.stagger > * { animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(7) { animation-delay: 0.26s; }
.stagger > *:nth-child(8) { animation-delay: 0.30s; }
.stagger > *:nth-child(9) { animation-delay: 0.34s; }
.stagger > *:nth-child(10) { animation-delay: 0.38s; }
.stagger > *:nth-child(n+11) { animation-delay: 0.42s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto !important; }
}

/* Accessibility skip link: visually hidden until keyboard focus.
   body/app-bg/a specificity keeps it above the shell stacking rule, and
   clip-path (not transform) keeps it invisible even if position is ever
   overridden again. width/height 1px + fixed => no layout shift, no overflow. */
body.app-bg > a.skip-link {
  position: fixed;
  z-index: 10000;
  left: 0.75rem;
  top: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  color: #04111a;
  background: #67e8f9;
  font-weight: 800;
  text-decoration: none;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body.app-bg > a.skip-link:focus {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  outline: 3px solid #04111a;
  outline-offset: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #67e8f9;
  outline-offset: 3px;
}
.action-feedback {
  position: fixed;
  z-index: 1200;
  inset: auto 1rem 1rem auto;
  width: min(34rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-color: rgba(248, 113, 113, 0.62);
}
.action-feedback p { margin: 0.35rem 0; }
.action-feedback pre { max-height: 8rem; overflow: auto; }

/* ----- Utility: gradient ring for active nav ----- */
.nav-tab {
    position: relative;
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-faint);
    transition: color 0.25s ease;
    white-space: nowrap;
}
.nav-tab:hover { color: var(--text); }
.nav-tab[data-active="true"] { color: #a5f3fc; }
.nav-tab[data-active="true"]::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    transform: translateX(-50%);
    width: 70%;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #22d3ee, #6366f1);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.8);
}

/* ----- Official CVS coupon card (white, branded) ----- */
.coupon-card {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 4px 24px -10px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.35s ease,
                border-color 0.35s ease;
    display: flex;
    flex-direction: column;
}
.coupon-card:hover {
    transform: translateY(-4px);
    border-color: rgba(204, 0, 0, 0.35);
    box-shadow: 0 22px 50px -18px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(204, 0, 0, 0.18),
                0 0 32px -10px rgba(204, 0, 0, 0.25);
}
.coupon-card-header {
    background: linear-gradient(135deg, #d10000 0%, #cc0000 50%, #b80000 100%);
    color: #fff;
    padding: 0.875rem 1.125rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}
.coupon-card-header::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 50%;
    background: radial-gradient(ellipse at 100% 50%, rgba(255, 255, 255, 0.12), transparent 70%);
    pointer-events: none;
}
.coupon-card-brand {
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    line-height: 1;
}
.coupon-card-brand-sub {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-top: 0.2rem;
}
.coupon-card-value-block { text-align: right; line-height: 1; flex-shrink: 0; position: relative; z-index: 1; }
.coupon-card-value-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.8;
}
.coupon-card-value {
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin-top: 0.1rem;
}
.coupon-card-reg {
    font-size: 0.65em;
    font-weight: 700;
    opacity: 0.7;
}

/* Perforated tear-line between body and footer */
.coupon-perf {
    border: 0;
    border-top: 2px dashed rgba(15, 23, 42, 0.13);
    margin: 0;
    position: relative;
}
.coupon-perf::before,
.coupon-perf::after {
    content: "";
    position: absolute;
    top: -7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cvs-bg);
}
.coupon-perf::before { left: -7px; }
.coupon-perf::after { right: -7px; }

/* Legacy CouponCard body / rows / actions */
.coupon-card-body {
    padding: 1.25rem 1.25rem 1.1rem;
    color: #0f172a;
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.coupon-card-pills {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.coupon-card-pills-left {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}
.coupon-card-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
    letter-spacing: -0.02em;
}
.coupon-card-reason {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    font-style: italic;
    color: #64748b;
    border-left: 2px solid #e2e8f0;
    padding-left: 0.75rem;
    line-height: 1.45;
}
.coupon-card-rows {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
}
.coupon-card-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    color: #475569;
}
.coupon-row-icon {
    width: 1rem;
    height: 1rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
    color: #94a3b8;
}
.coupon-card-row-text {
    font-weight: 500;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.coupon-exp-amber {
    color: #d97706;
    font-weight: 800;
}
.coupon-card-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(248, 250, 252, 0.85);
}
.coupon-copy-btn,
.coupon-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.875rem;
    font-family: inherit;
    padding: 0.65rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.coupon-copy-btn {
    background: #fff;
    color: #334155;
    border-color: #e2e8f0;
}
.coupon-copy-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.coupon-copy-btn.is-copied {
    color: #047857;
}
.coupon-copy-btn:disabled,
.coupon-act-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.coupon-act-red {
    color: #fff;
    background: linear-gradient(135deg, #d10000, #b80000);
    box-shadow: 0 6px 18px -8px rgba(204, 0, 0, 0.65);
    border: none;
}
.coupon-act-red:hover:not(:disabled) {
    filter: brightness(1.05);
}
.coupon-act-activated {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
    cursor: default;
}
.coupon-act-ghost {
  background: transparent;
  color: var(--muted, #6b7280);
  border: 1px solid rgba(107, 114, 128, 0.35);
}
.coupon-act-ghost:hover:not(:disabled) {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text, #111);
}
.coupon-act-disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}
.coupon-btn-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.coupon-pill-type-birthday {
    background: #fdf2f8;
    color: #be185d;
    border-color: #fbcfe8;
}
.coupon-pill-type-purchase {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}
.coupon-pill-type-product {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* Status pill on white card — subtle, professional */
.coupon-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1.2;
}

/* ----- Refined range slider ----- */
input[type="range"].range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.6), rgba(99, 102, 241, 0.6));
    outline: none;
    cursor: pointer;
}
input[type="range"].range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #22d3ee;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(34, 211, 238, 0.18);
    cursor: pointer;
    transition: transform 0.15s ease;
}
input[type="range"].range::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"].range::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; border: 3px solid #22d3ee; cursor: pointer;
}


/* ===== Automation Station layout (app shell) ===== */
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.app-shell { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 3.5rem; }
.shell-header { margin-bottom: 1.25rem; }
.shell-brand { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.shell-brand-left { display: flex; align-items: center; gap: 0.9rem; }
.shell-logo {
  width: 3rem; height: 3rem; border-radius: 1rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #04111a; font-size: 1.25rem;
  background: linear-gradient(135deg, #67e8f9, #2dd4bf 45%, #818cf8);
  box-shadow: 0 12px 36px -12px rgba(34, 211, 238, 0.55);
}
.shell-title { margin: 0; font-size: clamp(1.45rem, 3vw, 2.1rem); font-weight: 900; letter-spacing: -0.03em; }
.shell-sub { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.shell-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-top: 1.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  /* No overflow scrollbar that can look like a native menu/pulldown */
  overflow: visible;
}
.shell-nav button.nav-tab {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
/* Legacy second mobile nav removed from markup; keep CSS fail-closed */
.mobile-nav {
  display: none !important;
}

.resource-alerts {
  position: fixed;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: min(22rem, calc(100vw - 1.3rem));
  pointer-events: none;
}
.resource-alert {
  pointer-events: auto;
  padding: 0.55rem 0.75rem;
  border-radius: 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}
.resource-alert.err {
  border-color: rgba(244, 63, 94, 0.55);
  color: #fecdd3;
}
.resource-alert strong { display: block; margin-bottom: 0.15rem; }

.health-strip {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.65rem 0.9rem; margin-bottom: 1rem;
}
.health-stat {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
  padding: 0.25rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(7,12,24,.35);
}
.health-stat strong { color: var(--text); font-weight: 800; }
.health-stat.ok strong { color: var(--success); }
.health-stat.warn strong { color: var(--warning); }
.health-stat.err strong { color: var(--danger); }
.health-stat.info strong { color: var(--accent); }

/* Workbench panels: class + [hidden] dual-hide (JS sets both). [hidden] wins. */
.view { display: none !important; }
.view.active:not([hidden]) { display: block !important; }
[data-view-panel][hidden] { display: none !important; }

.page-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.page-title-row h2 {
  margin: 0; font-size: 1.35rem; font-weight: 800;
}
.icon-tile {
  width: 2.75rem; height: 2.75rem; border-radius: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(34,211,238,.25), rgba(99,102,241,.25));
  border: 1px solid rgba(34,211,238,.35);
  font-size: 1.15rem; margin-right: 0.65rem; flex-shrink: 0;
}
.title-with-icon { display: flex; align-items: center; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.75rem 0.9rem; margin-bottom: 0.85rem;
}
.toolbar .btn { margin: 0; }
.filter-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  margin-bottom: 0.85rem;
}
.filter-row .chip { margin: 0; font-family: inherit; }

.coupon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.15rem;
}
/* Keep legacy btn aliases for any remaining callers */
.btn-cvs-red {
  color: #fff !important;
  background: linear-gradient(135deg, #d10000, #b80000) !important;
  border: none !important;
  box-shadow: 0 6px 18px -8px rgba(204,0,0,.65);
}
.btn-copy-white {
  background: #fff !important; color: #0f172a !important;
  border: 1px solid rgba(15,23,42,.12) !important;
}
.coupon-pill-ready { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.coupon-pill-on_card { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.coupon-pill-skipped, .coupon-pill-skipped_percent { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.coupon-pill-pending { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.coupon-pill-failed { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.coupon-pill-used, .coupon-pill-unknown { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.coupon-pill .dot {
  width: 0.45rem; height: 0.45rem; border-radius: 999px; background: currentColor;
  display: inline-block;
}
.coupon-pill .dot.pulse,
.coupon-pill-ready .dot { animation: pulseGlow 2s ease-out infinite; }

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.account-card-row {
  padding: 0.95rem 1rem;
}
.account-card-row h3 {
  margin: 0 0 0.35rem; font-size: 0.95rem; font-weight: 800; word-break: break-all;
}
.account-meta { font-size: 0.8rem; color: var(--text-muted); margin: 0.2rem 0; }
.account-meta code { color: var(--accent); font-size: 0.78rem; }
.account-coupon-chips {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem;
}
.account-coupon-chips button.chip-val {
  border: 1px solid var(--border);
  background: rgba(7,12,24,.45);
  color: var(--text);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.account-coupon-chips button.chip-val:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.account-coupon-chips button.chip-val.active {
  background: rgba(52,211,153,.18);
  border-color: rgba(52,211,153,.45);
  color: #6ee7b7;
}
.account-add-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  margin-top: 0.5rem;
}
.account-add-row input {
  flex: 1 1 5.5rem; min-width: 5rem;
  font-size: 0.78rem; padding: 0.35rem 0.5rem;
}
.account-add-row .btn { font-size: 0.72rem; padding: 0.35rem 0.65rem; }
.account-coupon-list {
  margin: 0.55rem 0 0; padding: 0; list-style: none;
  max-height: 7.5rem; overflow: auto;
}
.account-coupon-list li {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-size: 0.75rem; padding: 0.25rem 0;
  border-top: 1px solid rgba(148,163,184,.12);
  color: var(--text-muted);
}
.account-coupon-list li strong { color: var(--text); font-weight: 700; }

/* Manual coupon workbench — search-first (large account libraries) */
.mc-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow: auto;
}
.mc-pick-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(7, 12, 24, 0.45);
  color: var(--text);
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font: inherit;
}
.mc-pick-row:hover {
  border-color: rgba(96, 165, 250, 0.45);
}
.mc-pick-row.active {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.1);
}
.mc-pick-row strong {
  font-size: 0.85rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc-pick-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc-pick-ec {
  font-size: 0.72rem;
  color: var(--accent);
  justify-self: end;
}
.mc-selected .account-add-row {
  max-width: 28rem;
}
@media (max-width: 640px) {
  .mc-pick-row {
    grid-template-columns: 1fr;
  }
  .mc-pick-ec {
    justify-self: start;
  }
}
.account-coupon-list button.rm {
  border: 0; background: transparent; color: #f87171;
  cursor: pointer; font-size: 0.7rem; font-weight: 700;
}
.mode-pill {
  display: inline-flex; font-size: 0.65rem; font-weight: 800;
  padding: 0.15rem 0.5rem; border-radius: 999px; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mode-pill.live { background: rgba(52,211,153,.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,.35); }
.mode-pill.stub, .mode-pill.protected {
  background: rgba(251,191,36,.12); color: #fcd34d; border: 1px solid rgba(251,191,36,.3);
}

.wallet-hero {
  padding: 1.25rem 1.35rem; margin-bottom: 1rem;
  background:
    radial-gradient(40rem 20rem at 0% 0%, rgba(34,211,238,.18), transparent 55%),
    radial-gradient(30rem 16rem at 100% 0%, rgba(99,102,241,.16), transparent 50%),
    var(--surface-strong);
}
.wallet-hero .hero-num {
  font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 900; margin: 0.25rem 0;
}
.wallet-stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.75rem; }
.wallet-stat {
  padding: 0.55rem 0.85rem; border-radius: 12px;
  background: rgba(7,12,24,.4); border: 1px solid var(--border);
  min-width: 6.5rem;
}
.wallet-stat .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); font-weight: 700; }
.wallet-stat .val { font-size: 1.2rem; font-weight: 800; margin-top: 0.15rem; }

/* Sort controls (CEP FilterControls parity) */
.filter-sort-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-left: 0.35rem;
}
.filter-sort-select {
  width: auto;
  min-width: 10.5rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
  margin: 0;
}

/* ----- Official CVS My Wallet cards — mobile: one card ≈ phone screen height ----- */
.wallet-main-panel {
  max-width: 100%;
  overflow-x: hidden;
}
.wallet-cvs-grid {
  display: grid;
  grid-template-columns: 1fr;
  /* Large gap so the next card is off-screen while viewing one full-height coupon */
  gap: 3.5rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding: 0 0 4rem;
  box-sizing: border-box;
  scroll-snap-type: y proximity;
}
@media (max-width: 719px) {
  .wallet-cvs-grid {
    gap: max(3.5rem, 12vh);
    scroll-snap-type: y mandatory;
    /* Breathing room below each “page” of coupon */
    padding-bottom: max(4rem, 10vh);
  }
}
@media (min-width: 720px) {
  .wallet-cvs-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 1.75rem 1.75rem;
    scroll-snap-type: none;
    padding-bottom: 1rem;
  }
}
.wallet-cvs-card {
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  max-width: min(100%, 420px);
  width: 100%;
  margin: 0 auto;
  color: #0f172a;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  /* One coupon fills the phone viewport; gap keeps neighbors out of view */
  min-height: calc(100dvh - 5.5rem);
  min-height: calc(100svh - 5.5rem);
  scroll-margin-top: 0.75rem;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
@media (min-width: 720px) {
  .wallet-cvs-card {
    min-height: 0;
    scroll-snap-align: none;
  }
}
.wallet-cvs-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.wallet-cvs-stack {
  flex: 1 1 auto;
}
.wallet-cvs-foot {
  flex: 0 0 auto;
  margin-top: auto;
}
/* Full-screen privacy blank (Contabo web My Wallet) */
.wallet-privacy-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #374151;
  font-weight: 800;
  font-size: 1.25rem;
  cursor: pointer;
  text-align: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.wallet-privacy-overlay.hidden { display: none !important; }
.wallet-privacy-overlay-hint {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.7;
  margin-top: 0.5rem;
}
@media (prefers-color-scheme: dark) {
  .wallet-privacy-overlay {
    background: #111827;
    color: #f9fafb;
  }
}
.wallet-cvs-header {
  background: #cc0000;
  color: #fff;
  padding: 0.875rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  box-sizing: border-box;
}
.wallet-cvs-body,
.wallet-cvs-foot {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}
.wallet-cvs-brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -1px;
  line-height: 1;
}
.wallet-cvs-value-block { text-align: right; line-height: 1; flex-shrink: 0; }
.wallet-cvs-value-label {
  font-size: 0.6rem;
  opacity: 0.85;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.wallet-cvs-value {
  font-size: 1.4rem;
  font-weight: 800;
  margin-top: 0.1rem;
}
.wallet-cvs-body {
  padding: 1rem 1.5rem 1.25rem;
}
.wallet-cvs-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.wallet-cvs-field-label {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}
.wallet-cvs-field-value {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
  word-break: break-word;
}
.wallet-cvs-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.wallet-cvs-name {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  color: #0f172a;
}
.wallet-cvs-merged-badge {
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}
.wallet-cvs-ec {
  color: #cc0000;
  font-weight: 700;
  font-size: 1.1rem;
  word-break: break-all;
}
.wallet-cvs-row2 {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .wallet-cvs-row2 {
    flex-direction: row;
    justify-content: space-between;
    gap: 1rem;
  }
  .wallet-cvs-field-right { text-align: right; }
}
.wallet-cvs-extra {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  max-width: 8.5rem;
}
@media (min-width: 640px) {
  .wallet-cvs-extra { align-items: flex-end; }
}
.wallet-cvs-extra .wallet-cvs-field-label {
  line-height: 1.2;
}
.wallet-cvs-extra-action {
  color: #cc0000;
  text-decoration: underline;
  font-weight: 800;
}
.wallet-cvs-extra:hover .wallet-cvs-extra-action {
  color: #991b1b;
}
.wallet-cvs-email {
  font-size: 0.85rem;
  color: #1f2937;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-all;
}
.wallet-cvs-expires {
  text-align: center;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
  border-top: 1px solid #f8fafc;
  margin-top: 0.25rem;
}
.wallet-cvs-expires-label {
  letter-spacing: 0.12em;
  font-size: 0.625rem;
}
.wallet-cvs-expiry-val {
  color: #f59e0b;
  font-weight: 800;
  font-size: 1.125rem;
}
.wallet-cvs-guide {
  background: rgba(254, 242, 242, 0.6);
  border: 1px solid rgba(254, 226, 226, 0.5);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.wallet-cvs-guide-main { flex: 1; min-width: 0; }
.wallet-cvs-guide-title {
  color: #cc0000;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.wallet-cvs-guide-list {
  margin: 0;
  padding-left: 0;
  list-style: decimal inside;
  color: rgba(127, 29, 29, 0.8);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.6;
}
.wallet-cvs-share-btn {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  font-size: 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: background 0.15s ease, transform 0.1s ease;
}
.wallet-cvs-share-btn:hover {
  background: #fef2f2;
}
.wallet-cvs-share-btn:active {
  transform: scale(0.96);
}
/* Setup “where to put data” tables (Settings) */
.setup-where {
  text-align: left;
}
.setup-where-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.5rem;
  color: var(--text, #e8eef9);
}
.setup-where-table th,
.setup-where-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 0.55rem 0.45rem;
  vertical-align: top;
  text-align: left;
  line-height: 1.45;
}
.setup-where-table th {
  color: var(--muted, #94a3b8);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.setup-where-table code {
  font-size: 0.78em;
  word-break: break-all;
}
.setup-where-table tr:last-child td {
  border-bottom: 0;
}

.wallet-cvs-foot {
  border-top: 1px dashed #e2e8f0;
  background: #fff;
  padding: 1.25rem 1.5rem 1.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Outer box — barcode stays fully inside; EC digits sit below, never overlapping */
.wallet-cvs-barcode-btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.85rem 1rem 0.65rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.wallet-cvs-barcode-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.3);
}
/* Inner frame: clips PDF417 so it cannot spill past the box edge */
.wallet-cvs-barcode-frame {
  width: 100%;
  max-width: 320px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 10px 12px;
  background: #fff;
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.wallet-cvs-barcode {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 88px;
  object-fit: contain;
  object-position: center;
  image-rendering: crisp-edges;
  /* no mix-blend — kept solid white so bars stay sharp and boxed */
}
.wallet-cvs-barcode-hint {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  text-align: center;
  line-height: 1.3;
}
@media (min-width: 640px) {
  .wallet-cvs-barcode-hint { display: none; }
}
.wallet-cvs-no-barcode {
  width: 100%;
  min-height: 6rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.625rem;
  color: #94a3b8;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.2em;
  font-weight: 700;
  text-align: center;
  padding: 1rem;
}
.wallet-cvs-ec-mono {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.2em;
  font-weight: 500;
  text-align: center;
  word-break: break-all;
  margin: 0 0 0.35rem;
  padding: 0 0.25rem;
  line-height: 1.35;
  max-width: 100%;
}
.wallet-cvs-mark-used {
  width: 100%;
  margin-top: 1.5rem;
  background: #fef2f2 !important;
  color: #cc0000 !important;
  font-weight: 800 !important;
  border: 1px solid #fee2e2 !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem 1rem !important;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease;
}
.wallet-cvs-mark-used:hover {
  background: #fee2e2 !important;
}
.wallet-cvs-mark-used:active {
  transform: scale(0.98);
}

/* Legacy BarcodeScanOverlay (lite) */
.barcode-scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.barcode-scan-overlay.hidden { display: none !important; }
.barcode-scan-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  color: #334155;
}
.barcode-scan-stage {
  width: min(100%, 28rem);
  text-align: center;
}
.barcode-scan-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  image-rendering: crisp-edges;
  mix-blend-mode: multiply;
}
.barcode-scan-ec {
  margin-top: 1rem;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.2em;
  color: #64748b;
  font-size: 0.9rem;
  word-break: break-all;
}

.settings-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
}
.settings-grid > *,
.form-grid > * { min-width: 0; }
@media (min-width: 900px) {
  .settings-grid.two { grid-template-columns: 1fr 1fr; }
}
.settings-directory {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0.6rem;
}
.settings-directory a {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}
.settings-directory a:hover,
.settings-directory a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
#first-hour-checklist { margin-bottom: 1rem; }
.settings-section { padding: 1.1rem 1.2rem; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.settings-section h3 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.settings-section.is-organized {
  align-self: start;
  width: 100%;
  padding: 0;
  /* Visible so ? popovers (e.g. Download backup) are not clipped by the card */
  overflow: visible;
}
.settings-section.is-collapsed {
  overflow: hidden;
}
.settings-section-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.settings-section-toggle:hover,
.settings-section-toggle:focus-visible {
  background: rgba(34, 211, 238, 0.07);
  outline: none;
}
.settings-section-toggle-copy {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}
.settings-section-toggle-eyebrow {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.settings-section-toggle-title {
  font-size: 0.98rem;
  font-weight: 800;
}
.settings-section-toggle-marker {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 1.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1;
}
.settings-section-toggle-marker::before { content: "−"; }
.settings-section.is-collapsed .settings-section-toggle {
  border-bottom-color: transparent;
}
.settings-section.is-collapsed .settings-section-toggle-marker::before { content: "+"; }
.settings-section.is-collapsed > .settings-section-body { display: none; }
.settings-section-body {
  padding: 1rem 1.1rem 1.1rem;
  overflow: visible;
}
.settings-section-body > :first-child { margin-top: 0; }
.settings-section-body > :last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .settings-directory {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .settings-directory a { white-space: nowrap; }
  .settings-section-toggle,
  .settings-section-body { padding-left: 0.85rem; padding-right: 0.85rem; }
}
/* Brief highlight when jumping from auto-unsub help → Data · import */
.settings-section-flash {
  outline: 2px solid rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
  transition: outline 0.2s ease, box-shadow 0.2s ease;
}
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-grid .full { grid-column: 1 / -1; }
label.field-label {
  display: block; font-size: 0.8rem; color: var(--text-muted);
  margin: 0 0 0.3rem; font-weight: 600;
}
/* Label row + tiny ? help (New Accounts and other dense forms) */
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0 0 0.3rem;
}
.field-head > .field-label,
.field-head > h2,
.field-head > h3,
.field-head > h4,
.field-head > .section-eyebrow {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.field-help {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  margin: 0;
  z-index: 1;
}
/* Lift whole panel when a ? is open so popovers paint above later sections
   (e.g. Account settings proxy help over “Manual coupon on card”). */
.settings-section:has(.field-help[open]),
.glass-panel:has(.field-help[open]) {
  position: relative;
  z-index: 40;
}
.field-help[open] {
  z-index: 50;
}
.field-help > summary {
  list-style: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(34, 211, 238, 0.1);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  user-select: none;
}
.field-help > summary::-webkit-details-marker { display: none; }
.field-help > summary::marker { content: ""; }
.field-help[open] > summary {
  background: rgba(34, 211, 238, 0.22);
  border-color: rgba(34, 211, 238, 0.45);
}
.advanced-settings {
  margin-top: 0.85rem;
  padding: 0.55rem 0.7rem 0.7rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(7, 12, 24, 0.28);
}
.advanced-settings > summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--text-muted);
  list-style: none;
}
.advanced-settings > summary::-webkit-details-marker { display: none; }
.advanced-settings > summary::marker { content: ""; }
.advanced-settings > summary::before {
  content: "▸ ";
  color: var(--accent);
}
.advanced-settings[open] > summary::before { content: "▾ "; }
.advanced-settings .form-grid { margin-top: 0.65rem; }
#first-hour-checklist {
  margin-bottom: 1rem;
}
#first-hour-checklist ol {
  margin: 0.55rem 0 0 1.15rem;
  padding: 0;
  line-height: 1.5;
}
#gmail-setup-guide,
#gmail-skip-filters-guide,
#catchall-domain-guide {
  margin: 0.75rem 0 0.25rem;
}
#gmail-setup-guide ol,
#gmail-skip-filters-guide ol,
#catchall-domain-guide ol {
  margin: 0.45rem 0 0 1.15rem;
  padding: 0;
  line-height: 1.5;
}
.field-help .help-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 60;
  width: min(19rem, 78vw);
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(8, 14, 28, 0.97);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  font-weight: 400;
  text-align: left;
}
/* Bottom-of-panel / action rows: open upward so the card shell does not clip them */
.field-help.help-above .help-popover,
.form-grid > .full .field-help .help-popover,
.form-actions .field-help .help-popover,
.action-with-help .field-help .help-popover {
  top: auto;
  bottom: calc(100% + 0.4rem);
}
.field-help.help-below .help-popover {
  top: calc(100% + 0.4rem);
  bottom: auto;
}
.field-help.help-start .help-popover {
  right: auto;
  left: 0;
}
#gmail-skip-filters-download + .field-help .help-popover,
#ag-domain-help .help-popover {
  width: min(24rem, 86vw);
}
.field-help .help-popover a {
  color: var(--accent);
}
.field-help .help-popover strong {
  color: var(--text);
  font-weight: 650;
}
.check-row-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
}
.check-row-wrap > .check-row {
  flex: 1;
  margin: 0.15rem 0;
  min-width: 0;
}
.check-row-wrap > .field-help {
  margin-top: 0.2rem;
}
label.check-row {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text); margin: 0.5rem 0; cursor: pointer; font-size: 0.9rem;
}
label.check-row input { width: auto; accent-color: var(--accent); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; align-items: center; }
.form-actions .btn { margin: 0; }
/* Keep each action + its ? on one chip so help never wraps onto its own line */
.action-with-help {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  max-width: 100%;
}
.action-with-help > .btn {
  flex: 0 1 auto;
}
.action-with-help > .field-help {
  flex: 0 0 auto;
}
#data-import-actions {
  gap: 0.65rem 0.85rem;
}
.hint { font-size: 0.78rem; color: var(--text-faint); margin: 0.25rem 0 0; line-height: 1.4; }

/* Job log (wallet) — collapsed by default; diagnostic only */
.job-log-panel { margin-top: 0.25rem; }
.job-log-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  text-align: left;
}
.job-log-toggle:hover .job-log-toggle-title { color: #a5f3fc; }
.job-log-toggle-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}
.job-log-toggle-hint { font-size: 0.78rem; }
.job-log-chevron {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: rgba(7, 12, 24, 0.45);
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.job-log-panel[data-expanded="true"] .job-log-chevron {
  transform: rotate(90deg);
  color: #a5f3fc;
  border-color: rgba(34, 211, 238, 0.4);
}
.job-log-body {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}
.job-log-body.hidden,
.job-log-body[hidden] {
  display: none !important;
}

.job-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.job-table th, .job-table td {
  text-align: left; padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border);
}
.job-table th { color: var(--text-faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; }
.empty-state {
  padding: 2rem 1.25rem; text-align: center; color: var(--text-muted);
}
.empty-state strong { color: var(--text); display: block; margin-bottom: 0.35rem; }

/* Toast / banner */
#toast-host {
  position: fixed; top: 1rem; right: 1rem; z-index: 1000;
  display: flex; flex-direction: column; gap: 0.5rem;
  max-width: min(26rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lift);
  font-size: 0.88rem; white-space: pre-wrap;
  animation: fadeUp 0.35s ease both;
}
.toast.ok { border-color: rgba(52,211,153,.4); color: #a7f3d0; }
.toast.err { border-color: rgba(244,63,94,.45); color: #fecdd3; }
.toast.info { border-color: rgba(34,211,238,.4); color: #a5f3fc; }

.btn-danger {
  color: #fff;
  background: #b91c1c;
  border-color: #f87171;
}
.btn-danger:hover { background: #991b1b; }

.support-preview,
.privacy-inventory,
.analytics-funnel {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.85rem;
}
.support-preview > :first-child { margin-top: 0; }
.support-preview li { margin: 0.3rem 0; color: var(--text-muted); }
.privacy-row {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(7, 12, 24, 0.35);
}
.privacy-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}
.privacy-row p { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.82rem; }
.privacy-history-box,
.privacy-danger-zone {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.privacy-history-box label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.25rem 0.9rem 0.55rem 0;
}
.privacy-history-box .btn { display: block; margin-top: 0.45rem; }
.privacy-danger-zone {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(127, 29, 29, 0.12);
}
.privacy-danger-zone h4 { margin: 0; }
.analytics-funnel {
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}
.analytics-step {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-sunken);
}
.analytics-step strong,
.analytics-step span,
.analytics-step small { display: block; }
.analytics-step strong { font-size: 1.35rem; }
.analytics-step span { text-transform: capitalize; font-weight: 700; }
.analytics-step small { color: var(--text-muted); margin-top: 0.2rem; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
}
.auth-card {
  width: 100%;
  max-width: 22rem;
  padding: 1.5rem 1.35rem 1.55rem;
}
.auth-card h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.auth-card .form-actions {
  margin-top: 0.25rem;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; word-break: break-all; }
.pill {
  display: inline-block; font-size: 0.72rem; padding: 0.12rem 0.5rem;
  border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted);
}
.pill.ok { color: var(--success); border-color: rgba(52,211,153,.4); }
.token-box {
  background: rgba(34,211,238,.08);
  border: 1px dashed var(--border-strong);
  border-radius: 12px; padding: 0.65rem 0.8rem; margin-top: 0.5rem;
}
.caps { display: flex; flex-wrap: wrap; gap: 0.55rem 0.9rem; margin-top: 0.35rem; }
.caps label { display: flex; align-items: center; gap: 0.35rem; margin: 0; color: var(--text); font-size: 0.85rem; }
.caps input { width: auto; }
.sunken-pad { padding: 0.85rem 0.95rem; }

@media (max-width: 768px) {
  .shell-title { font-size: 1.35rem; }
  .shell-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 0.2rem;
  }
  .shell-nav button.nav-tab {
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    scroll-snap-align: start;
  }
  .health-strip { align-items: stretch; }
  .health-stat { flex: 1 1 8rem; }
  .action-feedback { inset: auto 0.65rem 0.65rem; width: auto; }
  .form-actions .btn { min-height: 2.75rem; }
  .privacy-row > div { align-items: flex-start; }
}

@media (max-width: 640px) {
  .job-table,
  .diag-jobs table { display: block; }
  .job-table thead,
  .diag-jobs thead { display: none; }
  .job-table tbody,
  .diag-jobs tbody,
  .job-table tr,
  .diag-jobs tr { display: block; }
  .job-table tr,
  .diag-jobs tr {
    margin: 0.65rem 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-sunken);
  }
  .job-table td,
  .diag-jobs td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 42%) 1fr;
    gap: 0.55rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    overflow-wrap: anywhere;
  }
  .job-table td::before,
  .diag-jobs td::before {
    color: var(--text-faint);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .job-table td:nth-child(1)::before { content: "Type"; }
  .job-table td:nth-child(2)::before { content: "Status"; }
  .job-table td:nth-child(3)::before { content: "Result"; }
  .job-table td:nth-child(4)::before { content: "Started"; }
  .diag-jobs td:nth-child(1)::before { content: "Time"; }
  .diag-jobs td:nth-child(2)::before { content: "Type"; }
  .diag-jobs td:nth-child(3)::before { content: "Status"; }
  .diag-jobs td:nth-child(4)::before { content: "Outcome"; }
  .diag-jobs td:nth-child(5)::before { content: "Details"; }
}

/* Setup wizard leftovers */
.wizard-steps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }
.wizard-steps span {
  font-size: 0.75rem; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.65rem;
}
.wizard-steps span.on {
  color: #04111a; border-color: transparent;
  background: linear-gradient(135deg, #67e8f9, #2dd4bf);
}
.help-block {
  position: relative; margin: 0.85rem 0 0.35rem; padding: 0.65rem 0.75rem 0.75rem;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(7,12,24,.35);
}
.help-block-head { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.45rem; }
.help-block-title { font-size: 0.92rem; font-weight: 700; margin: 0; }
.help-block-sub { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.45rem; }
.help-icon {
  width: 1.35rem; height: 1.35rem; border-radius: 999px; border: 1px solid var(--border);
  background: rgba(34,211,238,.12); color: var(--accent); font-weight: 700; cursor: help;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem;
  padding: 0; margin: 0;
}
.help-panel {
  margin: 0 0 0.65rem; padding: 0.6rem 0.7rem; border-radius: 10px;
  border: 1px solid rgba(34,211,238,.3); background: rgba(34,211,238,.08);
  color: var(--text-muted); font-size: 0.84rem;
}
.lead { color: var(--text-muted); margin: 0.25rem 0 0.75rem; font-size: 0.9rem; }
a.btn { text-decoration: none; }
pre.raw-json {
  margin: 0.5rem 0 0; padding: 0.75rem; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(7,12,24,.55);
  overflow: auto; max-height: 14rem; font-size: 0.75rem; color: var(--text-muted);
}

/* --- Discord import dialog (Settings) --- */
.as-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(520px, 96vw);
  width: 100%;
  color: inherit;
  /* Beat .app-bg > * so the modal stays centered instead of scrolling with Settings. */
  position: fixed;
  inset: 0;
  height: fit-content;
  max-height: min(92vh, 900px);
  margin: auto;
  overflow: auto;
}
.app-bg > dialog.as-dialog {
  position: fixed;
  z-index: auto;
}
.as-dialog::backdrop {
  background: rgba(8, 12, 24, 0.82);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.as-dialog .glass-panel {
  background: #141c33;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.as-dialog-panel {
  margin: 0;
  padding: 1.15rem 1.25rem 1.25rem;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.as-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.discord-drop {
  border: 1.5px dashed rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.35);
  transition: border-color 0.15s, background 0.15s;
}
.discord-drop:hover,
.discord-drop:focus-visible {
  border-color: rgba(99, 102, 241, 0.8);
  outline: none;
}
.discord-drop.dragover {
  border-color: rgba(52, 211, 153, 0.9);
  background: rgba(16, 185, 129, 0.08);
}

.vine-entry {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  opacity: 0.72;
}
.vine-entry .btn {
  font-size: 0.82rem;
  padding: 0.28rem 0.7rem;
  color: var(--text-muted);
}
.vine-dialog {
  max-width: min(920px, 96vw);
}
.vine-dialog-panel {
  max-height: min(88vh, 860px);
  overflow: auto;
  scrollbar-gutter: stable;
}
.vine-settings {
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-sunken);
}
.vine-settings > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}
.vine-speed-bar {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem 0.85rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.vine-speed-bar .field-label {
  margin: 0;
}
.vine-speed-bar input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
#vine_speed_caption {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .vine-speed-bar {
    grid-template-columns: 1fr;
  }
}
.vine-queue-toolbar {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.vine-show-skipped {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.vine-product-list {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.5rem;
}
.vine-product-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.vine-product-row--skipped,
.vine-product-row--blacklisted {
  opacity: 0.62;
}
.vine-product-row--blacklisted {
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
}
.vine-product-row h4 {
  margin: 0;
  font-size: 0.92rem;
}
.vine-product-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.vine-skip-badge {
  display: inline-block;
  margin-top: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warning);
}
.vine-skip-badge--asin {
  color: #fca5a5;
}
@media (max-width: 640px) {
  .vine-product-row {
    grid-template-columns: 1fr;
  }
}

.diag-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0;
}
.diag-kpi {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.diag-kpi strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
}
.diag-kpi span {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.diag-signals {
  display: grid;
  gap: 0.5rem;
}
.diag-signal {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  font-size: 0.85rem;
}
.diag-jobs {
  overflow-x: auto;
}
.diag-jobs table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.diag-jobs th,
.diag-jobs td {
  text-align: left;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--border);
}
.diag-jobs button.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.diag-timeline {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
}
.diag-timeline li {
  margin: 0.35rem 0;
  font-size: 0.85rem;
}
.diag-timeline .muted {
  color: var(--text-muted);
  font-size: 0.75rem;
}
