:root {
    --bg: #f6f4ff;
    --surface: rgba(255, 255, 255, 0.82);
    --line: rgba(107, 83, 216, 0.12);
    --ink: #1f2440;
    --muted: #6c7396;
    --accent: #5b3df5;
    --accent-2: #a855f7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(168, 85, 247, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(91, 61, 245, 0.16), transparent 28%),
        linear-gradient(180deg, #fbfaff 0%, #f4f7ff 55%, #f8fbff 100%);
}

.page-shell {
    width: min(1400px, calc(100% - 24px));
    margin: 12px auto 24px;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 14px;
    padding: 18px 20px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(59, 42, 129, 0.95), rgba(111, 76, 255, 0.92)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
    color: #fff;
    box-shadow: 0 18px 40px rgba(61, 40, 140, 0.18);
    position: relative;
    overflow: hidden;
}

.hero-panel::before,
.hero-panel::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.hero-panel::before {
    width: 200px;
    height: 200px;
    right: -60px;
    top: -60px;
    background: rgba(255, 255, 255, 0.08);
}

.hero-panel::after {
    width: 140px;
    height: 140px;
    left: 45%;
    bottom: -80px;
    background: rgba(255, 143, 171, 0.18);
}

.hero-copy,
.hero-profile {
    position: relative;
    z-index: 1;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.brand-logo {
    width: 18px;
    height: 18px;
    display: block;
}

.hero-copy h1 {
    margin: 12px 0 8px;
    font-size: clamp(1.65rem, 2.6vw, 2.45rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.hero-copy p {
    max-width: 620px;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(238, 238, 255, 0.92);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(245, 244, 255, 0.94);
    font-size: 12px;
}

.hero-profile {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 12px;
}

.profile-card {
    width: 100%;
    min-height: auto;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(18px);
    display: grid;
    gap: 10px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.12));
}

.profile-card h2 {
    margin: 0;
    font-size: 22px;
}

.profile-card p {
    margin: 2px 0 0;
    font-size: 13px;
    color: rgba(233, 229, 255, 0.88);
}

.profile-status {
    display: grid;
    gap: 10px;
}

.status-pill {
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-good {
    background: rgba(34, 197, 94, 0.18);
    color: #dcfce7;
}

.status-watch {
    background: rgba(245, 158, 11, 0.18);
    color: #fef3c7;
}

.status-alert {
    background: rgba(239, 68, 68, 0.18);
    color: #fee2e2;
}

.logout-link {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.glass-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px;
    box-shadow: 0 10px 24px rgba(43, 38, 95, 0.06);
    backdrop-filter: blur(16px);
}

.control-panel {
    grid-column: 1 / -1;
}

.summary-strip {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-self: start;
    align-items: start;
}

.report-brief-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.brief-card {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(91, 61, 245, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 246, 255, 0.92));
    display: grid;
    gap: 8px;
    min-height: 94px;
}

.brief-label {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7380a6;
}

.brief-card strong {
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
}

.wide {
    grid-column: span 8;
}

.full-span {
    grid-column: 1 / -1;
}

.chart-panel {
    min-height: 280px;
}

.chart-panel:not(.wide) {
    grid-column: span 4;
}

.narrative-panel,
.timeline-panel,
.raw-panel {
    grid-column: span 4;
}

.timeline-panel.wide,
.raw-panel.wide {
    grid-column: span 8;
}

.narrative-panel,
.timeline-panel {
    min-height: 760px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.panel-header-actions {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #7c84ad;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.panel-caption,
.panel-subtitle,
.source-summary {
    font-size: 13px;
    color: var(--muted);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.preset-btn {
    border: 1px solid rgba(91, 61, 245, 0.12);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 12px;
    text-align: left;
    display: grid;
    gap: 6px;
    cursor: pointer;
    transition: 0.2s ease;
}

.preset-btn strong {
    font-size: 14px;
}

.preset-btn span {
    color: var(--muted);
    font-size: 12px;
}

.preset-btn:hover,
.preset-btn.active {
    transform: translateY(-1px);
    border-color: rgba(91, 61, 245, 0.28);
    box-shadow: 0 14px 30px rgba(91, 61, 245, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 237, 255, 0.94));
}

.upload-zone {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px dashed rgba(91, 61, 245, 0.24);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(240, 237, 255, 0.8), rgba(255, 255, 255, 0.72));
    cursor: pointer;
    margin-bottom: 10px;
}

.upload-zone h4 {
    margin: 0 0 6px;
    font-size: 14px;
}

.upload-zone p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

.upload-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #ede9fe, #fce7f3);
    font-size: 20px;
    color: var(--accent);
}

.sample-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
}

.sample-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.action-btn-inline {
    padding: 8px 12px;
    margin-left: auto;
}

.paste-panel {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(91, 61, 245, 0.1);
    padding: 12px;
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
}

.paste-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
}

