:root {
    color-scheme: light;
    --background: #f3f6fb;
    --paper: #fff;
    --ink: #14213a;
    --muted: #5e6c84;
    --line: #e1e7f1;
    --blue: #2459df;
    --blue-dark: #1843b4;
    --sidebar: #101b33;
    --teal: #00877d;
    --sidebar-width: 226px;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
    font-size: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 3.5vw, 33px); line-height: 1.18; letter-spacing: -.035em; }
h2 { font-size: 17px; line-height: 1.35; letter-spacing: -.02em; }
:focus-visible { outline: 3px solid #5c8bf6; outline-offset: 3px; }
[hidden] { display: none !important; }

.sidebar {
    background: var(--sidebar);
    color: #acb9d1;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 23px 14px 13px;
    z-index: 4;
}
.brand { display: flex; gap: 12px; align-items: center; font-weight: 750; color: #f5f8ff; font-size: 16px; padding: 0 8px; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: #b2bfd8; margin-top: 3px; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; background: #3267f3; border-radius: 10px; display: flex; align-items: end; justify-content: center; gap: 3px; padding-bottom: 10px; }
.brand-mark i { width: 4px; background: white; border-radius: 4px; height: 8px; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 17px; }
.sidebar nav { margin-top: 17px; overflow: auto; scrollbar-width: thin; }
.nav-section { text-transform: uppercase; color: #92a4c3; font-size: 11px; font-weight: 650; letter-spacing: .06em; padding: 15px 10px 6px; }
.nav-link { display: flex; align-items: center; min-height: 36px; gap: 11px; padding: 6px 10px; margin: 2px 0; border-radius: 7px; color: #c9d4e7; font-size: 13px; }
.nav-link:hover { background: #202f4c; color: #fff; }
.nav-link.active { background: #28467a; color: #fff; font-weight: 700; }
.nav-icon { font: 17px/1 system-ui,sans-serif; text-align: center; min-width: 18px; color: #a9bde3; }
.active .nav-icon { color: #c7daff; }
.sidebar-foot { margin: auto 5px 0; border-top: 1px solid #2b3a57; padding: 14px 5px 0; color: #a9b9d3; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #59d6bb; }
.shell { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { min-height: 65px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 8px 27px; }
.breadcrumb, .header-actions, .profile, .actions { display: flex; align-items: center; gap: 12px; }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--ink); }
.crumb-divider { color: #8d99ae; }
.header-actions { gap: 17px; }
.demo-badge { display: inline-flex; white-space: nowrap; align-items: center; gap: 6px; color: #7b4807; background: #fff3d9; border: 1px solid #f1d49c; border-radius: 30px; padding: 5px 9px; font-size: 11px; font-weight: 750; }
.demo-badge span { width: 6px; height: 6px; border-radius: 50%; background: #ac6509; }
.avatar { display: grid; place-items: center; border-radius: 50%; width: 34px; height: 34px; color: #214cd0; background: #e9efff; font-size: 14px; font-weight: 750; }
.profile { gap: 8px; }
.profile-name { font-size: 12px; font-weight: 700; white-space: nowrap; }
.profile-name small, .cell-note { display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-top: 4px; }
.mobile-menu { display: none; }

.content { padding: 26px 26px 36px; max-width: 1770px; margin: auto; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.page-heading p, .panel-heading p { color: var(--muted); margin-top: 7px; font-size: 13px; line-height: 1.55; }
.actions { gap: 8px; flex-wrap: wrap; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 4px #172c5310; min-width: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 37px; gap: 5px; padding: 6px 12px; color: #263954; background: #fff; border: 1px solid #d4deed; border-radius: 7px; white-space: nowrap; font-size: 13px; font-weight: 700; }
.button:hover { background: #eff4ff; border-color: #adbfef; }
.button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button.subtle { border-color: transparent; color: var(--muted); }
.button.small { padding: 4px 8px; min-height: 30px; font-size: 12px; }
.link-button, .icon-button { background: transparent; border: 0; color: var(--blue-dark); padding: 3px 0; font-weight: 650; white-space: nowrap; }
.link-button:hover, .text-link:hover { text-decoration: underline; }
.danger { color: #af3048; }
.logout { color: var(--muted); font-size: 12px; }
.text-link { color: var(--blue-dark); font-weight: 650; }
.filters { display: flex; gap: 11px; padding: 13px 15px; flex-wrap: wrap; align-items: end; margin-bottom: 17px; }
.filters label { flex: 1 1 108px; max-width: 250px; min-width: 0; }
.filters label:has(input[type=date]) { min-width: 132px; }
label { display: grid; gap: 6px; color: #475871; font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; color: var(--ink); background: #fff; border: 1px solid #d4deed; border-radius: 7px; padding: 7px 9px; min-height: 37px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #7296ee; }

.kpi-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 12px; margin-bottom: 17px; }
.kpi { min-height: 112px; padding: 14px; }
.kpi-label { display: flex; justify-content: space-between; align-items: center; gap: 4px; color: #4b5c75; font-size: 12px; font-weight: 650; }
.kpi-label span { color: #315bbb; background: #eaf0ff; border-radius: 5px; padding: 3px 5px; font-size: 9px; white-space: nowrap; }
.kpi > strong { display: block; width: 100%; overflow-wrap: anywhere; font-size: clamp(16px, 1.65vw, 28px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; margin: 9px 0; }
.kpi-foot { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
.change { padding: 2px 5px; border-radius: 5px; font-weight: 700; background: #eef2f9; color: #4e5e77; }
.change.good, .pill.positive { background: #e1f5ef; color: #086b53; }
.change.bad, .pill.negative { background: #fbe8ec; color: #a5233d; }
.change.neutral { background: #eaf0ff; color: #274faa; }

.analytics-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 16px; margin-bottom: 17px; }
.report-panel { padding: 17px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.legend { display: flex; align-items: center; gap: 12px; white-space: nowrap; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.blue-dot { background: var(--blue); }
.teal-dot { background: var(--teal); }
.chart { position: relative; margin-top: 12px; }
.chart canvas { width: 100%; height: 228px; display: block; }
.chart-tooltip { background: #152440; color: #fff; padding: 7px 9px; border-radius: 7px; white-space: pre-line; font-size: 11px; position: absolute; top: 8px; pointer-events: none; z-index: 2; }
.trend-details { margin-top: 10px; font-size: 12px; color: var(--muted); }
.trend-details .table-wrap { margin-top: 8px; max-height: 225px; }
.channel-bars { padding-top: 8px; display: grid; gap: 12px; }
.channel-item { border-radius: 5px; display: block; }
.channel-item:hover strong { color: var(--blue-dark); text-decoration: underline; }
.channel-item > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; margin-bottom: 6px; font-size: 12px; }
.channel-item span { color: #334460; text-align: right; font-variant-numeric: tabular-nums; }
.channel-item small { display: inline-block; color: var(--muted); font-size: 10px; margin-left: 5px; }
.progress { height: 7px; border-radius: 20px; background: #edf2fa; }
.progress i { display: block; height: 100%; border-radius: inherit; background: #4b75e4; }
.channel-item:nth-child(even) .progress i { background: #119d91; }
.quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 17px; }
.quick { display: flex; align-items: center; gap: 11px; padding: 13px 15px; }
.quick:hover { border-color: #9bb6ee; }
.quick-icon { background: #e9efff; color: var(--blue-dark); border-radius: 8px; font-size: 19px; width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; }
.quick-icon.warn { background: #fff0d9; color: #8d5107; }
.quick small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.quick b { color: var(--blue-dark); margin-left: auto; white-space: nowrap; font-size: 12px; }
.section-table { margin-bottom: 16px; }
.section-table .panel-heading { padding: 15px; }
.table-wrap { overflow: auto; border-radius: 11px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e8edf5; white-space: nowrap; }
th { background: #f2f5fb; color: #4c5d77; font-weight: 700; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbff; }
.wrap-cell { white-space: normal; min-width: 175px; max-width: 420px; overflow-wrap: anywhere; }
.empty { padding: 29px 14px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 11px 13px; color: var(--muted); font-size: 12px; }
.pagination > div, .row-actions { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; color: #475a77; background: #eef2f8; border-radius: 12px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.pill.warning { color: #835005; background: #fff1d5; }
.muted { color: var(--muted); }
.notice { border-radius: 8px; border: 1px solid; padding: 11px 14px; margin-bottom: 15px; }
.notice.success { background: #e5f6ef; color: #115b49; border-color: #b5e5d2; }
.notice.error { background: #fff0f1; color: #902339; border-color: #f0c3cc; }
.notice ul { margin: 5px 0 0; padding-left: 20px; }
.editor { max-width: 810px; padding: 19px; }
.editor li, .editor p { line-height: 1.65; }
.editor p + p { margin-top: 8px; }
.editor-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.editor-form .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.stack.compact { gap: 7px; width: 190px; margin: 7px 0; }
.tabs { display: flex; gap: 5px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { display: inline-flex; border: 1px solid transparent; border-radius: 7px; padding: 8px 11px; font-size: 13px; color: #4c5e7b; font-weight: 700; }
.tabs a.active { background: #e6eeff; border-color: #cbdaf8; color: #2147a8; }
.scan-form { align-items: end; }
.row-details summary { color: var(--blue-dark); }
.row-details pre { white-space: pre-wrap; max-width: 420px; overflow-wrap: anywhere; font-size: 11px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.login-visual { display: grid; grid-template-rows: auto 1fr; padding: clamp(25px, 6vw, 80px); color: #f6f8ff; background: radial-gradient(ellipse at 86% 75%, #284f92, transparent 60%), #101b33; }
.login-brand { padding: 0; }
.login-pitch { align-self: center; padding: 34px 0; }
.login-pitch h1 { font-size: clamp(37px, 6.1vw, 80px); line-height: 1.13; }
.login-pitch p { color: #c8d6f2; line-height: 1.7; margin-top: 18px; }
.login-bars { display: flex; align-items: end; gap: clamp(4px, 1vw, 12px); height: 128px; margin-top: 15px; }
.login-bars i { height: var(--height); width: clamp(9px, 2vw, 26px); border-radius: 5px 5px 0 0; background: linear-gradient(#83a7ff, #335fba40); }
.login-bars i:nth-child(3n) { background: linear-gradient(#54d9c4, #2e8b9e40); }
.login-main { display: grid; place-items: center; padding: 23px; }
.login-form { width: min(100%, 380px); }
.login-form h2 { font-size: 30px; margin: 13px 0 7px; }
.login-form .stack, .login-form .notice { margin-top: 18px; }
.login-form .button { min-height: 43px; }

@media (max-width: 1350px) { .kpi-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .kpi > strong { font-size: 24px; } }
@media (max-width: 980px) { :root { --sidebar-width: 180px; } .content,.topbar { padding-left: 17px; padding-right: 17px; } .analytics-grid { grid-template-columns: 1fr; } }
@media (max-width: 740px) {
    .sidebar { display: none; box-shadow: 10px 0 25px #14213a40; }
    body.nav-open .sidebar { display: flex; top: 55px; }
    .shell { margin-left: 0; }
    .mobile-menu { display: inline-flex; align-items: center; min-height: 34px; min-width: 27px; font-size: 18px; }
    .topbar { min-height: 55px; position: sticky; top: 0; z-index: 5; }
    .profile-name, .breadcrumb > span { display: none; }
    .header-actions { gap: 9px; }
    .content { padding-top: 18px; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; }
}
@media (max-width: 480px) {
    .content,.topbar { padding-left: 12px; padding-right: 12px; }
    .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
    .kpi { padding: 11px; }
    .kpi > strong { font-size: 20px; }
    .quick-grid, .editor-form, .login-page { grid-template-columns: 1fr; }
    .login-visual { padding: 22px; }
    .login-pitch { display: none; }
    .login-main { align-items: start; padding-top: 35px; }
    .login-page { grid-template-rows: auto 1fr; }
    .report-panel { padding: 12px; }
}

.budget-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) { .budget-kpis { grid-template-columns: 1fr 1fr; } }
