:root {
  color-scheme: light;
  --bg: #eef3f2;
  --bg-deep: #162724;
  --panel: #ffffff;
  --panel-soft: #f7faf9;
  --ink: #13211e;
  --muted: #66736f;
  --line: #dce6e2;
  --accent: #26a06f;
  --accent-strong: #16845c;
  --accent-soft: #e3f6ee;
  --danger: #bd3f46;
  --danger-soft: #fde9e6;
  --warning: #9a6a17;
  --warning-soft: #fff3d4;
  --shadow: 0 18px 42px rgba(19, 33, 30, 0.1);
  --shadow-soft: 0 8px 22px rgba(19, 33, 30, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ddebe6 0, rgba(238, 243, 242, 0) 240px),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 14px 14px 28px;
}

.hero-panel {
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(38, 160, 111, 0.24), rgba(255, 255, 255, 0) 48%),
    var(--bg-deep);
  color: #ffffff;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel .eyebrow {
  color: #a9ecd2;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.08;
}

h2 {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.18;
}

.hero-copy {
  display: grid;
  gap: 4px;
  margin: 18px 0 14px;
}

.hero-copy p {
  color: #c8d8d4;
  font-size: 13px;
}

.hero-copy strong {
  max-width: 620px;
  font-size: 24px;
  line-height: 1.12;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
}

.icon-button:disabled {
  opacity: 0.55;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.tab {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #dce9e5;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.tab.active {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.notice {
  display: grid;
  gap: 4px;
  border: 1px solid #ead18b;
  border-radius: 8px;
  background: var(--warning-soft);
  color: #61430d;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.notice[hidden] {
  display: none;
}

.notice span {
  font-size: 13px;
  line-height: 1.35;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric,
.product-card,
.empty-state,
.insight,
.form-panel,
.pulse-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 15px;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 14px 0 14px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.metric.danger {
  background: var(--danger-soft);
}

.metric.danger::after {
  background: var(--danger);
}

.metric span,
.product-metrics span,
.insight span,
label span,
.cost-row span,
.pulse-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.pulse-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.pulse-panel strong {
  display: block;
  margin-top: 5px;
  line-height: 1.25;
}

.secondary-button,
.primary-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 14px;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: var(--accent-strong);
  color: #ffffff;
}

.insight {
  padding: 14px;
}

.insight strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
  line-height: 1.12;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.segmented {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.segmented.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-card {
  padding: 14px;
}

.product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.product-id {
  color: var(--muted);
  font-size: 12px;
}

.status {
  min-height: 27px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status.forecast {
  background: var(--warning-soft);
  color: var(--warning);
}

.product-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.product-metrics div {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 9px;
}

.product-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
  line-height: 1.12;
}

.negative {
  color: var(--danger);
}

.drivers {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.driver {
  border-radius: 8px;
  background: #edf3f1;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
}

.form-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.form-head {
  display: grid;
  gap: 3px;
  padding-bottom: 2px;
}

label {
  display: grid;
  gap: 7px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

label small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cost-editor {
  display: grid;
  gap: 9px;
}

.cost-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(130px, 180px) minmax(130px, 180px);
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.cost-row strong {
  display: block;
  margin-bottom: 4px;
}

.empty-state {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    padding: 10px 10px 92px;
  }

  .hero-panel {
    padding: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .hero-copy strong {
    font-size: 21px;
  }

  .summary-grid,
  .insights-grid,
  .field-grid,
  .cost-row {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    gap: 8px;
  }

  .metric {
    min-height: 102px;
  }

  .pulse-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .tabbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    background: rgba(19, 33, 30, 0.88);
    padding: 6px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
  }

  .tab {
    min-height: 42px;
    border-color: transparent;
    background: transparent;
    color: #dce9e5;
    font-size: 11px;
  }

  .tab.active {
    background: #ffffff;
    color: var(--ink);
  }

  .product-head {
    align-items: flex-start;
  }

  .product-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .hero-copy strong {
    font-size: 19px;
  }

  .metric strong {
    font-size: 23px;
  }
}
