/* ========== PIN Screen ========== */
.pin-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #0F1117;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.pin-container {
    text-align: center;
    padding: 40px;
    max-width: 360px;
    width: 100%;
}
.pin-logo {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #6C5CE7, #a855f7);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(108,92,231,0.3);
}
.pin-container h2 {
    color: #E8E9ED;
    font-size: 22px;
    margin-bottom: 6px;
}
.pin-subtitle {
    color: #8B8FA3;
    font-size: 14px;
    margin-bottom: 28px;
}
.pin-input-group {
    margin-bottom: 16px;
}
.pin-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 20px;
    letter-spacing: 6px;
    text-align: center;
    background: #1A1D27;
    border: 2px solid #2E3140;
    border-radius: 12px;
    color: #E8E9ED;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.pin-input:focus {
    border-color: #6C5CE7;
    box-shadow: 0 0 0 3px rgba(108,92,231,0.2);
}
.pin-input::placeholder {
    font-size: 14px;
    letter-spacing: 0;
    color: #5A5E72;
}
.pin-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.pin-hint {
    color: #5A5E72;
    font-size: 12px;
    line-height: 1.6;
}
.pin-hint i { margin-right: 4px; }
.pin-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    color: #EF4444;
    font-size: 13px;
}
.pin-loading {
    margin-top: 12px;
    color: #6C5CE7;
    font-size: 14px;
}

/* Sync button states */
.sync-btn { position: relative; }
.sync-btn.syncing .fa-cloud { display: none; }
.sync-btn.syncing::before {
    content: '\f110'; /* fa-spinner */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    animation: spin 1s linear infinite;
    margin-right: 4px;
}
.sync-btn.synced { color: #10b981; border-color: rgba(16,185,129,0.3); }
.sync-btn.error { color: #EF4444; border-color: rgba(239,68,68,0.3); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== CSS Variables & Reset ========== */
:root {
    --bg: #0F1117;
    --bg-card: #1A1D27;
    --bg-hover: #252833;
    --bg-input: #252833;
    --border: #2E3140;
    --text: #E8E9ED;
    --text-muted: #8B8FA3;
    --text-dim: #5A5E72;
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --primary-bg: rgba(99, 102, 241, 0.12);
    --red: #EF4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --green: #22C55E;
    --green-bg: rgba(34, 197, 94, 0.12);
    --yellow: #EAB308;
    --yellow-bg: rgba(234, 179, 8, 0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.25);
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ========== Header ========== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
.header-left h1 i { color: var(--primary); margin-right: 8px; }
.header-right { display: flex; gap: 8px; }

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }
.btn-icon {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 8px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
}
.btn-icon:hover { color: var(--text); background: var(--bg-hover); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ========== Layout ========== */
.main-content {
    display: flex;
    height: calc(100vh - 53px);
}

/* Sidebar */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h3 { font-size: 14px; font-weight: 600; }
.group-list { padding: 8px; flex: 1; }
.group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 13px;
    color: var(--text-muted);
    position: relative;
}
.group-item:hover { background: var(--bg-hover); color: var(--text); }
.group-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.group-item i { width: 16px; text-align: center; }
.group-item span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.group-count {
    font-size: 11px;
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}
.group-item.active .group-count { background: rgba(99,102,241,0.25); }
.group-actions {
    position: absolute;
    right: 8px;
    display: none;
    gap: 2px;
}
.group-item:hover .group-actions { display: flex; }
.group-actions .btn-icon { padding: 2px 4px; font-size: 11px; }

/* Content Area */
.content-area {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

/* ========== Summary Cards ========== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: all var(--transition);
}
.summary-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.card-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.rate-hint { font-size: 10px; color: var(--text-dim); font-weight: 400; }
.card-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 13px; margin-top: 4px; font-weight: 500; }
.profit-up { color: var(--red); }
.profit-down { color: var(--green); }

/* ========== Action Bar ========== */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.action-left, .action-right { display: flex; align-items: center; gap: 8px; }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-btn {
    padding: 7px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 13px;
}
.view-btn.active { background: var(--primary); color: white; }
.view-btn:hover:not(.active) { background: var(--bg-hover); }
.time-filter select {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
}

/* Time Selector */
.time-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 600;
}

/* ========== Holdings Table ========== */
.table-container { overflow-x: auto; }
.holdings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.holdings-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.holdings-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.holdings-table tbody tr { transition: background var(--transition); }
.holdings-table tbody tr:hover { background: var(--bg-hover); }
.stock-info { display: flex; flex-direction: column; }
.stock-code { font-weight: 600; color: var(--text); font-size: 13px; }
.stock-name { color: var(--text-muted); font-size: 12px; }

/* Market badges (港/美) */
.market-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
    line-height: 1.2;
}
.market-hk {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.market-us {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.type-stock { background: var(--primary-bg); color: var(--primary); }
.type-fund { background: var(--yellow-bg); color: var(--yellow); }
.group-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
}
.action-btns { display: flex; gap: 4px; }
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { margin-bottom: 4px; }
.empty-hint { font-size: 12px; }

/* ========== Chart View ========== */
.chart-container { min-height: 500px; }
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    height: 340px;
}

/* ========== Period View ========== */
.period-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal.hidden { display: none; }
.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}
.modal-lg { width: 800px; }
.modal-sm { width: 400px; }
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-header h3 i { margin-right: 8px; color: var(--primary); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========== Forms ========== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}
.form-group input, .form-group select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    transition: border var(--transition);
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.required { color: var(--red); }

