:root {
    --sidebar-bg: #16324f;
    --sidebar-hover: #22486f;
    --main-bg: #f3f6fb;
    --card-bg: #ffffff;
    --primary-color: #1f4e78;
    --primary-dark: #163a5a;
    --border-color: #d8e0eb;
    --text-color: #1c2b39;
    --muted-color: #6e7d8c;
    --paper-border: #d8d8d8;
    --paper-head: #d0d0d0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei", "Microsoft JhengHei", sans-serif;
    color: var(--text-color);
    background: var(--main-bg);
}

a {
    text-decoration: none;
}

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #17314d 0%, #2c5d87 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.login-wrapper {
    width: 100%;
    max-width: 460px;
}

.login-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 30px 30px 36px 30px;
    box-shadow: 0 20px 60px rgba(10, 35, 66, 0.22);
}

.login-top-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo-image-wrap {
    width: 180px;
    margin: 0 auto 18px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-logo-image {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
}

.login-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
}

.login-subtitle {
    margin-top: 8px;
    margin-bottom: 0;
    color: var(--muted-color);
}

.login-btn {
    background: var(--primary-color);
    border-color: var(--primary-color);
    padding-top: 12px;
    padding-bottom: 12px;
    font-weight: 600;
}

.login-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--muted-color);
    font-size: 14px;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 18px;
}

.brand-block {
    padding: 8px 10px 24px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 18px;
}

.brand-logo-wrap {
    width: 140px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.brand-logo-img {
    display: block;
    width: 100%;
    max-width: 140px;
    height: auto;
}

.brand-subtitle {
    margin-top: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.86);
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.88);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-nav .nav-link.active {
    background: #ffffff;
    color: var(--sidebar-bg);
    font-weight: 700;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 18px;
}

.user-box {
    background: rgba(255, 255, 255, 0.08);
    padding: 14px;
    border-radius: 14px;
}

.user-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 6px;
}

.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
}

.topbar-subtitle {
    color: var(--muted-color);
    font-size: 14px;
    margin-top: 4px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.info-badge,
.login-time-badge {
    font-size: 12px;
    padding: 8px 12px;
}

.topbar-action-btn {
    min-width: 96px;
}

.lang-switch-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef3f8;
    padding: 6px 8px;
    border-radius: 999px;
}

.login-lang-switch {
    background: #f1f5f9;
}

.lang-label {
    font-size: 12px;
    color: var(--muted-color);
    margin-right: 2px;
}

.lang-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 30px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-dark);
    background: transparent;
    transition: all 0.2s ease;
}

.lang-switch-btn:hover {
    background: #dbe7f2;
    color: var(--primary-dark);
}

.lang-switch-btn.active {
    background: var(--primary-color);
    color: #ffffff;
}

.profile-switch-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fbff;
    border: 1px solid #d8e0eb;
    border-radius: 999px;
    padding: 5px 8px 5px 10px;
}

.profile-switch-label {
    color: var(--muted-color);
    font-size: 12px;
    white-space: nowrap;
}

.profile-switch-select {
    min-width: 190px;
    border-radius: 999px;
    border-color: #cfdcec;
    font-size: 12px;
}

.content-area {
    padding: 28px;
    flex: 1;
}

.bank-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(19, 42, 71, 0.06);
    overflow: hidden;
}

.bank-card-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bank-card-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
}

.bank-card-header p {
    margin: 6px 0 0 0;
    color: var(--muted-color);
    font-size: 14px;
}

.bank-card-body {
    padding: 22px;
}

.report-tabs-card {
    overflow: visible;
}

.report-tabs-header {
    border-bottom: 0;
    padding: 0;
    min-height: 18px;
}

.report-tabs-nav-wrap {
    padding: 0 22px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: #f8fbff;
}

.report-tabs-nav {
    border-bottom: 0;
    gap: 8px;
    padding: 14px 0 0 0;
    flex-wrap: wrap;
}

.report-tab-btn {
    border: 1px solid #cfdcec !important;
    border-bottom: 0 !important;
    border-radius: 12px 12px 0 0 !important;
    background: #edf4fb !important;
    color: var(--primary-dark) !important;
    font-weight: 700;
    padding: 10px 18px !important;
}

.report-tab-btn.active {
    background: #ffffff !important;
    color: var(--primary-dark) !important;
    border-color: var(--border-color) !important;
    position: relative;
    top: 1px;
}

.report-tabs-body {
    padding-top: 18px;
}

.report-tab-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    color: var(--muted-color);
    font-size: 13px;
    flex-wrap: wrap;
}

.report-tab-meta-title {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 16px;
}

.quote-data-wrap,
.account-summary-wrap,
.positions-wrap,
.generic-table-wrap {
    background: #ffffff;
    border: 1px solid #d8e0eb;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(19, 42, 71, 0.05);
}

.quote-data-title-row,
.positions-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.quote-data-title-row h4,
.positions-title-row h4 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 800;
}

.quote-data-title-row p,
.positions-title-row p {
    margin: 6px 0 0 0;
    color: var(--muted-color);
    font-size: 14px;
}

.quote-market-tabs {
    gap: 8px;
    margin-bottom: 16px;
}

.quote-market-tab-btn {
    border: 1px solid #cfdcec !important;
    background: #edf4fb !important;
    color: var(--primary-dark) !important;
    border-radius: 999px !important;
    font-weight: 700;
    padding: 8px 18px !important;
}

