/* ========================================
   AI差旅报销智能助手 - 样式表
   ======================================== */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667EEA;
    --primary-dark: #5568D3;
    --primary-light: #EEF0F8;
    --accent: #764BA2;
    --success: #52C41A;
    --success-dark: #389E0D;
    --warning: #FA8C16;
    --danger: #FF4D4F;
    --text-primary: #1A1A1A;
    --text-secondary: #4A4A4A;
    --text-muted: #8C8C8C;
    --border: #E8E8E8;
    --border-light: #F0F0F0;
    --bg-main: #F5F7FA;
    --bg-white: #FFFFFF;
    --bg-hover: #F8F9FA;
    --gradient-primary: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    --gradient-soft: linear-gradient(135deg, #EEF0F8 0%, #E8F4F8 100%);
    --gradient-pink: linear-gradient(135deg, #EFD9E2 0%, #EEF0F8 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* === Layout === */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* === Header === */
.header {
    background: var(--bg-white);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
}

.logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-dept-badge {
    font-size: 12px;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 10px;
    font-weight: 500;
}

/* === Main Content === */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* === Chat Container === */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #D9D9D9;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #BFBFBF;
}

/* === Messages === */
.message {
    display: flex;
    gap: 10px;
    max-width: 720px;
    animation: msgSlideIn 0.3s ease-out;
}

@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-avatar {
    background: var(--gradient-primary);
    color: white;
}

.user-avatar {
    background: var(--gradient-pink);
    color: var(--primary);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 620px;
    min-width: 0;
}

.message-text {
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    font-size: 14px;
    word-break: break-word;
    white-space: pre-line;
}

.ai-message .message-text {
    background: var(--gradient-soft);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}

.user-message .message-text {
    background: var(--gradient-pink);
    color: var(--text-primary);
    border-top-right-radius: 4px;
}

/* === AI Tag === */
.ai-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--gradient-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.25);
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* === Match Reason Tag === */
.match-reason {
    display: inline-block;
    background: #F0F5FF;
    color: var(--primary);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    font-weight: 500;
}

/* === Quick Action Buttons (in chat) === */
.message-content .chat-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.message-content .chat-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-white);
    color: var(--text-primary);
    text-align: left;
}

.message-content .chat-action-btn.recommended {
    background: var(--gradient-soft);
    border-color: var(--primary);
    position: relative;
}

.message-content .chat-action-btn.recommended::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.ai-recommendation-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--gradient-primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: auto;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.25);
    letter-spacing: 0.5px;
}

.third-level-countdown {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--gradient-soft);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
}

.message-content .chat-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(4px);
}

.message-content .chat-action-btn:active {
    transform: translateX(2px);
}

.message-content .chat-action-btn svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.message-content .chat-action-btn:hover svg {
    color: var(--primary);
}

/* === Trip Table === */
.trip-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: 13px;
}

.trip-table th,
.trip-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.trip-table th {
    background: var(--bg-main);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.trip-table tbody tr {
    transition: background 0.15s;
    cursor: pointer;
}

.trip-table tbody tr:hover {
    background: #F0F5FF;
}

.trip-table tbody tr.table-row-selected {
    background: var(--primary-light);
}

.trip-table tbody tr:last-child td {
    border-bottom: none;
}

/* === Recommendation Cards === */
.recommendation-card {
    background: var(--bg-hover);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recommendation-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.12);
    transform: translateY(-1px);
}

