:root {
  --tool-shell-navy: #075cae;
  --tool-shell-navy-2: #0c83d5;
  --tool-shell-teal: #20b4d8;
  --tool-shell-paper: #edf6fc;
  --tool-shell-ink: #12314d;
  --tool-shell-muted: #dff4ff;
  --tool-shell-line: #d4e5f1;
  --tool-shell-shadow: 0 18px 44px rgba(16, 100, 161, .14);
}

.policy-page,
.scheme-page {
  background: var(--tool-shell-paper);
  color: var(--tool-shell-ink);
}

/* 工具详情页统一使用与资料库、随心记相同的渐变页头。 */
.policy-page .hero {
  min-height: 142px;
  display: flex;
  align-items: center;
  padding: calc(26px + env(safe-area-inset-top)) max(24px, calc((100vw - 1160px) / 2)) 28px;
  overflow: hidden;
  border-radius: 0 0 30px 30px;
  background: linear-gradient(135deg, var(--tool-shell-navy) 0%, var(--tool-shell-navy-2) 62%, var(--tool-shell-teal) 100%);
  box-shadow: var(--tool-shell-shadow);
}

.policy-page .hero::after {
  right: -74px;
  top: -160px;
  width: 340px;
  height: 340px;
  background: rgba(255, 255, 255, .07);
}

.policy-page .hero-inner {
  width: min(1160px, 100%);
  max-width: none;
}

.policy-page .hero-inner > div {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 18px;
}

.policy-page .crumb {
  grid-row: 1 / 3;
  width: 54px;
  height: 54px;
  padding: 0;
  justify-content: center;
  border-radius: 18px;
  font-size: 0;
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 1px rgba(255, 255, 255, .15);
}

.policy-page .crumb svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.policy-page .hero h1 {
  margin: 0 0 4px;
  font-size: 32px;
  line-height: 1.18;
  letter-spacing: -.04em;
}

.policy-page .hero p {
  margin: 0;
  color: var(--tool-shell-muted);
  font-size: 14px;
  line-height: 1.55;
}

.policy-page .workspace {
  width: min(1160px, calc(100% - 32px));
  max-width: none;
  padding: 28px 0 70px;
}

.policy-page .overview {
  margin-top: 0;
}

.policy-page .metric,
.policy-page .toolbar-panel,
.policy-page .policy-card,
.policy-page .empty {
  border-color: var(--tool-shell-line);
  box-shadow: 0 13px 35px rgba(21, 56, 72, .065);
}

@media (max-width: 760px) {
  .scheme-page .topbar {
    position: relative;
    top: auto;
    z-index: 15;
    display: flex;
    min-height: 142px;
    height: auto;
    align-items: center;
    padding: calc(24px + env(safe-area-inset-top)) 16px 26px;
    color: #fff;
    border: 0;
    border-radius: 0 0 30px 30px;
    background: linear-gradient(135deg, var(--tool-shell-navy) 0%, var(--tool-shell-navy-2) 62%, var(--tool-shell-teal) 100%);
    box-shadow: var(--tool-shell-shadow);
    backdrop-filter: none;
  }

  .scheme-page .menu-btn {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    margin-right: 18px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    background: rgba(255, 255, 255, .09);
    box-shadow: inset 0 1px rgba(255, 255, 255, .15);
  }

  .scheme-page .menu-btn:hover {
    background: rgba(255, 255, 255, .16);
  }

  .scheme-page .topbar > div:nth-child(2) {
    display: block;
    min-width: 0;
  }

  .scheme-page .topbar h1 {
    margin: 0 0 5px;
    color: #fff;
    font-size: 28px;
    line-height: 1.18;
    letter-spacing: -.04em;
  }

  .scheme-page .topbar h1::after {
    content: none;
  }

  .scheme-page .topbar p {
    display: block;
    margin: 0;
    color: var(--tool-shell-muted);
    font-size: 13px;
    line-height: 1.5;
  }

  .scheme-page .topbar p span + span::before {
    content: " · ";
  }

  .scheme-page .view {
    padding-top: 28px;
  }

  .scheme-page .panel,
  .scheme-page .kpi-card,
  .scheme-page .ledger-card,
  .scheme-page .data-card,
  .scheme-page .filter-bar {
    border-color: var(--tool-shell-line);
    box-shadow: 0 13px 35px rgba(21, 56, 72, .055);
  }

  .policy-page .hero {
    min-height: 142px;
    padding: calc(24px + env(safe-area-inset-top)) 16px 26px;
    border-radius: 0 0 30px 30px;
  }

  .policy-page .hero h1 {
    font-size: 28px;
  }

  .policy-page .hero p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .policy-page .workspace {
    width: calc(100% - 26px);
    padding: 28px 0 calc(70px + env(safe-area-inset-bottom));
  }

  .policy-page .overview {
    margin-top: 0;
  }
}

@media (max-width: 420px) {
  .policy-page .hero-inner > div {
    column-gap: 14px;
  }

  .policy-page .crumb,
  .scheme-page .menu-btn {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .scheme-page .menu-btn {
    margin-right: 14px;
  }
}

/* Wide desktop shell for policy tools. Scheme has its own wide layout. */
@media (min-width: 1440px) {
  .policy-page .hero { padding-left: max(36px, calc((100vw - 1880px) / 2)); padding-right: max(36px, calc((100vw - 1880px) / 2)); }
  .policy-page .hero-inner { width: min(1880px, 100%); max-width: none; }
  .policy-page .workspace { width: min(1880px, calc(100% - 72px)); max-width: none; }
  .policy-page .workspace { padding-top: 36px; }
}

@media (min-width: 2000px) {
  .policy-page .hero { padding-left: max(48px, calc((100vw - 2040px) / 2)); padding-right: max(48px, calc((100vw - 2040px) / 2)); }
  .policy-page .hero-inner { width: min(2040px, 100%); }
  .policy-page .workspace { width: min(2040px, calc(100% - 96px)); }
}
