/*
 * Catch Alerts optional Modern layout
 * -----------------------------------
 * Every application-facing rule is gated by html[data-ca-layout="modern"].
 * With that attribute absent, the existing Classic stylesheet and markup win.
 * The only unscoped component is the opt-in layout switcher itself.
 */

/* Layout preview switcher: intentionally visible in both layouts. */
.ca-layout-switcher {
    appearance: none;
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 158px;
    min-height: 54px;
    padding: 8px 14px 8px 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 17px;
    background: rgba(15, 23, 42, 0.96);
    color: #ffffff;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: left;
    cursor: pointer;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.28),
        0 2px 8px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        background-color 180ms ease;
}

.ca-layout-switcher:hover {
    transform: translateY(-2px);
    box-shadow:
        0 22px 50px rgba(15, 23, 42, 0.34),
        0 3px 10px rgba(15, 23, 42, 0.18);
}

.ca-layout-switcher:active {
    transform: translateY(0);
}

.ca-layout-switcher:focus-visible {
    outline: 3px solid #a5b4fc;
    outline-offset: 3px;
}

.ca-layout-switcher__mark {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b5cf6, #4f46e5);
    color: #ffffff;
    font-size: 19px;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.ca-layout-switcher__copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.ca-layout-switcher__eyebrow {
    color: #a5b4fc;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ca-layout-switcher__value {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

html[data-ca-layout="modern"] .ca-layout-switcher {
    border-color: rgba(79, 70, 229, 0.18);
    background: rgba(255, 255, 255, 0.96);
    color: #172033;
    box-shadow:
        0 18px 45px rgba(30, 41, 59, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.7);
}

html[data-ca-layout="modern"] .ca-layout-switcher__mark {
    background: #eef2ff;
    color: #4f46e5;
}

html[data-ca-layout="modern"] .ca-layout-switcher__eyebrow {
    color: #697386;
}

html[data-ca-layout="modern"] .ca-layout-switcher__value {
    color: #172033;
}

/* Modern design tokens. Existing CSS variables are overridden only while active. */
html[data-ca-layout="modern"] {
    color-scheme: light;
    --primary: #5b5cf0;
    --primary-hover: #4b4ddc;
    --primary-light: #eeefff;
    --primary-dark: #3f3fb5;
    --success: #0f9f76;
    --success-light: #e5f8f1;
    --warning: #e39717;
    --warning-light: #fff7df;
    --danger: #dc5262;
    --danger-light: #fff0f2;
    --info: #3878d8;
    --info-light: #eaf3ff;
    --bg-color: #f4f6fb;
    --card-bg: #ffffff;
    --text-color: #172033;
    --text-muted: #697386;
    --text-light: #98a2b3;
    --border: #dfe4ee;
    --border-light: #edf0f5;
    --radius-sm: 10px;
    --radius: 15px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(22, 31, 50, 0.05);
    --shadow: 0 8px 24px rgba(22, 31, 50, 0.07);
    --shadow-lg: 0 16px 40px rgba(22, 31, 50, 0.11);
    --shadow-xl: 0 24px 60px rgba(22, 31, 50, 0.15);
    --ca-modern-ink: #172033;
    --ca-modern-muted: #697386;
    --ca-modern-line: #dfe4ee;
    --ca-modern-surface: rgba(255, 255, 255, 0.94);
    --ca-modern-accent: #5b5cf0;
    --ca-modern-accent-2: #15a9a0;
    --ca-modern-navy: #111a2d;
}

html[data-ca-layout="modern"] body {
    background:
        radial-gradient(circle at 7% -8%, rgba(99, 102, 241, 0.16), transparent 28rem),
        radial-gradient(circle at 96% 12%, rgba(20, 184, 166, 0.10), transparent 25rem),
        linear-gradient(180deg, #f8f9fd 0%, #f3f6fb 44%, #eef2f8 100%);
    color: var(--ca-modern-ink);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html[data-ca-layout="modern"] body::before {
    opacity: 0;
}

html[data-ca-layout="modern"] ::selection {
    background: rgba(91, 92, 240, 0.2);
    color: #111827;
}

html[data-ca-layout="modern"] a {
    text-underline-offset: 3px;
}

html[data-ca-layout="modern"] .container {
    width: min(100%, 1380px);
    max-width: 1380px;
    padding-right: clamp(18px, 3vw, 38px);
    padding-left: clamp(18px, 3vw, 38px);
}

html[data-ca-layout="modern"] .main {
    min-height: calc(100vh - 154px);
    padding: clamp(22px, 3vw, 38px) 0 56px;
}

/* Header and navigation */
html[data-ca-layout="modern"] .header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(17, 26, 45, 0.94);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

html[data-ca-layout="modern"] .nav {
    min-height: 68px;
    padding: 10px 0;
    gap: 24px;
}

html[data-ca-layout="modern"] .logo {
    gap: 11px;
    color: #ffffff;
}

html[data-ca-layout="modern"] .logo-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: linear-gradient(145deg, #686af8, #4748c9);
    font-size: 19px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        0 7px 20px rgba(79, 70, 229, 0.33);
}

html[data-ca-layout="modern"] .logo-text {
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -0.025em;
}

html[data-ca-layout="modern"] .nav-links {
    gap: 5px;
}

html[data-ca-layout="modern"] .nav-link {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 10px;
    color: #cbd3e1;
    font-size: 12px;
    font-weight: 650;
    line-height: 20px;
}

html[data-ca-layout="modern"] .nav-link:hover,
html[data-ca-layout="modern"] .nav-link.active {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

html[data-ca-layout="modern"] .nav-link.btn-primary {
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: linear-gradient(135deg, #6d6ef8, #5556df);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(55, 48, 163, 0.3);
}

html[data-ca-layout="modern"] .user-menu {
    gap: 10px;
    margin-left: 7px;
    padding-left: 12px;
    border-left-color: rgba(255, 255, 255, 0.14);
}

html[data-ca-layout="modern"] .user-name {
    color: #eef2ff;
    font-size: 12px;
}

html[data-ca-layout="modern"] .nav-link.logout {
    min-height: auto;
    color: #9ea9ba !important;
}

html[data-ca-layout="modern"] .nav-link.logout:hover {
    background: transparent;
    color: #fda4af !important;
}

/* Typography and shared surfaces */
html[data-ca-layout="modern"] h1,
html[data-ca-layout="modern"] h2,
html[data-ca-layout="modern"] h3 {
    color: var(--ca-modern-ink);
    letter-spacing: -0.025em;
}

html[data-ca-layout="modern"] h1 {
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.16;
}

html[data-ca-layout="modern"] h2 {
    line-height: 1.25;
}

html[data-ca-layout="modern"] .page-header {
    gap: 20px;
    margin-bottom: 22px;
}

html[data-ca-layout="modern"] .page-header h1,
html[data-ca-layout="modern"] .dashboard-title {
    font-size: clamp(25px, 3vw, 33px);
    letter-spacing: -0.035em;
}

html[data-ca-layout="modern"] .card,
html[data-ca-layout="modern"] .form-card,
html[data-ca-layout="modern"] .settings-card,
html[data-ca-layout="modern"] .admin-section,
html[data-ca-layout="modern"] .table-container,
html[data-ca-layout="modern"] .user-info-card,
html[data-ca-layout="modern"] .add-seller-card,
html[data-ca-layout="modern"] .seller-card,
html[data-ca-layout="modern"] .search-box,
html[data-ca-layout="modern"] .detail-section,
html[data-ca-layout="modern"] .privacy-content {
    border: 1px solid rgba(216, 222, 234, 0.92);
    border-radius: var(--radius-lg);
    background: var(--ca-modern-surface);
    box-shadow:
        0 12px 34px rgba(29, 41, 62, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

html[data-ca-layout="modern"] .card:hover,
html[data-ca-layout="modern"] .seller-card:hover {
    border-color: rgba(91, 92, 240, 0.28);
    box-shadow: 0 18px 42px rgba(29, 41, 62, 0.1);
}

html[data-ca-layout="modern"] .alert {
    gap: 14px;
    padding: 14px 17px;
    border-radius: 13px;
    box-shadow: 0 8px 20px rgba(29, 41, 62, 0.05);
}

html[data-ca-layout="modern"] .alert-success {
    border-color: #a9e5d1;
    background: #eaf9f3;
    color: #087052;
}

html[data-ca-layout="modern"] .alert-error {
    border-color: #f2bdc4;
    background: #fff1f3;
    color: #a72d3d;
}

html[data-ca-layout="modern"] .alert-warning {
    border-color: #f2d28c;
    background: #fff8e7;
    color: #8c5b0b;
}

html[data-ca-layout="modern"] .alert-info {
    border-color: #bed6f7;
    background: #eef6ff;
    color: #245ca8;
}

/* Buttons and form controls */
html[data-ca-layout="modern"] .btn {
    min-height: 41px;
    padding: 9px 16px;
    border: 1px solid #d8deea;
    border-radius: 11px;
    background: #ffffff;
    color: #293247;
    font-weight: 680;
    line-height: 1.2;
    box-shadow: 0 2px 5px rgba(23, 32, 51, 0.06);
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        box-shadow 160ms ease;
}

html[data-ca-layout="modern"] .btn:hover {
    border-color: #bcc5d5;
    background: #f8f9fc;
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(23, 32, 51, 0.1);
}

html[data-ca-layout="modern"] .btn:active {
    transform: translateY(0);
}

html[data-ca-layout="modern"] .btn-primary,
html[data-ca-layout="modern"] .btn-test {
    border-color: transparent;
    background: linear-gradient(135deg, #6566f3, #5153d7);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.22);
}

html[data-ca-layout="modern"] .btn-primary:hover,
html[data-ca-layout="modern"] .btn-test:hover {
    background: linear-gradient(135deg, #595ae8, #4547c8);
    box-shadow: 0 11px 24px rgba(79, 70, 229, 0.3);
}

html[data-ca-layout="modern"] .btn-success,
html[data-ca-layout="modern"] .btn-save {
    border-color: transparent;
    background: linear-gradient(135deg, #16a47c, #0c8866);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 159, 118, 0.2);
}

html[data-ca-layout="modern"] .btn-danger {
    border-color: transparent;
    background: linear-gradient(135deg, #e15a68, #c83f50);
    color: #ffffff;
}

html[data-ca-layout="modern"] .btn-secondary {
    border-color: #d8deea;
    background: #f7f8fb;
    color: #465064;
}

html[data-ca-layout="modern"] .btn-sm {
    min-height: 34px;
    padding: 7px 11px;
}

html[data-ca-layout="modern"] input[type="text"],
html[data-ca-layout="modern"] input[type="number"],
html[data-ca-layout="modern"] input[type="email"],
html[data-ca-layout="modern"] input[type="password"],
html[data-ca-layout="modern"] input[type="date"],
html[data-ca-layout="modern"] input[type="time"],
html[data-ca-layout="modern"] select,
html[data-ca-layout="modern"] textarea {
    min-height: 43px;
    border: 1px solid #d5dce8;
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
    box-shadow: inset 0 1px 2px rgba(23, 32, 51, 0.025);
}

html[data-ca-layout="modern"] input:hover,
html[data-ca-layout="modern"] select:hover,
html[data-ca-layout="modern"] textarea:hover {
    border-color: #b9c3d3;
}

html[data-ca-layout="modern"] input:focus,
html[data-ca-layout="modern"] select:focus,
html[data-ca-layout="modern"] textarea:focus,
html[data-ca-layout="modern"] button:focus-visible,
html[data-ca-layout="modern"] a:focus-visible {
    outline: none;
    border-color: #6869ef;
    box-shadow: 0 0 0 4px rgba(91, 92, 240, 0.14);
}

html[data-ca-layout="modern"] input[type="checkbox"],
html[data-ca-layout="modern"] input[type="radio"] {
    accent-color: var(--ca-modern-accent);
}

html[data-ca-layout="modern"] .form-hint,
html[data-ca-layout="modern"] .help-text,
html[data-ca-layout="modern"] .text-muted {
    color: var(--ca-modern-muted);
}

html[data-ca-layout="modern"] .current-email,
html[data-ca-layout="modern"] .info-box {
    border: 1px solid #e0e5ee;
    border-radius: 12px;
    background: #f7f8fb;
}

/* Tables, tabs, filters, and status elements */
html[data-ca-layout="modern"] .table-container {
    overflow-x: auto;
}

html[data-ca-layout="modern"] table {
    color: #263047;
}

html[data-ca-layout="modern"] th {
    border-bottom-color: #dfe4ee;
    background: #f5f7fb;
    color: #697386;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.1em;
}

html[data-ca-layout="modern"] td {
    border-bottom-color: #edf0f5;
}

html[data-ca-layout="modern"] .table-container tbody tr:hover,
html[data-ca-layout="modern"] .admin-table tbody tr:hover,
html[data-ca-layout="modern"] .search-table tbody tr:hover,
html[data-ca-layout="modern"] .sellers-table tbody tr:hover {
    background: #f5f5ff;
}

html[data-ca-layout="modern"] .badge,
html[data-ca-layout="modern"] .tier-badge,
html[data-ca-layout="modern"] .count-badge,
html[data-ca-layout="modern"] .interval-badge,
html[data-ca-layout="modern"] .action-badge,
html[data-ca-layout="modern"] .percent-badge {
    border-radius: 999px;
    font-weight: 700;
}

html[data-ca-layout="modern"] .quick-filters,
html[data-ca-layout="modern"] .tab-buttons {
    gap: 6px;
    padding: 5px;
    border: 1px solid #dfe4ee;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 5px 15px rgba(29, 41, 62, 0.05);
}

html[data-ca-layout="modern"] .filter-btn,
html[data-ca-layout="modern"] .tab-btn {
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #697386;
    font-weight: 680;
}

html[data-ca-layout="modern"] .filter-btn:hover,
html[data-ca-layout="modern"] .filter-btn.active,
html[data-ca-layout="modern"] .tab-btn:hover,
html[data-ca-layout="modern"] .tab-btn.active {
    border-color: rgba(91, 92, 240, 0.16);
    background: #eeefff;
    color: #4748c9;
}

/* Dashboard and saved-search cards */
html[data-ca-layout="modern"] .dashboard-header-compact {
    margin-bottom: 16px;
    padding: 19px 22px;
    border: 1px solid rgba(216, 222, 234, 0.9);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 255, 0.96));
    box-shadow: 0 14px 38px rgba(29, 41, 62, 0.08);
}

html[data-ca-layout="modern"] .dashboard-header-top {
    margin-bottom: 12px;
    padding-bottom: 14px;
}

html[data-ca-layout="modern"] .dashboard-header-top .dashboard-title {
    font-size: 25px;
}

html[data-ca-layout="modern"] .stats-bar {
    gap: 7px;
}

html[data-ca-layout="modern"] .stat-item {
    min-height: 49px;
    padding: 7px 13px;
    border-radius: 12px;
    background: #f5f7fb;
}

html[data-ca-layout="modern"] .stat-item.stat-link:hover {
    background: #eeefff;
    color: #4748c9;
}

html[data-ca-layout="modern"] .stat-divider {
    height: 28px;
    background: #dfe4ee;
}

html[data-ca-layout="modern"] .stat-value-sm {
    font-size: 18px;
}

html[data-ca-layout="modern"] .stats-grid {
    gap: 14px;
}

html[data-ca-layout="modern"] .stat-card {
    min-height: 110px;
    padding: 18px;
    border: 1px solid rgba(216, 222, 234, 0.95);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 28px rgba(29, 41, 62, 0.07);
}

html[data-ca-layout="modern"] .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 17px 38px rgba(29, 41, 62, 0.11);
}

html[data-ca-layout="modern"] .stat-value {
    color: #172033;
    font-size: 28px;
}

html[data-ca-layout="modern"] .stat-label {
    color: #697386;
}

html[data-ca-layout="modern"] .search-list {
    margin-top: 13px;
}

html[data-ca-layout="modern"] .search-card {
    gap: 16px;
    margin-bottom: 11px;
    padding: 17px 18px;
    border: 1px solid rgba(216, 222, 234, 0.95);
    border-left: 4px solid #7778ee;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(29, 41, 62, 0.055);
}

html[data-ca-layout="modern"] .search-card:hover {
    border-color: rgba(91, 92, 240, 0.34);
    border-left-color: #5657dc;
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(29, 41, 62, 0.1);
}

html[data-ca-layout="modern"] .search-card.inactive {
    border-left-color: #b7bfcd;
    opacity: 0.72;
}

html[data-ca-layout="modern"] .search-card-title {
    margin-bottom: 6px;
    font-size: 16px;
    letter-spacing: -0.015em;
}

html[data-ca-layout="modern"] .search-card-meta {
    gap: 7px 15px;
    color: #697386;
}

html[data-ca-layout="modern"] .search-card-actions {
    gap: 7px;
}

html[data-ca-layout="modern"] .empty-state {
    padding: clamp(42px, 7vw, 82px) 24px;
    border: 1px dashed #cbd3df;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.68);
}

/* New/Edit search workspace: presentation only; original form and handlers stay intact. */
html[data-ca-layout="modern"][data-ca-page="search"] .main {
    padding-top: 22px !important;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form {
    position: relative;
    padding: clamp(18px, 2.5vw, 28px) !important;
    border: 1px solid rgba(211, 218, 231, 0.95);
    border-radius: 23px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(250, 251, 254, 0.98));
    box-shadow: 0 18px 48px rgba(29, 41, 62, 0.1);
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form::before {
    content: "SEARCH WORKSPACE";
    display: block;
    width: fit-content;
    margin-bottom: 15px;
    padding: 5px 9px;
    border: 1px solid rgba(91, 92, 240, 0.16);
    border-radius: 999px;
    background: #eeefff;
    color: #5153c8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form > .form-row:first-of-type {
    justify-content: space-between;
    min-height: 35px;
    margin-bottom: 8px;
    padding-bottom: 9px;
    border-bottom: 1px solid #edf0f5;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form > .form-row:first-of-type > span {
    margin-left: auto !important;
    padding: 4px 5px 4px 10px;
    border: 1px solid #dfe4ee;
    border-radius: 10px;
    background: #f7f8fb;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .form-row {
    gap: 9px 12px !important;
    margin-bottom: 10px;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form label {
    color: #354057;
    font-size: 12px;
    font-weight: 700;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form input[type="text"],
html[data-ca-layout="modern"][data-ca-page="search"] .compact-form input[type="number"],
html[data-ca-layout="modern"][data-ca-page="search"] .compact-form select {
    height: 39px;
    min-height: 39px;
    padding: 7px 10px;
    border-color: #d4dbe7;
    border-radius: 9px;
    font-size: 12px;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .keyword-input {
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 12px 15px;
    border: 1px solid #cfd7e5;
    border-radius: 13px;
    background: #ffffff;
    font-size: 15px;
    font-weight: 550;
    box-shadow:
        0 5px 14px rgba(29, 41, 62, 0.045),
        inset 0 1px 2px rgba(29, 41, 62, 0.025);
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .keyword-input:focus {
    border-color: #6869ef;
    box-shadow:
        0 0 0 4px rgba(91, 92, 240, 0.13),
        0 8px 20px rgba(29, 41, 62, 0.06);
}

html[data-ca-layout="modern"][data-ca-page="search"] .keyword-hint {
    gap: 15px;
    margin: 7px 2px 12px;
    color: #697386;
    font-size: 11px;
    line-height: 1.5;
}

html[data-ca-layout="modern"][data-ca-page="search"] .char-counter {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 7px;
    background: #f0f2f7;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .checkbox-inline,
html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .radio-group {
    min-height: 34px;
    gap: 6px !important;
    padding: 6px 9px;
    border: 1px solid #dfe4ee;
    border-radius: 9px;
    background: #f8f9fb;
}

html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .checkbox-inline:hover,
html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .radio-group:hover {
    border-color: rgba(91, 92, 240, 0.4);
    background: #f2f2ff;
}

html[data-ca-layout="modern"][data-ca-page="search"] .advanced-toggle {
    margin-top: 15px;
    padding: 10px 13px;
    border: 1px solid #d9dfeb;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, #f8f9fc, #f1f3f8);
}

html[data-ca-layout="modern"][data-ca-page="search"] .advanced-toggle a {
    display: flex;
    align-items: center;
    color: #414b61;
    font-size: 12px;
}

html[data-ca-layout="modern"][data-ca-page="search"] .advanced-toggle a::after {
    content: "Adjust conditions, location, price and delivery";
    margin-left: auto;
    color: #8a94a6;
    font-size: 10px;
    font-weight: 500;
}

html[data-ca-layout="modern"][data-ca-page="search"] .advanced-options {
    padding: 15px 14px;
    border: 1px solid #d9dfeb;
    border-top: 0;
    border-radius: 0 0 14px 14px;
    background: #f8f9fc;
}

html[data-ca-layout="modern"][data-ca-page="search"] .advanced-options > .form-row {
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid #e6eaf1;
}

html[data-ca-layout="modern"][data-ca-page="search"] .advanced-options > .form-row:last-child {
    border-bottom: 0;
}

html[data-ca-layout="modern"][data-ca-page="search"] .inline-group,
html[data-ca-layout="modern"][data-ca-page="search"] .field-group {
    gap: 5px !important;
    min-height: 39px;
    padding: 4px 7px;
    border: 1px solid #dde3ed;
    border-radius: 10px;
    background: #ffffff;
}

html[data-ca-layout="modern"][data-ca-page="search"] .name-notes-row {
    margin-top: 14px;
    padding: 13px 14px;
    border: 1px solid #dfe4ee;
    border-radius: 13px;
    background: #f7f8fb;
}

html[data-ca-layout="modern"][data-ca-page="search"] .action-row {
    gap: 10px;
    margin-top: 16px;
    padding: 13px;
    border: 1px solid #d9dfeb;
    border-radius: 15px;
    background: #f1f3f8;
}

html[data-ca-layout="modern"][data-ca-page="search"] .action-row > .btn {
    min-height: 44px;
    padding: 10px 17px;
    font-size: 12px;
}

html[data-ca-layout="modern"][data-ca-page="search"] .save-box {
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #a7ddca;
    border-radius: 13px;
    background: #e7f7f1;
    box-shadow: 0 4px 12px rgba(15, 159, 118, 0.08);
}

html[data-ca-layout="modern"][data-ca-page="search"] .save-box .btn-save {
    min-height: 42px;
    padding: 9px 15px;
}

html[data-ca-layout="modern"][data-ca-page="search"] .interval-select select {
    height: 31px;
    min-height: 31px;
}

html[data-ca-layout="modern"][data-ca-page="search"] #searchActiveLabel {
    border-radius: 10px !important;
    box-shadow: 0 3px 10px rgba(29, 41, 62, 0.06);
}

html[data-ca-layout="modern"][data-ca-page="search"] #resultsSection {
    margin-top: 22px !important;
    padding: 16px;
    overflow-x: auto;
    border: 1px solid #d8deea;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 16px 42px rgba(29, 41, 62, 0.09);
}

html[data-ca-layout="modern"][data-ca-page="search"] #resultsSection > table {
    min-width: 850px;
}

html[data-ca-layout="modern"][data-ca-page="search"] #resultsTable {
    border: 1px solid #e1e6ef;
    border-radius: 13px;
    overflow: hidden;
}

html[data-ca-layout="modern"][data-ca-page="search"] #resultsTable td {
    padding: 9px !important;
}

html[data-ca-layout="modern"][data-ca-page="search"] #resultsTable img {
    border-radius: 9px;
    box-shadow: 0 4px 12px rgba(29, 41, 62, 0.12);
}

html[data-ca-layout="modern"][data-ca-page="search"] #paginationInfo,
html[data-ca-layout="modern"][data-ca-page="search"] #paginationControls,
html[data-ca-layout="modern"][data-ca-page="search"] #bottomPagination {
    color: #697386;
    font-size: 12px;
}

html[data-ca-layout="modern"] .search-info-card {
    position: relative;
    overflow: hidden;
    padding: clamp(22px, 3vw, 32px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    background:
        radial-gradient(circle at 90% 10%, rgba(45, 212, 191, 0.22), transparent 18rem),
        linear-gradient(135deg, #222954, #4546b7);
    box-shadow: 0 18px 44px rgba(38, 43, 110, 0.2);
}

html[data-ca-layout="modern"] .search-info-card h2 {
    color: #ffffff;
    font-size: clamp(22px, 3vw, 30px);
}

html[data-ca-layout="modern"] .filter-tag {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
}

html[data-ca-layout="modern"] .results-grid {
    gap: 16px;
}

html[data-ca-layout="modern"] .result-card,
html[data-ca-layout="modern"] .result-card-grid {
    border: 1px solid #dce2ec;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 9px 26px rgba(29, 41, 62, 0.07);
}

html[data-ca-layout="modern"] .result-card:hover,
html[data-ca-layout="modern"] .result-card-grid:hover {
    border-color: rgba(91, 92, 240, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 17px 38px rgba(29, 41, 62, 0.12);
}

html[data-ca-layout="modern"] .result-image {
    background: linear-gradient(145deg, #f8f9fc, #eff2f7);
}

html[data-ca-layout="modern"] .result-content {
    padding: 19px;
}

html[data-ca-layout="modern"] .result-price {
    color: #087b5c;
}

/* Settings and admin */
html[data-ca-layout="modern"][data-ca-page="settings"] .settings-container {
    width: min(100%, 780px);
    max-width: 780px;
    padding: 8px 20px 40px;
}

html[data-ca-layout="modern"] .settings-card {
    margin-bottom: 17px;
    padding: clamp(20px, 3vw, 28px);
}

html[data-ca-layout="modern"] .settings-card h2 {
    margin-bottom: 18px;
    padding-bottom: 13px;
    border-bottom: 1px solid #edf0f5;
}

html[data-ca-layout="modern"][data-ca-page="admin"] {
    --admin-bg: #f3f6fb;
    --admin-surface: #ffffff;
    --admin-surface-alt: #f7f8fb;
    --admin-ink: #172033;
    --admin-ink-soft: #354057;
    --admin-muted: #697386;
    --admin-border: #dfe4ee;
    --admin-border-strong: #cbd3df;
    --admin-accent: #5b5cf0;
    --admin-accent-strong: #4547c8;
    --admin-accent-soft: #eeefff;
    --admin-teal: #0f9f76;
    --admin-teal-soft: #e5f8f1;
}

html[data-ca-layout="modern"][data-ca-page="admin"] body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-ca-layout="modern"][data-ca-page="admin"] .main .container {
    max-width: 1320px;
}

html[data-ca-layout="modern"] .admin-header {
    min-height: 106px;
    padding: 22px 26px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 21px;
    background:
        radial-gradient(circle at 90% 8%, rgba(45, 212, 191, 0.25), transparent 18rem),
        linear-gradient(125deg, #172033 0%, #28335d 64%, #315f69 125%);
    box-shadow: 0 18px 44px rgba(23, 32, 51, 0.2);
}

html[data-ca-layout="modern"] .admin-header h1 {
    color: #ffffff;
    font-size: 25px;
}

html[data-ca-layout="modern"] .admin-header p {
    color: #ccd4e4;
    font-size: 13px;
}

html[data-ca-layout="modern"] .admin-nav {
    gap: 4px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid #dce2ec;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 22px rgba(29, 41, 62, 0.07);
}

html[data-ca-layout="modern"] .admin-nav a {
    padding: 8px 12px;
    border-radius: 10px;
    color: #697386;
    font-size: 10px;
}

html[data-ca-layout="modern"] .admin-nav a:hover {
    background: #f2f2ff;
    color: #4748c9;
}

html[data-ca-layout="modern"] .admin-nav a.active {
    border-color: #5b5cf0;
    background: #5b5cf0;
    color: #ffffff;
    box-shadow: 0 7px 16px rgba(79, 70, 229, 0.2);
}

html[data-ca-layout="modern"] .admin-section {
    padding: clamp(17px, 2.4vw, 23px);
}

html[data-ca-layout="modern"] .admin-section h2 {
    margin-bottom: 15px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 16px;
}

html[data-ca-layout="modern"] .admin-table,
html[data-ca-layout="modern"] .audit-table,
html[data-ca-layout="modern"] .stats-table,
html[data-ca-layout="modern"] .snapshot-table,
html[data-ca-layout="modern"] .ip-table {
    border: 1px solid #e0e5ee;
    border-radius: 13px;
    background: #ffffff;
    box-shadow: none;
}

/* Authentication, confirmations, and errors */
html[data-ca-layout="modern"][data-ca-page="auth"] body,
html[data-ca-layout="modern"] body.auth-page {
    background:
        radial-gradient(circle at 15% 8%, rgba(99, 102, 241, 0.2), transparent 26rem),
        radial-gradient(circle at 90% 90%, rgba(20, 184, 166, 0.12), transparent 25rem),
        linear-gradient(145deg, #f7f8fd, #eef2f8);
}

html[data-ca-layout="modern"] .auth-container {
    padding: clamp(32px, 7vw, 78px) 18px;
}

html[data-ca-layout="modern"] .auth-card {
    overflow: hidden;
    border: 1px solid rgba(216, 222, 234, 0.96);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 60px rgba(29, 41, 62, 0.14);
}

html[data-ca-layout="modern"] .auth-header {
    padding: 27px 27px 18px;
}

html[data-ca-layout="modern"] .auth-header h1,
html[data-ca-layout="modern"] .auth-header h2 {
    font-size: 25px;
}

html[data-ca-layout="modern"] .auth-body,
html[data-ca-layout="modern"] .auth-form {
    padding-right: 27px;
    padding-left: 27px;
}

html[data-ca-layout="modern"] .auth-footer {
    border-top-color: #edf0f5;
    background: #f8f9fb;
}

html[data-ca-layout="modern"] .confirm-container,
html[data-ca-layout="modern"] .error-page {
    border: 1px solid #dce2ec;
    border-radius: 23px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 22px 55px rgba(29, 41, 62, 0.13);
}

html[data-ca-layout="modern"] .confirm-icon,
html[data-ca-layout="modern"] .error-icon {
    filter: drop-shadow(0 8px 14px rgba(29, 41, 62, 0.12));
}

/* Marketing, pricing, privacy, and item detail pages */
html[data-ca-layout="modern"] .landing-main {
    padding-top: 0;
}

html[data-ca-layout="modern"] .hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 18%, rgba(91, 92, 240, 0.16), transparent 25rem),
        radial-gradient(circle at 8% 95%, rgba(20, 184, 166, 0.12), transparent 22rem);
}

html[data-ca-layout="modern"] .hero-title {
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.02;
    letter-spacing: -0.055em;
}

html[data-ca-layout="modern"] .hero-subtitle {
    color: #596579;
    font-size: clamp(16px, 2vw, 19px);
}

html[data-ca-layout="modern"] .hero-feature {
    border: 1px solid #e0e5ee;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
}

html[data-ca-layout="modern"] .feature-card,
html[data-ca-layout="modern"] .step-card,
html[data-ca-layout="modern"] .pricing-card {
    border: 1px solid #dce2ec;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 30px rgba(29, 41, 62, 0.065);
}

html[data-ca-layout="modern"] .feature-card:hover,
html[data-ca-layout="modern"] .step-card:hover,
html[data-ca-layout="modern"] .pricing-card:hover {
    border-color: rgba(91, 92, 240, 0.28);
    transform: translateY(-4px);
    box-shadow: 0 19px 42px rgba(29, 41, 62, 0.11);
}

html[data-ca-layout="modern"] .cta-section,
html[data-ca-layout="modern"] .pricing-card.featured {
    background:
        radial-gradient(circle at 85% 12%, rgba(45, 212, 191, 0.22), transparent 20rem),
        linear-gradient(135deg, #20284a, #4647b4);
}

html[data-ca-layout="modern"] .pricing-hero {
    margin-bottom: 34px;
}

html[data-ca-layout="modern"] .pricing-hero h1 {
    font-size: clamp(34px, 5vw, 52px);
}

html[data-ca-layout="modern"] .main-image {
    border-radius: 18px;
    background: #f4f6fa;
}

html[data-ca-layout="modern"] .image-gallery,
html[data-ca-layout="modern"] .detail-grid {
    gap: 18px;
}

html[data-ca-layout="modern"] .detail-item {
    padding: 13px 14px;
    border: 1px solid #e1e6ef;
    border-radius: 12px;
    background: #f8f9fb;
}

html[data-ca-layout="modern"] .footer {
    border-top: 1px solid #dde3ed;
    background: rgba(255, 255, 255, 0.72);
    color: #7b8597;
    backdrop-filter: blur(12px);
}

/* Responsive behavior: wrap, scroll, or stack without removing controls. */
@media (max-width: 960px) {
    html[data-ca-layout="modern"] .nav {
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    html[data-ca-layout="modern"] .nav-links {
        flex: 1 1 100%;
        justify-content: center;
        flex-wrap: wrap;
        padding-bottom: 4px;
    }

    html[data-ca-layout="modern"] .user-menu {
        margin-left: 0;
    }

    html[data-ca-layout="modern"] .admin-table,
    html[data-ca-layout="modern"] .audit-table,
    html[data-ca-layout="modern"] .stats-table,
    html[data-ca-layout="modern"] .snapshot-table,
    html[data-ca-layout="modern"] .ip-table {
        min-width: 760px;
    }

    html[data-ca-layout="modern"] .admin-section {
        overflow-x: auto;
    }
}

@media (max-width: 720px) {
    .ca-layout-switcher {
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        min-width: 0;
        min-height: 47px;
        padding: 6px 10px 6px 7px;
        border-radius: 15px;
    }

    .ca-layout-switcher__mark {
        flex-basis: 33px;
        width: 33px;
        height: 33px;
        border-radius: 10px;
    }

    .ca-layout-switcher__eyebrow {
        display: none;
    }

    .ca-layout-switcher__value {
        font-size: 11px;
    }

    html[data-ca-layout="modern"] .container {
        padding-right: 15px;
        padding-left: 15px;
    }

    html[data-ca-layout="modern"] .nav {
        min-height: 62px;
        padding: 10px 0;
    }

    html[data-ca-layout="modern"] .nav-links {
        gap: 3px;
    }

    html[data-ca-layout="modern"] .nav-link {
        min-height: 33px;
        padding: 6px 8px;
        font-size: 11px;
    }

    html[data-ca-layout="modern"] .user-menu {
        width: 100%;
        justify-content: center;
        padding: 7px 0 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-left: 0;
    }

    html[data-ca-layout="modern"] .main {
        padding-top: 20px;
    }

    html[data-ca-layout="modern"] .dashboard-header-compact,
    html[data-ca-layout="modern"] .settings-card,
    html[data-ca-layout="modern"] .admin-section {
        border-radius: 16px;
    }

    html[data-ca-layout="modern"] .search-card {
        align-items: stretch;
        padding: 15px;
    }

    html[data-ca-layout="modern"] .search-card-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .compact-form {
        padding: 16px !important;
        border-radius: 17px;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .compact-form > .form-row:first-of-type {
        align-items: stretch;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .compact-form > .form-row:first-of-type > span {
        margin-left: 0 !important;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .keyword-hint {
        align-items: flex-start !important;
        flex-direction: column;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .advanced-toggle a::after {
        display: none;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .compact-form .form-row {
        align-items: flex-start;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .action-row,
    html[data-ca-layout="modern"][data-ca-page="search"] .save-box {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    html[data-ca-layout="modern"][data-ca-page="search"] .action-row > .btn,
    html[data-ca-layout="modern"][data-ca-page="search"] .action-row > a,
    html[data-ca-layout="modern"][data-ca-page="search"] .save-box .btn {
        width: 100%;
    }

    html[data-ca-layout="modern"] .admin-header {
        min-height: 0;
        padding: 19px;
    }

    html[data-ca-layout="modern"] .admin-nav {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    html[data-ca-layout="modern"] .admin-nav a {
        flex: 0 0 auto;
    }

    html[data-ca-layout="modern"] .hero-title {
        font-size: clamp(36px, 12vw, 50px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ca-layout-switcher,
    html[data-ca-layout="modern"] *,
    html[data-ca-layout="modern"] *::before,
    html[data-ca-layout="modern"] *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .ca-layout-switcher {
        display: none !important;
    }
}