.recommendation-card.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.recommendation-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.recommendation-info {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.recommendation-match {
    display: inline-block;
    padding: 1px 6px;
    background: var(--success);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.recommendation-auto-selected {
    display: inline-block;
    padding: 1px 6px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.recommendations-container {
    max-height: 400px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.recommendations-container.expanded {
    max-height: 2000px;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
}

/* === Query Results === */
.query-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}

.query-result-card {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.query-result-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.query-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.query-result-ordinal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.query-result-id {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.query-result-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #E8F5E9;
    color: var(--success-dark);
    font-weight: 600;
}

.query-result-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.query-result-row {
    display: flex;
    align-items: center;
    font-size: 13px;
}

.query-result-label {
    color: var(--text-muted);
    min-width: 72px;
    flex-shrink: 0;
}

.query-result-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* === Query Results Toggle === */
.query-results-hidden {
    display: none;
}

.query-results-toggle,
.file-list-toggle,
.transaction-types-toggle {
    margin-top: 8px;
}

.toggle-btn {
    width: 100%;
    padding: 8px 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.query-results-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

/* === Loan Cards === */
.loan-cards-container {
    margin: 8px 0;
}

.loan-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.loan-card:last-child {
    margin-bottom: 0;
}

.loan-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.loan-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.loan-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.loan-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.loan-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.loan-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.loan-info {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding-left: 24px;
}

/* === Classification Section === */
.classification-section {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-bottom: 8px;
}

.classification-section:last-of-type {
    margin-bottom: 0;
}

.classification-header,
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.classification-title,
.category-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.classification-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 8px;
    border-radius: 4px;
}

.classification-item {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
}

.classification-list {
    min-height: 28px;
    transition: background 0.2s;
    border-radius: 4px;
    padding: 2px;
}

.classification-list.drag-over {
    background: #E8F4F8;
}

.item-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    margin-right: 6px;
    user-select: none;
    font-size: 14px;
    opacity: 0.5;
}

.item-drag-handle:active {
    cursor: grabbing;
}

.item-number {
    color: var(--text-muted);
    margin-right: 6px;
    min-width: 18px;
    font-size: 12px;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.item-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-details {
    font-size: 11px;
    color: var(--text-muted);
}

.item-move-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.item-move-btn:hover {
    background: var(--primary-light);
    opacity: 1;
}

.classification-empty {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 6px 0;
}

.draggable.dragging {
    opacity: 0.4;
}

/* === Itinerary Explanation === */
.itinerary-explanation {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: 8px;
}

.explanation-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* === Bill Info === */
.bill-info {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 8px;
}

.bill-info-section {
    margin-bottom: 14px;
}

.bill-info-section:last-child {
    margin-bottom: 0;
}

.bill-info-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bill-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
}

.bill-info-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
    flex-shrink: 0;
}

.bill-info-value {
    color: var(--text-primary);
    flex: 1;
}

.bill-info-missing {
    background: #FFF1F0;
    border-radius: 4px;
    padding: 6px 8px;
}

.bill-info-missing .bill-info-label,
.bill-info-missing .bill-info-value {
    color: var(--danger);
}

/* === Countdown Timer === */
.countdown-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #FFF7E6;
    border: 1px solid #FFD591;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--warning);
    margin-top: 8px;
}

.countdown-icon {
    animation: pulse 1s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === Transaction Type Cards === */
.transaction-type-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}

.transaction-type-card {
    background: var(--bg-hover);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.transaction-type-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.transaction-type-card.recommended {
    border-color: var(--primary);
    background: var(--primary-light);
}

.transaction-type-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.transaction-type-ordinal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.transaction-type-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.transaction-type-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.transaction-type-info {
    display: flex;
    gap: 16px;
    padding-left: 30px;
}

.transaction-type-stat {
    font-size: 12px;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
}

.transaction-types-hidden {
    display: none;
}

/* === Chat Input === */
.chat-input-container {
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-white);
}

.input-wrapper {
    width: 100%;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    transition: all 0.2s;
}

.input-area:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-primary);
}

.file-preview-item .file-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.file-preview-item .remove-file {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.file-preview-item .remove-file:hover {
    background: var(--danger);
    color: white;
}

.clear-files-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    flex-shrink: 0;
}

.clear-files-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.chat-input {
    width: 100%;
    padding: 4px 0;
    border: none;
    font-size: 14px;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    resize: none;
    line-height: 1.5;
    font-family: inherit;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.upload-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--bg-white);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.upload-icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* === Sidebar === */
.sidebar {
    width: 300px;
    background: var(--bg-main);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #D9D9D9;
    border-radius: 2px;
}

.sidebar-section {
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-title svg {
    color: var(--text-muted);
}

.info-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
}

.info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amount-value {
    color: var(--primary);
    font-size: 15px;
}

.status-draft {
    color: var(--text-muted);
}

.status-pending {
    color: var(--warning);
}

.status-saved {
    color: var(--primary);
}

.status-submitted {
    color: var(--success);
}

.clickable {
    cursor: pointer;
    color: var(--primary);
    transition: all 0.15s;
}

.clickable:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Sidebar File List */
.file-list {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.file-list-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-list .file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    font-size: 12px;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.file-list .file-item:hover {
    border-color: var(--border);
}

.file-list .file-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 4px;
    flex-shrink: 0;
}

.file-list .file-info {
    flex: 1;
    min-width: 0;
}

.file-list .file-name {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list .file-type {
    font-size: 11px;
    color: var(--text-muted);
}

.file-list-hidden {
    display: none;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    gap: 8px;
}

.related-info {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

/* === Sidebar Action Buttons === */
.sidebar-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.large-btn {
    min-height: 44px;
}

.primary-btn {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.success-btn {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
}

.success-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(82, 196, 26, 0.4);
}

/* Small action buttons (used in chat messages) */
.small-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.small-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.small-action-btn.secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.small-action-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* === Loading === */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Inline file items in chat === */
.message-content .file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 13px;
}

.message-content .file-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.message-content .file-type {
    color: var(--text-muted);
    font-size: 11px;
}

.file-remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    margin-left: auto;
    transition: all 0.15s;
    line-height: 1;
}

.file-remove-btn:hover {
    transform: scale(1.2);
}

/* === File Preview Modal === */
.file-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-preview-modal.show {
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.file-preview-modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.file-preview-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.file-icon-large {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-lg);
}

.file-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 80px;
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .chat-container {
        order: 1;
        flex: 1;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: none;
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .sidebar-section {
        flex: 1;
        min-width: 200px;
        margin-bottom: 0;
    }

    .sidebar-actions {
        flex-direction: row;
        width: 100%;
    }

    .sidebar-actions .action-btn {
        flex: 1;
    }

    .chat-messages {
        padding: 16px;
    }

    .message {
        max-width: 100%;
    }

    .message-content {
        max-width: calc(100% - 46px);
    }
}
