:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --ink: #17211e;
  --muted: #65726d;
  --line: #dbe4df;
  --green: #159a73;
  --green-dark: #08785a;
  --yellow: #f7c948;
  --danger: #b95024;
  --shadow: 0 24px 70px rgba(18, 38, 32, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(21, 154, 115, 0.18), transparent 32rem),
    linear-gradient(145deg, #f9fbfa, var(--bg));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-panel {
  width: min(100%, 28rem);
  padding: 2.25rem;
  border: 1px solid rgba(219, 228, 223, 0.9);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  border-radius: 0.5rem;
  color: #ffffff;
  background: linear-gradient(135deg, var(--green), #0e6f73);
  font-weight: 800;
}

.brand-mark.small {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.85rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

h3 {
  margin-bottom: 0.55rem;
  font-size: 1.2rem;
}

.login-copy,
.section-heading p,
.chart-empty p {
  color: var(--muted);
}

.stacked-form,
.tool-panel {
  display: grid;
  gap: 1rem;
}

label,
fieldset {
  display: grid;
  gap: 0.45rem;
  color: #2f3c38;
  font-size: 0.92rem;
  font-weight: 650;
}

fieldset {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
}

legend {
  padding: 0 0.25rem;
}

input,
select {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  padding: 0.72rem 0.85rem;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(21, 154, 115, 0.12);
}

.input-unit {
  position: relative;
}

.input-unit input {
  padding-right: 4rem;
}

.input-unit span {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  color: var(--muted);
  transform: translateY(-50%);
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
}

.choice-row input {
  width: 1rem;
  min-height: 1rem;
}

.checkbox-row {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #fbfdfc;
}

.primary-button,
.ghost-button,
.nav-button {
  min-height: 2.85rem;
  border: 0;
  border-radius: 0.45rem;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(21, 154, 115, 0.22);
}

.primary-button:hover {
  background: var(--green-dark);
}

.ghost-button {
  color: var(--ink);
  background: #eef5f1;
}

.form-message {
  min-height: 1.3rem;
  margin: 0;
  color: var(--danger);
  font-weight: 650;
}

.app-shell {
  min-height: 100vh;
}

.menu-toggle {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  gap: 0.22rem;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(18, 38, 32, 0.12);
  cursor: pointer;
}

.menu-toggle span {
  width: 1.05rem;
  height: 0.13rem;
  border-radius: 1rem;
  background: var(--ink);
}

.side-panel {
  position: fixed;
  z-index: 15;
  inset: 0 auto 0 0;
  width: min(82vw, 18rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5rem 1rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}

.side-panel.open {
  transform: translateX(0);
}

.panel-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.panel-brand span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.panel-nav {
  display: grid;
  gap: 0.55rem;
}

.nav-button {
  padding: 0 1rem;
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.nav-button.active,
.nav-button:hover {
  color: var(--green-dark);
  background: #e9f6f1;
}

.workspace {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 5.5rem 0 2rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.user-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 99rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 700;
}

.badge {
  color: #795c00;
  background: #fff7d7;
  border-color: #f4df8b;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(18rem, 1.1fr);
  gap: 1rem;
}

.tool-grid.wide {
  grid-template-columns: minmax(18rem, 0.78fr) minmax(22rem, 1.22fr);
}

.tool-panel,
.result-panel,
.chart-panel {
  border: 1px solid rgba(219, 228, 223, 0.9);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 44px rgba(18, 38, 32, 0.08);
}

.tool-panel {
  padding: 1.25rem;
}

.result-panel,
.chart-panel {
  min-height: 25rem;
  padding: 1.4rem;
}

.result-panel.empty {
  display: grid;
  align-content: center;
}

.result-panel h3 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.result-address {
  color: var(--muted);
}

.result-list {
  display: grid;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.result-list.compact {
  gap: 0.4rem;
  margin-top: 0;
}

.result-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.finance-box {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #d4ebe2;
  border-radius: 0.45rem;
  background: #f2fbf7;
}

.finance-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.finance-grid div {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border-radius: 0.4rem;
  background: #ffffff;
}

.finance-grid span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.finance-grid strong {
  font-size: 1.25rem;
}

.success-note,
.warning-note {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 0.45rem;
  font-weight: 700;
}

.success-note {
  color: #0f654e;
  background: #e4f7ef;
}

.warning-note {
  color: var(--danger);
  background: #fff0e8;
}

.chart-panel {
  position: relative;
}

.chart-empty,
.loading-state {
  min-height: 22rem;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.spinner {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border: 0.35rem solid #d9ebe4;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.chart-content {
  height: 26rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.brand-logo {
  width: 4.5rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--green-dark);
  background: #ffffff;
  font-weight: 850;
}

.brand-logo img {
  max-width: 3.7rem;
  max-height: 2.25rem;
  object-fit: contain;
}

#productionChart {
  height: 21rem !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .tool-grid,
  .tool-grid.wide {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading {
    display: grid;
  }

  .user-pill {
    justify-self: start;
  }
}
