:root {
  --layout-gap: 20px;
  --card-radius: 12px;
  --card-padding: 16px;
  --sidebar-width: 30%;

  --primary: #0086d5;
  --primary-strong: #006faf;
  --primary-soft: rgba(0, 134, 213, 0.1);
  --accent: #ff9f43;
  --success: #22a06b;
  --error: #e05b5f;
  --border: #e8edf3;
  --bg-light: #f4f7f9;
  --text-main: #2b3551;
  --text-sub: #6f7f97;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Avenir Next", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: #f5f7fa;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.top-bar {
  height: 60px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.sys-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.top-bar__right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-bar__meta {
  font-size: 13px;
  color: var(--text-sub);
}

.layout-container {
  display: grid;
  grid-template-columns: minmax(0, calc(100% - var(--sidebar-width) - var(--layout-gap))) minmax(300px, var(--sidebar-width));
  gap: var(--layout-gap);
  height: calc(100vh - 60px);
  padding: var(--layout-gap);
}

.left-zone,
.card,
.modal,
.floating-panel {
  background: #fff;
  border: 1px solid var(--border);
}

.left-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
}

.global-org-filter,
.module-nav,
.global-time-bar,
.local-toolbar,
.category-bar,
.history-tabs,
.toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.global-org-filter,
.global-time-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: rgba(250, 251, 253, 0.94);
}

.workspace-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.module-nav {
  display: flex;
  gap: 8px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.module-nav__item,
.history-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f9fc;
  color: var(--text-sub);
  cursor: pointer;
}

.module-nav__item.active,
.history-tab.active {
  color: var(--primary);
  background: #eef6ff;
  border-color: #b8d1ec;
  font-weight: 600;
}

.global-org-filter__label,
.global-time-bar__label,
.local-toolbar__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.select-box {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fff;
  color: var(--text-main);
  font-size: 13px;
}

.select-box--date {
  min-width: 160px;
}

.select-box--full {
  width: 100%;
}

.breadcrumb-hint,
.time-state-pill,
.frozen-banner {
  font-size: 12px;
  border-radius: 999px;
}

.breadcrumb-hint,
.time-state-pill {
  margin-left: auto;
  padding: 6px 10px;
  color: var(--primary);
  background: rgba(0, 134, 213, 0.08);
}

.global-time-bar,
.local-toolbar__group,
.local-toolbar__actions,
.toolbar__actions,
.tool-list,
.floating-actions,
.ai-actions,
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.time-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f6f8fb;
}

.time-tab,
.category-bar__item {
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
}

.time-tab.active,
.category-bar__item.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  border: 1px solid #cfe0f2;
}

.time-tab:disabled {
  color: #b4bfce;
  cursor: not-allowed;
}

.help-dot {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0, 134, 213, 0.16);
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.module-content,
.history-view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

.module-content--active,
.history-view--active {
  display: flex;
}

.local-toolbar,
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: #fff;
}

.toggle-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-main);
  font-size: 13px;
}

.toggle-chip input {
  accent-color: var(--primary);
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: #fff;
  padding-top: 8px;
  padding-bottom: 8px;
}

.toolbar--flat {
  border-bottom: 0;
  padding-bottom: 0;
}

.main-sort-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(0, 134, 213, 0.08);
  color: var(--primary);
  font-size: 12px;
}

.toolbar__title,
.toolbar__hint,
.ranking-note {
  font-size: 13px;
  color: var(--text-sub);
}

.ranking-note {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #b8d1ec;
  border-radius: 8px;
  background: #eef6ff;
  color: #155ea6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  border-color: #99c2eb;
  background: #e3f0ff;
}

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

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-accent {
  color: var(--primary);
  background: #eef6ff;
  border-color: #b8d1ec;
}

.btn-block {
  width: 100%;
}

.table-container {
  flex: 1;
  overflow: auto;
  position: relative;
  min-height: 0;
}

table {
  width: 100%;
  min-width: 1480px;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #fff;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fafbfd;
  color: #5f6c81;
  font-weight: 600;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  border-right: 1px solid var(--border);
  background: #fff;
}

.sticky-col--first {
  min-width: 180px;
}

.grouped-table thead tr:first-child th:not(.sticky-col) {
  text-align: center;
}

.main-sort-col {
  background: rgba(255, 159, 67, 0.08) !important;
}

.table-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

.table-link:hover {
  text-decoration: underline;
}

.metric-cell {
  position: relative;
  font-weight: 600;
}

.metric-cell::after {
  content: "目标 " attr(data-target);
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-sub);
}

.metric-cell--compare::after {
  content: attr(data-actual) " / " attr(data-target);
  margin-top: 0;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
}

.metric-cell--compare {
  color: transparent;
}

.metric-cell--compare.metric-cell--exception-good::after {
  color: var(--success);
}