.paste-toolbar select,
.paste-panel textarea {
    width: 100%;
    border: 1px solid rgba(111, 118, 154, 0.18);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 12px 14px;
    color: var(--ink);
    font: inherit;
}

.paste-toolbar select {
    max-width: 180px;
}

.paste-panel textarea {
    min-height: 92px;
    resize: vertical;
    line-height: 1.5;
}

.paste-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-btn {
    border: 0;
    border-radius: 14px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.action-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex: 0 0 auto;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

.action-btn.subtle {
    background: rgba(91, 61, 245, 0.08);
    color: var(--accent);
}

.action-btn:hover {
    transform: translateY(-1px);
}

.source-box {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(250, 249, 255, 0.82);
    border: 1px solid rgba(91, 61, 245, 0.08);
}

.source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.source-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(91, 61, 245, 0.08);
    color: var(--accent);
}

.scope-switch {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: rgba(91, 61, 245, 0.08);
    gap: 4px;
}

.scope-btn {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    padding: 6px 12px;
    font-weight: 700;
    cursor: pointer;
}

.scope-btn.active {
    background: #fff;
    color: var(--accent);
    box-shadow: 0 8px 18px rgba(91, 61, 245, 0.14);
}

.metric-card {
    padding: 16px;
    border-radius: 20px;
    color: var(--ink);
    min-height: 0;
    display: grid;
    gap: 6px;
    align-content: start;
    border: 1px solid rgba(255, 255, 255, 0.36);
    box-shadow: 0 8px 20px rgba(60, 47, 112, 0.05);
}

.metric-card.good {
    background: #edf8f2;
}

.metric-card.sky {
    background: #eef4fb;
}

.metric-card.warm {
    background: #fff7e7;
}

.metric-card.rose {
    background: #fdf1f4;
}

.metric-label {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7380a6;
}

.metric-value {
    font-size: clamp(1.8rem, 2.8vw, 2.5rem);
    font-weight: 800;
    line-height: 1;
}

