:root {
  color-scheme: light;
  --ink: #14201c;
  --muted: #718078;
  --lime: #d1f56a;
  --paper: #f5f6ef;
  --line: #dfe4da;
  --dark: #14211d;
  --white: #fff;
  font-family: "Avenir Next","PingFang SC","Microsoft YaHei",sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #111b19;
  color: var(--ink);
}

button,input,select {
  font: inherit;
}

button,select {
  cursor: pointer;
}

button, input, select {
  touch-action: manipulation;
}

button:focus-visible,input:focus-visible,select:focus-visible {
  outline: 3px solid #83a929;
  outline-offset: 3px;
}

.page-shell {
  max-width: 1600px;
  margin: auto;
  padding: 0 5.4%;
}

main {
  padding-bottom: 45px;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 72px 0 48px;
  color: #f7f9f1;
}

.intro h1 {
  font-size: clamp(42px,5.4vw,76px);
  letter-spacing: -.065em;
  line-height: 1.16;
  margin: 0;
  font-weight: 700;
}

.intro h1 em {
  font-style: normal;
  color: var(--lime);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0,.94fr) minmax(0,1.06fr);
  align-items: stretch;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 28px 80px #0003;
}

.input-panel,.result-panel {
  padding: 40px 44px;
}

.input-panel {
  background: #fff;
}

.result-panel {
  background: var(--paper);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
}

.section-heading h2 {
  font-size: 24px;
  letter-spacing: -.04em;
  margin: 0;
}

fieldset {
  padding: 0;
  border: 0;
  margin: 0;
  min-width: 0;
}

legend {
  width: 100%;
  padding: 0;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 750;
}

.soc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
}

.soc-box {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px 17px 13px;
  background: #fafbf8;
}

.soc-box>span:first-child,.field {
  font-size: 12px;
  font-weight: 650;
  color: #67766b;
}

.target-box {
  background: #f5f9ea;
  border-color: #d7e8b9;
}

.soc-box:focus-within {
  outline: 3px solid #83a929;
  outline-offset: 2px;
}

.number-field {
  display: flex;
  align-items: baseline;
  margin-top: 7px;
}

.number-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -.06em;
  outline: none;
}

.number-field b {
  font-size: 17px;
  color: #8a9a8b;
}

.soc-arrow {
  text-align: center;
  color: #87988a;
  font-size: 19px;
}

.preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  color: #8b998d;
  font-size: 11px;
}

.preset-row div {
  display: flex;
  gap: 6px;
}

.preset {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #e2e9dc;
  border-radius: 6px;
  background: white;
  color: #78877b;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
}

.preset.active {
  background: #e8f5cc;
  border-color: #cde3a7;
  color: #334e20;
}

.form-section {
  border-top: 1px solid #edf0e9;
  margin-top: 25px;
  padding-top: 24px;
}

.field {
  display: block;
}

.field>input,.field select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 8px;
  border: 1px solid #dfe5dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  height: 45px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.field select {
  appearance: auto;
}

.field-hint {
  font-size: 11px;
  line-height: 1.6;
  color: #93a095;
  margin: 10px 0 0;
}

.plan-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 16px;
}

.plan-mode legend {
  margin-bottom: 9px;
  color: #67766b;
  font-size: 12px;
}

.plan-mode label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 5px;
  font-size: 12px;
  color: #405345;
}

.plan-mode input {
  accent-color: #668c35;
  width: 18px;
  height: 18px;
  flex: none;
}

.deadline-type {
  margin-top: 12px;
}

.field[hidden] {
  display: none;
}

.form-error {
  background: #fff0eb;
  border-radius: 8px;
  color: #a73d27;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  margin: 18px 0 0;
}

.result-panel {
  display: flex;
  flex-direction: column;
}

.result-heading {
  margin-bottom: 31px;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dbe5d2;
  border-radius: 99px;
  padding: 7px 10px;
  color: #59724c;
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8bb84c;
}

.result-status.incomplete {
  color: #8a6330;
  border-color: #e7dabe;
}

.result-status.incomplete .status-dot {
  background: #d0a250;
}

.hero-result {
  padding: 25px 0 30px;
}

.hero-result>p:first-child {
  font-size: 13px;
  color: #6e7e72;
  margin: 0 0 9px;
}

.hero-result strong {
  font-size: clamp(45px,5vw,70px);
  letter-spacing: -.06em;
  line-height: 1;
  font-weight: 700;
}

.hero-result #hero-unit {
  font-size: 15px;
  font-weight: 700;
  margin-left: 8px;
}

.hero-detail {
  font-size: 12px;
  color: #7d8b7f;
  margin: 13px 0 0;
  line-height: 1.6;
}

.charge-visual {
  margin-bottom: 29px;
}

.bar-labels,.bar-caption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #8d9c8f;
}

.bar-labels b {
  color: #405345;
  margin-left: 5px;
}

