/*
 * screen2.0 / V2.2 visual unification layer.
 * Shared navigation, KPI rails and card surfaces use one visual language across
 * every module. Domain-specific charts keep their own data presentation.
 */
.platform-screen .top-menu {
  top: 45px;

  .m-menu-item {
    min-width: 120px;
    height: 36px;
    margin: 0 5px;
    padding: 0 18px;
    border: 1px solid rgba(91, 224, 244, 0.12);
    border-radius: 18px;
    color: rgba(231, 249, 252, 0.76);
    font-size: 14px;
    font-weight: 600;
    line-height: 34px;
    background-image: linear-gradient(180deg, rgba(9, 57, 76, 0.5), rgba(3, 28, 43, 0.34));
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      inset 0 -1px 0 rgba(48, 220, 255, 0.12);
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;

    &:hover {
      border-color: rgba(91, 224, 244, 0.42);
      color: #fff;
      background-image: linear-gradient(180deg, rgba(20, 104, 127, 0.76), rgba(5, 42, 59, 0.68));
    }

    &:focus-visible {
      outline: none;
      box-shadow: 0 0 0 2px rgba(2, 15, 24, 0.94), 0 0 0 4px rgba(126, 251, 246, 0.9);
    }

    &.is-active {
      border-color: rgba(126, 251, 246, 0.76);
      color: #fff;
      background-image: linear-gradient(180deg, rgba(29, 142, 158, 0.9), rgba(5, 57, 74, 0.86));
      box-shadow:
        inset 0 0 0 1px rgba(126, 251, 246, 0.2),
        inset 0 -2px 0 #7efbf6,
        0 0 16px rgba(48, 220, 255, 0.18);
    }

    &.is-active::after {
      content: none;
      animation: none;
    }
  }
}

