/* ESS Sizing Studio - 样式 */
:root {
  --bg: #ffffff;
  --bg2: #f8fafc;
  --panel: #ffffff;
  --panel2: #f1f5f9;
  --line: #e2e8f0;
  --line2: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --accent: #1d4ed8;
  --accent2: #0f766e;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 28px rgba(15,23,42,.06);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; row-gap: 10px;
  padding: 14px 22px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15,23,42,.03);
}
.brand { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; }
.logo {
  width: auto; height: 43px; max-width: 176px; flex: none;
  display: block; object-fit: contain;
}
@media (max-width: 720px) {
  .logo { height: 36px; max-width: 148px; }
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.topbar .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.brand { min-width: 0; }
.brand-title { min-width: 0; }
/* 顶栏右侧固定工具区：标题文案变化不会带动语言选择位置 */
.top-right {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  justify-content: flex-end; margin-left: auto;
}
.mode-switch { display: flex; align-items: center; padding: 3px; border-radius: 999px; background: #eef3f7; border: 1px solid #e0e8ef; }
.mode-choice { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; padding: 6px 11px; border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1; white-space: nowrap; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.mode-choice:hover { color: var(--text); }
.mode-choice.active { background: #fff; color: var(--text); box-shadow: 0 2px 8px rgba(20,50,80,.11); }
/* 三语单选切换（文字 + 同比例缩小的圆形国旗） */
.lang-switch {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-left: 16px; border-left: 1px solid var(--line);
}
.lang-choice {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 7px; border-radius: 999px; cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.lang-choice:hover { background: var(--bg2); color: var(--text); }
.lang-choice.active { color: var(--text); background: #f8fafc; border-color: var(--line2); }
.lang-choice input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.lang-flag {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  display: inline-block; background-color: #fff;
  background-repeat: no-repeat; background-position: center;
  background-size: 14px auto; background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.18);
}
.flag-zh { background-image: url("../assets/flag-cn.svg"); }
.flag-en { background-image: url("../assets/flag-gb.svg"); }
.flag-es { background-image: url("../assets/flag-es.svg"); }
@media (max-width: 900px) {
  .top-right { width: 100%; gap: 8px; }
  .mode-choice { min-width: 52px; padding: 5px 8px; font-size: 10px; }
  .lang-switch { padding-left: 0; border-left: 0; gap: 4px; }
  .lang-choice { padding: 3px 5px; }
}
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 410px; width: 410px; }
/* 顶栏：项目名称录入 + 当前选择的国家 */
.top-meta { display: flex; align-items: center; gap: 14px; margin-left: 26px; flex: 1 1 auto; min-width: 0; }
.project-field { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; max-width: 400px; }
.project-field > span { font-size: 11.5px; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
.project-field input { padding: 6px 10px; font-size: 12.5px; min-width: 0; }
/* 顶栏：算法（测算引擎）选择 —— 位于项目名称之后 */
.engine-field { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.engine-field > span { font-size: 11.5px; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
.engine-field select { padding: 6px 8px; font-size: 12.5px; width: auto; min-width: 162px; cursor: pointer; }
.country-chip { font-size: 11.5px; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
.country-chip b { margin-left: 4px; color: var(--text); font-weight: 600; }
.export-group {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; letter-spacing: .4px; color: var(--muted);
}
.export-group select {
  padding: 6px 8px; font-size: 12.5px; width: auto; min-width: 92px; cursor: pointer;
}

.pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line2); color: var(--muted); background: var(--bg2);
  white-space: nowrap;
}
.pill.ok { color: #166534; border-color: #a7f3d0; background: #ecfdf5; }
.pill.err { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.pill.busy { color: #92400e; border-color: #fde68a; background: #fffbeb; }

/* ---------------- 布局 ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 60px;
  align-items: start;
}
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

.col-inputs { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.col-results { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
/* 结果区各卡片之间留出间距（#results 是卡片容器，卡片为其直接子元素） */
#results { display: flex; flex-direction: column; gap: 22px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card.flat { background: var(--panel); }
.card > summary {
  cursor: pointer; list-style: none;
  padding: 12px 14px; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid transparent;
}
.card[open] > summary { border-bottom-color: var(--line); }
.card > summary::-webkit-details-marker { display: none; }
.card > summary::after {
  content: "▾"; margin-left: auto; color: var(--muted); font-size: 12px;
  transition: transform .15s ease;
}
.card[open] > summary::after { transform: rotate(180deg); }
.card-body { padding: 16px 18px 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; font-size: 14px; }
.card-head .controls { display: flex; align-items: center; gap: 8px; }

.step {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: #eff6ff; color: var(--accent); border: 1px solid #bfdbfe;
}

/* ---------------- 表单 ---------------- */
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; flex: 1 1 120px; }
.field.grow { flex: 1 1 100%; }
.field > span { font-size: 11.5px; color: var(--muted); }

input[type=number], input[type=text], input[type=file], select, textarea {
  width: 100%; padding: 7px 9px; color: var(--text);
  background: #ffffff; border: 1px solid var(--line2); border-radius: 8px;
  font: inherit; font-size: 13px; outline: none;
}
select { cursor: pointer; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.14); }
input[type=file] { padding: 6px; font-size: 12px; }

/* 自定义文件上传卡片：避免浏览器原生控件语言与界面语言不一致 */
.file-upload {
  position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center; gap: 11px; min-height: 64px; padding: 10px 12px;
  border: 1px dashed #93c5fd; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 72%);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.file-upload:hover, .file-upload:focus-within {
  border-color: var(--accent); background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(29,78,216,.10);
}
.file-upload input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; opacity: 0; cursor: pointer;
}
.file-upload-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid #bfdbfe; border-radius: 10px;
  background: #fff; color: #1d4ed8; box-shadow: 0 2px 6px rgba(29,78,216,.08);
}
.file-upload-copy { min-width: 0; }
.file-upload-copy b { display: block; color: #0f172a; font-size: 12.5px; line-height: 1.35; }
.file-upload-copy small {
  display: block; margin-top: 2px; color: #64748b;
  font-size: 10.5px; line-height: 1.35; letter-spacing: .015em;
}
.file-upload-action {
  padding: 6px 10px; border-radius: 8px; background: #1d4ed8; color: #fff;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.file-upload-name {
  display: flex; align-items: center; gap: 6px; min-height: 21px; margin-top: 5px;
  color: #64748b; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere;
}
.file-upload-name::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1;
}
.file-upload-name.has-file { color: #1e3a8a; font-weight: 650; }
.file-upload-name.has-file::before { background: #16a34a; }

.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.check input { width: auto; }

/* 项目信息：是否有光伏，上下排列的互斥单选项 */
.radio-stack { display: flex; flex-direction: column; gap: 6px; margin-top: 3px; }
.radio-option { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.radio-option input { width: auto; margin: 0; accent-color: var(--accent); cursor: pointer; }

/* 自动动态计算 / 固定台数：两个明确选项，默认选中自动模式 */
.mode-segment { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; }
.mode-segment>.mode-choice {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px;
  border: 1px solid var(--line2); border-radius: 8px; background: var(--bg2);
  color: var(--muted); font-size: 12.5px; cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.mode-segment>.mode-choice input { width: auto; margin: 0; accent-color: var(--accent); cursor: pointer; }
.mode-segment>.mode-choice.active { border-color: var(--accent); background: #eff6ff; color: var(--text); font-weight: 600; }
.mode-segment>.mode-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.static-value {
  min-height: 34px; display: flex; align-items: center; padding: 7px 9px;
  border: 1px dashed var(--line2); border-radius: 8px; background: var(--bg2);
  color: var(--text); font-size: 12.5px;
}

.btn {
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: #f8fafc; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #1e40af);
  border-color: transparent; font-weight: 600; color: #fff;
  box-shadow: 0 6px 18px rgba(29,78,216,.20);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e40af, #172554);
  border-color: transparent; color: #fff;
}
.btn.primary:active:not(:disabled) {
  background: linear-gradient(135deg, #172554, #1e3a8a);
  box-shadow: 0 3px 10px rgba(29,78,216,.22);
}
.btn.primary:disabled {
  background: #64748b; border-color: #64748b; color: #fff;
  opacity: 1; box-shadow: none;
}
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.wide { width: 100%; padding: 11px; font-size: 14px; }
.btn.active {
  border-color: var(--accent); color: var(--accent);
  background: #eff6ff; font-weight: 600;
}
.btn.active::before { content: "✓ "; color: var(--accent); }
.run-bar { position: sticky; bottom: 12px; padding: 0; display: flex; gap: 8px; align-items: stretch; }
.run-bar .wide { flex: 1 1 auto; }

.sub-title { font-size: 12px; color: var(--text); font-weight: 600; margin: 12px 0 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hint { font-weight: 400; font-size: 11px; color: var(--warn); }
.note { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }
.head-note { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* 电价输入 */
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.price-grid .field { min-width: 0; }
.price-mode-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.price-mode-switch label {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--muted); font-size: 12px; cursor: pointer;
}
.price-mode-switch label:has(input:checked) {
  border-color: var(--accent); background: #eff6ff; color: var(--accent); font-weight: 600;
}
.price-mode-switch input { accent-color: var(--accent); margin: 0; }
.monthly-profile-picker {
  margin-top: 8px; padding: 12px; border: 1px solid #dbeafe; border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}
.monthly-profile-picker > .field { margin: 0 0 7px; }
.monthly-profile-picker > .field > span {
  color: #1e3a8a; font-size: 12px; font-weight: 650; letter-spacing: .01em;
}
.combo { position: relative; }
.combo-control { position: relative; }
.combo-control input {
  width: 100%; height: 42px; padding: 8px 46px 8px 39px;
  border-color: #bfdbfe; border-radius: 10px; background: #fff;
  font-size: 12.5px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.combo-control input:focus {
  border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(29,78,216,.13);
}
.combo-search-icon {
  position: absolute; left: 12px; top: 50%; z-index: 1;
  display: grid; place-items: center; color: #64748b;
  transform: translateY(-50%); pointer-events: none;
}
.combo-toggle {
  position: absolute; top: 4px; right: 4px; bottom: 4px; width: 32px;
  display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px;
  background: #eff6ff; color: #1d4ed8; font-size: 13px; line-height: 1;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.combo-toggle svg { display: block; }
.combo-toggle:hover, .combo-toggle:focus-visible {
  background: #dbeafe; color: #1e40af; outline: none;
}
.combo-list {
  position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 248px; overflow: auto; background: #fff;
  border: 1px solid var(--line2); border-radius: 9px;
  box-shadow: 0 12px 28px rgba(15,23,42,.16);
}
.combo-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 8px 11px; border: 0; border-bottom: 1px solid #eef2f7;
  background: #fff; color: var(--text); text-align: left; cursor: pointer;
}
.combo-option:last-child { border-bottom: 0; }
.combo-option:hover, .combo-option.is-active { background: #eff6ff; }
.combo-option[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); background: #f8fbff; }
.combo-option-main { font-size: 12.5px; font-weight: 600; }
.combo-option-meta { font-size: 11px; color: var(--muted); }
.combo-empty { padding: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.monthly-profile-source {
  margin-top: 8px; padding: 7px 10px; border-left: 3px solid var(--accent);
  border-radius: 4px; background: #f8fbff; color: #1e3a8a; font-size: 11.5px;
}
.monthly-profile-source:empty { display: none; }
.warn-text { color: #b45309; }
.substitute-text { color: #b91c1c; font-weight: 600; }
.price-grid input.substituted { border-color: #dc2626; background: #fef2f2; color: #b91c1c; font-weight: 700; }
.season-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.season-map .m { display: flex; flex-direction: column; gap: 3px; }
.season-map .m span { font-size: 10.5px; color: var(--muted); text-align: center; }
.season-map select { padding: 4px 2px; font-size: 10.5px; min-width: 0; width: 100%; }
      .season-map .m em.zh { font-style: normal; font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.35; }

.tou-editor { overflow-x: auto; padding-bottom: 4px; }
.tou-editor table { border-collapse: collapse; }
.tou-editor th, .tou-editor td { padding: 2px; font-size: 10.5px; color: var(--muted); text-align: center; font-weight: 400; }
.tou-editor select { padding: 2px 1px; font-size: 10px; border-radius: 5px; text-align: center; min-width: 42px; }
.tou-editor th.season { text-align: center; color: var(--text); font-weight: 600; padding-right: 8px; white-space: nowrap; }

/* 预览 */
.preview {
  font-size: 11.5px; max-height: 190px; overflow: auto;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; margin-top: 10px; font-family: var(--mono);
  white-space: pre; line-height: 1.5;
}
.preview b { color: var(--text); font-weight: 600; }

/* ---------------- 结果 ---------------- */
.empty {
  border: 1px dashed var(--line2); border-radius: var(--radius);
  padding: 40px 28px; text-align: center; color: var(--muted);
  background: #f8fafc;
}
.empty h2 { color: var(--text); margin: 0 0 8px; font-size: 17px; }
.empty ul { display: inline-block; text-align: left; margin: 14px 0 0; padding-left: 18px; }

.warn {
  border: 1px solid #fcd34d; background: #fffbeb; color: #92400e;
  border-radius: var(--radius); padding: 10px 14px; font-size: 12.5px;
}
.warn ul { margin: 6px 0 0; padding-left: 18px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.result-overview-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 10px; }
.result-overview-head h3 { margin: 0; color: var(--text); font-size: 18px; letter-spacing: .1px; }
.kpi {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi .k { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.kpi .v { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.kpi .u { font-size: 11px; color: var(--muted); margin-left: 4px; font-weight: 400; }
.kpi .s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kpi.good .v { color: var(--ok); }
.kpi.bad .v { color: var(--danger); }
.kpi.accent .v { color: var(--accent); }
.kpi.teal .v { color: var(--accent2); }
#kpiGrid .kpi .v { color: var(--text); }
#kpiGrid .kpi.accent .v { color: var(--accent); }
#kpiGrid .kpi.irr-kpi.good .v { color: var(--ok); }
#kpiGrid .kpi.irr-kpi.bad .v { color: var(--danger); }
.kpi-extra { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.kpi-extra .sub-k { color: var(--muted); font-size: 10.5px; }
.kpi-extra .sub-v { color: var(--text); font-family: var(--mono); font-size: 14px; font-weight: 700; }
.kpi-extra .sub-u { color: var(--muted); font-size: 10px; }

.badge {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
}
.badge.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* 表格 */
.table-wrap { overflow: auto; max-height: 440px; border: 1px solid var(--line); border-radius: 10px; margin-top: 12px; }
table.data { border-collapse: collapse; width: 100%; font-size: 12px; }
table.data th, table.data td { padding: 6px 9px; text-align: center; white-space: nowrap; border-bottom: 1px solid #e2e8f0; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 11px;
  border-bottom: 1px solid var(--line2);
}
table.data tbody tr:hover td { background: #f8fafc; }
table.data tr.best td { background: #f0fdf4; }
table.data tr.best td:first-child::after { content: " ★"; color: var(--ok); }
table.data td.num { font-family: var(--mono); }

.chart-wrap { width: 100%; margin-top: 10px; }

/* 光伏发电量：第一年 12 个月与运营年限逐年两张图并排一行 */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .chart-row { grid-template-columns: 1fr; } }

/* 逐时运行模拟：全年 12 个月各一张“典型日”图 */
.mchart-intro { display: block; margin: 0 0 8px; }
.mchart { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.mchart:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.mhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mhead b { font-size: 13px; color: var(--text); }
.mnote { font-size: 11.5px; color: var(--muted); }
.mchart canvas { width: 100%; display: block; margin-top: 4px; cursor: crosshair; }
.mtable { margin-top: 4px; }
.mtable > summary { cursor: pointer; font-size: 11.5px; color: var(--muted); }
.mtable .table-wrap { max-height: 320px; margin-top: 8px; }
canvas { width: 100%; display: block; }
.assumptions { font-size: 12.5px; color: var(--muted); }
.assumptions b { color: var(--text); }
.assumptions ul { margin: 6px 0 10px; padding-left: 18px; }
.assumptions li.cap-advice { color: var(--danger); }
.assumptions li.cap-advice b { color: var(--danger); }

/* ---------------- 分时电价：P1（最贵，红）→ P6（最便宜，绿） ---------------- */
.tou-editor select[data-p="P1"] { color:#dc2626; border-color:rgba(220,38,38,.55); background:rgba(220,38,38,.07); }
.tou-editor select[data-p="P2"] { color:#ea580c; border-color:rgba(234,88,12,.55); background:rgba(234,88,12,.07); }
.tou-editor select[data-p="P3"] { color:#ca8a04; border-color:rgba(202,138,4,.55); background:rgba(202,138,4,.08); }
.tou-editor select[data-p="P4"] { color:#65a30d; border-color:rgba(101,163,13,.55); background:rgba(101,163,13,.07); }
.tou-editor select[data-p="P5"] { color:#16a34a; border-color:rgba(22,163,74,.55); background:rgba(22,163,74,.07); }
.tou-editor select[data-p="P6"] { color:#059669; border-color:rgba(5,150,105,.55); background:rgba(5,150,105,.07); }

.ptag {
  display: inline-block; padding: 0 4px; margin: 0 1px; border-radius: 4px;
  border: 1px solid currentColor; font-weight: 600; font-size: 9.5px; line-height: 1.45;
}
.ptag[data-p="P1"] { color:#dc2626; }
.ptag[data-p="P2"] { color:#ea580c; }
.ptag[data-p="P3"] { color:#ca8a04; }
.ptag[data-p="P4"] { color:#65a30d; }
.ptag[data-p="P5"] { color:#16a34a; }
.ptag[data-p="P6"] { color:#059669; }
.season-map .m em.zh .sep { color: var(--muted); opacity: .55; }

/* ---------------- PDF 版本选择：简易版 / 商业版 ---------------- */
body.pdf-export-open { overflow: hidden; }
.pdf-export-overlay {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(7,19,38,.58); backdrop-filter: blur(4px);
}
.pdf-export-dialog {
  position: relative; width: min(820px, 96vw); max-height: 92vh; overflow: auto;
  border: 1px solid #cfd9e5; border-radius: 22px; background: #fff;
  box-shadow: 0 30px 90px rgba(4,15,32,.34);
  animation: pdf-export-in .18s ease-out;
}
@keyframes pdf-export-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.pdf-export-head {
  position: relative; padding: 28px 32px 22px;
  border-bottom: 1px solid #e4eaf1;
  background: linear-gradient(180deg,#fbfcfe 0%,#fff 100%);
}
.pdf-export-head h2 { margin: 7px 0 6px; color: #0a1b33; font-size: 23px; line-height: 1.25; }
.pdf-export-head p { margin: 0; max-width: 660px; color: #526173; font-size: 13px; line-height: 1.65; }
.pdf-export-kicker {
  display: inline-block; color: #c56b2d; font-size: 10px; font-weight: 800;
  letter-spacing: .15em;
}
.pdf-export-head::after {
  content: ""; position: absolute; left: 32px; bottom: -1px; width: 64px; height: 3px;
  background: #c56b2d;
}
.pdf-export-close {
  position: absolute; top: 18px; right: 20px; width: 36px; height: 36px;
  border: 1px solid #d7e0ea; border-radius: 50%; background: #fff; color: #526173;
  font: 400 23px/1 Arial, sans-serif; cursor: pointer;
}
.pdf-export-close:hover { border-color: #1d4ed8; color: #1d4ed8; background: #f8fbff; }
.pdf-export-options {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px;
  padding: 26px 32px 28px;
}
.pdf-export-option {
  position: relative; min-height: 184px; padding: 24px 22px 22px; text-align: left;
  border: 1.5px solid #d7e0ea; border-radius: 16px; background: #fff; color: #0a1b33;
  font: inherit; cursor: pointer; overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.pdf-export-option::after {
  content: "→"; position: absolute; right: 20px; bottom: 18px;
  color: #1d4ed8; font-size: 20px; font-weight: 700; opacity: .7;
}
.pdf-export-option:hover, .pdf-export-option:focus-visible {
  transform: translateY(-2px); border-color: #1d4ed8; outline: none;
  box-shadow: 0 12px 30px rgba(29,78,216,.12);
}
.pdf-export-option.is-commercial { border-color: #d9b99f; }
.pdf-export-option.is-commercial::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: linear-gradient(90deg,#0a1b33 0%,#0a1b33 68%,#c56b2d 68%,#c56b2d 100%);
}
.pdf-export-option.is-commercial:hover, .pdf-export-option.is-commercial:focus-visible {
  border-color: #c56b2d; box-shadow: 0 12px 30px rgba(197,107,45,.14);
}
.pdf-export-option.is-commercial::after { color: #c56b2d; }
.pdf-export-no { display: block; color: #93a1b3; font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.pdf-export-tag {
  display: inline-block; margin: 12px 0 11px; padding: 3px 8px;
  border: 1px solid #bfdbfe; border-radius: 999px; background: #f8fbff;
  color: #1d4ed8; font-size: 10.5px; font-weight: 700;
}
.pdf-export-option.is-commercial .pdf-export-tag {
  border-color: #ecd2bd; background: #fffaf6; color: #a34f1e;
}
.pdf-export-option b { display: block; margin: 0 0 9px; font-size: 20px; color: #0a1b33; }
.pdf-export-option small { display: block; padding-right: 18px; color: #526173; font-size: 12px; line-height: 1.65; }
.pdf-export-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 32px 18px; border-top: 1px solid #e4eaf1; background: #fbfcfe;
}
.pdf-export-foot span { color: #6b7a8d; font-size: 11px; line-height: 1.5; }
.pdf-export-foot .btn { min-width: 92px; flex: 0 0 auto; }
@media (max-width: 640px) {
  .pdf-export-overlay { padding: 12px; }
  .pdf-export-dialog { width: 100%; max-height: 94vh; border-radius: 16px; }
  .pdf-export-head { padding: 24px 20px 18px; }
  .pdf-export-head::after { left: 20px; }
  .pdf-export-options { grid-template-columns: 1fr; padding: 18px 20px; gap: 12px; }
  .pdf-export-option { min-height: 156px; padding: 20px 18px; }
  .pdf-export-foot { align-items: flex-start; flex-direction: column; padding: 14px 20px 18px; }
  .pdf-export-foot .btn { width: 100%; }
}

/* ---------------- 测算工具弹窗：占全屏 75% ---------------- */
body.tools-open { overflow: hidden; }
.tools-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15,23,42,.46); backdrop-filter: blur(3px);
}
.tools-dialog {
  position: relative;
  width: 80vw; height: 80vh; min-width: 680px; min-height: 520px;
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15,23,42,.30);
}
.tools-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--line); background: #f8fafc;
}
.tools-head h2 { margin: 0; font-size: 20px; }
.tools-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.tools-close {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line2);
  background: #fff; color: var(--text); font-size: 24px; line-height: 1; cursor: pointer;
}
.tools-close:hover { background: #f1f5f9; border-color: var(--accent); }
.tools-access-gate {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 24px;
  background: rgba(15,23,42,.52); backdrop-filter: blur(3px);
}
.tools-access-card {
  width: min(500px, 100%); padding: 24px 26px 20px;
  border: 1px solid #cbd5e1; border-radius: 16px; background: #fff;
  box-shadow: 0 22px 54px rgba(15,23,42,.30);
}
.tools-access-icon {
  width: 42px; height: 42px; display: grid; place-items: center;
  margin-bottom: 12px; border-radius: 12px; background: #eff6ff;
  font-size: 21px;
}
.tools-access-card h3 { margin: 0; color: #0f172a; font-size: 19px; }
.tools-access-card > p { margin: 7px 0 14px; color: #475569; font-size: 12.5px; line-height: 1.6; }
.tools-access-target {
  display: inline-flex; align-items: center; margin-bottom: 15px; padding: 5px 9px;
  border: 1px solid #bfdbfe; border-radius: 999px; background: #f8fbff;
  color: #1d4ed8; font-size: 11.5px; font-weight: 650;
}
.tools-access-card .field > span { font-weight: 650; }
.tools-access-digits { display: flex; align-items: center; gap: 10px; }
.tools-access-digit {
  width: 52px; height: 56px; flex: 0 0 auto; box-sizing: border-box; padding: 0;
  border: 1.5px solid #94a3b8; border-radius: 10px; background: #fff;
  color: #0f172a; font: 700 26px/1 "Segoe UI", Arial, sans-serif;
  text-align: center; caret-color: #1d4ed8;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.tools-access-digit:hover { border-color: #64748b; }
.tools-access-digit:focus {
  border-color: #1d4ed8; outline: none;
  box-shadow: 0 0 0 3px rgba(29,78,216,.22);
}
.tools-access-digit.is-filled { border-color: #2563eb; background: #eff6ff; }
.tools-access-digit[aria-invalid="true"] { border-color: #dc2626; background: #fef2f2; }
@media (max-width: 560px) {
  .tools-access-digits { gap: 8px; }
  .tools-access-digit { width: 46px; height: 50px; font-size: 22px; }
}
.tools-access-error {
  min-height: 20px; margin-top: 7px; color: #b91c1c;
  font-size: 12px; font-weight: 650; line-height: 1.4;
}
.tools-access-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px;
}
.tools-access-actions .btn { min-width: 112px; }
.tools-access-card #toolsAccessHint,
.tools-access-card #pdfCommercialHint { margin: 14px 0 0; }
.tools-main { display: grid; grid-template-columns: 252px minmax(0,1fr); flex: 1 1 auto; min-height: 0; }
.tools-nav { padding: 14px; border-right: 1px solid var(--line); background: #f8fafc; }
.tool-tab {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  padding: 12px; margin-bottom: 8px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--text); font: inherit; cursor: pointer;
}
.tool-tab:hover { border-color: var(--line2); background: #f1f5f9; }
.tool-tab.active { border-color: var(--accent); background: #eff6ff; box-shadow: 0 0 0 2px rgba(29,78,216,.08); }
.tool-tab .tool-no {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
}
.tool-tab b { display: block; font-size: 13px; }
.tool-tab small { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.tools-panels { min-width: 0; overflow: auto; padding: 18px 22px; }
.tool-panel-head h3 { margin: 0; font-size: 16px; }
.tool-panel-head p { margin: 4px 0 14px; color: var(--muted); font-size: 12px; }
.manual-intro {
  padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 10px;
  background: #f8fbff; color: #1f2937; font-size: 12.5px; line-height: 1.6;
}
.manual-intro b { display: block; color: #0f172a; font-size: 13px; }
.manual-intro ul { margin: 6px 0 0; padding-left: 19px; }
.manual-intro li + li { margin-top: 4px; }
#toolManualPanel .sub-title { margin: 18px 0 8px; color: #0f172a; }
.manual-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.manual-actions .btn { min-width: 160px; }
.manual-status { flex: 1 1 280px; color: #334155; font-size: 12px; line-height: 1.45; }
.manual-status.busy { color: #1d4ed8; }
.manual-status.ok { color: #15803d; font-weight: 600; }
.manual-status.err { color: #b91c1c; font-weight: 600; }
.manual-outline {
  margin-top: 18px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: #334155; font-size: 11.5px; line-height: 1.55;
}
.manual-outline b { display: block; margin-bottom: 3px; color: #0f172a; font-size: 12.5px; }
.manual-outline span { display: block; }
.deploy-intro {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid #bfdbfe; border-radius: 11px;
  background: #f8fbff; color: #1e293b; font-size: 12.5px; line-height: 1.58;
}
.deploy-intro > div:first-child { flex: 1 1 430px; }
.deploy-intro b { display: block; margin-bottom: 4px; color: #0f172a; font-size: 13.5px; }
.deploy-intro span { display: block; }
.deploy-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.deploy-badges span {
  padding: 4px 8px; border: 1px solid #bfdbfe; border-radius: 999px;
  background: #fff; color: #1d4ed8; font-size: 10.5px; font-weight: 600; white-space: nowrap;
}
.deploy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.deploy-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.deploy-card b { display: block; color: #0f172a; font-size: 13px; }
.deploy-card ul, .deploy-card ol { margin: 7px 0 0; padding-left: 19px; color: #334155; font-size: 11.5px; line-height: 1.6; }
.deploy-card li + li { margin-top: 3px; }
.deploy-skill-note {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start;
  margin-top: 12px; padding: 11px 14px; border: 1px solid #fcd34d; border-radius: 10px;
  background: #fffbeb; color: #78350f; font-size: 11.5px; line-height: 1.58;
}
.deploy-skill-note b { color: #92400e; font-size: 12.5px; }
.deploy-skill-note code { color: #713f12; font-weight: 600; }
#toolDeployPanel .sub-title { margin: 18px 0 8px; color: #0f172a; }
.deploy-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.deploy-actions .btn { min-width: 140px; }
#deployStatus { flex: 1 1 300px; min-width: 220px; }
.deploy-note { margin: 0 0 10px; color: #475569; font-size: 11.5px; line-height: 1.55; }
.deploy-file-list { display: grid; gap: 11px; padding-bottom: 8px; }
.deploy-group { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.deploy-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border-bottom: 1px solid var(--line); background: #f8fafc;
}
.deploy-group-head b { color: #0f172a; font-size: 12px; }
.deploy-group-head span { color: #64748b; font-size: 10.5px; }
.deploy-file { display: grid; grid-template-columns: minmax(210px, .8fr) minmax(0, 1.2fr); gap: 12px; padding: 7px 11px; border-bottom: 1px solid #eef2f7; }
.deploy-file:last-child { border-bottom: 0; }
.deploy-file code { color: #1e3a8a; font-size: 10.5px; overflow-wrap: anywhere; }
.deploy-file span { color: #475569; font-size: 10.5px; line-height: 1.45; }
.linux-api-card { margin-top: 14px; padding: 13px 15px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.linux-api-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.linux-api-head b { color: #0f172a; font-size: 13px; }
.linux-api-head span { color: #475569; font-size: 10.5px; line-height: 1.45; text-align: right; }
.linux-storage-paths { margin: 4px 0 5px; color: #334155; font-size: 10.5px; line-height: 1.5; overflow-wrap: anywhere; }
.linux-record-list { display: grid; gap: 5px; margin-top: 7px; }
.linux-record { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; border: 1px solid #dbeafe; border-radius: 7px; background: #fff; }
.linux-record span { color: #1e293b; font-size: 10.5px; line-height: 1.45; overflow-wrap: anywhere; }
.linux-record a { flex: 0 0 auto; color: #1d4ed8; font-size: 10.5px; font-weight: 600; }
.linux-record a:hover { text-decoration: underline; }
.linux-local-card { margin-top: 14px; padding: 14px 16px 16px; border: 1px solid #93c5fd; border-radius: 11px; background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%); }
.linux-local-config { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr); gap: 12px; margin: 12px 0; }
.linux-local-config.hidden { display: none; }
.linux-local-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.linux-local-link { color: #1d4ed8; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.linux-local-link:hover { text-decoration: underline; }
.linux-local-link.hidden { display: none; }
.linux-build-gate {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 24px;
  background: rgba(15,23,42,.58); backdrop-filter: blur(4px);
}
.linux-build-card {
  width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 22px 24px 20px; border: 1px solid #94a3b8; border-radius: 16px;
  background: #fff; box-shadow: 0 24px 60px rgba(15,23,42,.34);
}
.linux-build-head { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 18px; }
.linux-build-head h3 { margin: 2px 0 4px; color: #0f172a; font-size: 20px; }
.linux-build-head p { margin: 0; color: #475569; font-size: 12px; line-height: 1.55; }
.linux-build-kicker {
  display: inline-flex; padding: 3px 8px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; font-size: 10.5px; font-weight: 700;
}
.linux-build-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 18px 0 14px;
}
.linux-build-step {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px 10px; border: 1px solid #dbe2ea; border-radius: 9px;
  background: #f8fafc; color: #475569; font-size: 11.5px;
}
.linux-build-step span {
  width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; background: #e2e8f0; color: #334155; font-size: 11px; font-weight: 750;
}
.linux-build-step b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linux-build-step.is-active { border-color: #2563eb; background: #eff6ff; color: #1e3a8a; }
.linux-build-step.is-active span { background: #2563eb; color: #fff; }
.linux-build-step.is-done { border-color: #86efac; background: #f0fdf4; color: #166534; }
.linux-build-step.is-done span { background: #16a34a; color: #fff; }
.linux-build-status {
  flex: 0 0 auto;
  padding: 8px 10px; border: 1px solid #bfdbfe; border-radius: 8px;
  background: #f8fbff; color: #1e40af; font-size: 11px; line-height: 1.5;
}
.linux-build-status.warn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.linux-build-status.ok { border-color: #86efac; background: #f0fdf4; color: #166534; }
.linux-build-status.busy { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.linux-build-error {
  flex: 0 0 auto; max-height: 190px; overflow-y: auto; overflow-x: hidden;
  margin-top: 7px; padding: 8px 10px; border: 1px solid #fecaca; border-radius: 8px;
  background: #fef2f2; color: #991b1b; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 10.5px; font-weight: 500; line-height: 1.55; overscroll-behavior: contain;
}
.linux-build-error:empty { display: none; }
.linux-build-panel { flex: 0 0 auto; padding: 5px 1px 0; }
.linux-build-panel h4 { margin: 10px 0 5px; color: #0f172a; font-size: 14px; }
.linux-build-panel > p { margin: 0 0 12px; color: #475569; font-size: 11.5px; line-height: 1.6; }
.linux-build-fields { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.35fr); gap: 12px; margin: 13px 0 10px; }
.linux-build-fields .field > span { color: #334155; font-weight: 650; }
.linux-build-fields input { height: 36px; }
.linux-build-hint { padding: 9px 11px; border-radius: 8px; background: #f8fafc; color: #475569 !important; font-size: 10.8px !important; }
.linux-build-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.linux-build-summary > div { padding: 9px 11px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.linux-build-summary span { display: block; color: #64748b; font-size: 10px; }
.linux-build-summary b { display: block; margin-top: 3px; color: #0f172a; font-size: 12px; overflow-wrap: anywhere; }
.linux-build-warning { padding: 10px 12px; border: 1px solid #fca5a5; border-radius: 9px; background: #fef2f2; }
.linux-build-warning b { display: block; color: #991b1b; font-size: 12px; }
.linux-build-warning span { display: block; margin-top: 4px; color: #7f1d1d; font-size: 10.8px; line-height: 1.55; }
.linux-build-actions { display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 9px; margin-top: 17px; padding-top: 13px; border-top: 1px solid #e2e8f0; }
.linux-build-actions .btn { min-width: 104px; }
.bill-upload-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.bill-upload-note { flex: 1 1 320px; margin: 0; }
.bill-upload-actions { display: flex; flex: 0 0 auto; gap: 10px; }
.bill-upload-actions .btn { min-width: 112px; height: 34px; }
.bill-file-list { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 5px; min-height: 21px; font-size: 11px; }
.bill-upload-state { min-height: 18px; margin-top: 4px; color: #64748b; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.bill-upload-state.busy { color: #1d4ed8; }
.bill-upload-state.ok { color: #15803d; font-weight: 650; }
.bill-upload-state.warn { color: #b45309; }
@media (max-width: 720px) {
  .bill-upload-foot { align-items: flex-start; flex-direction: column; }
  .bill-upload-actions { width: 100%; justify-content: flex-end; }
}
.file-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; font-size: 11px; }
.file-chip b { color: var(--accent); }
.file-chip em { color: var(--muted); font-style: normal; }
.bill-status { min-height: 22px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.bill-status.busy { color: var(--accent); }
.bill-status.ok { color: var(--ok); }
.bill-status.warn { color: var(--warn); }
.bill-status.err { color: var(--danger); }
.bill-summary { margin-top: 4px; padding: 8px 10px; border-left: 3px solid var(--accent); background: #eff6ff; color: #1e3a8a; font-size: 11.5px; }
.bill-tax-summary {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 11px;
  border: 1px solid #bfdbfe; border-radius: 8px; background: #f8fbff;
  color: #1e3a8a; font-size: 12px; font-weight: 600;
}
.bill-tax-summary::before { content: "CIF / NIF"; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: .3px; }
.bill-monthly { margin-top: 14px; }
.bill-monthly-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.bill-monthly-head b { font-size: 12.5px; color: var(--text); }
.bill-monthly-head span { font-size: 10.5px; color: var(--muted); }
.bill-monthly-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bill-monthly-table { width: 100%; table-layout: fixed; font-size: 10.5px; }
.bill-monthly-table th, .bill-monthly-table td { padding: 5px 3px; text-align: center; white-space: nowrap; }
.bill-monthly-table th:first-child, .bill-monthly-table td:first-child { width: 56px; color: var(--text); font-weight: 600; }
.bill-monthly-table td.num { font-family: var(--mono); }
.bill-table-wrap { max-height: none; overflow: visible; margin-top: 10px; }
.bill-table { table-layout: fixed; }
.bill-table th:nth-child(1) { width: 5%; }
.bill-table th:nth-child(2) { width: 26%; }
.bill-table th:nth-child(3) { width: 21%; }
.bill-table th:nth-child(4) { width: 26%; }
.bill-table th:nth-child(5) { width: 22%; }
.bill-table input { min-width: 0; width: 100%; text-align: center; font-family: var(--mono); font-size: 11.5px; }
.bill-table td.avg { color: var(--text); font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.bill-table input.missing { border-color: #f59e0b; background: #fffbeb; }
.bill-weighted-summary {
  margin-top: 14px; border: 1px solid #bfdbfe; border-radius: 10px;
  background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.bill-weighted-head {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 12px 14px; border-bottom: 1px solid #dbeafe; background: #f8fbff;
}
.bill-weighted-kpi { flex: 2 1 300px; min-width: 0; }
.bill-weighted-kpi span { display: block; color: #334155; font-size: 11.5px; font-weight: 600; }
.bill-weighted-kpi strong { display: block; margin-top: 2px; color: #0f172a; font-family: var(--mono); font-size: 24px; line-height: 1.15; }
.bill-weighted-kpi strong small { color: #475569; font-family: inherit; font-size: 11px; font-weight: 600; }
.bill-weighted-totals { flex: 3 1 420px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bill-weighted-totals span { padding: 7px 9px; border: 1px solid #e2e8f0; border-radius: 7px; background: #fff; color: #475569; font-size: 10.5px; }
.bill-weighted-totals b { display: block; margin-top: 2px; color: #0f172a; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.bill-weighted-table-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 14px 6px; }
.bill-weighted-table-head b { color: var(--text); font-size: 12px; }
.bill-weighted-table-head span { color: var(--muted); font-size: 10.5px; }
.bill-weighted-table { width: 100%; table-layout: fixed; font-size: 11px; }
.bill-weighted-table th, .bill-weighted-table td { padding: 6px 5px; text-align: center; white-space: nowrap; }
.bill-weighted-table th { color: #334155; background: #f8fafc; font-size: 10.5px; }
.bill-weighted-table th:first-child, .bill-weighted-table td:first-child { width: 9%; }
.bill-weighted-table th:nth-child(2), .bill-weighted-table td:nth-child(2) { width: 17%; }
.bill-weighted-table th:nth-child(3), .bill-weighted-table td:nth-child(3) { width: 22%; }
.bill-weighted-table th:nth-child(4), .bill-weighted-table td:nth-child(4) { width: 32%; }
.bill-weighted-table th:nth-child(5), .bill-weighted-table td:nth-child(5) { width: 20%; }
.bill-weighted-table td.num { color: #0f172a; font-family: var(--mono); }
.bill-weighted-table td.weighted-price { font-weight: 700; }
.bill-weighted-table td.weighted-share { color: #0f766e; font-weight: 700; }
.bill-weighted-note { padding: 8px 14px 10px; border-top: 1px solid #e2e8f0; color: #475569; font-size: 10.5px; line-height: 1.55; }
.bill-warnings { margin-top: 8px; padding: 8px 10px; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: 11.5px; }
.bill-warnings:empty { display: none; }
.bill-warnings ul { margin: 4px 0 0; padding-left: 18px; }
.bill-monthly-table td.blank { background: #fafafa; }
.bill-monthly-table td.substituted { background: #fef2f2; color: #b91c1c; font-weight: 700; }
.bill-tou-template { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.bill-tou-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.bill-tou-head b { display: block; color: var(--text); font-size: 12.5px; }
.bill-tou-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.bill-tou-actions { display: flex; gap: 7px; flex-shrink: 0; }
.bill-tou-table-wrap { width: 100%; }
.bill-tou-table { table-layout: fixed; width: 100%; font-size: 10.5px; }
.bill-tou-table th, .bill-tou-table td { padding: 6px 5px; text-align: center; vertical-align: middle; }
.bill-tou-table th { color: #334155; background: #f8fafc; }
.bill-tou-table th:first-child, .bill-tou-table td:first-child { width: 9%; }
.bill-tou-table th:nth-child(2), .bill-tou-table td:nth-child(2) { width: 40%; }
.bill-tou-table th:nth-child(3), .bill-tou-table td:nth-child(3) { width: 40%; }
.bill-tou-table th:nth-child(4), .bill-tou-table td:nth-child(4) { width: 11%; }
.bill-tou-table tbody tr:nth-child(even) { background: #fcfdff; }
.bill-tou-month b { display: block; color: var(--text); font-size: 11px; }
.bill-tou-month small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.bill-tou-segments { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.tou-seg { display: inline-flex; align-items: baseline; gap: 3px; padding: 2px 5px; border: 1px solid; border-radius: 5px; font-family: var(--mono); font-size: 9.5px; line-height: 1.35; white-space: nowrap; }
.tou-seg b { font-weight: 600; }
.tou-seg em { font-style: normal; font-weight: 700; }
.tou-seg[data-p="P1"] { color:#b91c1c; border-color:#fecaca; background:#fef2f2; }
.tou-seg[data-p="P2"] { color:#c2410c; border-color:#fed7aa; background:#fff7ed; }
.tou-seg[data-p="P3"] { color:#a16207; border-color:#fde68a; background:#fefce8; }
.tou-seg[data-p="P4"] { color:#4d7c0f; border-color:#d9f99d; background:#f7fee7; }
.tou-seg[data-p="P5"] { color:#15803d; border-color:#bbf7d0; background:#f0fdf4; }
.tou-seg[data-p="P6"] { color:#047857; border-color:#a7f3d0; background:#ecfdf5; }
.bill-tou-editor { margin-top: 10px; padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 9px; background: #f8fbff; }
.bill-tou-editor-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.bill-tou-editor-head > b { flex: 1; color: var(--text); font-size: 11.5px; }
.bill-tou-editor-head .field { flex: 0 0 140px; width: 140px; margin: 0; }
.bill-tou-editor-head .field span { font-size: 9.5px; }
.bill-tou-hour-head, .bill-tou-hour-row { display: grid; grid-template-columns: 82px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.bill-tou-hour-head { margin-top: 7px; color: var(--muted); font-family: var(--mono); font-size: 8px; text-align: center; }
.bill-tou-hour-row > span { color: #334155; font-size: 10px; font-weight: 600; }
.bill-tou-hour-row select { width: 100%; min-width: 0; padding: 3px 0; border-radius: 4px; font-size: 9.5px; text-align: center; appearance: none; -webkit-appearance: none; }
.bill-tou-hour-row select[data-p="P1"] { color:#b91c1c; border-color:#fecaca; background:#fef2f2; }
.bill-tou-hour-row select[data-p="P2"] { color:#c2410c; border-color:#fed7aa; background:#fff7ed; }
.bill-tou-hour-row select[data-p="P3"] { color:#a16207; border-color:#fde68a; background:#fefce8; }
.bill-tou-hour-row select[data-p="P4"] { color:#4d7c0f; border-color:#d9f99d; background:#f7fee7; }
.bill-tou-hour-row select[data-p="P5"] { color:#15803d; border-color:#bbf7d0; background:#f0fdf4; }
.bill-tou-hour-row select[data-p="P6"] { color:#047857; border-color:#a7f3d0; background:#ecfdf5; }
.bill-tou-status { min-height: 18px; margin-top: 7px; font-size: 10.5px; color: var(--muted); }
.bill-tou-status.ok { color: var(--ok); }
.bill-tou-status.warn { color: #b45309; }
.bill-tou-status.err { color: var(--danger); }
.ok-text { color: var(--ok); }
.bill-save-box { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.bill-save-box .field { flex: 0 1 260px; }
.bill-save-box .check { flex: 1 1 260px; margin: 0 0 8px; }
.saved-bills { margin-top: 18px; }
.bill-saved-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.saved-bill { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.saved-bill:last-child { border-bottom: 0; }
.saved-bill b { display: block; font-size: 12.5px; }
.saved-bill span { display: block; color: var(--muted); font-size: 10.5px; }
.saved-actions { display: flex; gap: 6px; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover:not(:disabled) { border-color: var(--danger); background: #fef2f2; }
.season-tools { padding: 4px 0 8px; }
.season-tools .tou-editor { margin-top: 8px; }
#toolSeasonPanel .tou-editor table { width: 100%; table-layout: fixed; }
#toolSeasonPanel .tou-editor th.season { width: 126px; padding-right: 4px; font-size: 10px; }
#toolSeasonPanel .tou-editor th:not(.season), #toolSeasonPanel .tou-editor td { padding: 1px 0; }
#toolSeasonPanel .tou-editor select { width: 100%; min-width: 0; padding: 1px 0; font-size: 9px; }
.tools-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 20px; border-top: 1px solid var(--line); background: #f8fafc; font-size: 11.5px; color: var(--muted); }
@media (max-width: 900px) {
  .tools-dialog { width: 92vw; height: 90vh; min-width: 0; min-height: 0; }
  .tools-main { grid-template-columns: 1fr; }
  .tools-nav { display: flex; gap: 8px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .tool-tab { margin: 0; flex: 1 1 0; }
  .tools-panels { padding: 14px; }
  .deploy-grid { grid-template-columns: 1fr; }
  .deploy-skill-note { grid-template-columns: 1fr; }
  .deploy-file { grid-template-columns: 1fr; gap: 3px; }
  .linux-api-head { display: block; }
  .linux-api-head span { display: block; margin-top: 3px; text-align: left; }
  .linux-record { display: block; }
  .linux-record a { display: inline-block; margin-top: 3px; }
  .linux-local-config { grid-template-columns: 1fr; }
  .linux-build-gate { padding: 12px; }
  .linux-build-card { padding: 17px 16px 15px; }
  .linux-build-steps { grid-template-columns: 1fr; gap: 5px; }
  .linux-build-fields, .linux-build-summary { grid-template-columns: 1fr; }
  .linux-build-actions { flex-wrap: wrap; }
  .top-actions { flex: 1 1 100%; width: auto; }
}
@media (max-width: 1120px) {
  .bill-monthly-grid { grid-template-columns: 1fr; }
  .bill-weighted-head { align-items: flex-start; flex-direction: column; }
  .bill-weighted-totals { width: 100%; }
  .bill-tou-head { flex-direction: column; }
  .bill-tou-actions { width: 100%; }
  .bill-tou-hour-head, .bill-tou-hour-row { grid-template-columns: 64px repeat(24, minmax(30px, 1fr)); min-width: 830px; }
  .bill-tou-editor { overflow-x: auto; }
}
