* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #1a1d2e;
    --bg-tertiary: #24283b;
    --bg-card: #50505e;
    --gradient-primary: linear-gradient(135deg, #FFB75E 0%, #ED8F03 100%);
    --gradient-btn: linear-gradient(135deg, #FFB75E 0%, #ED8F03 100%);
    --text-primary: #e4e7f1;
    --text-secondary: #a0a8c1;
    --accent-purple: #F5A623;
    --border-color: rgba(245, 166, 35, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    body {
        padding: 12px;
    }
    .container {
        padding: 0 12px;
    }
}

/* ═══════════════════════════════════════
   Header
═══════════════════════════════════════ */
.site-header {
    text-align: center;
    padding: 20px 0 30px;
    position: relative;
}

.header-auth {
    position: absolute;
    right: 0;
    top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 600px) {
    .header-auth {
        position: absolute;
        right: 0;
        top: 0;
        justify-content: flex-end;
        margin-bottom: 0;
    }
}

.header-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.header-title {
    font-size: 2.2em;
    color: #F5A623;
    font-weight: bold;
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .header-title {
        font-size: 1.8em;
    }
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: bold;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s;
}

.header-btn-login {
    background: var(--gradient-primary);
    color: #1a1a2e;
}

.header-btn-setting {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-secondary);
}

.header-btn-setting:hover {
    background: rgba(255,255,255,0.14);
}

/* ═══════════════════════════════════════
   Main card
═══════════════════════════════════════ */
.page-main {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .page-main {
        padding: 20px;
        border-radius: 12px;
    }
}

/* ═══════════════════════════════════════
   Input section
═══════════════════════════════════════ */
.input-section {
    /* no extra styles needed */
}

.field-label {
    display: block;
    font-size: 17px;
    font-weight: bold;
    color: #000;
    margin-bottom: 8px;
}

.field-label::before {
    content: '';
    /* label styling */
}

#conversation-input {
    width: 100%;
    height: 200px;
    padding: 14px;
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    margin-bottom: 6px;
    box-sizing: border-box;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: border-color 0.2s;
    line-height: 1.6;
}

#conversation-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

#conversation-input::placeholder {
    color: var(--text-secondary);
    font-size: 13.5px;
}

@media (max-width: 600px) {
    #conversation-input {
        height: 150px;
        font-size: 16px;
    }
}

.char-count {
    text-align: right;
    color: #888;
    font-size: 12px;
    margin-bottom: 20px;
}

#context-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: border-color 0.2s;
    line-height: 1.6;
}

#context-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

#context-input::placeholder {
    color: var(--text-secondary);
    font-size: 13px;
}

@media (max-width: 600px) {
    #context-input {
        font-size: 16px;
    }
}

.primary-btn {
    width: 100%;
    padding: 15px;
    background: var(--gradient-btn);
    color: #1a1a2e;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 1px;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 183, 94, 0.4);
}

