/* ==========================================================================
   工具页 · 最终样式（浅色、干净、层次靠底色而不是画框）
   原则：
     1. 只有「最外层卡片」和「输入框」有边框，其它包裹层一律不画框
     2. 分区块用极浅底色 / 分隔线区分，不用套娃边框
     3. 文字深色高对比，数值用青绿
   ========================================================================== */

/* ---------- 外层卡片：浅边框 + 轻阴影 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(.card, .result-card, .panel, .canvas-panel) {
  border: 1px solid #e3e8e5 !important;
  border-radius: 18px !important;
  box-shadow: 0 1px 2px rgba(16, 24, 20, .04),
              0 10px 30px -22px rgba(16, 24, 20, .28) !important;
  background: #ffffff !important;
}

/* ---------- 中间包裹层：一律不画框 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(
  .sprocket-item, .field, .metric, .stat-card, .crate-card,
  .range-card, .bms-card, .compare-card, .fold-section,
  .table-wrap, .formula, .sprocket-grid, .grid2, .metrics,
  .result-panel, .result-section, .input-panel
) {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* 指标卡：用极浅底色区分，不画框 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(.metric, .stat-card) {
  background: #f7f9f8 !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
}

/* 折叠项：浅底色 + 圆角，不用边框 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(details, .fold-section) {
  background: #f7f9f8 !important;
  border-radius: 12px !important;
  border: 0 !important;
  overflow: hidden;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(summary, .fold-header) {
  background: transparent !important;
  border: 0 !important;
  color: #23302a !important;
  font-weight: 700 !important;
}

/* ---------- 输入框：唯一有描边的地方 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(input, textarea, select) {
  background: #ffffff !important;
  border: 1px solid #cfd8d2 !important;
  border-radius: 10px !important;
  color: #000000 !important;
  font-weight: 700 !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(.big-box) {
  border: 1px solid #cfd8d2 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
}

/* 输入框所在的大数字框里，输入本身不要再画一遍 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .big-box input {
  border: 0 !important;
  background: transparent !important;
}

/* ---------- 文字 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(h1, h2, h3, h4, h5, h6) {
  color: #0f1712 !important;
  font-weight: 800 !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(label, .cond-title, .m-label, .stat-label) {
  color: #2f3a33 !important;
  font-weight: 700 !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(p, li, dt, dd, strong, b, td, th) {
  color: #1f2922 !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(.m-note, .field-hint, .sub, .diagram-cap, .unit-hint) {
  color: #5d6a62 !important;
}

/* 数值：深青，和黑字区分 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(
  .m-value, .rec-num, .rec-ratio, .crate-value, .stat-value,
  .kwh-number, .result-value, .metric-value, .rp-main strong,
  .ratio-preview strong, .big-number
) {
  color: #0b6b7d !important;
  -webkit-text-fill-color: #0b6b7d !important;
  font-weight: 800 !important;
}

/* 传动比小卡：淡绿底，不画框 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .ratio-preview {
  background: #f1f9f4 !important;
  border: 0 !important;
}

/* ---------- 表格 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(table, th, td) {
  border-color: #e3e8e5 !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) thead th {
  background: #f4f7f5 !important;
  color: #23302a !important;
  font-weight: 800 !important;
}

/* ---------- 顶栏 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(.aq-back, .aqx-langbar) {
  border: 1px solid #e3e8e5 !important;
  background: #ffffff !important;
  color: #2f3a33 !important;
}

/* ---------- 分享卡 ---------- */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .share-card {
  border: 1px solid #e3e8e5 !important;
  background: #ffffff !important;
}


/* #result 只是容器，本身不要画卡片，避免「卡片后面还有一张卡片」 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) #result {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* 结果区内部的卡片保持白底浅框 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) #result > .card,
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) #result > .result-card {
  background: #ffffff !important;
  border: 1px solid #e3e8e5 !important;
  border-radius: 18px !important;
  padding: 22px 24px !important;
}


/* ==========================================================================
   标题与数字：去掉渐变文字、统一字体，保证黑字清晰
   ========================================================================== */

