* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy: #102f60;
    --navy-dark: #071e3f;
    --navy-light: #1b4e91;
    --blue: #2475ee;
    --blue-light: #eaf3ff;
    --green: #0ca764;
    --border: #d9e2ee;
    --text: #10182b;
    --muted: #6d7890;
    --background: #f3f6fb;
}

html {
    background: var(--background);
}

body {
    min-width: 320px;
    background: var(--background);
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font-family: inherit;
}

.topbar {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #183d77, #102f60);
    color: #fff;
}

.brand {
    min-width: 245px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.brand-icon {
    color: #54a1ff;
    font-size: 30px;
}

.top-nav {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2px;
}

.top-nav a {
    height: 100%;
    padding: 0 22px;
    display: flex;
    align-items: center;
    position: relative;
    color: #e8effb;
    font-size: 14px;
    white-space: nowrap;
}

.top-nav a:hover,
.top-nav a.active {
    background: rgba(255, 255, 255, .04);
    color: #fff;
}

.top-nav a.active::after {
    content: "";
    height: 3px;
    position: absolute;
    left: 15px;
    right: 15px;
    bottom: 0;
    border-radius: 4px;
    background: #3291ff;
}

.search-box {
    width: 250px;
    height: 38px;
    margin-left: auto;
    display: flex;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
}

.search-box input {
    width: 100%;
    padding: 0 13px;
    border: 0;
    outline: 0;
    color: #333;
}

.search-box button {
    width: 45px;
    border: 0;
    background: #fff;
    color: #12366a;
    font-size: 20px;
    cursor: pointer;
}

.hero {
    height: 120px;
    padding-left: 285px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(5, 33, 67, .92), rgba(6, 43, 83, .65)),
        radial-gradient(circle at 80% 40%, #1761a3 0, #0a315b 40%, #061d3b 100%);
}

.hero::before {
    content: "";
    width: 650px;
    height: 220px;
    position: absolute;
    right: 30px;
    top: -70px;
    opacity: .25;
    background:
        linear-gradient(90deg, transparent 10%, #52a9ff 11%, transparent 12%),
        linear-gradient(0deg, transparent 20%, #52a9ff 21%, transparent 22%);
    background-size: 80px 60px;
    transform: skewX(-10deg);
}

.hero-content {
    padding-top: 27px;
    position: relative;
    z-index: 2;
    color: #fff;
}

.hero-content h1 {
    font-size: 27px;
}

.hero-content p {
    margin-top: 10px;
    color: #dceaff;
    font-size: 13px;
}

.app-layout {
    width: 100%;
    min-height: calc(100vh - 240px);
    display: grid;
    grid-template-columns: 255px minmax(0, 1fr);
}

.sidebar {
    min-height: 880px;
    position: relative;
    background: linear-gradient(180deg, #0b2b56, #123b72);
    color: #fff;
}

.side-nav {
    padding: 22px 15px;
}

.side-nav a {
    height: 52px;
    margin-bottom: 6px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: 6px;
    color: #eef5ff;
    font-size: 15px;
}

.side-nav a:hover,
.side-nav a.active {
    background: linear-gradient(90deg, #2166c5, #1a4d94);
    box-shadow: 0 4px 15px rgba(0, 0, 0, .15);
}

.side-nav a.active {
    border-left: 3px solid #36a0ff;
}

.nav-icon {
    width: 22px;
    color: #fff;
    text-align: center;
    font-size: 18px;
}

.side-bottom {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 55px;
    text-align: center;
}

.city-line {
    width: 100%;
    height: 160px;
    opacity: .35;
    background:
        linear-gradient(180deg, transparent, rgba(26, 110, 200, .3)),
        linear-gradient(90deg,
            transparent 5%,
            #75b7ff 5% 7%,
            transparent 7% 20%,
            #75b7ff 20% 23%,
            transparent 23% 40%,
            #75b7ff 40% 43%,
            transparent 43% 70%,
            #75b7ff 70% 73%,
            transparent 73%);
}

.side-slogan {
    margin-top: 15px;
    color: #fff;
    font-size: 19px;
    line-height: 1.8;
    letter-spacing: 3px;
}

.main-content {
    min-width: 0;
    padding: 18px 24px 25px;
}

.stock-card,
.result-card,
.history-card {
    border: 1px solid #e2e8f1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(25, 58, 102, .06);
}

.stock-card {
    padding: 22px 20px 18px;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.stock-header h2 {
    margin-bottom: 4px;
    font-size: 20px;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

#last-price {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.15;
}

.change-box {
    color: var(--green);
    font-size: 19px;
    font-weight: 700;
}

.stock-subtitle {
    margin-top: 5px;
    color: #7b8494;
    font-size: 11px;
}

.stock-subtitle a {
    text-decoration: underline;
}

.date-box {
    height: 38px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #35425a;
    font-size: 13px;
}

.time-tabs {
    margin-top: 16px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.tab-btn {
    min-width: 58px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #d8e1ed;
    border-radius: 4px;
    background: #fff;
    color: #445168;
    cursor: pointer;
}

.tab-btn:hover {
    background: #f4f8ff;
}

.tab-btn.active {
    border-color: #2475ee;
    background: #2475ee;
    color: #fff;
}

.chart-container {
    width: 100%;
    height: 330px;
    margin-top: 17px;
    position: relative;
}

#myChart {
    width: 100% !important;
    height: 330px !important;
}

.stock-stats {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.stats-column:first-child {
    border-right: 1px solid var(--border);
}

.stat-row {
    height: 45px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
    border-bottom: 0;
}

.stat-label {
    color: #758095;
    font-size: 13px;
}

.stat-row strong {
    color: #111827;
    font-size: 14px;
}

.bottom-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: .95fr 1.05fr;
    gap: 16px;
}

.result-card,
.history-card {
    padding: 17px;
}

.card-title-row {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title-row h2 {
    font-size: 19px;
}

.title-icon {
    margin-right: 7px;
    color: #1479f6;
}

.result-date {
    color: #77849a;
    font-size: 12px;
}

.table-scroll,
.history-scroll {
    width: 100%;
    margin-top: 12px;
    overflow-x: auto;
}

.summary-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.summary-table th,
.summary-table td {
    border: 1px solid #cdd9e8;
    text-align: center;
}

.summary-table th {
    height: 42px;
    background: #edf5ff;
    color: #173d73;
    font-size: 13px;
}

.summary-table td {
    height: 54px;
    background: #fff;
    font-size: 13px;
}

.result-number {
    font-size: 20px !important;
    font-weight: 800;
}

.history-scroll {
    max-height: 270px;
    overflow-y: auto;
}

.history-table {
    min-width: 540px;
}

.history-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 31px;
    padding: 5px;
    border: 1px solid #cbd6e5;
    background: #edf5ff;
    color: #173d73;
    font-size: 11px;
}

.history-table td {
    height: 27px;
    padding: 4px;
    border: 1px solid #d6dee8;
    text-align: center;
    color: #26364e;
    font-size: 11px;
}

.history-table tbody tr:nth-child(even) {
    background: #f8fbff;
}

.history-table tbody tr:hover {
    background: #edf5ff;
}

.footer {
    min-height: 50px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #dce4ef;
    background: #fff;
    color: #69768a;
    font-size: 11px;
}

.footer-links {
    display: flex;
    gap: 12px;
}

@media (max-width: 1200px) {
    .top-nav a {
        padding: 0 12px;
    }

    .search-box {
        width: 200px;
    }

    .hero {
        padding-left: 245px;
    }

    .app-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 950px) {
    .topbar {
        height: auto;
        min-height: 65px;
        flex-wrap: wrap;
        padding: 12px 15px;
        gap: 10px;
    }

    .brand {
        min-width: 0;
    }

    .top-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .top-nav a {
        height: 42px;
    }

    .search-box {
        margin-left: auto;
    }

    .hero {
        height: 105px;
        padding-left: 25px;
    }

    .app-layout {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .search-box {
        display: none;
    }

    .main-content {
        padding: 12px;
    }

    .stock-card {
        padding: 17px 12px;
    }

    .stock-header {
        flex-direction: column;
    }

    .date-box {
        width: fit-content;
    }

    #last-price {
        font-size: 36px;
    }

    .change-box {
        font-size: 15px;
    }

    .chart-container,
    #myChart {
        height: 260px !important;
    }

    .stock-stats {
        grid-template-columns: 1fr;
    }

    .stats-column:first-child {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .summary-table {
        min-width: 550px;
    }

    .footer {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}