:root {
  color-scheme: light;
  --ink: #172922;
  --muted: #78847e;
  --line: #e8ece7;
  --paper: #ffffff;
  --canvas: #f5f6f2;
  --green: #197355;
  --green-dark: #115c42;
  --green-pale: #e9f4ee;
  --orange: #e69a51;
  --shadow: 0 18px 50px rgba(32, 52, 42, .055);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "DM Sans", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1100px, calc(100% - 52px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e6e9e3; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font: 800 18px Manrope, sans-serif; letter-spacing: -.7px; }
.brand-mark { width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; background: var(--green); color: white; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-dot { color: var(--green); }
.privacy-note { display: inline-flex; align-items: center; gap: 8px; color: #78847e; font-size: 12px; font-weight: 500; }
.privacy-dot { width: 7px; height: 7px; border-radius: 50%; background: #68a984; box-shadow: 0 0 0 3px #e2eee5; }

.intro { padding: 45px 0 31px; }
.eyebrow, .step-label, .result-month-label { color: var(--green); font-size: 10px; line-height: 1.4; font-weight: 700; letter-spacing: 1.1px; }
.eyebrow { display: flex; gap: 7px; align-items: center; }
.eyebrow-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; background: #e6efe7; font-size: 12px; }
h1, h2, h3, p { margin-top: 0; }
.intro h1 { margin: 13px 0 8px; font: 700 clamp(34px, 4vw, 43px)/1.15 Manrope, sans-serif; letter-spacing: -2.1px; }
.intro h1 span { color: var(--green); }
.intro p { margin: 0; color: #78847e; font-size: 14px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(370px, .92fr); gap: 30px; align-items: start; }
.section-heading { min-height: 57px; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.step-label { color: #8c9791; font-size: 9px; }
.section-heading h2 { margin: 5px 0 0; font: 700 18px Manrope, sans-serif; letter-spacing: -.45px; }
.month-field { display: grid; gap: 5px; color: #87918b; font-size: 10px; font-weight: 600; }
.month-field input { width: 142px; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 0 9px; color: var(--ink); font-size: 11px; outline: none; }
.month-field input:focus, .input-wrap:focus-within { border-color: #78a991; box-shadow: 0 0 0 3px rgba(31, 115, 83, .08); }

.card { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 5px 20px rgba(35, 54, 44, .025); padding: 17px 18px 0; margin-bottom: 12px; }
.card-heading { min-height: 38px; display: flex; align-items: center; gap: 11px; margin-bottom: 17px; }
.meter-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.meter-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.main-icon { color: #547a90; background: #eff4f6; }
.shop-icon { color: var(--green); background: #edf5ef; }
.card-heading h3 { margin: 0 0 3px; font: 700 12px Manrope, sans-serif; }
.card-heading p { margin: 0; color: #89948e; font-size: 10px; }
.required-tag { margin-left: auto; border: 1px solid #e5eae5; border-radius: 4px; padding: 4px 6px; color: #8a948e; font-size: 8px; font-weight: 700; letter-spacing: .5px; }
.reading-grid { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); align-items: end; gap: 8px; }
.input-field { display: grid; gap: 7px; min-width: 0; }
.input-field > span { color: #79847e; font-size: 10px; font-weight: 600; }
.meter-card > .reading-grid { padding-bottom: 17px; }
.meter-card > .reading-grid:has(#mainUnits) { grid-template-columns: minmax(0, 1fr); }
.input-wrap { min-width: 0; height: 38px; display: flex; align-items: center; border: 1px solid #e8ece7; border-radius: 7px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.input-wrap input { min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; background: transparent; padding: 0 10px; color: var(--ink); font-size: 12px; font-weight: 600; }
.input-wrap input::placeholder { color: #b4bdb7; font-size: 11px; font-weight: 400; }
.input-wrap input::-webkit-inner-spin-button, .input-wrap input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.input-wrap input[type=number] { appearance: textfield; }
.input-wrap > span { flex: 0 0 auto; padding: 0 9px 0 3px; color: #a1aaa4; font-size: 9px; }
.reading-arrow { align-self: center; justify-self: center; margin-top: 22px; color: #adb7b1; font-size: 13px; }
.meter-result { height: 39px; display: flex; align-items: center; justify-content: space-between; margin-top: 14px; border-top: 1px solid #f0f2ef; color: #87928c; font-size: 10px; }
.meter-result strong { color: #51625a; font-size: 11px; }
.meter-result small { color: #97a19b; font-size: 9px; font-weight: 500; }

.bill-field { margin-top: 19px; }
.bill-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bill-label > span { color: #a1aaa4; font-size: 9px; font-weight: 400; }
.bill-input { height: 46px; }
.bill-input .currency-symbol { padding: 0 0 0 12px; color: var(--green); font-size: 15px; font-weight: 700; }
.bill-input input { padding-left: 9px; font: 700 17px Manrope, sans-serif; }
.bill-input input::placeholder { font: 500 15px Manrope, sans-serif; }
.bill-input .currency-code { border-left: 1px solid #edf0ed; padding-left: 11px; padding-right: 12px; color: #97a19b; font-size: 9px; font-weight: 600; letter-spacing: .6px; }
.form-error { min-height: 15px; margin: 6px 0 2px; color: #bd5149; font-size: 10px; }
.action-row { display: flex; gap: 9px; margin-top: 5px; }
.button { height: 43px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 0 13px; cursor: pointer; font-size: 11px; font-weight: 700; transition: background .15s, transform .15s, box-shadow .15s; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button-secondary { border-color: #e4e9e3; background: white; color: #51615a; }
.button-secondary:hover { background: #f9fbf9; }
.button-primary { flex: 1; background: var(--green); color: white; box-shadow: 0 5px 13px rgba(25, 115, 85, .13); }
.button-primary:hover:not(:disabled) { background: var(--green-dark); }
.button:disabled { cursor: not-allowed; opacity: .48; box-shadow: none; }
.jpg-tag { border-radius: 4px; padding: 3px 5px; background: rgba(255,255,255,.17); color: white; font-size: 8px; letter-spacing: .5px; }
.draft-status { min-height: 16px; margin: 7px 0 0; color: #87928c; font-size: 9px; }
.draft-status.error { color: #bd5149; }

.result-heading { margin-bottom: 14px; }
.result-card { overflow: hidden; border: 1px solid #e4eae4; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.result-card-top { display: flex; align-items: center; justify-content: space-between; padding: 17px 19px 13px; }
.result-month-label { display: block; margin-bottom: 5px; color: #98a29c; font-size: 8px; letter-spacing: .9px; }
.result-card-top > div > strong { font: 700 12px Manrope, sans-serif; }
.result-status { display: inline-flex; align-items: center; gap: 6px; color: #a0aaa4; font-size: 8px; font-weight: 700; letter-spacing: .5px; }
.result-status span { width: 6px; height: 6px; border-radius: 50%; background: #c6ceca; }
.result-status.ready { color: var(--green); }
.result-status.ready span { background: #4d9b72; box-shadow: 0 0 0 3px #e8f2eb; }
.bill-total { display: flex; justify-content: space-between; align-items: center; padding: 13px 19px; background: #f7f9f6; border-top: 1px solid #eff2ee; border-bottom: 1px solid #eff2ee; }
.bill-total > span { color: #79847e; font-size: 11px; font-weight: 600; }
.bill-total strong { font: 700 20px Manrope, sans-serif; letter-spacing: -.7px; }
.share-list { padding: 5px 19px 0; }
.share-item { display: flex; align-items: center; gap: 10px; min-height: 56px; border-bottom: 1px solid #f0f2ef; }
.share-item:last-child { border-bottom: 0; }
.share-avatar { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 auto; border-radius: 9px; font: 700 11px Manrope, sans-serif; }
.avatar-you { color: var(--green); background: #eaf4ed; }
.avatar-other { color: #a9713e; background: #f8f1e9; }
.share-details { display: grid; gap: 3px; min-width: 0; }
.share-details strong { overflow: hidden; max-width: 180px; color: #3a4b43; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.share-details span { color: #929c96; font-size: 9px; }
.share-amount { display: grid; gap: 3px; justify-items: end; margin-left: auto; }
.share-amount strong { font: 700 13px Manrope, sans-serif; }
.share-amount span { color: #929c96; font-size: 9px; }
.usage-bar { display: flex; height: 6px; overflow: hidden; margin: 13px 19px 9px; border-radius: 9px; background: #eee; }
.usage-bar span:first-child { width: 50%; background: var(--green); transition: width .2s ease; }
.usage-bar span:last-child { flex: 1; background: var(--orange); }
.bar-legend { display: flex; justify-content: space-between; padding: 0 19px 15px; color: #89948e; font-size: 9px; }
.bar-legend span { display: flex; align-items: center; gap: 5px; }
.bar-legend i { width: 6px; height: 6px; border-radius: 2px; }
.legend-you { background: var(--green); }
.legend-other { background: var(--orange); }
.result-footnote { min-height: 35px; display: flex; align-items: center; padding: 7px 19px; border-top: 1px solid #eff2ee; background: #fafbf9; color: #87928c; font-size: 9px; line-height: 1.5; }
.result-footnote.warning { color: #ae673e; background: #fcf7f1; }

.formula-note { display: flex; gap: 11px; padding: 14px 15px; margin-top: 13px; border: 1px solid #e7ece6; border-radius: 10px; background: #f0f4ef; }
.formula-icon { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: #e1ebe2; color: var(--green); font: 700 16px Georgia, serif; }
.formula-note strong { display: block; margin: 1px 0 5px; font: 700 10px Manrope, sans-serif; }
.formula-note p { margin: 0; color: #77837c; font-size: 9px; line-height: 1.55; }

.history-section { margin-top: 24px; }
.history-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.history-heading h3 { margin: 0; font: 700 12px Manrope, sans-serif; }
.history-heading > span { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 6px; background: #e9eee8; color: #758179; font-size: 9px; font-weight: 700; }
.history-list { display: grid; gap: 6px; }
.empty-history { margin: 0; padding: 13px; border: 1px dashed #dce3dc; border-radius: 8px; color: #909a94; font-size: 10px; text-align: center; }
.history-item { min-width: 0; display: flex; align-items: stretch; gap: 4px; padding: 4px 5px 4px 11px; border: 1px solid #e7ece6; border-radius: 8px; background: #fff; }
.history-item:hover { border-color: #adc9b7; background: #fbfdfb; }
.history-load { min-width: 0; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 5px 6px 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.history-load > span { min-width: 0; display: grid; gap: 3px; }
.history-item strong { color: #42534b; font-size: 10px; }
.history-item small { color: #929c96; font-size: 9px; }
.history-item b { font: 700 11px Manrope, sans-serif; }
.history-item .history-share { text-align: right; }
.history-delete { width: 34px; height: 34px; flex: 0 0 auto; align-self: center; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #9a706b; cursor: pointer; }
.history-delete:hover { background: #faeeec; color: #af453d; }
.history-delete:focus-visible, .history-load:focus-visible { outline: 2px solid #6caa88; outline-offset: 2px; }
.history-delete svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.page-footer { display: flex; justify-content: space-between; gap: 16px; padding: 23px 0 30px; margin-top: 28px; border-top: 1px solid #e6e9e3; color: #929c96; font-size: 9px; }
.footer-dot { padding: 0 4px; color: #c1c9c3; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; padding: 11px 15px; border-radius: 8px; background: #203b30; color: white; font-size: 11px; box-shadow: 0 8px 24px rgba(23, 41, 34, .2); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 820px) {
  .app-shell { width: min(670px, calc(100% - 36px)); }
  .workspace { grid-template-columns: 1fr; gap: 34px; }
  .result-column { display: contents; }
  .result-heading, .result-card, .formula-note, .history-section { grid-column: 1; }
  .entry-column { display: contents; }
  .workspace { display: flex; flex-direction: column; }
  .entry-column { display: block; width: 100%; }
  .result-column { display: block; width: 100%; }
  .page-footer { margin-top: 34px; }
}

@media (max-width: 520px) {
  .app-shell { width: calc(100% - 30px); }
  .topbar { height: 66px; }
  .intro { padding: 34px 0 24px; }
  .intro h1 { font-size: 34px; }
  .intro p { max-width: 310px; font-size: 12px; line-height: 1.55; }
  .section-heading { align-items: flex-end; }
  .section-heading h2 { font-size: 16px; }
  .month-field input { width: 132px; }
  .card { padding: 15px 13px 0; }
  .reading-grid { gap: 5px; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); }
  .input-wrap input { padding: 0 8px; font-size: 11px; }
  .input-wrap > span { padding-right: 7px; font-size: 8px; }
  .reading-arrow { font-size: 11px; }
  .bill-label { align-items: flex-start; flex-direction: column; gap: 3px; }
  .action-row { flex-direction: column-reverse; }
  .button { width: 100%; }
  .result-card-top, .share-list { padding-right: 14px; padding-left: 14px; }
  .bill-total { padding-right: 14px; padding-left: 14px; }
  .usage-bar { margin-right: 14px; margin-left: 14px; }
  .bar-legend { padding-right: 14px; padding-left: 14px; }
  .result-footnote { padding-right: 14px; padding-left: 14px; }
  .result-status { font-size: 7px; }
  .page-footer { flex-direction: column; gap: 7px; font-size: 8px; }
}