/* 页面 h1 / h2 若是渐变文字，白底上会发浅绿 → 改成纯深色 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(h1, h2) {
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  color: #0f1712 !important;
  -webkit-text-fill-color: #0f1712 !important;
  font-weight: 800 !important;
}

/* 数字输入框：去掉等宽细体，用正文字体加粗 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(input, select, textarea) {
  font-family: inherit !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

/* 大数字（Z1/Z2 那种）：字号要能装进框里，否则会被裁掉上半截 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .big-box {
  min-height: 58px !important;
  align-items: center !important;
  padding: 6px 12px !important;
  overflow: visible !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .big-box input {
  font-size: 1.7rem !important;
  line-height: 1.3 !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  font-weight: 800 !important;
}

/* 标签字号略提，读起来更清楚 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(label, .cond-title) {
  font-size: .82rem !important;
  letter-spacing: .08em;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .field-hint {
  font-size: .76rem !important;
}


/* ==========================================================================
   电线页「使用电流」主输入块：做成醒目的大输入
   ========================================================================== */
html body[class*="tool-"].tool-wire .row:has(#currentB) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin-bottom: 22px;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.tool-wire .row:has(#currentB) > label {
  font-size: .84rem !important;
  letter-spacing: .06em;
  color: #23302a !important;
  font-weight: 700 !important;
}

body.tool-wire .row:has(#currentB) .input-group {
  position: relative;
  display: block;
}

body.tool-wire #currentB {
  width: 100% !important;
  height: 62px !important;
  font-size: 1.7rem !important;
  font-weight: 800 !important;
  text-align: center !important;
  padding: 0 46px 0 16px !important;
  border: 1px solid #bfdccd !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #000000 !important;
}

body.tool-wire .row:has(#currentB) .input-group::after {
  content: "A";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .9rem;
  font-weight: 700;
  color: #6b7c72;
  pointer-events: none;
}


/* 电线页「线径规格」块：和「使用电流」统一成主输入卡 */
html body[class*="tool-"].tool-wire .row:has(#specValue) {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin-bottom: 22px;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.tool-wire .row:has(#specValue) > label {
  font-size: .84rem !important;
  letter-spacing: .06em;
  color: #23302a !important;
  font-weight: 700 !important;
}

body.tool-wire .row:has(#specValue) .input-group {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

body.tool-wire #specValue {
  flex: 1 1 auto;
  height: 56px !important;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  padding: 0 16px !important;
  border: 1px solid #bfdccd !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #000000 !important;
}

body.tool-wire #specUnit {
  flex: 0 0 150px;
  height: 56px !important;
  font-size: .92rem !important;
  font-weight: 700 !important;
  padding: 0 12px !important;
  border: 1px solid #bfdccd !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #1b211c !important;
}


/* Tab 面板只是容器，不要画成卡片（否则出现「两层框」） */
html body[class*="tool-"]:is(.tool-wire, .tool-dc, .tool-chain) :is(.panel, .tab-panel, .step-panel) {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 0 20px !important;
}


/* 用电线页的 id 直接压掉面板边框（ID 权重最高） */
html body #panel-a,
html body #panel-b,
html body #panel-a .row,
html body #panel-b .row {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

html body #panel-b .row,
html body #panel-a .row {
  margin-bottom: 22px !important;
}


/* ==========================================================================
   DC 页负载输入网格：标签在上、输入框在下，两列对齐
   ========================================================================== */
body.tool-dc .load-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px 20px !important;
}

body.tool-dc .load-item {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  min-width: 0 !important;
}

body.tool-dc .load-item > label {
  font-size: .82rem !important;
  font-weight: 700 !important;
  color: #2f3a33 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.3 !important;
}

body.tool-dc .w-box {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 50px !important;
  padding: 0 12px !important;
  background: #ffffff !important;
  border: 1px solid #cfd8d2 !important;
  border-radius: 10px !important;
}

