﻿:root {
            color-scheme: light;
            --bg: #f6f3ec;
            --panel: rgba(255, 255, 255, 0.88);
            --panel-strong: #ffffff;
            --ink: #15221d;
            --muted: #5a6961;
            --line: rgba(21, 34, 29, 0.12);
            --accent: #15795e;
            --accent-dark: #0f614c;
            --accent-soft: rgba(21, 121, 94, 0.1);
            --warm: #f0a84a;
            --warm-soft: rgba(240, 168, 74, 0.14);
            --alert: #b35d17;
            --danger: #b83838;
            --danger-soft: rgba(184, 56, 56, 0.12);
            --shadow: 0 24px 60px rgba(21, 34, 29, 0.1);
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            min-height: 100vh;
            font-family: "Trebuchet MS", "Segoe UI", sans-serif;
            color: var(--ink);
            background:
                radial-gradient(circle at top left, rgba(21, 121, 94, 0.18), transparent 28%),
                radial-gradient(circle at top right, rgba(240, 168, 74, 0.18), transparent 24%),
                radial-gradient(circle at bottom right, rgba(21, 121, 94, 0.1), transparent 28%),
                linear-gradient(180deg, #fcfaf6 0%, var(--bg) 100%);
        }

        button,
        textarea,
        select {
            font: inherit;
        }

        .page {
            width: min(1180px, calc(100% - 28px));
            margin: 0 auto;
            padding: 22px 0 28px;
        }

        .shell {
            display: grid;
            grid-template-columns: 320px 1fr;
            gap: 18px;
            align-items: start;
        }

        .panel {
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.84) 100%);
            border: 1px solid var(--line);
            border-radius: 28px;
            box-shadow: var(--shadow);
            backdrop-filter: blur(14px);
        }

        .sidebar {
            padding: 24px;
            position: sticky;
            top: 22px;
            overflow: hidden;
        }

        .sidebar::before {
            content: "";
            position: absolute;
            top: -40px;
            left: -36px;
            width: 210px;
            height: 210px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(21, 121, 94, 0.12), transparent 68%);
            pointer-events: none;
        }

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

        .brand {
            font-size: 1.25rem;
            font-weight: 700;
        }

        .back-link {
            color: var(--muted);
            text-decoration: none;
            font-size: 0.95rem;
        }

        .back-link:hover {
            color: var(--ink);
        }

        .sidebar h1 {
            margin-top: 18px;
            font-size: 2rem;
            line-height: 1;
        }

        .sidebar p {
            margin-top: 14px;
            color: var(--muted);
            line-height: 1.7;
        }

        .status-block,
        .note-block,
        .prompt-block {
            margin-top: 18px;
            padding: 18px;
            border-radius: 22px;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 251, 249, 0.92) 100%);
            border: 1px solid var(--line);
        }

        .status-label {
            display: inline-block;
            padding: 6px 10px;
            border-radius: 999px;
            background: var(--accent-soft);
            color: var(--accent-dark);
            font-size: 0.82rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .status-message {
            margin-top: 10px;
            color: var(--muted);
            line-height: 1.6;
        }

        .status-message.error {
            color: var(--danger);
        }

        .future-button {
            width: 100%;
            margin-top: 14px;
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px dashed rgba(21, 34, 29, 0.2);
            background: rgba(21, 121, 94, 0.05);
            color: var(--muted);
            font-weight: 700;
            cursor: not-allowed;
        }

        .prompt-list {
            display: grid;
            gap: 10px;
            margin-top: 14px;
        }

        .prompt-chip {
            width: 100%;
            text-align: left;
            border: 1px solid var(--line);
            background: #fff;
            border-radius: 16px;
            padding: 14px 15px;
            cursor: pointer;
            transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
        }

        .prompt-chip:hover {
            transform: translateY(-1px);
            border-color: rgba(21, 121, 94, 0.28);
            box-shadow: 0 12px 24px rgba(21, 34, 29, 0.08);
        }

        .prompt-chip strong {
            display: block;
            margin-bottom: 4px;
            font-size: 0.95rem;
        }

        .prompt-chip span {
            color: var(--muted);
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .chat-panel {
            display: flex;
            flex-direction: column;
            min-height: calc(100vh - 44px);
        }

        .chat-header {
            display: flex;
            justify-content: space-between;
            gap: 18px;
            align-items: center;
            padding: 22px 24px;
            border-bottom: 1px solid var(--line);
            background:
                radial-gradient(circle at top right, rgba(240, 168, 74, 0.12), transparent 28%),
                linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 252, 251, 0.84) 100%);
            border-top-left-radius: 28px;
            border-top-right-radius: 28px;
        }

        .chat-header h2 {
            font-size: 1.35rem;
        }

        .chat-header p {
            margin-top: 6px;
            color: var(--muted);
        }

        .status-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 12px;
            border-radius: 999px;
            background: linear-gradient(135deg, rgba(21, 121, 94, 0.08), rgba(240, 168, 74, 0.12));
            border: 1px solid var(--line);
            color: var(--muted);
            font-size: 0.9rem;
            white-space: nowrap;
        }

        .chat-area {
            flex: 1;
            padding: 22px 24px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .empty-state {
            border: 1px dashed rgba(21, 34, 29, 0.18);
            background: rgba(255, 255, 255, 0.74);
            border-radius: 24px;
            padding: 28px;
        }

        .empty-state h3 {
            font-size: 1.35rem;
        }

        .empty-state p {
            margin-top: 10px;
            color: var(--muted);
            line-height: 1.7;
            max-width: 60ch;
        }

        .message {
            display: flex;
        }

        .message.user {
            justify-content: flex-end;
        }

        .message.assistant,
        .message.system {
            justify-content: flex-start;
        }

        .message-bubble {
            max-width: min(760px, 88%);
            padding: 16px 18px;
            border-radius: 22px;
            border: 1px solid var(--line);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 249, 0.96) 100%);
            box-shadow: 0 14px 32px rgba(21, 34, 29, 0.06);
            line-height: 1.7;
        }

        .message.user .message-bubble {
            background: linear-gradient(135deg, #15795e 0%, #1e8f70 100%);
            color: #fff;
            border: none;
            border-bottom-right-radius: 8px;
        }

        .message.assistant .message-bubble {
            border-bottom-left-radius: 8px;
        }

        .message.system .message-bubble {
            border-bottom-left-radius: 8px;
            background: rgba(255, 255, 255, 0.78);
        }

        .result-grid {
            display: grid;
            gap: 14px;
        }

        .result-top {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap;
        }

        .result-title {
            font-size: 1.06rem;
            font-weight: 700;
            letter-spacing: 0.01em;
        }

        .urgency-badge {
            padding: 6px 10px;
            border-radius: 999px;
            font-size: 0.82rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .urgency-routine {
            background: var(--accent-soft);
            color: var(--accent-dark);
        }

        .urgency-soon {
            background: rgba(179, 93, 23, 0.12);
            color: var(--alert);
        }

        .urgency-urgent {
            background: var(--danger-soft);
            color: var(--danger);
        }

        .result-section {
            padding-top: 12px;
            border-top: 1px solid rgba(21, 34, 29, 0.08);
        }

        .result-section h4 {
            font-size: 0.92rem;
            margin-bottom: 6px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }

        .result-section p {
            color: var(--ink);
        }

        .retinal-meta-list {
            display: grid;
            gap: 8px;
        }

        .retinal-subcard {
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px solid rgba(21, 34, 29, 0.08);
            background: rgba(21, 121, 94, 0.04);
        }

        .retinal-subtitle {
            margin-bottom: 6px;
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--accent-dark);
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .retinal-note {
            color: var(--muted);
        }

        .report-lines {
            display: grid;
            gap: 8px;
        }

        .report-probability-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

        .report-probability-chip {
            padding: 8px 11px;
            border-radius: 999px;
            background: linear-gradient(135deg, rgba(21, 121, 94, 0.08), rgba(240, 168, 74, 0.12));
            border: 1px solid rgba(21, 121, 94, 0.16);
            color: var(--accent-dark);
            font-size: 0.84rem;
            font-weight: 700;
        }

        .processing-bubble {
            border: 1px solid rgba(21, 121, 94, 0.16);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 248, 0.96) 100%);
        }

        .processing-header {
            display: grid;
            gap: 6px;
        }

        .processing-title {
            font-size: 0.96rem;
            font-weight: 700;
            color: var(--accent-dark);
        }

        .processing-current {
            color: var(--muted);
            line-height: 1.6;
        }

        .processing-progress-track {
            margin-top: 12px;
            height: 12px;
            border-radius: 999px;
            background: rgba(21, 121, 94, 0.08);
            overflow: hidden;
            border: 1px solid rgba(21, 121, 94, 0.08);
        }

        .processing-progress-fill {
            height: 100%;
            border-radius: inherit;
            background: linear-gradient(90deg, var(--accent) 0%, var(--warm) 100%);
            box-shadow: 0 0 18px rgba(21, 121, 94, 0.18);
            transition: width 0.45s ease;
        }

        .processing-steps {
            display: grid;
            gap: 8px;
            margin-top: 14px;
        }

        .processing-step {
            padding: 10px 12px;
            border-radius: 14px;
            background: rgba(21, 121, 94, 0.04);
            border: 1px solid rgba(21, 121, 94, 0.08);
            color: var(--muted);
            font-size: 0.9rem;
        }

        .processing-step.active {
            background: linear-gradient(135deg, rgba(21, 121, 94, 0.12), rgba(240, 168, 74, 0.12));
            border-color: rgba(21, 121, 94, 0.22);
            color: var(--ink);
            transform: translateX(2px);
        }

        .processing-step.complete {
            background: rgba(21, 121, 94, 0.08);
            border-color: rgba(21, 121, 94, 0.14);
            color: var(--accent-dark);
        }

        .loading-row {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            color: var(--muted);
        }

        .loading-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: var(--accent);
            animation: pulse 1s infinite ease-in-out;
        }

        .loading-dot:nth-child(2) {
            animation-delay: 0.16s;
        }

        .loading-dot:nth-child(3) {
            animation-delay: 0.32s;
        }

        @keyframes pulse {
            0%, 80%, 100% {
                transform: scale(0.65);
                opacity: 0.45;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .composer {
            padding: 20px 24px 24px;
            border-top: 1px solid var(--line);
            background:
                radial-gradient(circle at top right, rgba(240, 168, 74, 0.12), transparent 26%),
                linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(249, 251, 250, 0.84) 100%);
            border-bottom-left-radius: 28px;
            border-bottom-right-radius: 28px;
        }

        .composer-row {
            display: flex;
            gap: 12px;
            align-items: flex-start;
        }

        .input-stack {
            flex: 1;
            display: grid;
            gap: 12px;
        }

        .toolbar {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }

        .toolbar label {
            font-size: 0.92rem;
            color: var(--muted);
        }

        select {
            margin-left: 8px;
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 10px 12px;
            background: linear-gradient(180deg, #ffffff 0%, #f7faf8 100%);
            color: var(--ink);
        }

        textarea {
            width: 100%;
            min-height: 120px;
            resize: vertical;
            border: 1px solid var(--line);
            border-radius: 18px;
            padding: 16px;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 249, 0.96) 100%);
            color: var(--ink);
            line-height: 1.6;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
        }

        textarea:focus,
        select:focus {
            outline: none;
            border-color: rgba(21, 121, 94, 0.48);
            box-shadow: 0 0 0 4px rgba(21, 121, 94, 0.08);
        }

        .helper-row {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
            color: var(--muted);
            font-size: 0.9rem;
        }

        .upload-panel {
            display: grid;
            gap: 10px;
            padding: 14px;
            border-radius: 18px;
            border: 1px dashed rgba(21, 34, 29, 0.18);
            background: linear-gradient(135deg, rgba(21, 121, 94, 0.06), rgba(240, 168, 74, 0.08));
        }

        .upload-panel[hidden] {
            display: none;
        }

        .upload-header {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            align-items: center;
            flex-wrap: wrap;
        }

        .upload-copy strong {
            display: block;
            font-size: 0.95rem;
            margin-bottom: 4px;
        }

        .upload-copy span {
            color: var(--muted);
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .upload-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 14px;
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink);
            padding: 11px 14px;
            cursor: pointer;
            font-weight: 700;
            transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
        }

        .upload-button:hover {
            transform: translateY(-1px);
            border-color: rgba(21, 121, 94, 0.28);
            box-shadow: 0 12px 24px rgba(21, 34, 29, 0.08);
        }

        .upload-status {
            color: var(--muted);
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .upload-preview {
            display: flex;
            justify-content: flex-start;
        }

        .upload-preview[hidden] {
            display: none;
        }

        .upload-preview-image {
            display: block;
            width: min(100%, 280px);
            max-height: 220px;
            object-fit: cover;
            border-radius: 18px;
            border: 1px solid rgba(21, 34, 29, 0.12);
            background: rgba(255, 255, 255, 0.8);
            box-shadow: 0 12px 24px rgba(21, 34, 29, 0.08);
        }

        .file-input {
            display: none;
        }

        .message-attachment-wrap {
            margin-top: 12px;
        }

        .message-attachment-image {
            display: block;
            width: min(100%, 280px);
            max-height: 280px;
            object-fit: cover;
            border-radius: 18px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background: rgba(255, 255, 255, 0.18);
        }

        .attachment-chip {
            display: inline-flex;
            align-items: center;
            margin-top: 10px;
            padding: 8px 10px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.18);
            color: rgba(255, 255, 255, 0.95);
            font-size: 0.84rem;
            border: 1px solid rgba(255, 255, 255, 0.18);
        }

        .send-button {
            border: none;
            border-radius: 18px;
            min-width: 132px;
            padding: 16px 18px;
            background: linear-gradient(135deg, var(--accent) 0%, #1e8f70 55%, var(--warm) 100%);
            color: #fff;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
            box-shadow: 0 16px 28px rgba(21, 121, 94, 0.18);
        }

        .send-button:hover:not(:disabled) {
            transform: translateY(-1px);
            background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 58%, var(--warm) 100%);
            box-shadow: 0 18px 34px rgba(21, 34, 29, 0.16);
        }

        .send-button:disabled {
            cursor: not-allowed;
            opacity: 0.6;
        }

        .error-banner {
            display: none;
            margin-top: 14px;
            padding: 12px 14px;
            border-radius: 14px;
            border: 1px solid rgba(184, 56, 56, 0.18);
            background: rgba(255, 244, 244, 0.9);
            color: var(--danger);
        }

        @media (max-width: 980px) {
            .shell {
                grid-template-columns: 1fr;
            }

            .sidebar {
                position: static;
            }

            .chat-panel {
                min-height: auto;
            }
        }

        @media (max-width: 640px) {
            .page {
                width: min(100% - 18px, 1180px);
                padding-top: 14px;
            }

            .sidebar,
            .chat-header,
            .chat-area,
            .composer {
                padding-left: 18px;
                padding-right: 18px;
            }

            .composer-row {
                flex-direction: column;
            }

            .send-button {
                width: 100%;
            }

            .message-bubble {
                max-width: 100%;
            }
        }