/* ========== Upload Zone ========== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    overflow: hidden;
}
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-bg); }
.upload-prompt {
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
}
.upload-prompt i { font-size: 40px; margin-bottom: 12px; color: var(--primary); }
.upload-prompt p { margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text-dim); }

/* Upload Preview */
.preview-images {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
}
.preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .remove-btn {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-item .status-icon {
    position: absolute;
    bottom: 4px; right: 4px;
    font-size: 16px;
}

/* OCR Result */
.ocr-table-wrap { overflow-x: auto; margin-top: 12px; }
.ocr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ocr-table th, .ocr-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.ocr-table th { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.ocr-table input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 4px;
    width: 100%;
    font-size: 13px;
}
.ocr-table select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}
.ocr-hint { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.status-ok { color: var(--green); }
.status-warn { color: var(--yellow); }
.status-err { color: var(--red); }

/* ========== Color Picker ========== */
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.selected { border-color: white; box-shadow: 0 0 0 2px var(--primary); }

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    box-shadow: var(--shadow);
}
.toast-success { background: var(--green); color: white; }
.toast-error { background: var(--red); color: white; }
.toast-info { background: var(--primary); color: white; }
.toast-warning { background: var(--yellow); color: #000; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== Loading ========== */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none; }
.loading-spinner {
    text-align: center;
    color: white;
}
.loading-spinner i { font-size: 32px; margin-bottom: 12px; }
.loading-spinner p { font-size: 14px; }

/* ========== Utility ========== */
.hidden { display: none !important; }

/* ========== Context Menu ========== */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    z-index: 1500;
    box-shadow: var(--shadow);
    min-width: 160px;
}
.context-menu-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
    transition: background var(--transition);
    color: var(--text-muted);
}
.context-menu-item:hover { background: var(--bg-hover); color: var(--text); }
.context-menu-item.danger { color: var(--red); }
.context-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ========== Responsive ========== */

/* Mobile utility classes */
.mobile-menu-btn { display: none; }
.app-title-short { display: none; }
.app-title-full { display: inline; }
.sidebar-overlay { display: none; }

