:root {
    color-scheme: light;
    --ink: #17221d;
    --muted: #647168;
    --line: #dce5df;
    --paper: #ffffff;
    --canvas: #f4f7f5;
    --brand: #176b45;
    --brand-soft: #e6f3ec;
    --danger: #a53c32;
    --warning: #8a5a13;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
}

button { font: inherit; }
.hidden { display: none !important; }

.topbar {
    min-height: 68px;
    padding: 12px clamp(18px, 4vw, 54px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: white;
    background: var(--brand);
    font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); }

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.account-name { color: var(--muted); }
.secondary-link { color: var(--brand); text-decoration: none; }

.page-shell {
    width: min(900px, calc(100% - 32px));
    margin: 32px auto 60px;
}

.hero, .panel-heading, .auth-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.hero { margin-bottom: 24px; }
.hero h1 { margin: 7px 0; font-size: clamp(28px, 5vw, 42px); }
.hero p, .panel-heading p, .auth-panel p, .chat-tip p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.65;
}

.eyebrow {
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.subscription-panel, .auth-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 10px 32px rgba(30, 50, 39, .05);
}

.panel-heading {
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 { margin: 0 0 5px; }
.panel-heading p { margin-top: 0; }

button, .primary-link, .chat-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

button:disabled { opacity: .6; cursor: wait; }
.primary-link { color: white; background: var(--brand); }
.secondary-button, .chat-link {
    color: var(--brand);
    background: white;
    border-color: #b9cec1;
}

.subscription-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.subscription-card {
    min-width: 0;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fbfdfb;
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.card-heading h3 { margin: 0; font-size: 18px; }
.schedule { margin: 20px 0 6px; font-size: 21px; font-weight: 750; }
.source, .eligibility, .personal-final-note {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.status-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 13px;
    font-weight: 750;
}

.status-badge.off { color: var(--muted); background: #edf1ee; }
.eligibility { color: var(--warning); }

.personal-final-note {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.personal-final-note p { margin: 4px 0; }

.state-card, .empty-state {
    margin-top: 20px;
    padding: 30px 18px;
    text-align: center;
    color: var(--muted);
    border-radius: 14px;
    background: #f8faf8;
}

.loading-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--brand);
    animation: pulse 1.2s ease-in-out infinite;
}

.empty-icon { color: var(--brand); font-size: 28px; }
.empty-state h2 { margin: 10px 0 5px; color: var(--ink); font-size: 20px; }
.empty-state p { margin: 0; }
.empty-state blockquote { margin: 12px auto 18px; color: var(--ink); }

.chat-tip {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid #cfe1d5;
    border-radius: 14px;
    background: var(--brand-soft);
}

.chat-tip p { margin-top: 4px; }

.error-banner {
    margin-bottom: 18px;
    padding: 12px 15px;
    color: var(--danger);
    border-radius: 10px;
    background: #fff0ee;
}

@keyframes pulse {
    0%, 100% { opacity: .35; transform: scale(.85); }
    50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 760px) {
    .subscription-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .topbar, .hero, .panel-heading, .auth-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        align-items: flex-start;
        justify-content: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .page-shell {
        width: min(100% - 20px, 900px);
        margin-top: 20px;
    }

    .subscription-panel, .auth-panel { padding: 18px; }
    .secondary-button, .chat-link, .primary-link { width: 100%; }
    .card-heading { align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-dot { animation: none; }
}