.metric-cell--compare.metric-cell--exception-warn::after {
  color: var(--error);
}

.metric-cell--exception-good {
  color: var(--success);
}

.metric-cell--exception-warn {
  color: var(--error);
}

.snapshot-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
  background: #f9fbfd;
}

.snapshot-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: #fff;
  padding: var(--card-padding);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.snapshot-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 134, 213, 0.24);
  box-shadow: 0 8px 18px rgba(0, 134, 213, 0.12);
}

.snapshot-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.snapshot-card__meta {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.8;
}

.tag-frozen {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--primary);
  background: rgba(0, 134, 213, 0.08);
}

.frozen-banner {
  margin: 16px 16px 0;
  padding: 8px 12px;
  color: #a56a00;
  background: #fff5df;
}

.right-zone {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  min-width: 300px;
}

.card {
  padding: 20px;
  border-radius: var(--card-radius);
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(232, 237, 243, 0.8);
  font-size: 14px;
  font-weight: 700;
}

.card-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px dashed #edf1f6;
}

.ranking-home-card {
  display: grid;
  gap: 14px;
}

.ranking-home-card__summary {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #d7e5f5;
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
}

.ranking-home-card__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.ranking-home-card__scope {
  font-size: 14px;
  font-weight: 700;
  color: #183b63;
}

.ranking-home-card__metric {
  margin-top: 4px;
  font-size: 12px;
  color: #6d84a3;
}

.ranking-home-card__rank {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(0, 134, 213, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ranking-home-card__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ranking-home-stat {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
}

.ranking-home-stat__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6d84a3;
}

.ranking-home-stat__value {
  font-size: 18px;
  line-height: 1.3;
  color: #243b5f;
}

.ranking-home-card__sublist {
  display: grid;
  gap: 8px;
}

.ranking-home-card__subhead {
  font-size: 12px;
  font-weight: 700;
  color: #6d84a3;
}

.ranking-home-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px dashed #edf1f6;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

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

.ranking-home-row__rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.ranking-home-row__name {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #243b5f;
}

.ranking-home-row__metric {
  font-size: 12px;
  font-weight: 600;
  color: #5d7391;
  white-space: nowrap;
}

.ranking-home-row:hover .ranking-home-row__name,
.ranking-home-row:hover .ranking-home-row__metric {
  color: var(--primary);
}

.tool-list {
  flex-direction: column;
}

.metric-good {
  color: var(--success);
  font-weight: 600;
}

.metric-warn {
  color: var(--error);
  font-weight: 600;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(18, 29, 52, 0.3);
  z-index: 100;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(520px, calc(100% - 32px));
  padding: 24px;
  border-radius: 14px;
  display: none;
  transform: translate(-50%, -50%);
  z-index: 101;
}

.modal h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.modal-tip {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 134, 213, 0.08);
  color: var(--primary);
  font-size: 12px;
  line-height: 1.65;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.form-field {
  margin-top: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-sub);
}

.checkbox-row label {
  font-size: 13px;
  color: var(--text-main);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.floating-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  flex-direction: column;
  z-index: 120;
}

.fab {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 700;
}

.fab--ghost {
  color: var(--primary-strong);
  background: #fff;
  border: 1px solid rgba(0, 134, 213, 0.18);
  box-shadow: 0 10px 24px rgba(33, 54, 90, 0.12);
}

.fab--ai {
  color: var(--primary);
  background: linear-gradient(135deg, rgba(0, 134, 213, 0.16), rgba(57, 198, 193, 0.18));
  box-shadow: 0 10px 24px rgba(0, 134, 213, 0.14);
}

.floating-panel {
  position: fixed;
  right: 96px;
  bottom: 24px;
  width: 340px;
  padding: 18px;
  border-radius: 14px;
  display: none;
  z-index: 119;
}

.floating-panel--open {
  display: block;
}

.floating-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.slider-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.slider-item {
  display: grid;
  gap: 8px;
}

.slider-item span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-sub);
  font-size: 13px;
}

.slider-item strong {
  color: var(--text-main);
}

.slider-item input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.ai-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 14px;
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(0, 134, 213, 0.15), rgba(57, 198, 193, 0.16));
}

.ai-card p {
  margin: 0;
  color: var(--text-sub);
  line-height: 1.65;
}

.ai-actions {
  margin-top: 14px;
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .layout-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .right-zone {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .top-bar {
    height: auto;
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .top-bar__right,
  .workspace-topline,
  .global-time-bar,
  .local-toolbar,
  .toolbar,
  .modal-actions {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .floating-panel {
    left: 16px;
    right: 16px;
    width: auto;
  }

  .ranking-home-card__stats {
    grid-template-columns: 1fr;
  }

  .ranking-home-row {
    grid-template-columns: 24px 1fr;
  }

  .ranking-home-row__metric {
    grid-column: 2;
    white-space: normal;
  }
}
