body {
    background: var(--bg-primary, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

body[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-card: #111b2e;
    --border-color: #22324a;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5f5;
    --muted-color: #94a3b8;
    --shadow: 0 24px 60px -30px rgba(8, 19, 33, 0.85);
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .text-muted {
    color: var(--muted-color, #94a3b8) !important;
}

.subscription-card {
    color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .subscription-card {
    background: var(--bg-card, #111b2e);
    border-color: var(--border-color, #22324a);
    box-shadow: 0 24px 48px -26px rgba(15, 23, 42, 0.55);
    color: var(--text-primary, #f1f5f9);
}

[data-theme="dark"] .subscription-card h4,
[data-theme="dark"] .subscription-card h5,
[data-theme="dark"] .subscription-card h6 {
    color: var(--text-primary, #f1f5f9);
}

[data-theme="dark"] .subscription-card .text-muted {
    color: var(--muted-color, #94a3b8) !important;
    opacity: 0.95;
}

[data-theme="dark"] #currentPlanDescription,
[data-theme="dark"] #currentPlanDates,
[data-theme="dark"] #usageList .usage-item p,
[data-theme="dark"] #usageList .usage-item small,
[data-theme="dark"] .subscription-card .plan-note {
    color: var(--muted-color, #94a3b8) !important;
}

.subscription-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

/* Header styles matching test-runner */
.header {
    background: var(--bg-card, #ffffff);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    margin-bottom: 1.5rem;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 100;
    overflow: visible;
}

.header > div {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    overflow: visible;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #0f172a);
}

.header .text-muted {
    font-size: 0.85rem;
    margin-top: 0.25rem !important;
    color: var(--text-secondary, #64748b);
}

[data-theme="dark"] .header .text-muted {
    color: var(--muted-color, #94a3b8);
    opacity: 0.92;
}

.header-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    min-width: 0;
    overflow: visible;
    margin-left: auto;
}

.header-controls-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0 0.375rem;
    flex-shrink: 0;
    overflow: visible;
}

.header-controls-right {
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    max-width: 100%;
    position: relative;
    overflow: visible;
}

.header-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: transparent;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
}

.header-icon-btn:hover {
    background: var(--bg-container, #f1f5f9);
    border-color: var(--primary-color, #2563eb);
    color: var(--primary-color, #2563eb);
}

[data-theme="dark"] .header-icon-btn {
    border-color: var(--border-color, #334155);
    color: var(--text-primary, #e2e8f0);
}

[data-theme="dark"] .header-icon-btn:hover {
    background: var(--bg-container, #374151);
    border-color: var(--primary-color, #3b82f6);
    color: var(--primary-color, #3b82f6);
}

.subscription-card {
    background: var(--bg-card, #ffffff);
    border-radius: 18px;
    box-shadow: var(--shadow, 0 20px 45px -24px rgba(15, 23, 42, 0.45));
    border: 1px solid var(--border-color, #e2e8f0);
    margin-bottom: 1.5rem;
    padding: 2rem;
}

[data-theme="dark"] .subscription-card {
    background: var(--bg-card, #111b2e);
    border-color: var(--border-color, #22324a);
    box-shadow: 0 24px 48px -26px rgba(15, 23, 42, 0.55);
}

[data-theme="dark"] .subscription-card,
[data-theme="dark"] .subscription-card h4,
[data-theme="dark"] .subscription-card h5,
[data-theme="dark"] .subscription-card h6,
[data-theme="dark"] .subscription-card p,
[data-theme="dark"] .subscription-card li {
    color: var(--text-primary, #f1f5f9);
}

[data-theme="dark"] .subscription-card .text-muted {
    color: var(--muted-color, #94a3b8) !important;
    opacity: 0.95;
}

[data-theme="dark"] #currentPlanDates,
[data-theme="dark"] #currentPlanDescription,
[data-theme="dark"] #usageList .usage-item p,
[data-theme="dark"] #usageList .usage-item small {
    color: var(--muted-color, #94a3b8) !important;
}

[data-theme="dark"] .subscription-card-header .current-plan-info .text-muted,
[data-theme="dark"] .subscription-card-header .current-plan-meta .text-muted,
[data-theme="dark"] .subscription-card .plan-note,
[data-theme="dark"] .subscription-card .subscription-footer,
[data-theme="dark"] .subscription-card .plan-price .price-sub {
    color: var(--muted-color, #94a3b8) !important;
}

.subscription-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.subscription-card-header .current-plan-info {
    flex: 1 1 260px;
    min-width: 220px;
}

.subscription-card-header .current-plan-meta {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .subscription-card-header .current-plan-meta {
        align-items: flex-start;
        text-align: left;
    }
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.plan-badge.free {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.plan-badge.professional {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.plan-badge.corporate {
    background: rgba(236, 72, 153, 0.12);
    color: #be185d;
}

body[data-theme="dark"] .plan-badge.free {
    background: rgba(59, 130, 246, 0.28);
    color: #bfdbfe;
}

body[data-theme="dark"] .plan-badge.professional {
    background: rgba(16, 185, 129, 0.28);
    color: #bbf7d0;
}

body[data-theme="dark"] .plan-badge.corporate {
    background: rgba(236, 72, 153, 0.32);
    color: #f9a8d4;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.82rem;
}

.status-badge.expired {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.status-badge.cancelled {
    background: rgba(148, 163, 184, 0.18);
    color: #475569;
}

.status-badge.trial {
    background: rgba(192, 132, 252, 0.16);
}

body[data-theme="dark"] .status-badge {
    background: rgba(14, 165, 233, 0.32);
    color: #e0f2fe;
}

body[data-theme="dark"] .status-badge.expired {
    background: rgba(239, 68, 68, 0.24);
    color: #fecaca;
}

body[data-theme="dark"] .status-badge.cancelled {
    background: rgba(148, 163, 184, 0.28);
    color: #f1f5f9;
}

body[data-theme="dark"] .status-badge.trial {
    background: rgba(192, 132, 252, 0.25);
    color: #f3e8ff;
    border: 1px solid rgba(192, 132, 252, 0.4);
}

body[data-theme="dark"] .status-badge.trial i {
    color: #c084fc;
}

.trial-days-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 12px;
    background: rgba(192, 132, 252, 0.16);
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 0.75rem;
}

.trial-days-badge.expired {
    background: rgba(239, 68, 68, 0.16);
    color: #dc2626;
}

body[data-theme="dark"] .trial-days-badge {
    background: rgba(192, 132, 252, 0.2);
    color: #f3e8ff;
    border: 1px solid rgba(192, 132, 252, 0.35);
    font-weight: 500;
}

body[data-theme="dark"] .trial-days-badge i {
    color: #c084fc;
}

body[data-theme="dark"] .trial-days-badge.expired {
    background: rgba(239, 68, 68, 0.25);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

body[data-theme="dark"] .trial-days-badge.expired i {
    color: #f87171;
}

.subscription-divider {
    height: 1px;
    background: var(--border-color, #e2e8f0);
    margin: 1.5rem 0;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.plan-card {
    position: relative;
    border-radius: 18px;
    padding: 2rem;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #ffffff);
    box-shadow: var(--shadow, 0 12px 35px -20px rgba(15, 23, 42, 0.4));
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .plan-card {
    border-color: var(--border-color, #334155);
}

.plan-card.popular {
    border-width: 2px;
    border-color: rgba(59, 130, 246, 0.65);
    box-shadow: 0 16px 40px -28px rgba(37, 99, 235, 0.75);
}

.plan-popular-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.plan-price {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}

.plan-price small {
    font-size: 0.8rem;
    color: var(--text-secondary, #475569);
}

body[data-theme="dark"] .plan-price {
    color: var(--text-primary);
}

body[data-theme="dark"] .plan-price small {
    color: var(--text-secondary);
}

.plan-features {
    margin-top: 1.5rem;
    padding: 0;
    list-style: none;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0;
    color: var(--text-secondary, #475569);
}

body[data-theme="dark"] .plan-features li {
    color: var(--text-secondary);
}

.plan-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.plan-actions .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.7rem 1.2rem;
}

.plan-actions .btn-outline-secondary {
    color: var(--text-secondary, #475569);
}

.usage-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.usage-item {
    background: rgba(248, 250, 252, 0.8);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(226, 232, 240, 0.7);
}

[data-theme="dark"] .usage-item {
    background: rgba(30, 41, 59, 0.88);
    border-color: rgba(71, 85, 105, 0.7);
}

.usage-item h6 {
    font-size: 0.85rem;
    color: var(--text-secondary, #475569);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.usage-item p {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .usage-item h6 {
    color: var(--text-secondary);
}

[data-theme="dark"] .usage-item p {
    color: var(--text-primary);
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.payments-table th,
.payments-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    text-align: left;
    font-size: 0.93rem;
}

.payments-table th {
    font-weight: 600;
    color: var(--text-secondary, #475569);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.payments-table td {
    color: var(--text-primary, #0f172a);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

.status-chip.failed,
.status-chip.canceled,
.status-chip.cancelled {
    background: rgba(248, 113, 113, 0.16);
    color: #b91c1c;
}

.status-chip.pending {
    background: rgba(251, 191, 36, 0.16);
    color: #b45309;
}

.status-chip.succeeded {
    background: rgba(16, 185, 129, 0.16);
    color: #047857;
}

.instruction-list {
    margin-top: 1rem;
    list-style: none;
    padding-left: 0;
}

.instruction-list li {
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.7);
    background: rgba(248, 250, 252, 0.7);
    margin-bottom: 0.6rem;
}

[data-theme="dark"] .instruction-list li {
    border-color: rgba(51, 65, 85, 0.7);
    background: rgba(30, 41, 59, 0.6);
}

.instruction-list li strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-secondary, #475569);
}

.error-state {
    margin-bottom: 1.5rem;
}

.empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary, #475569);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.65);
    border: 1px dashed var(--border-color, #e2e8f0);
}

[data-theme="dark"] .empty-state {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(51, 65, 85, 0.7);
}

.plan-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.plan-card.corporate .plan-feature-icon {
    background: rgba(236, 72, 153, 0.12);
    color: #be185d;
}

body[data-theme="dark"] .plan-feature-icon {
    background: rgba(59, 130, 246, 0.35);
    color: #bfdbfe;
}

body[data-theme="dark"] .plan-card.corporate .plan-feature-icon {
    background: rgba(236, 72, 153, 0.38);
    color: #f9a8d4;
}

.test-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(14, 165, 233, 0.2);
    color: #0369a1;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.test-alert {
    margin-top: 1rem;
    padding: 1rem 1.2rem;
    border-left: 4px solid #2563eb;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 12px;
    color: var(--text-secondary, #475569);
}

.subscription-footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-secondary, #475569);
    font-size: 0.9rem;
}

.subscription-footer a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.subscription-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1200px) {
    .header h1 {
        font-size: 1.3rem;
    }
    
    .header .text-muted {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .subscription-container {
        padding: 1rem;
    }
    
    .subscription-card {
        padding: 1.5rem;
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .header .text-muted {
        display: none;
    }
    
    .header-controls {
        gap: 0.125rem;
    }
    
    .header-icon-btn {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
    
    .plan-card {
        padding: 1.7rem 1.5rem;
    }
}

/* Calendar feature block */
.bg-light {
    background-color: rgba(248, 250, 252, 0.8) !important;
}

[data-theme="dark"] .bg-light {
    background-color: rgba(30, 41, 59, 0.88) !important;
}

[data-theme="dark"] .bg-light h6 {
    color: var(--text-primary, #f1f5f9) !important;
}

[data-theme="dark"] .bg-light p {
    color: var(--text-secondary, #cbd5f5) !important;
}

[data-theme="dark"] .bg-light .text-muted {
    color: var(--muted-color, #94a3b8) !important;
}

[data-theme="dark"] .bg-light .text-primary {
    color: var(--primary-color, #3b82f6) !important;
}

[data-theme="dark"] .bg-light i.fas.fa-calendar-alt {
    color: var(--primary-color, #3b82f6) !important;
}

[data-theme="dark"] .bg-light .fw-semibold {
    color: var(--text-primary, #f1f5f9) !important;
}

/* Alert styles for trial messages */
.alert {
    border-radius: 12px;
    padding: 1rem 1.25rem;
    border: 1px solid transparent;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

[data-theme="dark"] .alert-info {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}

[data-theme="dark"] .alert-info i {
    color: #60a5fa;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

[data-theme="dark"] .alert-warning i {
    color: #fbbf24;
}

