:root {
    --ink: #14213d;
    --muted: #65728a;
    --line: #e4e9f1;
    --blue: #1267e5;
    --blue-dark: #0a4fb8;
    --green: #1c9c6b;
    --surface: #ffffff;
    --background: #f4f7fb;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--ink);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 90% 0, #e9f2ff 0, transparent 28%), var(--background); }
button, input, select { font: inherit; }
.shell { width: min(1840px, calc(100% - 48px)); margin: 0 auto; padding: 32px 0 44px; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: -.02em; }
.subtitle { margin: 9px 0 0; color: var(--muted); font-size: 15px; }
.status { display: flex; gap: 9px; align-items: center; padding: 9px 14px; border: 1px solid #cfe9df; border-radius: 999px; background: #f0fbf6; color: #13734e; font-size: 13px; font-weight: 650; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #d7f3e7; }
.status.offline { border-color: #f1d2d2; color: #a53b3b; background: #fff5f5; }
.status.offline span { background: #d84f4f; box-shadow: 0 0 0 4px #f8dddd; }

.toolbar, .data-panel, .metrics article { border: 1px solid rgba(220, 227, 238, .9); background: rgba(255,255,255,.96); box-shadow: 0 9px 30px rgba(34, 57, 93, .06); }
.toolbar { display: grid; grid-template-columns: minmax(330px, 1.15fr) minmax(220px, .8fr) minmax(190px, .65fr) minmax(320px, 1.5fr) auto; gap: 16px; align-items: end; padding: 20px; border-radius: 16px; }
.toolbar label { display: grid; gap: 7px; min-width: 190px; }
.toolbar label span { color: #536078; font-size: 12px; font-weight: 700; }
.filter-field { position: relative; display: grid; gap: 7px; min-width: 190px; }
.filter-field > span { color: #536078; font-size: 12px; font-weight: 700; }
.search-field { flex: 1 1 300px; }
.range-field { min-width: 330px; }
.range-picker-button { width: 100%; height: 46px; display: grid; grid-template-columns: minmax(110px,1fr) auto minmax(110px,1fr) 20px; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid #cfd9e7; border-radius: 10px; color: #223653; background: white; cursor: pointer; text-align: left; }
.range-picker-button b { color: #8b98aa; font-weight: 500; }
.range-picker-button svg { width: 18px; fill: none; stroke: #687892; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.range-picker-button:hover, .range-picker-button[aria-expanded="true"] { border-color: #68a2ed; box-shadow: 0 0 0 3px rgba(18,103,229,.1); outline: none; }
.range-picker-popup { position: absolute; top: calc(100% + 9px); left: 0; z-index: 50; width: 356px; padding: 16px; border: 1px solid #d7e0ec; border-radius: 14px; background: white; box-shadow: 0 22px 60px rgba(27,48,79,.22); }
.range-calendar-head { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; margin-bottom: 10px; }
.range-calendar-head strong { text-align: center; font-size: 15px; }
.range-calendar-head button { width: 34px; height: 34px; border: 0; border-radius: 8px; color: #53647f; background: #f4f7fb; cursor: pointer; font-size: 22px; }
.range-calendar-head button:hover:not(:disabled) { color: white; background: var(--blue); }
.range-calendar-head button:disabled { color: #b9c2cf; cursor: not-allowed; }
.range-weekdays, .range-calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.range-weekdays span { display: grid; place-items: center; height: 28px; color: #8994a7; font-size: 11px; }
.range-calendar-days button, .range-calendar-days .calendar-blank { height: 36px; }
.range-calendar-days button { position: relative; border: 0; border-radius: 8px; color: #324866; background: white; cursor: pointer; font-weight: 650; }
.range-calendar-days button:hover:not(:disabled) { color: var(--blue); background: #eaf3ff; }
.range-calendar-days button.in-range { border-radius: 0; color: #1457a9; background: #e7f1ff; }
.range-calendar-days button.range-start, .range-calendar-days button.range-end { border-radius: 8px; color: white; background: var(--blue); box-shadow: 0 5px 12px rgba(18,103,229,.28); }
.range-calendar-days button:disabled { color: #c7ced8; background: transparent; cursor: not-allowed; font-weight: 400; }
.range-calendar-days button.has-data::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 3px; height: 3px; transform: translateX(-50%); border-radius: 50%; background: currentColor; opacity: .65; }
.range-picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; padding-top: 12px; border-top: 1px solid #edf0f5; }
.range-picker-foot span { color: #66748a; font-size: 12px; }
.range-picker-foot button { border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
select, input { height: 42px; border: 1px solid #d6dde9; border-radius: 9px; background: white; color: var(--ink); outline: none; padding: 0 12px; }
.toolbar input[type="search"] { height: 46px; }
select:focus, input:focus { border-color: #74a9ef; box-shadow: 0 0 0 3px rgba(18, 103, 229, .1); }
.date-field { position: relative; }
.date-picker { position: relative; }
.date-picker-button { width: 100%; height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 12px; border: 1px solid #d6dde9; border-radius: 9px; color: var(--ink); background: white; cursor: pointer; text-align: left; }
.date-picker-button:focus, .date-picker-button[aria-expanded="true"] { border-color: #74a9ef; box-shadow: 0 0 0 3px rgba(18, 103, 229, .1); outline: none; }
.date-picker-button svg { width: 18px; fill: none; stroke: #73809a; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.calendar-popup { position: absolute; top: calc(100% + 9px); left: 0; z-index: 20; width: 314px; padding: 15px; border: 1px solid #dce3ed; border-radius: 12px; background: white; box-shadow: 0 16px 45px rgba(28, 45, 73, .18); }
.calendar-head { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; margin-bottom: 10px; }
.calendar-head strong { text-align: center; font-size: 15px; }
.calendar-head button { height: 32px; border: 0; border-radius: 7px; color: #4c5b73; background: transparent; cursor: pointer; font-size: 24px; line-height: 1; }
.calendar-head button:hover:not(:disabled) { color: var(--blue); background: #eef5ff; }
.calendar-head button:disabled { color: #c6ccd6; cursor: not-allowed; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-weekdays span { display: grid; place-items: center; height: 30px; color: #66728a; font-size: 12px; }
.calendar-days button, .calendar-blank { height: 34px; }
.calendar-days button { border: 0; border-radius: 7px; color: #37506f; background: #eef5ff; cursor: pointer; font-weight: 700; }
.calendar-days button:hover:not(:disabled) { color: white; background: #4b91ed; }
.calendar-days button.selected { color: white; background: var(--blue); box-shadow: 0 4px 10px rgba(18,103,229,.25); }
.calendar-days button:disabled { color: #bdc4cf; background: transparent; cursor: not-allowed; font-weight: 400; }
.calendar-note { margin: 11px 0 0; color: #7a879b; font-size: 11px; text-align: center; }
.button { height: 42px; border: 0; border-radius: 9px; padding: 0 18px; cursor: pointer; font-weight: 700; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button.primary { color: white; background: var(--blue); box-shadow: 0 7px 16px rgba(18, 103, 229, .22); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { display: flex; gap: 8px; align-items: center; border: 1px solid #cbd7e8; color: #25507d; background: #f6f9fd; }
.button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.toolbar-actions .button { height: 46px; white-space: nowrap; }
.multi-select-button { width: 100%; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; border: 1px solid #d6dde9; border-radius: 10px; color: var(--ink); background: white; cursor: pointer; text-align: left; }
.multi-select-button::after { content: "⌄"; color: #728099; font-size: 18px; }
.multi-select-button:hover, .multi-select-button:focus { border-color: #74a9ef; box-shadow: 0 0 0 3px rgba(18,103,229,.1); outline: none; }
.multi-select-popup { position: absolute; top: calc(100% + 9px); left: 0; z-index: 30; width: 350px; overflow: hidden; padding: 10px; border: 1px solid #dce3ed; border-radius: 12px; background: white; box-shadow: 0 16px 45px rgba(28,45,73,.18); }
.multi-select-head { display: grid; gap: 8px; margin-bottom: 8px; }
.multi-select-head input { width: 100%; }
.selection-actions { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 3px; }
.selection-actions span { color: #6d7a90; font-size: 12px; font-weight: 600; }
.selection-actions button { min-width: 74px; height: 30px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--blue); background: #edf5ff; cursor: pointer; font-size: 12px; font-weight: 750; }
.selection-actions button:hover { color: white; background: var(--blue); }
.selection-actions button:disabled { color: #a8b1bf; background: #f2f4f7; cursor: not-allowed; }
.multi-select-options { display: grid; gap: 5px; max-height: 300px; overflow-y: auto; padding-right: 2px; }
.option-group { overflow: hidden; border: 1px solid #edf0f5; border-radius: 9px; }
.group-option, .check-option { display: flex; align-items: center; gap: 9px; min-height: 37px; padding: 7px 9px; cursor: pointer; }
.group-option { justify-content: space-between; color: #2e405c; background: #f7f9fc; font-weight: 750; }
.group-option strong { flex: 1; }
.group-option small, .check-option small { margin-left: auto; color: #8a96a9; font-weight: 500; }
.check-option { padding-left: 28px; color: #42516b; }
.check-option:hover { background: #f3f7fd; }
.group-option input, .check-option input { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--blue); }
.no-option { padding: 20px 10px; color: var(--muted); text-align: center; font-size: 13px; }
.multi-select-done { width: 100%; height: 36px; margin-top: 9px; border: 0; border-radius: 8px; color: white; background: var(--blue); cursor: pointer; font-weight: 700; }
.multi-select-done:hover { background: var(--blue-dark); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.metrics article { display: grid; gap: 8px; padding: 17px 20px; border-radius: 12px; }
.metrics span { color: var(--muted); font-size: 12px; font-weight: 650; }
.metrics strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.data-panel { overflow: hidden; border-radius: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 15px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.page-size { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 12px; }
.page-size select { height: 34px; }
.table-wrap { position: relative; min-height: 440px; max-height: calc(100vh - 410px); overflow: auto; }
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th, td { max-width: 280px; height: 42px; padding: 0 13px; overflow: hidden; border-right: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; white-space: nowrap; text-overflow: ellipsis; }
th { position: sticky; top: 0; z-index: 3; color: #3c4b63; background: #f5f8fc; text-align: left; font-weight: 750; box-shadow: inset 0 -1px #dce3ed; }
td { color: #28364d; background: white; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #f4f8ff; }
.group-row td { position: static !important; height: 36px; padding: 0 14px; color: #24466e; background: #edf5ff !important; box-shadow: none !important; font-weight: 700; }
.group-row td strong { margin-right: 12px; }
.group-row td span { display: inline-block; padding: 3px 8px; border-radius: 999px; color: #315f96; background: #dcecff; font-size: 11px; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 2; }
th:first-child { z-index: 5; }
th:nth-child(4), td:nth-child(4) { position: sticky; left: 102px; z-index: 2; box-shadow: 4px 0 8px rgba(27, 50, 81, .04); }
th:nth-child(4) { z-index: 5; }
.state-card { position: absolute; inset: 55px 0 0; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.92); font-size: 14px; }
.state-card.error { color: #b33b3b; }
.hidden { display: none !important; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 14px 18px; }
.pagination button { height: 34px; padding: 0 13px; border: 1px solid #d8dfeb; border-radius: 7px; color: #42516b; background: white; cursor: pointer; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
#pageInfo { min-width: 150px; color: var(--muted); text-align: center; font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; transform: translateY(20px); padding: 12px 17px; border-radius: 9px; color: white; background: #263650; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: .2s ease; font-size: 13px; }
.toast.show { transform: translateY(0); opacity: 1; }
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgba(19,31,51,.42); backdrop-filter: blur(3px); }
.modal-card { width: min(560px, 100%); padding: 22px; border: 1px solid #dde4ee; border-radius: 16px; background: white; box-shadow: 0 22px 65px rgba(20,33,61,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 8px; color: #60708a; background: #f3f6fa; cursor: pointer; font-size: 20px; }
.export-option { display: grid; grid-template-columns: 20px 1fr; gap: 4px 10px; margin: 9px 0; padding: 13px; border: 1px solid #e0e6ef; border-radius: 11px; cursor: pointer; }
.export-option:hover { border-color: #a8c8ef; background: #f7faff; }
.export-option input { grid-row: 1 / span 2; align-self: center; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--blue); }
.export-option strong { color: #2a3d59; }
.export-option span { color: var(--muted); font-size: 12px; }
.validation-result { margin: 14px 0 0; padding: 12px; border-radius: 9px; color: #42516b; background: #f3f6fa; font-size: 13px; line-height: 1.6; }
.validation-result.passed { color: #13734e; background: #ecf9f3; }
.validation-result.failed { color: #a53b3b; background: #fff0f0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 1450px) {
    .toolbar { grid-template-columns: minmax(330px, 1.15fr) minmax(220px, .8fr) minmax(190px, .7fr); }
    .search-field { grid-column: 1 / span 2; }
    .toolbar-actions { grid-column: 3; }
}

@media (max-width: 900px) {
    .shell { width: calc(100% - 24px); padding-top: 22px; }
    .hero { gap: 14px; }
    .status { display: none; }
    .toolbar { grid-template-columns: 1fr 1fr; }
    .toolbar label, .filter-field { min-width: 0; }
    .range-field, .search-field { grid-column: 1 / -1; }
    .toolbar-actions { grid-column: 1 / -1; }
    .metrics { grid-template-columns: repeat(3, minmax(150px, 1fr)); overflow-x: auto; }
    .table-wrap { max-height: calc(100vh - 430px); }
}

@media (max-width: 600px) {
    h1 { font-size: 28px; }
    .toolbar { grid-template-columns: 1fr; }
    .range-field, .search-field { grid-column: auto; }
    .toolbar-actions { grid-column: auto; justify-content: stretch; }
    .multi-select-button, .multi-select-popup, .range-picker-popup { width: 100%; }
    .range-picker-button { grid-template-columns: 1fr auto 1fr 18px; font-size: 13px; }
    .button { flex: 1 1 calc(50% - 7px); }
    .panel-head { align-items: flex-end; }
    .metrics { grid-template-columns: 1fr; }
}