.quote-market-tab-btn.active {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

.quote-market-content {
    margin-top: 10px;
}

.quote-market-title {
    color: var(--primary-dark);
    font-weight: 800;
    margin-bottom: 10px;
}

.quote-excel-table,
.account-summary-table,
.positions-table,
.generic-report-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    background: #ffffff;
    font-size: 14px;
}

.quote-excel-table th,
.account-summary-table th,
.positions-table th,
.generic-report-table th {
    border: 1px solid #111111;
    padding: 8px 10px;
    background: #f5f7fb;
    color: #111827;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}

.quote-excel-table td,
.account-summary-table td,
.positions-table td,
.generic-report-table td {
    border: 1px solid #111111;
    padding: 8px 10px;
    color: #111827;
    white-space: nowrap;
    vertical-align: middle;
}

.quote-excel-table td:not(:first-child),
.quote-excel-table th:not(:first-child),
.positions-table td:not(:first-child),
.positions-table th:not(:first-child),
.generic-report-table td:not(:first-child),
.generic-report-table th:not(:first-child) {
    text-align: center;
}

.quote-excel-table tbody tr:nth-child(even),
.positions-table tbody tr:nth-child(even),
.generic-report-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.account-profile-grid {
    display: none;
    margin-bottom: 18px;
}

.account-profile-table {
    border-collapse: collapse;
    min-width: 720px;
    font-size: 16px;
    background: #ffffff;
}

.account-profile-table td {
    border: 1px solid #111111;
    padding: 8px 12px;
    min-width: 180px;
    color: #111827;
}

.account-profile-no {
    width: 200px;
}

.account-profile-name-en {
    width: 280px;
}

.account-profile-name-zh {
    width: 280px;
}

.account-summary-table-wrap,
.positions-table-wrap {
    overflow-x: auto;
}

.account-summary-table {
    min-width: 820px;
    max-width: 1100px;
}

.account-summary-title-cell {
    font-weight: 800;
    font-size: 16px;
    background: #ffffff;
}

.account-summary-label-cell {
    font-weight: 700;
    background: #ffffff;
}

.account-summary-profile-cell {
    font-weight: 700;
    color: #111827;
    background: #ffffff;
    text-align: left;
}

.account-summary-table th {
    background: #ffffff;
    font-size: 16px;
}

.summary-row-title {
    text-align: left;
    font-weight: 600;
}

.summary-value-cell {
    text-align: center;
}

.account-report-header {
    min-width: 820px;
    max-width: 1100px;
    margin-bottom: 18px;
    padding: 18px 22px 16px 22px;
    border: 1px solid #d8d8d8;
    background: #ffffff;
}

.account-report-title {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.account-report-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 36px;
}

.account-report-meta-left {
    flex: 1;
    min-width: 260px;
    padding-top: 4px;
}

.account-report-company {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
    line-height: 1.6;
}

.account-report-meta-right {
    min-width: 340px;
    font-size: 14px;
    color: #111827;
}

.account-report-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    line-height: 1.8;
    white-space: nowrap;
}

.account-report-meta-row span {
    font-weight: 700;
    color: #374151;
}

.account-report-meta-row strong {
    font-weight: 800;
    color: #111827;
}

.positions-table {
    max-width: 620px;
}

.positions-table th,
.positions-table td {
    height: 38px;
    font-size: 15px;
}

.backend-footer {
    background: #eef1f7;
    border-top: 1px solid #dbe2ec;
    margin-top: 10px;
    padding: 34px 28px;
}

.backend-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 42px;
    max-width: 1320px;
    margin: 0 auto;
}

.backend-footer-left {
    flex: 1.1;
}

.backend-footer-right {
    flex: 0.9;
    max-width: 420px;
}

.backend-footer-logo-row {
    margin-bottom: 16px;
}

.backend-footer-logo {
    width: 160px;
    max-width: 100%;
    height: auto;
}

.backend-footer-block {
    margin-bottom: 18px;
}

.backend-footer-title {
    font-size: 15px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px;
}

.backend-footer-text {
    font-size: 14px;
    line-height: 1.75;
    color: #1f2937;
}

.backend-footer-strong {
    font-size: 16px;
    line-height: 1.6;
    font-weight: 800;
    color: #111827;
}

.topbar-info-badge,
.info-badge,
.login-time-badge {
    font-size: 14px;
    font-weight: 800;
    padding: 9px 13px;
    line-height: 1.2;
}

.profile-switch-form {
    font-size: 14px;
    font-weight: 800;
}

.profile-switch-label {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-dark);
}

.profile-switch-select {
    min-width: 120px;
    font-size: 14px;
    font-weight: 800;
}

.account-summary-wrap {
    padding-top: 22px;
}

@media (max-width: 1200px) {
    .backend-footer-inner {
        flex-direction: column;
    }

    .backend-footer-right {
        max-width: none;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .topbar {
        padding: 16px 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .content-area {
        padding: 18px;
    }

    .report-tabs-nav-wrap {
        padding: 0 16px;
    }

    .backend-footer {
        padding: 24px 18px;
    }

    .profile-switch-form {
        width: 100%;
        border-radius: 14px;
        justify-content: space-between;
    }

    .profile-switch-select {
        min-width: 160px;
    }

    .account-report-header {
        min-width: 760px;
    }

    .account-report-meta {
        flex-direction: column;
        gap: 14px;
    }

    .account-report-meta-right {
        min-width: 100%;
    }
}