/* Tablet */
@media (max-width: 1024px) {
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
    /* Header */
    .app-header { padding: 10px 12px; }
    .header-left h1 { font-size: 15px; }
    .header-left h1 i { margin-right: 4px; font-size: 14px; }
    .app-title-full { display: none; }
    .app-title-short { display: inline; }
    .mobile-menu-btn { display: inline-flex; margin-right: 6px; }
    .header-right .btn-text { display: none; }
    .header-right .btn { padding: 8px 10px; }

    /* Sidebar as slide-out drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px;
        z-index: 500;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 499;
    }
    .sidebar-overlay.open { display: block; }

    /* Content area */
    .content-area {
        padding: 12px;
        width: 100%;
    }
    .main-content { height: auto; min-height: calc(100vh - 45px); }

    /* Summary cards */
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    .summary-card { padding: 12px; }
    .card-value { font-size: 16px; }
    .card-label { font-size: 11px; }
    .card-sub { font-size: 11px; }

    /* Action bar */
    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
    }
    .action-left {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .action-left .btn {
        justify-content: center;
        padding: 10px 8px;
        font-size: 12px;
    }
    .action-left .btn-text { display: none; }
    .action-right {
        display: flex;
        justify-content: space-between;
    }

    /* Table → Card layout on mobile */
    .table-container { overflow-x: visible; }
    .holdings-table { display: block; }
    .holdings-table thead { display: none; }
    .holdings-table tbody { display: flex; flex-direction: column; gap: 8px; }
    .holdings-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 12px;
        position: relative;
        gap: 0;
    }
    .holdings-table tbody tr:hover { background: var(--bg-card); }
    .holdings-table tbody tr.empty-row {
        display: flex;
        justify-content: center;
        padding: 40px 12px;
    }
    .holdings-table tbody td {
        border: none;
        padding: 2px 0;
        white-space: normal;
    }

    /* Card item layout */
    .holdings-table tbody td:nth-child(1) {
        /* checkbox */
        position: absolute;
        top: 12px;
        right: 12px;
    }
    .holdings-table tbody td:nth-child(2) {
        /* code/name */
        width: 60%;
        order: 1;
    }
    .holdings-table tbody td:nth-child(3) {
        /* type badge */
        width: 40%;
        order: 2;
        text-align: right;
        padding-right: 30px;
    }
    .holdings-table tbody td:nth-child(4),
    .holdings-table tbody td:nth-child(5),
    .holdings-table tbody td:nth-child(6) {
        /* quantity, cost, price */
        width: 33.33%;
        order: 3;
        font-size: 12px;
        color: var(--text-muted);
        padding-top: 8px;
    }
    .holdings-table tbody td:nth-child(4)::before { content: '数量 '; font-size: 10px; color: var(--text-dim); display: block; }
    .holdings-table tbody td:nth-child(5)::before { content: '成本 '; font-size: 10px; color: var(--text-dim); display: block; }
    .holdings-table tbody td:nth-child(6)::before { content: '现价 '; font-size: 10px; color: var(--text-dim); display: block; }

    .holdings-table tbody td:nth-child(7),
    .holdings-table tbody td:nth-child(8),
    .holdings-table tbody td:nth-child(9) {
        /* market value, profit, pct */
        width: 33.33%;
        order: 4;
        font-size: 12px;
        padding-top: 6px;
    }
    .holdings-table tbody td:nth-child(7)::before { content: '市值 '; font-size: 10px; color: var(--text-dim); display: block; }
    .holdings-table tbody td:nth-child(8)::before { content: '收益 '; font-size: 10px; color: var(--text-dim); display: block; }
    .holdings-table tbody td:nth-child(9)::before { content: '收益率 '; font-size: 10px; color: var(--text-dim); display: block; }

    .holdings-table tbody td:nth-child(10),
    .holdings-table tbody td:nth-child(11) {
        /* dividend yield, annual dividend */
        width: 50%;
        order: 5;
        font-size: 12px;
        padding-top: 6px;
    }
    .holdings-table tbody td:nth-child(10)::before { content: '股息率 '; font-size: 10px; color: var(--text-dim); display: block; }
    .holdings-table tbody td:nth-child(11)::before { content: '年股息 '; font-size: 10px; color: var(--text-dim); display: block; }

    .holdings-table tbody td:nth-child(12) {
        /* group */
        order: 6;
        width: 50%;
        padding-top: 6px;
    }
    .holdings-table tbody td:nth-child(13) {
        /* actions */
        order: 7;
        width: 50%;
        padding-top: 6px;
        display: flex;
        justify-content: flex-end;
    }
    .holdings-table tbody td:nth-child(13) .action-btns { gap: 8px; }
    .holdings-table tbody td:nth-child(13) .btn-icon { padding: 6px 10px; font-size: 14px; }

    /* Stock info in card */
    .stock-code { font-size: 14px; }
    .stock-name { font-size: 12px; }

    /* Modal */
    .modal-content {
        width: 95vw;
        max-height: 85vh;
        margin: 0 auto;
    }
    .modal-lg { width: 95vw; }
    .modal-sm { width: 90vw; }
    .modal-header { padding: 12px 16px; }
    .modal-header h3 { font-size: 15px; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 10px 16px; }

    /* Form */
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-group { margin-bottom: 12px; }
    .form-group input, .form-group select { padding: 10px 12px; font-size: 14px; }

    /* Upload */
    .upload-prompt { padding: 32px 16px; }
    .upload-prompt i { font-size: 32px; }
    .preview-item { width: 80px; height: 80px; }
    .ocr-table-wrap { font-size: 12px; }
    .ocr-table input, .ocr-table select { font-size: 12px; padding: 4px 6px; }

    /* Chart */
    .chart-grid { grid-template-columns: 1fr; gap: 12px; }
    .chart-box { height: 280px; padding: 12px; }

    /* Period view */
    .period-summary { grid-template-columns: 1fr; gap: 8px; }

    /* Toast - move to bottom on mobile */
    .toast-container {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
    }
    .toast { min-width: auto; width: 100%; font-size: 12px; padding: 10px 14px; }

    /* Empty state */
    .empty-state { padding: 40px 12px; }
    .empty-state i { font-size: 36px; }
    .empty-state p { font-size: 13px; }
}

/* Extra small screens (iPhone SE etc) */
@media (max-width: 375px) {
    .summary-cards { grid-template-columns: 1fr; gap: 6px; }
    .card-value { font-size: 15px; }
    .action-left { grid-template-columns: 1fr 1fr; }
    .holdings-table tbody td:nth-child(4),
    .holdings-table tbody td:nth-child(5),
    .holdings-table tbody td:nth-child(6),
    .holdings-table tbody td:nth-child(7),
    .holdings-table tbody td:nth-child(8),
    .holdings-table tbody td:nth-child(9) {
        width: 50%;
    }
}
