:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-strong: #eef5f2;
  --text: #13201c;
  --muted: #61706b;
  --line: #d9e3df;
  --teal: #18745f;
  --blue: #315f9b;
  --amber: #a45f14;
  --red: #a33a32;
  --shadow: 0 10px 30px rgba(26, 45, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

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

.plan-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  z-index: 3;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.plan-topbar nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.plan-topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
}

.plan-topbar nav a[aria-current="page"] {
  color: var(--teal);
}

.login-band,
.locked-band {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-panel,
.locked-band {
  width: min(440px, 100%);
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-panel h1,
.locked-band h1 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  padding: 0 16px;
  cursor: pointer;
}

.button.secondary {
  background: var(--surface-strong);
  color: var(--text);
}

.login-panel button {
  width: 100%;
  margin-top: 16px;
}

.status {
  min-height: 22px;
  color: var(--red);
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.summary-band,
.control-band,
.content-grid {
  padding-inline: clamp(18px, 4vw, 44px);
}

.summary-band {
  padding-top: 30px;
}

.summary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 0 0 7px;
}

.summary-heading h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  margin: 0;
  max-width: 760px;
}

.summary-heading p:not(.eyebrow) {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 760px;
}

.billing-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  margin-top: 26px;
}

.status-strip div {
  background: var(--surface);
  padding: 16px;
  min-width: 0;
}

.status-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.status-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.control-band {
  margin-top: 22px;
}

.scenario-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 0.7fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 44px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel.wide {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.12rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.88rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.product-tile,
.addon-row,
.timeline-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.product-tile h3,
.addon-row h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 900;
  background: var(--surface-strong);
  color: var(--teal);
}

.pill.locked {
  color: var(--amber);
  background: #fff4e5;
}

.pill.readonly {
  color: var(--blue);
  background: #eef4ff;
}

.product-meta,
.addon-meta,
.timeline-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.tile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tile-actions .button {
  min-height: 34px;
  font-size: 0.86rem;
  padding-inline: 10px;
}

.usage-list,
.addon-list,
.timeline,
.measures-focus {
  display: grid;
  gap: 10px;
}

.usage-row {
  display: grid;
  gap: 7px;
}

.usage-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}

.usage-line span:last-child {
  color: var(--muted);
  text-align: right;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--teal);
}

.meter.warning span {
  background: var(--amber);
}

.meter.limit_reached span {
  background: var(--red);
}

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

.metric-box {
  background: var(--surface-strong);
  border-radius: 8px;
  padding: 12px;
}

.metric-box span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
}

.metric-box strong {
  display: block;
  font-size: 1.25rem;
  margin-top: 3px;
}

.timeline-row {
  display: grid;
  gap: 2px;
}

.timeline-row time {
  color: var(--muted);
  font-size: 0.8rem;
}

.billing-portal-panel {
  box-shadow: none;
}

.billing-portal {
  min-height: 120px;
}

.portal-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.6fr) minmax(280px, 1fr) minmax(220px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.portal-state,
.portal-copy,
.portal-actions {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.portal-state {
  border-left: 4px solid var(--blue);
}

.portal-state.success {
  border-left-color: var(--teal);
}

.portal-state.warning {
  border-left-color: var(--amber);
}

.portal-state.danger,
.portal-state.restricted {
  border-left-color: var(--red);
}

.portal-state strong,
.portal-copy h3 {
  display: block;
  margin: 0 0 8px;
}

.portal-state p,
.portal-copy p,
.portal-result {
  color: var(--muted);
  margin: 0;
}

.portal-note {
  font-size: 0.9rem;
  margin-top: 10px !important;
}

.portal-actions {
  list-style: none;
  margin: 0;
  display: grid;
  gap: 8px;
}

.portal-actions li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.portal-actions li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.portal-actions strong {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.portal-result {
  min-height: 22px;
  margin-top: 12px;
}

.portal-result a {
  color: var(--teal);
  font-weight: 800;
}

button:disabled,
.button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 980px) {
  .status-strip,
  .product-grid,
  .content-grid,
  .scenario-controls,
  .portal-layout {
    grid-template-columns: 1fr;
  }

  .summary-heading {
    display: grid;
  }

  .billing-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .plan-topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-heading h1 {
    font-size: 2rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