.metric-note {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.chart-wrap {
    position: relative;
    min-height: 210px;
}

.chart-wrap.tall {
    min-height: 240px;
}

.narrative-stack {
    display: grid;
    gap: 14px;
    min-height: calc(100% - 52px);
    align-content: stretch;
    grid-template-rows: minmax(170px, 1.2fr) minmax(136px, 0.85fr) minmax(150px, 1fr);
}

.narrative-card {
    border-radius: 18px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(91, 61, 245, 0.08);
    height: 100%;
}

.narrative-card.primary {
    background: linear-gradient(135deg, rgba(91, 61, 245, 0.9), rgba(168, 85, 247, 0.82));
    color: #fff;
}

.narrative-tag {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(91, 61, 245, 0.08);
    color: var(--accent);
    font-weight: 700;
}

.narrative-card.primary .narrative-tag {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.narrative-card p {
    margin: 0;
    line-height: 1.8;
}

.bullet-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.75;
    color: var(--ink);
}

.timeline-list {
    position: relative;
    display: grid;
    gap: 10px;
    max-height: 692px;
    overflow: auto;
    padding-right: 6px;
}

.timeline-item {
    position: relative;
    padding: 12px 14px 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(91, 61, 245, 0.08);
    overflow: hidden;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.timeline-item-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.timeline-item-title {
    font-weight: 800;
    font-size: 14px;
}

.timeline-item-time {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.timeline-item-body {
    color: #425072;
    line-height: 1.65;
    font-size: 13px;
}

.timeline-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
}

.timeline-list::-webkit-scrollbar {
    width: 8px;
}

.timeline-list::-webkit-scrollbar-thumb {
    background: rgba(91, 61, 245, 0.22);
    border-radius: 999px;
}

.timeline-list::-webkit-scrollbar-track {
    background: rgba(91, 61, 245, 0.06);
    border-radius: 999px;
}

.timeline-tag.alert {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.timeline-tag.event {
    background: rgba(91, 61, 245, 0.1);
    color: var(--accent);
}

.raw-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.raw-panel {
    display: none;
}

.collaboration-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.collab-card {
    border-radius: 24px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(91, 61, 245, 0.08);
    display: grid;
    gap: 14px;
}

.collab-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.collab-card-head h4 {
    margin: 0;
    font-size: 17px;
}

.mini-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(91, 61, 245, 0.08);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.mini-note {
    font-size: 12px;
    color: var(--muted);
}

.task-list {
    display: grid;
    gap: 12px;
}

.task-item {
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(245, 244, 255, 0.9), rgba(255, 255, 255, 0.92));
    border: 1px solid rgba(91, 61, 245, 0.08);
    display: grid;
    gap: 8px;
}

.task-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.task-title {
    font-weight: 700;
}

.task-meta {
    font-size: 12px;
    color: var(--muted);
}

.task-progress {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    overflow: hidden;
}

.task-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #7c6cff, #34d399);
}

.feedback-input,
.setting-input {
    width: 100%;
    border: 1px solid rgba(111, 118, 154, 0.18);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 12px 14px;
    color: var(--ink);
    font: inherit;
}

.feedback-input {
    min-height: 150px;
    resize: vertical;
    line-height: 1.7;
}

.setting-row {
    display: grid;
    gap: 10px;
}

.setting-row label,
.toggle-row {
    font-size: 14px;
    color: var(--ink);
}

.range-row .range-meta {
    display: grid;
    gap: 8px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.digest-summary {
    padding: 14px;
    border-radius: 18px;
    background: rgba(91, 61, 245, 0.06);
    color: #425072;
    line-height: 1.7;
    font-size: 13px;
}

.raw-grid h4 {
    margin: 0 0 10px;
    font-size: 14px;
}

.raw-block {
    min-height: 150px;
    max-height: 220px;
    overflow: auto;
    padding: 16px;
    margin: 0;
    border-radius: 20px;
    background: #12152a;
    color: #dce4ff;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    max-width: 320px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(18, 21, 42, 0.92);
    color: #fff;
    box-shadow: 0 24px 40px rgba(18, 21, 42, 0.26);
    z-index: 60;
}

.hidden {
    display: none !important;
}

@media (max-width: 1180px) {
    .content-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .control-panel,
    .wide,
    .narrative-panel,
    .timeline-panel,
    .raw-panel,
    .timeline-panel.wide,
    .raw-panel.wide {
        grid-column: span 1;
    }

    .summary-strip {
        grid-column: span 1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-brief-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .narrative-panel,
    .timeline-panel {
        min-height: 0;
    }

    .narrative-stack {
        min-height: 0;
        grid-template-rows: none;
    }

    .timeline-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .preset-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .page-shell {
        width: min(100% - 20px, 1440px);
        margin: 10px auto 24px;
    }

    .hero-panel {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .hero-profile {
        justify-content: stretch;
    }

    .summary-strip {
        grid-template-columns: 1fr;
    }

    .report-brief-grid,
    .collaboration-grid,
    .raw-grid {
        grid-template-columns: 1fr;
    }
}