.platform-screen {
  --v22-surface: rgba(4, 28, 42, 0.9);
  --v22-surface-raised: rgba(7, 42, 58, 0.94);
  --v22-border: rgba(91, 224, 244, 0.46);
  --v22-border-strong: rgba(126, 251, 246, 0.76);
  --v22-text: rgba(247, 254, 255, 0.96);
  --v22-text-secondary: rgba(223, 250, 255, 0.8);
  --v22-text-muted: rgba(211, 241, 247, 0.66);
  --v22-accent: #7efbf6;
  --v22-accent-strong: #30dcff;
  --v22-highlight: #ffd76c;
  --v22-focus-ring: 0 0 0 2px rgba(2, 15, 24, 0.94), 0 0 0 4px rgba(126, 251, 246, 0.9);

  color: var(--v22-text);

  button,
  [role="button"],
  input,
  select,
  textarea {
    font-family: var(--screen-font-ui, "PingFang SC", "Microsoft YaHei", sans-serif);
  }

  button:focus-visible,
  [role="button"]:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: none !important;
    box-shadow: var(--v22-focus-ring) !important;
  }

  .m-card-bd::before {
    background:
      radial-gradient(circle at 18% 0%, rgba(74, 210, 233, 0.12), transparent 40%),
      linear-gradient(160deg, rgba(6, 38, 54, 0.95), rgba(2, 20, 32, 0.91));
    box-shadow:
      inset 0 0 0 1px rgba(91, 224, 244, 0.22),
      0 12px 28px rgba(0, 8, 16, 0.27);
  }

  .m-card-hd-title {
    left: 18px;
    color: #fff;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0.5px;
  }

  .m-card-hd .saoguang,
  .m-card-hd-zs1 {
    opacity: 0.34;
  }

  .top-count-card {
    top: 110px;
    column-gap: 24px;

    .count-card {
      min-height: 86px;
      padding: 4px 12px 6px !important;
      border-bottom: 1px solid rgba(91, 224, 244, 0.16);
      background: linear-gradient(90deg, rgba(5, 34, 48, 0.5), rgba(4, 24, 37, 0.08));
    }

    .title-zh {
      color: var(--v22-text-secondary);
      font-size: 14px;
      font-weight: 600;
    }

    .value {
      font-variant-numeric: tabular-nums;
    }

    .unit {
      color: var(--v22-text-muted);
      font-size: 12px;
    }
  }

  &.is-home .top-count-card.is-home-five {
    left: 492px;
    right: 492px;
    top: 96px;
    grid-template-columns: 188px 200px 214px 146px 146px;
    column-gap: 10px;

    .count-card {
      display: grid;
      grid-template-columns: 54px minmax(0, 1fr);
      grid-template-rows: 19px 35px;
      align-content: center;
      align-items: center;
      min-height: 74px;
      padding: 0 !important;
      border-bottom: 0;
      background: none;
      box-sizing: border-box;
    }

    .count-card-left {
      display: contents;
    }

    .count-card-icon {
      grid-column: 1;
      grid-row: 1 / 3;
      align-self: center;
      width: 54px;
      height: 68px;
      flex-basis: 54px;
      margin-right: 0;
    }

    .count-card-title {
      grid-column: 2;
      grid-row: 1;
      align-self: end;
      min-width: 0;
    }

    .count-card-title .title-zh {
      overflow: hidden;
      color: rgba(223, 250, 255, 0.78);
      font-size: 12px;
      line-height: 17px;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .count-card-right {
      grid-column: 2;
      grid-row: 2;
      align-self: start;
      min-width: 0;
      padding-left: 0;
    }

    .count-card-right .value {
      min-height: 31px;
      margin-right: 5px;
      font-size: 27px;
      line-height: 31px;
    }

    .count-card-right .unit {
      padding-top: 0;
      font-size: 10px;
      line-height: 14px;
    }
  }

  .platform-map-tools {
    gap: 8px;
    transform: none;

    button {
      width: 38px;
      height: 38px;
      border-radius: 2px;
      background: linear-gradient(180deg, rgba(18, 92, 115, 0.94), rgba(3, 31, 47, 0.96));
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 20px rgba(0, 7, 14, 0.28);
    }
  }

  .layer-panel-item {
    min-height: 34px;
    padding-block: 6px;
    border-radius: 2px;
    font-size: 13px;
  }

  .layer-panel-section-title,
  .layer-panel .legend-name,
  .layer-panel-empty {
    font-size: 12px;
    line-height: 18px;
  }

  .layer-panel-empty.is-legend {
    min-height: 32px;
    color: var(--v22-text-muted);
  }

  .fgw-bottom-topic,
  .yak-bottom-topic {
    bottom: 28px;
  }

  .fgw-map-layer-tools,
  .pasture-map-layer-tools,
  .yak-map-layer-tools {
    bottom: 116px;
  }

  .business-panel.is-v21 {
    .business-column-item,
    .business-peak-item,
    .business-bar-row,
    .business-donut-row,
    .business-rose-row,
    .business-metric-item,
    .business-split-row {
      color: var(--v22-text-secondary);
      font-size: 12px;
    }

    .business-column-item strong,
    .business-peak-item strong,
    .business-bar-row strong,
    .business-donut-row strong,
    .business-metric-item strong {
      color: #fff;
      font-size: 13px;
    }
  }

  .feature-row span {
    color: var(--v22-text-secondary);
    font-size: 12px;
  }

  .feature-row strong {
    color: #fff;
    font-size: 13px;
  }

  .epidemic-record-toolbar,
  .trade-ledger-toolbar {
    height: 32px;

    input,
    button {
      height: 28px;
      font-size: 11px;
    }
  }

  .epidemic-record-header,
  .trade-ledger-header {
    height: 28px;

    span {
      color: var(--v22-text-secondary);
      font-size: 11px;
      font-weight: 600;
    }
  }

  .epidemic-record-rows,
  .trade-ledger-rows {
    gap: 4px;

    button {
      min-height: 28px;
      border-color: rgba(91, 224, 244, 0.12);
      background: rgba(5, 38, 52, 0.5);
    }

    span,
    strong {
      color: var(--v22-text-secondary);
      font-size: 11px;
      line-height: 15px;
    }

    strong {
      color: #fff;
    }
  }

  .business-project-frame {
    th,
    td {
      font-size: 12px !important;
      line-height: 16px !important;
    }

    tbody td {
      min-height: 34px;
      padding-top: 5px;
      padding-bottom: 5px;
    }

    strong {
      font-size: 13px !important;
      line-height: 16px !important;
    }

    .business-project-locate-button {
      width: 30px;
      height: 30px;
    }
  }

  .trade-year-switcher,
  .forecast-year-switcher,
  .epidemic-year-switcher {
    width: 110px;
    box-sizing: border-box;

    button {
      width: 100%;
      min-width: 0;
      height: 34px;
      border-color: rgba(91, 224, 244, 0.35);
      color: var(--v22-text-secondary);
      font-size: 12px;
      background: rgba(4, 32, 45, 0.86);

      &.active {
        border-color: rgba(126, 251, 246, 0.72);
        color: #061c29;
        background: linear-gradient(180deg, #8dfcf7, #45dbea);
      }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/*
 * Keep every top KPI tile on the same 200px × 82px footprint. Screens with fewer
 * metrics stay centered instead of stretching their cards to a different size.
 */
.platform-screen .top-count-card {
  left: 432px !important;
  right: 432px !important;
  top: 102px !important;
  display: grid !important;
  grid-template-columns: repeat(3, 200px) !important;
  grid-auto-rows: 82px !important;
  justify-content: center !important;
  align-items: stretch !important;
  column-gap: 12px !important;
  row-gap: 8px !important;

  > .count-card {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    grid-template-rows: 21px 34px !important;
    align-content: center !important;
    align-items: center !important;
    width: 200px !important;
    min-width: 200px !important;
    min-height: 82px !important;
    height: 82px !important;
    padding: 0 8px !important;
    box-sizing: border-box !important;
    justify-content: stretch !important;
  }

  .count-card-left {
    display: contents !important;
  }

  .count-card-icon {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
    align-self: center !important;
    width: 54px !important;
    height: 68px !important;
    flex-basis: 54px !important;
    margin-right: 0 !important;
  }

  .count-card-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: end !important;
    min-width: 0 !important;
  }

  .count-card-title .title-zh {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    font-size: 12px !important;
    line-height: 17px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .count-card-title .title-en {
    display: none !important;
  }

  .count-card-right {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
    min-width: 0 !important;
    padding-left: 0 !important;
  }

  .count-card-right .value {
    min-height: 31px !important;
    margin-right: 4px !important;
    font-size: 27px !important;
    line-height: 31px !important;
  }

  .count-card-right .unit {
    padding-top: 8px !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }
}

.platform-screen .top-count-card.is-four {
  left: 432px !important;
  right: 432px !important;
  grid-template-columns: repeat(4, 200px) !important;
  column-gap: 12px !important;
}

.platform-screen .top-count-card.is-multi,
.platform-screen .top-count-card.is-home-five,
.platform-screen.is-home .top-count-card.is-home-five {
  left: 432px !important;
  right: 432px !important;
  display: grid !important;
  grid-template-columns: repeat(5, 200px) !important;
  column-gap: 12px !important;
  justify-content: center !important;
}

/*
 * Dense ecological cards keep the full business dataset visible inside the
 * fixed 16:9 side rail. These rules only adjust presentation density.
 */
.platform-screen.is-ecological-protection {
  .fgw-side-card[class*="-wetland-distribution"] {
    .business-stat-list.is-compact {
      padding: 4px 12px 6px;
      overflow: hidden;
    }

    .business-stat-row {
      grid-template-columns: 19px minmax(0, 1fr) 112px;
      gap: 6px;
      height: 20px;
    }

    .business-stat-rank {
      width: 16px;
      height: 16px;
      font-size: 10px;
      line-height: 14px;
    }

    .business-stat-name {
      font-size: 11px;
      line-height: 13px;
    }

    .business-stat-bar {
      height: 3px;
      margin-top: 2px;
    }

    .business-stat-value {
      display: flex;
      align-items: baseline;
      justify-content: flex-end;
      gap: 2px;
      white-space: nowrap;

      strong {
        font-size: 13px;
        line-height: 15px;
      }

      em {
        margin-left: 0;
        font-size: 9px;
      }

      span {
        display: inline;
        margin-top: 0;
        overflow: hidden;
        font-size: 9px;
        line-height: 11px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }

  .fgw-side-card[class*="-resource-structure"] {
    .business-structure-row {
      grid-template-columns: 9px minmax(0, 1fr) 64px 60px;
      gap: 4px;
      padding-inline: 6px;
    }
  }

  .ecological-side-card--restoration-measure-area {
    .business-structure-list {
      grid-auto-rows: minmax(15px, 1fr);
      gap: 2px;
    }

    .business-structure-row {
      grid-template-columns: 7px minmax(0, 1fr) 66px 56px;
      gap: 3px;
      padding-inline: 4px;

      i {
        width: 6px;
        height: 6px;
      }

      span,
      small {
        font-size: 9px;
        line-height: 11px;
      }

      strong {
        font-size: 11px;
        line-height: 13px;
      }
    }
  }

  .ecological-side-card--restoration-projects {
    .business-project-frame tbody td {
      height: 28px;
      min-height: 28px;
      padding-top: 0;
      padding-bottom: 0;
      overflow: hidden;
      line-height: 14px;
      text-overflow: ellipsis;
      white-space: nowrap;
      word-break: normal;
    }
  }
}

.platform-screen.is-yak-management {
  .trade-ledger-header,
  .trade-ledger-rows button {
    grid-template-columns: 90px 56px 39px 46px 34px 64px;
  }
}

/*
 * Yak industry chain scope: only normalize the left/right card shell and KPI
 * hierarchy. Stage data, chart grammar, lists, map content and interactions stay
 * owned by the business module.
 */
.platform-screen.is-yak-industry-chain {
  .industry-bottom-switcher {
    left: 50%;
    right: auto;
    width: max-content;
    transform: translateX(-50%);
  }

  .industry-bottom-switcher .topic-switcher,
  .industry-bottom-switcher .topic-switcher-menu {
    width: max-content;
    max-width: calc(100vw - 96px);
  }

  .industry-bottom-switcher .topic-switcher-item {
    flex: 0 0 min(var(--topic-item-width, 104px), 104px);
    width: min(var(--topic-item-width, 104px), 104px);
    min-width: min(var(--topic-item-width, 104px), 104px);
    padding-inline: 2px;
  }

  .industry-side-panel--left,
  .industry-side-panel--right {
    perspective: none;
  }

  .industry-side-stack {
    transform-style: flat;

    &.is-left,
    &.is-right {
      transform: none;
      transform-origin: center;
    }
  }

  .industry-side-panel--left,
  .industry-side-panel--right {
    .industry-side-card {
      .m-card-hd-title {
        left: 18px;
        color: var(--v22-text);
        font-size: 16px;
        font-weight: 650;
        line-height: 24px;
        letter-spacing: 0.5px;
      }

      .m-card-bd::before {
        border-color: var(--v22-border);
        background:
          radial-gradient(circle at 18% 0%, rgba(74, 210, 233, 0.12), transparent 40%),
          linear-gradient(160deg, rgba(6, 38, 54, 0.95), rgba(2, 20, 32, 0.91));
      }

      .business-metrics {
        gap: 8px;
        padding: 8px 12px 10px;
      }

      .business-metric-item,
      .business-icon-metric-item,
      .business-spotlight-main,
      .business-spotlight-chip {
        border: 1px solid rgba(91, 224, 244, 0.2);
        border-radius: 2px;
        background:
          linear-gradient(135deg, rgba(12, 66, 83, 0.54), rgba(4, 27, 41, 0.7)),
          rgba(4, 28, 42, 0.72);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
      }

      .business-metric-item {
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
        grid-template-rows: 18px 30px;
        align-content: center;
        align-items: end;
        padding: 8px 10px;

        span {
          grid-column: 1 / -1;
          align-self: center;
          color: var(--v22-text-secondary) !important;
          font-size: 12px;
          font-weight: 600;
          line-height: 18px;
        }

        strong {
          align-self: end;
          margin-top: 0;
          color: var(--v22-text) !important;
          font-size: 22px;
          font-variant-numeric: tabular-nums;
          line-height: 28px;
        }

        em {
          align-self: end;
          margin-left: 4px;
          padding-bottom: 4px;
          color: var(--v22-text-muted) !important;
          font-size: 10px;
          line-height: 12px;
        }
      }

      .business-icon-metric-copy span,
      .business-spotlight-main span,
      .business-spotlight-chip span {
        color: var(--v22-text-secondary) !important;
        font-size: 12px;
        font-weight: 600;
      }

      .business-icon-metric-copy strong,
      .business-spotlight-main strong,
      .business-spotlight-chip strong {
        color: var(--v22-text) !important;
        font-variant-numeric: tabular-nums;
      }

      .business-icon-metric-copy strong em,
      .business-spotlight-main strong em,
      .business-spotlight-chip strong em {
        color: var(--v22-text-muted) !important;
        font-size: 10px;
      }

      .business-panel-empty,
      .industry-panel-empty {
        color: var(--v22-text-muted);
        font-size: 13px;
        font-weight: 600;
      }

      &.industry-side-card--family-support-type {
        .business-structure-row {
          grid-template-columns: 9px minmax(0, 1fr) 64px 60px;
          gap: 4px;
          padding-inline: 6px;
        }
      }

      &.industry-side-card--family-net-fence {
        .business-stat-list.is-compact {
          gap: 1px;
          padding: 2px 12px 4px;
          overflow: hidden;
        }

        .business-stat-row {
          grid-template-columns: 19px minmax(0, 1fr) 126px;
          gap: 6px;
          height: 16px;
        }

        .business-stat-rank {
          width: 16px;
          height: 14px;
          font-size: 9px;
          line-height: 12px;
        }

        .business-stat-name {
          font-size: 10px;
          line-height: 12px;
        }

        .business-stat-bar {
          height: 3px;
          margin-top: 2px;
        }

        .business-stat-value {
          display: flex;
          align-items: baseline;
          justify-content: flex-end;
          gap: 2px;
          white-space: nowrap;

          strong {
            font-size: 12px;
            line-height: 14px;
          }

          em {
            margin-left: 0;
            font-size: 9px;
          }

          span {
            display: inline;
            margin-top: 0;
            overflow: hidden;
            font-size: 9px;
            line-height: 11px;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
      }

      .business-spotlight {
        grid-template-columns: 132px minmax(0, 1fr);
        gap: 8px;
        padding: 8px 10px;
      }

      .business-spotlight-main {
        padding: 10px 8px 8px;

        strong {
          margin: 7px 0 4px;
          font-size: 26px;
          line-height: 29px;
        }
      }

      .business-spotlight-side {
        grid-template-rows: repeat(3, minmax(0, 1fr));
        gap: 5px;
      }

      .business-spotlight-chip {
        grid-template-columns: 7px minmax(0, 1fr);
        gap: 0 6px;
        padding: 4px 8px;

        i {
          width: 6px;
          height: 22px;
        }

        span,
        small {
          font-size: 10px;
          line-height: 12px;
        }

        strong {
          font-size: 15px;
          line-height: 17px;
        }
      }

      &.industry-side-card--grass-project-area {
        .business-spec-grid {
          gap: 3px;
          padding: 5px 8px 6px;
        }

        .business-spec-grid__row {
          grid-template-rows: 16px 17px;
          column-gap: 6px;
          padding: 2px 6px 2px 5px;
        }

        .business-spec-grid__index {
          width: 20px;
          height: 20px;
          font-size: 10px;
        }

        .business-spec-grid__name {
          font-size: 11px;
          line-height: 14px;
        }

        .business-spec-grid__count {
          min-width: 48px;
          padding-left: 7px;
          font-size: 19px;
          line-height: 21px;
        }

        .business-spec-grid__specs {
          gap: 3px;

          > span {
            gap: 2px;
            padding: 1px 3px;
          }
        }
      }

      &.industry-side-card--grass-operation {
        .business-bars {
          gap: 2px;
          padding: 4px 12px 5px;
        }

        .business-bar-row {
          min-height: 0;
        }
      }
    }
  }

  .top-count-card {
    .title-zh {
      color: var(--v22-text-secondary) !important;
      font-size: 12px !important;
      font-weight: 600;
    }

    .value {
      color: var(--v22-text) !important;
      font-variant-numeric: tabular-nums;
    }

    .unit {
      color: var(--v22-text-muted) !important;
      font-size: 10px !important;
    }
  }
}

.platform-screen.is-smart-management {
  .wisdom-input-bar {
    flex-basis: 72px;
    padding: 10px 8px 2px;
  }

  .wisdom-input-shell {
    height: 54px;
    gap: 8px;
    padding: 6px 7px 6px 14px;
    border-color: rgba(91, 224, 244, 0.5);
    background:
      linear-gradient(90deg, rgba(10, 54, 70, 0.86), rgba(2, 21, 34, 0.96)),
      rgba(3, 24, 37, 0.94);
  }

  .wisdom-input-icon {
    width: 14px;
    height: 14px;
    margin-right: 3px;
    border-width: 1.5px;
  }

  .wisdom-input-shell input {
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(48, 220, 255, 0.58);
    background: rgba(0, 16, 27, 0.44);
    box-shadow: inset 0 0 14px rgba(48, 220, 255, 0.04);
    box-sizing: border-box;
    font-size: 14px;
  }

  .wisdom-input-shell input:focus {
    border-color: rgba(126, 251, 246, 0.92);
    box-shadow:
      inset 0 0 16px rgba(48, 220, 255, 0.08),
      0 0 0 1px rgba(126, 251, 246, 0.12);
  }

  .wisdom-voice-button,
  .wisdom-submit-button {
    height: 38px;
  }

  .wisdom-voice-button {
    width: 40px;
    border-color: rgba(48, 220, 255, 0.46);
  }

  .wisdom-submit-button {
    font-size: 13px;
    font-weight: 650;
  }

  .wisdom-submit-button:disabled,
  .wisdom-voice-button:disabled {
    opacity: 0.48;
  }
}