.primary-btn:disabled {
    background: rgba(255, 183, 94, 0.3);
    color: rgba(26,26,46,0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.upload-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 12px;
    flex: 1;
    min-width: 200px;
}

.upload-btn-inline {
    padding: 6px 16px;
    background: transparent;
    color: var(--accent-purple);
    border: 1px solid var(--accent-purple);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.upload-btn-inline:hover {
    background: var(--accent-purple);
    color: #fff;
}

.upload-btn-inline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════
   Tabs
═══════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: inherit;
}

.tab.active {
    background: var(--gradient-primary);
    color: #1a1a2e;
    border-color: transparent;
    font-weight: bold;
}

.tab:hover:not(.active) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ═══════════════════════════════════════
   Results section
═══════════════════════════════════════ */
.results-section {
    margin-top: 32px;
}

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.result-header h2 {
    color: var(--accent-purple);
    font-size: 1.1rem;
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.result-btn {
    padding: 6px 14px;
    background: rgba(245, 166, 35, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(245, 166, 35, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
}

.result-btn:hover {
    background: rgba(245, 166, 35, 0.25);
    border-color: var(--accent-purple);
}

.ai-result {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    background: #1a1d2e;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* AI structured result styles */
.result-title {
    font-size: 1.4em;
    color: #e8a020;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(232,160,32,0.4);
    font-weight: bold;
}

.result-sections h2 {
    font-size: 1.15em;
    color: var(--accent-purple);
    margin: 22px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.result-sections h3 {
    font-size: 1.05em;
    color: var(--text-primary);
    margin: 16px 0 8px;
    font-weight: 600;
}

.result-sections p {
    margin-bottom: 10px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.result-sections ul, .result-sections ol {
    margin: 10px 0 14px 22px;
}

.result-sections ul {
    list-style: disc;
}

.result-sections ol {
    list-style: decimal;
}

.result-sections ul li, .result-sections ol li {
    margin-bottom: 7px;
    color: #c0c0d8;
    line-height: 1.65;
}

.result-sections blockquote {
    background: rgba(245, 166, 35, 0.08);
    border-left: 3px solid var(--accent-purple);
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.result-raw {
    font-size: 14px;
    line-height: 1.8;
    color: #c0c0d8;
    white-space: pre-wrap;
}

.markdown-body {
    font-size: 15px;
    line-height: 2;
    color: #c0c0d8;
}

.markdown-body h2 {
    font-size: 1.15em;
    color: #F5A623;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(245,166,35,0.3);
    font-weight: bold;
}

.markdown-body strong {
    color: #fff;
    font-weight: bold;
}

.markdown-body p {
    margin: 5px 0;
}

.markdown-body .item-title {
    margin: 12px 0 2px;
    color: #e0d8ff;
    font-weight: bold;
}

.markdown-body .item-body {
    margin: 2px 0 8px;
    padding-left: 1em;
    color: #c0c0d8;
}

.markdown-body .special-label {
    margin: 10px 0 3px;
    color: #b8b8d8;
    font-size: 0.95em;
}

/* ═══════════════════════════════════════
   Info card (personal center)
═══════════════════════════════════════ */
.info-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.info-value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.coins-value {
    color: var(--accent-purple);
    font-size: 18px;
    font-weight: bold;
}

/* ═══════════════════════════════════════
   Auth form styles
═══════════════════════════════════════ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-sizing: border-box;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-btn);
    color: #1a1a2e;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    margin-top: 8px;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 183, 94, 0.4);
}

.auth-btn:disabled {
    background: rgba(255, 183, 94, 0.3);
    color: rgba(26,26,46,0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error-msg {
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.error-msg.show {
    display: block;
}

.success-msg {
    color: #10b981;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.success-msg.show {
    display: block;
}

.username-hint {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

/* ═══════════════════════════════════════
   Sessions list (personal center)
═══════════════════════════════════════ */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    color: #aaa;
    font-size: 13px;
    transition: color 0.2s;
}

.session-item:hover {
    color: var(--accent-purple);
}

.session-item-id {
    color: var(--accent-purple);
    flex-shrink: 0;
    font-weight: 500;
}

.session-item-time {
    color: var(--text-secondary);
    font-size: 0.85em;
}

.session-item-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   Beans badge (coins display)
═══════════════════════════════════════ */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.beans-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(245, 166, 35, 0.1);
    border: 1px solid rgba(245, 166, 35, 0.2);
    border-radius: 20px;
    padding: 0.35rem 0.5rem 0.35rem 0.8rem;
    gap: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    transition: var(--transition);
}

.beans-badge:hover {
    background: rgba(245, 166, 35, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 166, 35, 0.15);
}

.beans-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.beans-count {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'Inter', monospace;
    min-width: 2ch;
    text-align: center;
}

.btn-recharge-sm {
    background: var(--gradient-btn);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.4rem 1rem;
    color: #1a1a2e;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(255, 183, 94, 0.3);
}

.btn-recharge-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 183, 94, 0.5);
    filter: brightness(1.1);
}

/* ═══════════════════════════════════════
   Module cards (diagnosis result)
═══════════════════════════════════════ */
.module-card {
    background: #1e2133;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.module-card:hover {
    border-color: rgba(245,166,35,0.2);
}
.module-card.action-zone {
    border-color: rgba(245,166,35,0.25);
    background: #1f2235;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.module-header:hover {
    background: rgba(255,255,255,0.03);
}
.module-header:active {
    background: rgba(255,255,255,0.06);
}

.module-arrow {
    font-size: 10px;
    color: #888;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.module-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #e4e7f1;
}

.module-copy-btn {
    padding: 4px 12px;
    background: rgba(245,166,35,0.15);
    border: 1px solid rgba(245,166,35,0.3);
    border-radius: 6px;
    color: #F5A623;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    flex-shrink: 0;
}
.module-copy-btn:hover {
    background: rgba(245,166,35,0.25);
}
.module-copy-btn:active {
    transform: scale(0.96);
}

.module-body {
    padding: 0 16px 16px;
    font-size: 14px;
    line-height: 1.8;
    color: #c0c0d8;
}
.module-body p {
    margin: 4px 0;
    color: #c0c0d8;
}
.module-body ul {
    margin: 6px 0 10px 18px;
    list-style: disc;
}
.module-body ul li {
    margin-bottom: 4px;
    color: #b0b0c8;
    line-height: 1.65;
}
.module-body h4 {
    font-size: 14px;
    color: #e4e7f1;
    margin: 12px 0 4px;
}
.module-body strong {
    color: #fff;
    font-weight: 600;
}

/* 立即行动区 */
.action-zone-wrapper {
    border: 2px solid rgba(245,166,35,0.3);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
}
.action-zone-label {
    background: linear-gradient(135deg, rgba(245,166,35,0.2), rgba(237,143,3,0.15));
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #F5A623;
    text-align: center;
    letter-spacing: 2px;
}
.action-zone-wrapper .module-card {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.action-zone-wrapper .module-card:last-child {
    border-bottom: none;
}

/* 客户回复场景 */
.reply-scenario {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

/* 话术块 */
.script-block {
    background: rgba(245,166,35,0.06);
    border-left: 3px solid rgba(245,166,35,0.4);
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    line-height: 1.7;
    color: #e4e7f1;
    position: relative;
}
.script-copy-inline {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(245,166,35,0.2);
    border: 1px solid rgba(245,166,35,0.3);
    border-radius: 4px;
    color: #F5A623;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 8px;
}
.script-copy-inline:hover {
    background: rgba(245,166,35,0.35);
}

@media (max-width: 600px) {
    .module-header {
        padding: 16px 14px;
    }
    .module-title {
        font-size: 14px;
    }
    .module-body {
        padding: 0 14px 14px;
        font-size: 13px;
    }
    .module-copy-btn {
        padding: 6px 14px;
        font-size: 13px;
    }
    .script-copy-inline {
        top: 4px;
        right: 4px;
        padding: 4px 10px;
    }
}
