:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f0f5f4;
  --line: #d9dee8;
  --text: #1f2937;
  --muted: #64748b;
  --brand: #2364aa;
  --brand-dark: #184b82;
  --sidebar-bg: #f7fbff;
  --sidebar-text: #26445f;
  --sidebar-muted: #6b8196;
  --sidebar-hover: #eef7ff;
  --sidebar-press: #d9ecff;
  --sidebar-active: #e4f1ff;
  --sidebar-active-text: #174f8a;
  --sidebar-accent: #2f80c9;
  --teal: #0f8b8d;
  --green: #2f855a;
  --amber: #b7791f;
  --red: #c2410c;
  --danger: #b91c1c;
  --purple: #6d5bd0;
  --shadow: 0 12px 30px rgba(30, 41, 59, 0.08);
  --interactive-hover: #f4f9ff;
  --interactive-press: #e1f0ff;
  --interactive-border: #c7dff4;
  --interactive-border-strong: #96c4ea;
  --interactive-shadow: 0 8px 22px rgba(35, 100, 170, 0.08);
  --interactive-shadow-strong: 0 12px 28px rgba(35, 100, 170, 0.13);
  --focus-ring: 0 0 0 3px rgba(47, 128, 201, 0.18);
  --press-shadow: inset 0 1px 5px rgba(35, 100, 170, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

a {
  color: inherit;
}

#toast {
  position: fixed;
  right: 20px;
  top: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--danger);
}

.version-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px 8px 16px;
  border: 1px solid #b9d7ef;
  border-radius: 8px;
  background: #f3f9ff;
  color: #174f8a;
  box-shadow: 0 12px 26px rgba(35, 100, 170, 0.14);
  transform: translateX(-50%);
}

.version-banner span {
  font-weight: 700;
  white-space: nowrap;
}

.login-screen {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: clamp(28px, 6vh, 58px) clamp(22px, 5vw, 76px);
  overflow: hidden;
  background: #eef6fb;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: url("/login-bg.svg") center / cover no-repeat;
  transform: scaleX(-1);
}

.login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(270deg, rgba(238, 246, 251, 0.96) 0%, rgba(238, 246, 251, 0.82) 36%, rgba(238, 246, 251, 0.48) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 46%);
}

.login-panel {
  position: relative;
  z-index: 2;
  width: min(440px, calc(100vw - 44px));
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #c9dcec;
  border-radius: 8px;
  box-shadow: 0 22px 48px rgba(36, 88, 132, 0.14);
  padding: 28px;
  backdrop-filter: blur(8px);
}

.login-panel h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.2;
}

