/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --primary-light: #e8f0fe;
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f2f5;
    --text: #1f1f1f;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --danger: #d93025;
    --success: #188038;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== NAV ===================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* navbar logo (tiger head) */
.nav-logo-img {
    height: 36px;
    width: auto;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    text-decoration: none;
}
.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text);
    text-decoration: none;
}
.nav-btn {
    border: 1px solid var(--border);
    font-weight: 500;
}
.nav-user {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 导航下拉菜单 */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { cursor: pointer; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px 0;
    z-index: 100;
}
.nav-dropdown-menu a {
    display: block;
    padding: 10px 18px;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--bg-secondary); color: var(--primary); }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-btn-primary {
    background: var(--primary);
    color: #fff !important;
    border-color: var(--primary);
}
.nav-btn-primary:hover {
    background: var(--primary-hover) !important;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.nav-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ===================== HERO ===================== */
.hero {
    padding: 100px 24px 80px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}
body.home-page { background: url('/static/bg_main.png') no-repeat center top / cover fixed; min-height: 100vh; }
.features { background: var(--bg); }
.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 24px;
    font-weight: 500;
}
.hero-title {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}
.hero-logo-text { font-size: 56px; font-weight: 900; background: linear-gradient(135deg, #e8d5b7, #c6a87e 50%, #b89660); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: 6px; line-height: 1.2; display: inline-block; }
.gradient-text {
    color: var(--text);
}
.hero-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 36px;
    line-height: 1.7;
}
.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 450;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
    color: var(--text-secondary);
    background: transparent;
}
.btn:hover { 
    text-decoration: none; 
    background: var(--bg-secondary);
    color: var(--text);
}
.btn-primary { 
    background: var(--primary); 
    color: #fff; 
    font-weight: 500;
}
.btn-primary:hover { 
    background: var(--primary-hover);
    color: #fff;
}
.btn-outline { border: 1px solid var(--border); }
.btn-lg { padding: 10px 24px; font-size: 0.95rem; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: #fce8e6; color: var(--danger); }

/* ===================== FEATURES ===================== */
.features { padding: 40px 24px 80px; }
.features-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.feature-card {
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    transition: all 0.3s;
}
.feature-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}
.feature-icon { font-size: 2rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* ===================== STATS ===================== */
.stats {
    background: var(--bg-secondary);
    padding: 60px 24px;
}
.stats-inner {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    text-align: center;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-size: 2.4rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-secondary); font-size: 0.9rem; }