body.tool-dc .w-box input {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  border: 0 !important;
  background: transparent !important;
  text-align: right !important;
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  color: #000000 !important;
  padding: 0 !important;
}

body.tool-dc .w-box span {
  flex: 0 0 auto;
  color: #6b7c72 !important;
  font-size: .84rem !important;
  font-weight: 700 !important;
}

/* 「更多设备」折叠里的同类网格也统一两列 */
body.tool-dc :is(.load-grid, .extra-grid, .more-grid) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.tool-dc .power-field {
  margin-bottom: 20px !important;
}

body.tool-dc .power-head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: baseline !important;
  margin-bottom: 10px !important;
}


/* ==========================================================================
   模块内部不要再画框：一个模块只留外框 + 输入框
   ========================================================================== */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .card :is(
  .power-field, .load-item, .sum-box, .summary-box,
  .result-row, .rec-box, .bar-wrap, .progress, .meter,
  .kwh-area, .stat-card, .metric, .info-row, .tip-row,
  .fold-body, .adv-body, .notes, .hint-box, .formula
) {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* 但输入框本身要保留描边 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .card :is(input, select, textarea) {
  border: 1px solid #cfd8d2 !important;
}

/* 「更多设备」这类折叠项：只留浅底，不画线 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(details, .fold-section) {
  border: 0 !important;
  box-shadow: none !important;
}


/* 输入容器（w-box / big-box）保留唯一的一条描边 */
body.tool-dc .w-box {
  border: 1px solid #cfd8d2 !important;
  background: #ffffff !important;
}

body[class*="tool-"]:not(.tool-quote):not(.tool-susp) .big-box {
  border: 1px solid #cfd8d2 !important;
  background: #ffffff !important;
}

/* 输入元素自身不再重复画线 */
body[class*="tool-"]:not(.tool-quote):not(.tool-susp) :is(.w-box input, .big-box input) {
  border: 0 !important;
}


/* DC 负载输入：数字居中，单位固定在右侧 */
body.tool-dc .w-box {
  position: relative !important;
}

body.tool-dc .w-box input {
  text-align: center !important;
  padding: 0 30px !important;
}

body.tool-dc .w-box span {
  position: absolute !important;
  right: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  pointer-events: none;
}


/* DC 页所有输入框 / 下拉框：文字居中 */
body.tool-dc :is(input, select, textarea) {
  text-align: center !important;
}

body.tool-dc select {
  padding-left: 34px !important;
  padding-right: 34px !important;
  text-align-last: center;
}


/* ==========================================================================
   浅色主题：三个按钮保持彩色（覆盖自动生成的白色背景规则）
   ========================================================================== */
html body[class*="tool-"] :is(.btn-group, .button-group) .btn-primary,
html body[class*="tool-"] :is(.btn-group, .button-group) #btnCalc,
html body[class*="tool-"] :is(.btn-group, .button-group) #calcBtn,
html body[class*="tool-"] #btnCalc,
html body[class*="tool-"] #calcBtn {
  background: #22d3ee !important;
  background-image: none !important;
  color: #04202a !important;
  border: 0 !important;
  font-weight: 800 !important;
}

html body[class*="tool-"] :is(.btn-group, .button-group) .btn-secondary,
html body[class*="tool-"] #btnReset,
html body[class*="tool-"] #resetBtn,
html body[class*="tool-"] .btn-reset {
  background: #3b82f6 !important;
  background-image: none !important;
  color: #ffffff !important;
  border: 0 !important;
  font-weight: 800 !important;
}

html body[class*="tool-"] :is(.btn-group, .button-group) a,
html body[class*="tool-"] #btnMore,
html body[class*="tool-"] #moreBtn,
html body[class*="tool-"] #otherToolsBtn {
  background: #f59e0b !important;
  background-image: none !important;
  color: #1a1206 !important;
  border: 0 !important;
  font-weight: 800 !important;
}

html body[class*="tool-"] :is(.btn-group, .button-group) :is(a, button, a span, button span) {
  color: inherit;
}