.login-panel .subtitle {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-password-field {
  margin-top: 12px;
}

.login-bottom-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.login-submit {
  min-width: 96px;
}

.login-remember {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.16s ease;
}

.login-remember:hover {
  color: var(--brand-dark);
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  grid-template-rows: 58px minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 3px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid #d8e5f0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.7), 6px 0 22px rgba(35, 100, 170, 0.04);
  padding: 12px 10px;
  overflow-y: auto;
  scrollbar-color: rgba(35, 100, 170, 0.26) transparent;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 5px;
  border-radius: 10px;
}

.nav-group-title {
  position: relative;
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr 20px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.nav-group-title:hover,
.nav-group.active .nav-group-title {
  color: var(--sidebar-active-text);
  background: var(--sidebar-hover);
}

.nav-group-title:hover {
  border-color: #cde3f5;
  box-shadow: 0 5px 14px rgba(35, 100, 170, 0.07);
  transform: translateX(2px);
}

.nav-group-title:active {
  background: var(--sidebar-press);
  transform: translateX(1px) scale(0.99);
}

.nav-group-title:focus-visible {
  border-color: #9fc9ec;
  box-shadow: 0 0 0 3px rgba(47, 128, 201, 0.16);
}

.nav-group.active .nav-group-title {
  border-color: #c9e1f5;
  background: #f0f8ff;
  box-shadow: inset 3px 0 0 var(--sidebar-accent), 0 6px 16px rgba(35, 100, 170, 0.07);
}

.nav-group.active .nav-group-title:hover {
  background: #e8f4ff;
  border-color: #b9d8f1;
  box-shadow: inset 3px 0 0 var(--sidebar-accent), 0 8px 18px rgba(35, 100, 170, 0.1);
}

.nav-group-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #e6f1fb;
  color: var(--sidebar-active-text);
  font-size: 13px;
  line-height: 1;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.18s ease;
}

.nav-group-title:hover .nav-group-icon {
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(35, 100, 170, 0.12);
}

.nav-group:not(.collapsed) .nav-group-title:hover .nav-group-icon {
  transform: translateY(-1px);
}

.nav-group.collapsed .nav-group-icon {
  transform: rotate(-90deg);
}

.nav-group.collapsed .nav-group-title:hover .nav-group-icon {
  transform: rotate(-90deg) translateX(-1px);
}

.nav-group-items {
  display: grid;
  gap: 4px;
  margin-left: 11px;
  padding-left: 10px;
  border-left: 1px solid #d9e9f5;
}

.nav-group-items[hidden] {
  display: none;
}

.nav-button {
  position: relative;
  width: 100%;
  height: 38px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
  color: var(--sidebar-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.nav-button:hover {
  background: var(--sidebar-hover);
  border-color: #cde3f5;
  color: var(--sidebar-active-text);
  box-shadow: 0 5px 14px rgba(35, 100, 170, 0.07);
  transform: translateX(2px);
}

.nav-button:active {
  background: var(--sidebar-press);
  box-shadow: inset 0 1px 4px rgba(35, 100, 170, 0.16);
  transform: translateX(1px) scale(0.99);
}

.nav-button:focus-visible {
  border-color: #9fc9ec;
  box-shadow: 0 0 0 3px rgba(47, 128, 201, 0.16);
}

.nav-button.active {
  background: var(--sidebar-active);
  border-color: #bddaf2;
  color: var(--sidebar-active-text);
  box-shadow: inset 3px 0 0 var(--sidebar-accent), 0 8px 18px rgba(35, 100, 170, 0.1);
  font-weight: 800;
}

.nav-button.active:hover {
  background: #dcedff;
  border-color: #a8cff0;
  box-shadow: inset 3px 0 0 var(--sidebar-accent), 0 10px 22px rgba(35, 100, 170, 0.13);
  transform: translateX(1px);
}

.nav-button.active:active {
  background: #d4e9ff;
  box-shadow: inset 3px 0 0 var(--sidebar-accent), inset 0 1px 5px rgba(35, 100, 170, 0.15);
  transform: translateX(1px) scale(0.99);
}

.nav-button > span:first-child {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef6fc;
  color: #51718c;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.nav-button:hover > span:first-child {
  background: #ffffff;
  color: var(--sidebar-active-text);
  box-shadow: 0 2px 7px rgba(35, 100, 170, 0.12);
  transform: translateY(-1px);
}

.nav-button.active > span:first-child {
  background: #ffffff;
  color: var(--sidebar-active-text);
  box-shadow: 0 2px 8px rgba(35, 100, 170, 0.12);
}

.nav-button.active::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 9px;
  width: 3px;
  height: 20px;
  border-radius: 999px 0 0 999px;
  background: var(--sidebar-accent);
  box-shadow: none;
  transition: height 0.16s ease, top 0.16s ease, background 0.16s ease;
}

.nav-button.active:hover::after {
  top: 7px;
  height: 24px;
}

.branding-preview {
  min-height: 72px;
  display: flex;
  align-items: center;
}

.brand-logo-preview {
  width: 112px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.brand-logo-empty {
  width: 112px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}

.main {
  min-width: 0;
  overflow: auto;
  padding: 18px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.page-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.panel-header {
  min-height: 46px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
}

.modal-panel {
  width: min(880px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.46);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-header {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.measurement-detail-panel .detail-list {
  grid-template-columns: 128px minmax(0, 1fr);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 108px;
  padding: 13px;
  min-width: 0;
  color: inherit;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.metric-action {
  width: 100%;
  cursor: pointer;
  outline: none;
}

.metric-action:hover,
.panel-action:hover,
.tag-button:hover,
.rank-row.route-jump:hover {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--interactive-shadow);
}

.metric-action:hover,
.panel-action:hover {
  background: #fbfdff;
  transform: translateY(-2px);
}

.metric-action:active,
.panel-action:active {
  background: var(--interactive-hover);
  box-shadow: var(--press-shadow);
  transform: translateY(0) scale(0.995);
}

.metric-action:focus-visible,
.panel-action:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.metric-card span {
  display: block;
}

.metric-label {
  color: var(--muted);
  margin-bottom: 7px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.metric-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.screen-dashboard {
  min-height: calc(100vh - 92px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid #cddfeb;
  border-radius: 8px;
  background: #edf6fb;
  color: #102033;
  overflow: auto;
}

.screen-dashboard:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  padding: 14px;
  background: #edf6fb;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.screen-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.screen-brand .brand-mark,
.screen-brand .brand-logo {
  width: 44px;
  height: 44px;
}

.screen-brand h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-brand p {
  margin: 4px 0 0;
  color: #527086;
}

.screen-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  color: #527086;
  text-align: right;
}

.screen-clock {
  min-width: 164px;
  font-weight: 700;
  color: #163a5d;
}

.screen-data-state {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
}

.screen-data-state.ok {
  background: #dff4ea;
  color: #1f6f4a;
}

.screen-data-state.stale {
  background: #fff0d8;
  color: #9a5b12;
}

.screen-total-band,
.screen-panel,
.screen-kpi,
.screen-total-item {
  border: 1px solid #cddfeb;
  border-radius: 8px;
  background: #ffffff;
}

.screen-total-band,
.screen-panel {
  padding: 12px;
  min-width: 0;
}

.screen-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.screen-section-title h3 {
  margin: 0;
  font-size: 16px;
}

.screen-section-title span {
  color: #527086;
  font-size: 12px;
}

.screen-total-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 9px;
}

.screen-total-item,
.screen-kpi {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 78px;
  padding: 9px 10px;
  color: inherit;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.screen-total-item span,
.screen-kpi span {
  color: #527086;
}

.screen-total-item strong,
.screen-kpi strong {
  font-size: 24px;
  line-height: 1;
}

.screen-total-item em,
.screen-kpi em {
  color: #6c7f91;
  font-size: 12px;
  font-style: normal;
}

.screen-total-item.route-jump:hover,
.screen-kpi.route-jump:hover,
.screen-feed-row.route-jump:hover,
.screen-alert-row.route-jump:hover,
.screen-dept-row.route-jump:hover {
  border-color: var(--interactive-border-strong);
  background: #f8fcff;
  box-shadow: var(--interactive-shadow);
  transform: translateY(-1px);
}

.screen-total-item.route-jump:active,
.screen-kpi.route-jump:active,
.screen-feed-row.route-jump:active,
.screen-alert-row.route-jump:active,
.screen-dept-row.route-jump:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
  transform: translateY(0) scale(0.995);
}

.screen-total-item.route-jump:focus-visible,
.screen-kpi.route-jump:focus-visible,
.screen-feed-row.route-jump:focus-visible,
.screen-alert-row.route-jump:focus-visible,
.screen-dept-row.route-jump:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
  outline: none;
}

.screen-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 8px;
}

.screen-kpi {
  min-height: 80px;
}

.screen-kpi strong {
  font-size: 26px;
}

.screen-main-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(184px, auto);
  gap: 10px;
  align-items: stretch;
}

.screen-panel-large {
  grid-column: span 2;
  display: grid;
  grid-template-rows: auto auto;
}

.screen-recent-panel {
  grid-column: span 3;
}

.screen-dashboard .pie-chart {
  grid-template-columns: minmax(96px, 128px) minmax(0, 1fr);
  gap: 8px;
}

.screen-dashboard .donut-chart {
  max-width: 128px;
}

.screen-dashboard .donut-center strong {
  font-size: 22px;
}

.screen-trend-bars {
  height: 172px;
  min-height: 172px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  align-items: end;
}

.screen-trend-day {
  min-width: 0;
  display: grid;
  grid-template-rows: 126px auto auto;
  align-content: end;
  gap: 5px;
  justify-items: center;
  color: #527086;
  font-size: 12px;
}

.screen-trend-day strong {
  color: #163a5d;
}

.screen-trend-stack {
  height: 126px;
  width: 50px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}

.screen-trend-bar {
  display: block;
  flex: 0 0 19px;
  width: 19px;
  min-height: 0;
  border-radius: 5px 5px 0 0;
  transition: height 0.18s ease, filter 0.18s ease;
}

.screen-trend-bar.total {
  background: var(--teal);
}

.screen-trend-bar.abnormal {
  background: var(--red);
}

.screen-dept-list,
.screen-alert-list,
.screen-feed-list {
  display: grid;
  gap: 8px;
}

.screen-dept-row {
  display: grid;
  grid-template-columns: minmax(80px, 0.85fr) minmax(90px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  text-align: left;
  background: #f8fbfe;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.screen-dept-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-dept-row div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4edf5;
}

.screen-dept-row div span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.screen-dept-row em {
  color: #527086;
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.screen-feed-row,
.screen-alert-row {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  background: #f8fbfe;
  color: inherit;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.screen-feed-row {
  grid-template-columns: 70px minmax(52px, 0.5fr) minmax(140px, 1.35fr) minmax(112px, auto);
}

.screen-feed-row.active,
.screen-alert-row.active {
  border-color: #95c6ee;
  background: #eef7ff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.screen-feed-row strong,
.screen-feed-row span,
.screen-alert-row span,
.screen-alert-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-feed-row em {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  min-width: 0;
  font-style: normal;
}

.screen-feed-time {
  color: #527086;
  font-size: 12px;
}

.screen-alert-row {
  grid-template-columns: 1fr;
}

.screen-alert-row div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.screen-alert-row div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-alert-row em {
  color: #527086;
  font-size: 12px;
  font-style: normal;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  min-width: 0;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
}

.pending-filter {
  display: grid;
  grid-template-columns: minmax(360px, 1.6fr) repeat(2, minmax(150px, 0.7fr)) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.time-segmented {
  min-height: 36px;
  display: grid;
  grid-template-columns: repeat(5, minmax(62px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.time-range-button {
  min-width: 0;
  min-height: 34px;
  padding: 0 9px;
  border-left: 1px solid var(--line);
  background: #fff;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.time-range-button:first-child {
  border-left: 0;
}

.time-range-button:hover {
  background: var(--interactive-hover);
  color: var(--brand-dark);
}

.time-range-button:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
}

.time-range-button:focus-visible {
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 2px var(--sidebar-accent);
}

.time-range-button.active {
  background: #e4f1ff;
  color: var(--brand-dark);
  box-shadow: inset 0 -3px 0 var(--brand);
  font-weight: 700;
}

.filter-summary {
  color: var(--muted);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 7px 9px;
  color: var(--text);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field .toggle-control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.field .toggle-control input {
  width: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--brand);
}

.field .toggle-control:hover {
  border-color: var(--interactive-border);
  background: var(--interactive-hover);
}

.field .read-only-value {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--interactive-border);
  background: #fbfdff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.date-cn-input {
  letter-spacing: 0;
}

.trend-filter {
  align-items: end;
}

.trend-person-field {
  grid-column: span 2;
}

.trend-person-select {
  min-height: 42px;
  border-color: #b9c7d8;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  font-weight: 700;
}

.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #e8edf4;
  color: #263548;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:hover {
  background: #dfe9f4;
  border-color: #cbd8e6;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.btn:active {
  background: #d5e1ee;
  box-shadow: var(--press-shadow);
  transform: translateY(0) scale(0.98);
}

.btn:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: 0 8px 20px rgba(35, 100, 170, 0.22);
}

.btn.primary:active {
  background: #143f6f;
  border-color: #143f6f;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.18);
}

.btn.danger {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.btn.danger:hover {
  background: #fecaca;
  border-color: #fca5a5;
  box-shadow: 0 7px 18px rgba(185, 28, 28, 0.12);
}

.btn.danger:active {
  background: #fee2e2;
  box-shadow: inset 0 1px 5px rgba(185, 28, 28, 0.14);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-dark);
}

.btn.ghost:hover {
  background: var(--interactive-hover);
  border-color: var(--interactive-border);
}

.btn:disabled {
  box-shadow: none;
  transform: none;
}

.btn:disabled:hover,
.btn:disabled:active {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.btn.primary:disabled:hover,
.btn.primary:disabled:active {
  background: var(--brand);
  border-color: var(--brand);
}

.btn.danger:disabled:hover,
.btn.danger:disabled:active {
  background: #fee2e2;
  border-color: #fecaca;
}

.btn.icon {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.action-btn {
  min-width: 70px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.action-icon {
  width: 15px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.btn.action-view {
  border-color: #bad6ef;
  background: #edf6ff;
  color: #18578f;
}

.btn.action-view:hover {
  border-color: #8ebce3;
  background: #dfefff;
  color: #104b80;
}

.btn.action-edit {
  border-color: #b6ddd6;
  background: #edf8f6;
  color: #0d6b65;
}

.btn.action-edit:hover {
  border-color: #82c5b9;
  background: #daf2ee;
  color: #095c57;
}

.btn.action-jump {
  border-color: #c6dced;
  background: #f8fbff;
  color: #245e8c;
}

.btn.action-jump:hover {
  border-color: #98c1e2;
  background: #eaf4fd;
  color: #174f7d;
}

.btn.action-process {
  border-color: #9fc5e8;
  background: #e5f0fb;
  color: #174f82;
}

.btn.action-process:hover {
  border-color: #76addd;
  background: #d5e8f9;
  color: #123f69;
}

.btn.action-save {
  border-color: #acd7bc;
  background: #edf8f1;
  color: #216b42;
}

.btn.action-save:hover {
  border-color: #7fc29a;
  background: #daf1e3;
  color: #185535;
}

.btn.action-view:disabled:hover {
  border-color: #bad6ef;
  background: #edf6ff;
  color: #18578f;
}

.btn.action-edit:disabled:hover {
  border-color: #b6ddd6;
  background: #edf8f6;
  color: #0d6b65;
}

.btn.action-jump:disabled:hover {
  border-color: #c6dced;
  background: #f8fbff;
  color: #245e8c;
}

.btn.action-process:disabled:hover {
  border-color: #9fc5e8;
  background: #e5f0fb;
  color: #174f82;
}

.btn.action-save:disabled:hover {
  border-color: #acd7bc;
  background: #edf8f1;
  color: #216b42;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

th {
  background: #f3f6fa;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr.clickable-row:hover td {
  background: #f4f9ff;
}

tbody tr.clickable-row:hover td:first-child {
  box-shadow: inset 2px 0 0 rgba(47, 128, 201, 0.34);
}

tr.selected-row td {
  background: #edf6ff;
}

tr.selected-row td:first-child {
  box-shadow: inset 4px 0 0 var(--brand);
}

tr.selected-row:hover td {
  background: #e8f3ff;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.row-actions select {
  max-width: 150px;
  min-width: 112px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.row-actions select:hover {
  border-color: var(--interactive-border);
  background: #fbfdff;
}

.row-actions select:focus {
  outline: none;
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.pending-panel table {
  min-width: 1120px;
}

.pending-match-cell {
  width: 420px;
  min-width: 360px;
  vertical-align: top;
}

.match-control {
  display: grid;
  gap: 8px;
  max-width: 430px;
}

.match-picker {
  position: relative;
  display: grid;
  gap: 8px;
}

.person-select-trigger {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid #ccd6e3;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.person-select-trigger:hover,
.match-picker.open .person-select-trigger {
  border-color: rgba(35, 100, 170, 0.55);
  background: #f4f8fd;
  box-shadow: 0 0 0 3px rgba(35, 100, 170, 0.08);
}

.person-select-trigger:hover {
  transform: translateY(-1px);
}

.person-select-trigger:active {
  background: var(--interactive-press);
  transform: translateY(0) scale(0.995);
}

.person-select-trigger:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.person-avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  border-radius: 50%;
  background: #e6f0fb;
  color: var(--brand-dark);
  font-weight: 800;
}

.person-selected-text,
.person-option-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.person-selected-text strong,
.person-option-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-selected-text span,
.person-option-text span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.match-chevron {
  color: var(--muted);
  font-size: 16px;
}

.person-options {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.person-search {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.person-search:hover {
  border-color: var(--interactive-border);
  background: #fbfdff;
}

.person-search:focus {
  outline: none;
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.person-option-list {
  display: grid;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}

.person-option {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px;
  color: var(--text);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.person-option:hover {
  border-color: rgba(35, 100, 170, 0.38);
  background: #f8fbff;
  box-shadow: var(--interactive-shadow);
  transform: translateX(2px);
}

.person-option:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
  transform: translateX(1px) scale(0.995);
}

.person-option:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.person-option.selected {
  border-color: rgba(35, 100, 170, 0.48);
  background: #eef6ff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.person-option.selected:hover {
  background: #e6f2ff;
  box-shadow: inset 3px 0 0 var(--brand), var(--interactive-shadow);
}

.person-empty,
.match-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.match-hint {
  color: var(--muted);
  font-size: 12px;
}

.match-footer .btn {
  min-width: 104px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e7edf5;
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}

.badge.normal,
.badge.online,
.badge.active,
.badge.valid,
.badge.passed,
.badge.closed,
.badge.confirmed {
  background: #dcfce7;
  color: #166534;
}

.badge.warn,
.badge.pending,
.badge.review,
.badge.processing,
.badge.rechecked {
  background: #fef3c7;
  color: #92400e;
}

.badge.high,
.badge.offline,
.badge.invalid,
.badge.pending_match {
  background: #ffedd5;
  color: #9a3412;
}

.badge.critical,
.badge.fault,
.badge.disabled {
  background: #fee2e2;
  color: #991b1b;
}

.badge.low,
.badge.maintenance {
  background: #ede9fe;
  color: #5b21b6;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.detail-list {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.identity-conflict-filter {
  align-items: end;
  margin-bottom: 12px;
}

.identity-conflict-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.identity-candidates {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.identity-candidate {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.identity-candidate > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.identity-candidate span {
  color: var(--muted);
  font-size: 12px;
}

.identity-candidate code {
  max-width: 56%;
  overflow-wrap: anywhere;
  color: var(--brand-dark);
  background: var(--surface-soft);
  border-radius: 5px;
  padding: 5px 7px;
}

.identity-candidate-actions {
  max-width: 60%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.identity-candidate-actions code {
  max-width: calc(100% - 40px);
}

.identity-resolution-form {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.identity-resolution-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-bars {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  padding-top: 12px;
}

.trend-chart {
  width: 100%;
  min-width: 0;
  height: 220px;
  min-height: 220px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  cursor: pointer;
}

.trend-chart:hover {
  background: #fbfdff;
}

.dashboard-trend-chart {
  height: 224px;
  min-height: 224px;
}

.screen-trend-chart {
  height: 172px;
  min-height: 172px;
  background: #ffffff;
}

.trend-chart-fallback {
  cursor: default;
}

.bar-group {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-items: end;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.bar-stack {
  height: 168px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}

.bar {
  display: block;
  flex: 0 0 19px;
  width: 19px;
  min-height: 0;
  border-radius: 5px 5px 0 0;
  background: var(--teal);
}

.bar.alert {
  background: var(--red);
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) 42px;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 4px;
  text-align: left;
  cursor: default;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.rank-row.route-jump {
  cursor: pointer;
}

.rank-row.route-jump:hover {
  background: var(--interactive-hover);
  transform: translateX(2px);
}

.rank-row.route-jump:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
  transform: translateX(1px) scale(0.995);
}

.rank-row.route-jump:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.track {
  height: 9px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.track > span {
  display: block;
  height: 100%;
  background: var(--teal);
  transition: filter 0.16s ease, transform 0.16s ease;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 2px;
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.tag-button:hover {
  background: var(--interactive-hover);
  transform: translateY(-1px);
}

.tag-button:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
  transform: translateY(0) scale(0.98);
}

.tag-button:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.tag-button:hover .badge {
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.08);
}

.pie-chart {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.donut-chart {
  position: relative;
  width: 100%;
  max-width: 210px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.donut-track,
.donut-slice {
  fill: none;
  cx: 18;
  cy: 18;
}

.donut-track {
  stroke: #eef2f7;
  stroke-width: 8.5;
}

.donut-slice {
  stroke-width: 8.5;
  cursor: pointer;
  pointer-events: stroke;
  transition: stroke-width 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

.donut-slice:hover,
.donut-slice:focus {
  stroke-width: 10.2;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.18));
  outline: none;
}

.donut-slice:active {
  stroke-width: 9.4;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.14));
}

.donut-slice:focus-visible {
  stroke-width: 10.2;
  filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0)) drop-shadow(0 5px 10px rgba(35, 100, 170, 0.22));
}

.donut-chart:hover .donut-slice:not(:hover) {
  opacity: 0.62;
}

.donut-center {
  position: absolute;
  inset: 27%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 0 0 1px #eef2f7;
  text-align: center;
  pointer-events: none;
}

.donut-center strong {
  font-size: 30px;
  line-height: 1;
}

.donut-center span {
  max-width: 82px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.pie-chart:has(.donut-slice:hover) .donut-center,
.pie-chart:has(.chart-legend-item:hover) .donut-center {
  box-shadow: inset 0 0 0 2px var(--hover-color, var(--brand)), 0 8px 22px rgba(15, 23, 42, 0.1);
}

.chart-legend {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.chart-legend-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f8fafc;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.chart-legend-item:hover,
.chart-legend-item:focus {
  background: #fff;
  border-color: rgba(35, 100, 170, 0.22);
  box-shadow: 0 6px 16px rgba(35, 100, 170, 0.08);
  outline: none;
  transform: translateX(2px);
}

.chart-legend-item:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
  transform: translateX(1px) scale(0.995);
}

.chart-legend-item:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.chart-legend-item span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-legend-item em {
  color: var(--muted);
  font-style: normal;
}

.column-chart {
  height: 236px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 12px;
  align-items: end;
  min-width: 0;
}

.column-item {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 6px;
  align-items: end;
  justify-items: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.column-item:hover {
  background: var(--interactive-hover);
  border-color: var(--interactive-border);
  box-shadow: var(--interactive-shadow);
  transform: translateY(-2px);
}

.column-item:active {
  background: var(--interactive-press);
  box-shadow: var(--press-shadow);
  transform: translateY(0) scale(0.995);
}

.column-item:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.column-stack {
  height: 170px;
  width: 34px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
}

.column {
  width: 14px;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  transition: filter 0.16s ease, transform 0.16s ease;
}

.column-item:hover .column {
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.column.total {
  background: var(--brand);
}

.column.abnormal {
  background: var(--red);
}

.column-item strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.column-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.panel-action {
  border: 1px solid var(--line);
  cursor: pointer;
  outline: none;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-jump-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 8px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
}

.route-jump {
  cursor: pointer;
}

button.panel-jump-label:hover {
  border-color: #b9d8f1;
  background: #eef7ff;
  box-shadow: 0 4px 12px rgba(35, 100, 170, 0.08);
}

button.panel-jump-label:active {
  background: #d9ecff;
  box-shadow: inset 0 1px 4px rgba(35, 100, 170, 0.14);
  transform: translateY(1px);
}

.route-jump:not(button):focus-visible {
  outline: 3px solid rgba(47, 128, 201, 0.28);
  outline-offset: 2px;
}

.panel-action:focus-visible {
  border-color: var(--interactive-border-strong);
  box-shadow: var(--focus-ring);
}

.measurement-detail.active,
.btn.active {
  border-color: #76addd;
  background: #d8eafb;
  color: var(--brand-dark);
  box-shadow: 0 0 0 2px rgba(35, 100, 170, 0.12), 0 5px 14px rgba(35, 100, 170, 0.08);
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.svg-chart {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  overflow: visible;
}

.svg-chart text {
  font-size: 12px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 11px;
}

.timeline-item time {
  color: var(--muted);
  font-size: 12px;
}

.code {
  max-height: 210px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: #101827;
  color: #e5e7eb;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .dashboard-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .screen-total-grid,
  .screen-kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .screen-main-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .screen-panel-large,
  .screen-recent-panel {
    grid-column: auto;
  }

  .identity-conflict-grid {
    grid-template-columns: 1fr;
  }

  .identity-resolution-form {
    padding-left: 0;
    padding-top: 16px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .form-grid,
  .form-grid.compact {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .pending-filter {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .pending-range-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
    min-height: 58px;
    padding: 10px 12px;
  }

  .sidebar {
    grid-column: 1;
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    padding: 8px;
  }

  .nav {
    display: flex;
    width: max-content;
  }

  .nav-group-items {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .nav-button {
    width: auto;
  }

  .main {
    padding: 12px;
  }

  .metric-grid,
  .form-grid,
  .form-grid.compact,
  .pending-filter {
    grid-template-columns: 1fr;
  }

  .pending-range-field {
    grid-column: auto;
  }

  .time-segmented {
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(66px, 1fr));
  }

  .pie-chart {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .screen-dashboard {
    min-height: calc(100vh - 88px);
    padding: 10px;
  }

  .screen-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .screen-status {
    justify-content: flex-start;
    text-align: left;
  }

  .screen-total-grid,
  .screen-kpi-grid {
    grid-template-columns: 1fr;
  }

  .screen-main-grid {
    grid-template-columns: 1fr;
  }

  .screen-feed-row {
    grid-template-columns: 1fr;
  }

  .screen-feed-row em {
    justify-content: flex-start;
  }

  .screen-dashboard .pie-chart {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .trend-person-field {
    grid-column: auto;
  }

  .page-head {
    display: grid;
  }
}