/* ===================== FOOTER ===================== */
.main { flex: 1; padding-top: 64px; }
.footer {
    border-top: 1px solid var(--border-light);
    background: #f8f9fb;
    padding: 36px 24px 32px;
    margin-top: 40px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.footer-row-1 {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 28px;
}
.footer-links { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: #555; font-size: 0.85rem; text-decoration: none; }
.footer-links a:hover { color: #4d6bfe; text-decoration: underline; }
.footer-separator {
    width: 1px;
    height: 16px;
    background: #d0d0d0;
}
.footer-work-hours { 
    color: #888; 
    font-size: 0.8rem; 
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.footer-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #4d6bfe, #7c93ff);
    margin: 0 auto;
    border-radius: 2px;
}
.footer-info { 
    display: flex; 
    gap: 20px; 
    color: #aaa; 
    font-size: 0.75rem; 
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================== FLASH ===================== */
.flash {
    padding: 12px 20px;
    margin: 0 auto;
    max-width: 500px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9rem;
    transition: opacity 0.5s;
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
}
.flash-error { background: #fce8e6; color: var(--danger); border: 1px solid #f5c6cb; }
.flash-success { background: #e6f4ea; color: var(--success); border: 1px solid #b7e1cd; }

/* ===================== AUTH ===================== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 64px); }
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.auth-card h2 { text-align: center; margin-bottom: 24px; }
.auth-link { text-align: center; margin-top: 16px; font-size: 0.9rem; color: var(--text-secondary); }

/* ===================== FORM ===================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; cursor: pointer; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ===================== CONTACT ===================== */
.contact-section {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 24px;
}
.contact-card {
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.contact-card h2 { margin-bottom: 24px; }
.contact-items { display: flex; flex-direction: column; gap: 24px; }
.contact-item { display: flex; gap: 16px; align-items: flex-start; }
.contact-icon { font-size: 1.5rem; }
.contact-item h4 { font-size: 0.9rem; margin-bottom: 4px; }
.contact-item p { color: var(--text-secondary); font-size: 0.9rem; }
.wechat-qr { max-width: 160px; border-radius: var(--radius-sm); margin-top: 8px; }

/* ===================== STATIC PAGE ===================== */
.static-page {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 24px;
}
.static-content h1 { font-size: 2rem; margin-bottom: 20px; }
.static-content h2 { font-size: 1.4rem; margin: 24px 0 12px; }
.static-content h3 { font-size: 1.1rem; margin: 20px 0 10px; }
.static-content p { margin-bottom: 12px; color: var(--text-secondary); line-height: 1.8; }

/* ===================== DOCUMENTS ===================== */
.cat-btn {
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.cat-btn:hover, .cat-btn.active { background: var(--primary-light); color: var(--primary); }
/* ===================== CONSULTATION CHAT ===================== */
.consult-layout {
    display: flex;
    height: calc(100vh - 64px);
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}
.consult-sidebar {
    width: 300px;
    min-width: 300px;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    overflow: hidden;
}
.consult-sidebar:not(.open) {
    width: 0;
    min-width: 0;
    border-right: none;
    padding: 0;
}
.consult-sidebar.open {
    width: 300px;
    min-width: 300px;
    border-right: 1px solid var(--border-light);
}
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-header h2 { font-size: 1rem; }
.sidebar-filters {
    display: flex;
    padding: 12px 16px;
    gap: 6px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-light);
}
.filter-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sidebar-list { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

.consult-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
}
.consult-item:hover { background: var(--bg-secondary); }
.consult-item.active { background: var(--primary-light); }
.consult-item-title { font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; }
.consult-item-meta { display: flex; gap: 8px; font-size: 0.78rem; color: var(--text-muted); align-items: center; }
.status-badge { padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; }
.status-pending { background: #fff3cd; color: #856404; }
.status-active { background: #cce5ff; color: #004085; }
.status-closed { background: #e2e3e5; color: #383d41; }

/* Chat area */
.consult-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 8px;
}
.placeholder-icon { font-size: 4rem; }
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.chat-status { font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
}
.message-self {
    align-self: flex-end;
    background: var(--primary-light);
    color: var(--text);
    border-bottom-right-radius: 4px;
}
.message-other {
    align-self: flex-start;
    background: var(--bg-secondary);
    border-bottom-left-radius: 4px;
}
.message-sender { font-size: 0.75rem; margin-bottom: 4px; opacity: 0.7; }
.message-content { word-break: break-word; }
.message-time { font-size: 0.7rem; margin-top: 4px; opacity: 0.6; }
.message-other .message-time { text-align: right; }
.msg-img { max-width: 200px; border-radius: var(--radius-sm); cursor: pointer; }
.message-file { margin-top: 8px; }
.message-self .message-file a { color: var(--primary); opacity: 0.85; }
.message-other .message-file a { color: var(--primary); }

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}
.chat-input-area form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    resize: none;
    min-height: 80px;
    max-height: 180px;
}
.chat-input-area textarea:focus { border-color: var(--primary); }
.upload-btn, .send-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.upload-btn:hover { background: var(--bg-secondary); color: var(--text); }
.send-btn { 
    background: var(--primary); 
    color: #fff;
    font-weight: 500;
    padding: 8px 16px;
}
.send-btn:hover { background: var(--primary-hover); color: #fff; }
.file-previews { width: 100%; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.file-tag button { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0 2px; font-size: 1.1rem; line-height: 1; }
.file-tag button:hover { color: var(--danger); }

/* ===================== ADMIN ===================== */
.admin-page .main { padding-top: 64px; }
.admin-layout { display: flex; min-height: calc(100vh - 64px); }
.admin-sidebar {
    width: 200px;
    flex-shrink: 0;
    padding: 24px;
    border-right: 1px solid var(--border-light);
    background: var(--bg-secondary);
}
.admin-sidebar h3 { font-size: 0.9rem; margin-bottom: 16px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-nav-link {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-bottom: 4px;
    transition: all 0.2s;
}
.admin-nav-link:hover, .admin-nav-link.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.admin-main { flex: 1; padding: 24px 32px; overflow-y: auto; }
.admin-main h2 { font-size: 1.1rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; }
.admin-header-left { display: flex; align-items: center; gap: 12px; }
.admin-header-right { display: flex; align-items: center; gap: 4px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    text-align: center;
}
.stat-card .stat-num { font-size: 2rem; }
.stat-card .stat-label { font-size: 0.85rem; }
.admin-filters { margin-bottom: 16px; display: flex; gap: 8px; }
.admin-filters .filter-btn { font-size: 0.85rem; }
.admin-table { overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}
.admin-table th { font-weight: 500; color: var(--text-secondary); font-size: 0.8rem; }
.admin-table tr:hover td { background: var(--bg-secondary); }

/* Admin chat */
.admin-chat { margin-top: 24px; border: 1px solid var(--border-light); border-radius: var(--radius); }
.admin-messages {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.admin-chat-input { padding: 16px; border-top: 1px solid var(--border-light); }
.admin-chat-input form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 8px 8px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-chat-input form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.admin-chat-input textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    font-family: var(--font);
    resize: none;
    min-height: 80px;
    max-height: 180px;
    background: transparent;
    padding: 6px 0;
    line-height: 1.5;
    min-width: 120px;
}
.admin-chat-input .upload-btn,
.admin-chat-input .send-btn {
    border: none;
    background: none;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.admin-chat-input .upload-btn:hover { background: var(--bg-secondary); color: var(--text); }
.admin-chat-input .send-btn {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
}
.admin-chat-input .send-btn:hover { background: var(--primary-hover); color: #fff; }
.admin-chat-input .file-previews {
    width: 100%;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.admin-chat-input .file-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.consult-info { margin-bottom: 20px; }
.consult-info p { margin-bottom: 8px; font-size: 0.9rem; }

/* ===================== MODAL ===================== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: var(--bg);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* ===================== HIDDEN NAV/FOOTER ===================== */
.nav-hidden { display: none !important; }
.footer-hidden { display: none !important; }
.main-full { padding-top: 0 !important; }

/* ===================== CHAT REDESIGN (DeepSeek-like) ===================== */

/* Sidebar redesign */
.sidebar-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.sidebar-header-top h2 {
    font-size: 0.95rem;
    flex: 1;
}
.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text);
    display: none;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-secondary); }
.toggle-label { font-size: 0.8rem; font-weight: 400; color: var(--text-secondary); }
.sidebar-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    outline: none;
    font-family: var(--font);
    transition: border-color 0.2s;
}
.sidebar-search input:focus {
    border-color: var(--primary);
}

/* Sidebar toggles visible on desktop for consult page, on mobile only for others */
.consult-layout .sidebar-toggle, .chat-empty-top-bar .sidebar-toggle {
    display: inline-flex;
}
.new-chat-btn { white-space: nowrap; flex-shrink: 0; }
.sidebar-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.sidebar-loading {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Empty state top bar */
.chat-empty-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
}
.chat-empty-top-bar .home-link {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.15s;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.chat-empty-top-bar .home-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}
.home-nav-btn { font-size: 0.85rem !important; color: var(--primary) !important; text-decoration: underline !important; text-underline-offset: 3px !important; }
.home-nav-btn:hover { background: var(--primary-light) !important; }

/* Empty state (DeepSeek-like) */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    gap: 12px;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}
.chat-empty-icon {
    color: var(--text-muted);
    margin-bottom: 8px;
    opacity: 0.5;
}
.chat-empty h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}
.chat-empty-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 24px;
}
.chat-empty-input {
    width: 100%;
    max-width: 680px;
}
.chat-empty-input form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 8px 8px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-empty-input form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.chat-empty-input textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: var(--font);
    resize: none;
    min-height: 80px;
    max-height: 180px;
    background: transparent;
    padding: 6px 0;
    line-height: 1.5;
}
.chat-empty-input .upload-btn,
.chat-empty-input .send-btn {
    border: none;
    background: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.1rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    flex-shrink: 0;
}
.chat-empty-input .upload-btn:hover {
    background: var(--bg-secondary);
}
.chat-empty-input .send-btn {
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
}
.chat-empty-input .send-btn:hover {
    background: var(--primary-hover);
}
.chat-empty-hints {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
    max-width: 680px;
}
.hint-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.hint-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* First file previews inside empty state */
.chat-empty #first-file-previews {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Chat input area redesign (like DeepSeek) */
.chat-input-area {
    padding: 12px 20px 20px;
    background: var(--bg);
}
.chat-input-area form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 8px 8px 16px;
    max-width: 768px;
    margin: 0 auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-area form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.chat-input-area textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: var(--font);
    resize: none;
    min-height: 28px;
    max-height: 120px;
    background: transparent;
    padding: 6px 0;
    line-height: 1.5;
}
.chat-input-area .upload-btn,
.chat-input-area .send-btn {
    border: none;
    background: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.1rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    flex-shrink: 0;
}
.chat-input-area .upload-btn:hover {
    background: var(--bg-secondary);
}
.chat-input-area .send-btn {
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
}
.chat-input-area .send-btn:hover {
    background: var(--primary-hover);
}
.file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0 2px;
}
.file-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
}

/* Chat header minimal */
.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.chat-header-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.chat-header-title-row h3 {
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.chat-header-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}
.message-self {
    align-self: flex-end;
    background: var(--primary-light);
    color: var(--text);
    border-bottom-right-radius: 4px;
}
.message-other {
    align-self: flex-start;
    background: var(--bg-secondary);
}
.message-sender { font-size: 0.75rem; margin-bottom: 4px; opacity: 0.65; }
.message-content { white-space: pre-wrap; }
.message-content a { color: inherit; text-decoration: underline; }
.message-self .message-content a { color: var(--primary); }
.message-time { font-size: 0.7rem; margin-top: 4px; opacity: 0.5; }
.message-other .message-time { text-align: right; }
.msg-img {
    max-width: 240px;
    max-height: 240px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 4px;
    display: block;
}
.message-file { margin-top: 6px; }
.message-self .message-file a { color: var(--primary); opacity: 0.85; }
.message-other .message-file a { color: var(--primary); }

/* Mobile-only elements */
.mobile-only { display: none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .mobile-only { display: inline-flex; }
    .sidebar-toggle { display: inline-flex; }
    
    .consult-layout { position: relative; }
    .consult-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: 280px;
        background: var(--bg);
        box-shadow: var(--shadow-lg);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: 1px solid var(--border);
    }
    .consult-sidebar.open {
        transform: translateX(0);
    }
    
    .chat-empty { padding: 24px 16px; }
    .chat-empty h3 { font-size: 1.1rem; }
    
    .chat-messages { padding: 12px; max-width: 100%; }
    .message { max-width: 90%; }
    
    .chat-input-area { padding: 8px 12px 16px; }
    .chat-input-area form { padding: 6px 6px 6px 12px; }
    .chat-empty-input form { padding: 6px 6px 6px 12px; }
}

/* ===================== PRICING / BALANCE / INVOICE ===================== */
.pricing-card { transition: all 0.2s; }
.pricing-card:hover { border-color: var(--primary) !important; box-shadow: var(--shadow); }

.quick-amount { transition: all 0.15s; cursor: pointer; }
.quick-amount:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.balance-header { background: linear-gradient(135deg, var(--primary), #1557b0); border-radius: var(--radius); padding: 32px; color: #fff; }

/* ===================== Homepage mobile nav toggle */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border-light); padding: 16px; }
    .nav-links.open { display: flex; }
    .hero-title { font-size: 2rem; }
    .features-grid { grid-template-columns: 1fr; }
    .stats-inner { grid-template-columns: repeat(2, 1fr); }
    .docs-layout { position: relative; }
    .docs-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
        width: 280px; background: var(--bg); box-shadow: var(--shadow-lg);
        transform: translateX(-100%); transition: transform 0.25s ease;
        border-right: 1px solid var(--border); padding: 24px;
        overflow-y: auto;
    }
    .docs-sidebar.open { transform: translateX(0); }
    .docs-sidebar-footer { display: none; }
    .admin-layout { position: relative; }
    .admin-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
        width: 240px; background: var(--bg); box-shadow: var(--shadow-lg);
        transform: translateX(-100%); transition: transform 0.25s ease;
        border-right: 1px solid var(--border); padding: 24px;
        overflow-y: auto; display: flex; flex-direction: column;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-sidebar-toggle { display: inline-flex !important; }
    .docs-sidebar-toggle { display: inline-flex !important; }
    .docs-list-header { justify-content: space-between !important; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { gap: 16px; }
    .footer-separator { display: none; }
    .footer-row-1 { flex-direction: column; gap: 12px; }
}

/* ===================== HOME LINKS ===================== */
.contact-section-top {
    max-width: 700px;
    margin: 0 auto;
    padding: 12px 24px 0;
    display: flex;
    justify-content: flex-end;
}
.top-home-link {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.15s;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.top-home-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}
/* Password visibility toggle */
.pwd-field { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pwd-field input { border: none !important; flex: 1; }
.pwd-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.pwd-field input:focus { box-shadow: none !important; }
.pwd-toggle { background: none; border: none; padding: 8px 12px; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); flex-shrink: 0; }
.pwd-toggle:hover { color: var(--text); }