.charge-track {
  display: flex;
  overflow: hidden;
  height: 15px;
  background: #e1e8da;
  border-radius: 20px;
  margin: 11px 0;
}

.charge-existing {
  background: #839b7e;
}

.charge-added {
  background: #a7d448;
}

.bar-caption {
  font-size: 10px;
}

.time-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 14px;
  margin-top: 16px;
  color: #65766a;
  font-size: 11px;
}

.time-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.time-legend b {
  color: #344a38;
}

.time-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}

.time-dot-charge, .time-charge-segment {
  background: #a7d448;
}

.time-dot-bms, .time-bms-segment {
  background: #427ec4;
}

.tariff-context {
  margin: 10px 0 0;
  color: #748478;
  font-size: 10px;
  line-height: 1.5;
}

.tariff-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 15px;
  color: #65766a;
  font-size: 10px;
}

.tariff-legend span:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tariff-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
}

.time-track {
  position: relative;
}

.tariff-peak-overlay {
  position: absolute;
  top: 0;
  height: 100%;
  background: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255, 255, 255, .48) 4px 6px);
  pointer-events: none;
}

.tariff-valley {
  background: #9caf9a;
}

.tariff-peak {
  background: repeating-linear-gradient(135deg, #738879 0 2px, #e8efe4 2px 4px);
}

.tariff-marker:not([hidden]) {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: #fff;
  box-shadow: 0 0 0 1px #344e40;
  transform: translateX(-50%);
}

.tonight-card {
  background: #dff2b8;
  border: 1px solid #d4eaaa;
  border-radius: 12px;
  padding: 20px 21px;
}

.tonight-heading,.total-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  align-items: center;
}

.tonight-heading h3,.total-heading h3 {
  margin: 0;
  font-size: 15px;
}

.tonight-heading>span {
  font-size: 11px;
  color: #678257;
  font-weight: 600;
}

.tonight-grid,.total-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-top: 24px;
}

.tonight-grid>div,.total-grid>div {
  min-width: 0;
}

.tonight-grid span,.total-grid span {
  display: block;
  color: #708567;
  font-size: 11px;
  margin-bottom: 8px;
}

.tonight-grid strong,.total-grid strong {
  font-size: 19px;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.bms-section {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid #dbe3d7;
  border-radius: 12px;
  background: #fff;
}

.bms-section[hidden], .bms-times[hidden] {
  display: none;
}

.bms-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 12px;
}

.bms-heading h3 {
  margin: 0;
  font-size: 14px;
}

.bms-heading > span {
  color: #607951;
  font-size: 11px;
  font-weight: 700;
}

.bms-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 17px;
}

.bms-times span, .bms-times strong {
  display: block;
}

.bms-times span {
  color: #78877b;
  font-size: 11px;
  line-height: 1.5;
}

.bms-times strong {
  margin-top: 5px;
  font-size: 16px;
}

.bms-note {
  margin: 14px 0 0;
  color: #78877b;
  font-size: 11px;
  line-height: 1.6;
}

.total-section {
  padding: 26px 2px 0;
}

.total-heading>span {
  font-size: 10px;
  color: #98a69a;
}

.total-grid {
  margin-top: 22px;
}

.total-grid span {
  color: #94a095;
}

.total-grid strong {
  font-size: 16px;
}

.total-note {
  color: #99a59a;
  font-size: 10px;
  margin: 18px 0 0;
  line-height: 1.5;
}

.result-empty {
  border-top: 1px solid var(--line);
  padding: 30px 0;
  color: #758477;
  font-size: 13px;
  line-height: 1.7;
}

@media(max-width:850px) {
  .page-shell {
    padding: 0 5%;
  }
  .intro {
    padding: 54px 0 38px;
  }
  .input-panel,.result-panel {
    padding: 32px 26px;
  }
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

}

@media(max-width:760px) {
  .intro {
    display: block;
    padding: 47px 0 32px;
  }
  .intro h1 {
    font-size: 43px;
  }

  .workspace {
    grid-template-columns: 1fr;
    border-radius: 14px;
  }
  .input-panel,.result-panel {
    padding: 29px 24px;
  }
  .section-heading {
    margin-bottom: 28px;
  }
  .result-panel {
    padding-bottom: 34px;
  }
  .hero-result strong {
    font-size: clamp(42px, 11vw, 57px);
  }
  main {
    padding-bottom: 36px;
  }

  .tonight-grid strong {
    font-size: 18px;
  }
}

@media(max-width:430px) {
  .tonight-grid,.total-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 18px;
  }
  .tonight-grid strong,.total-grid strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .time-legend {
    justify-content: flex-start;
  }
}

@media(max-width:350px) {
  .page-shell {
    padding: 0 12px;
  }
  .input-panel,.result-panel {
    padding-left: 18px;
    padding-right: 18px;
  }
  .tonight-card {
    padding: 18px 14px;
  }
  .tonight-grid strong {
    font-size: 16px;
  }
  .total-grid strong {
    font-size: 14px;
  }
}
