:root {
  --background: #F7F9F4;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #FFFFFF;
  --brand: #8FD42E;
  --brand-dark: #5F9417;
  --brand-soft: #EAF8D8;
  --lab: #F87171;
  --lab-dark: #D84646;
  --lab-soft: #FEE2E2;
  --ink: #050505;
  --muted: rgba(5, 5, 5, 0.58);
  --line: rgba(5, 5, 5, 0.1);
  --shadow: 0 28px 70px rgba(5, 5, 5, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--background) 44%, #FFFFFF 100%);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1160px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px 18px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 20px;
}

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

.brand-lockup img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header h1,
.panel-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(1.55rem, 3.8vw, 2.55rem);
  line-height: 1;
  font-weight: 860;
}

.header-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
  gap: 14px;
}

.workspace-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78), 0 18px 44px rgba(5, 5, 5, 0.09);
  backdrop-filter: blur(18px) saturate(1.1);
}

.workspace-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(143, 212, 46, 0.12), rgba(248, 113, 113, 0.08) 42%, transparent 68%);
  opacity: 0.72;
}

.secondary-panel {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 16px 42px rgba(5, 5, 5, 0.08);
}

.secondary-panel::before {
  opacity: 0.34;
}

.menu-panel textarea {
  min-height: 154px;
}

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

.panel-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-title h2 {
  font-size: 1.18rem;
  font-weight: 820;
}

.panel-title p,
.field,
.signal-row,
.signal-card small,
.toggle-row small {
  color: var(--muted);
}

.panel-title p {
  margin: 5px 0 0;
  line-height: 1.35;
}

.field {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 750;
}

.field.compact {
  max-width: 520px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(5, 5, 5, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 264px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(143, 212, 46, 0.72);
  box-shadow: 0 0 0 5px rgba(143, 212, 46, 0.18);
}

.primary-action,
.secondary-action,
.icon-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 999px;
  font-weight: 820;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action {
  padding: 0 17px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #050505;
  box-shadow: 0 14px 28px rgba(95, 148, 23, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.primary-action:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #A5EA44 0%, var(--brand-dark) 100%);
  box-shadow: 0 18px 34px rgba(95, 148, 23, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.full-action {
  width: 100%;
}

.secondary-action,
.icon-button {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(5, 5, 5, 0.08), 0 10px 22px rgba(5, 5, 5, 0.07);
}

.secondary-action:hover,
.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(5, 5, 5, 0.1), 0 14px 26px rgba(5, 5, 5, 0.1);
}

.secondary-action {
  padding: 0 14px;
}

.secondary-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(5, 5, 5, 0.08), 0 10px 22px rgba(5, 5, 5, 0.07);
  font-weight: 820;
  text-decoration: none;
}

.icon-button {
  width: 46px;
  flex: 0 0 46px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.signal-stack {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.signal-row,
.signal-card,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.signal-card {
  justify-content: flex-start;
  padding: 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(5, 5, 5, 0.08);
  box-shadow: 0 10px 24px rgba(5, 5, 5, 0.05);
}

.signal-card span,
.signal-card small,
.toggle-row span,
.toggle-row small {
  display: block;
}

.signal-card span,
.toggle-row span {
  color: var(--ink);
  font-weight: 800;
}

.toggle-row {
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.toggle-row input {
  position: relative;
  appearance: none;
  width: 52px;
  height: 28px;
  min-height: auto;
  flex: 0 0 52px;
  border: 0;
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.16);
  box-shadow: inset 0 0 0 1px rgba(5, 5, 5, 0.08);
  transition: background 160ms ease;
}

.toggle-row input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 10px rgba(5, 5, 5, 0.22);
  transition: transform 160ms ease;
}

.toggle-row input:checked {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.toggle-row input:checked::after {
  transform: translateX(24px);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--brand);
}

.menu-output {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border: 1px dashed rgba(5, 5, 5, 0.2);
}

.menu-card,
.promo-card,
.agent-card,
.offer-box,
.offer-preview-card {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(5, 5, 5, 0.08);
}

.menu-card {
  padding: 15px;
  box-shadow: 0 12px 28px rgba(5, 5, 5, 0.06);
}

.menu-card h3 {
  margin: 0 0 10px;
  color: var(--brand-dark);
  font-size: 1rem;
}

.menu-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.menu-item:first-of-type {
  border-top: 0;
}

.menu-item strong,
.promo-card strong {
  overflow-wrap: anywhere;
}

.menu-item span,
.promo-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--brand-dark);
  font-weight: 800;
}

.promo-form {
  position: relative;
  z-index: 1;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.promo-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 178px;
  overflow-y: auto;
  padding-right: 4px;
}

.capability-list {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.capability-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(5, 5, 5, 0.08);
  box-shadow: 0 12px 28px rgba(5, 5, 5, 0.05);
}

.capability-card span {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 860;
}

.capability-card.pending span {
  background: var(--lab-soft);
  color: var(--lab-dark);
}

.capability-card strong {
  font-size: 0.9rem;
}

.capability-card small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.score-summary {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.score-summary strong {
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.score-summary span {
  color: var(--brand-dark);
  font-weight: 860;
}

.score-bar {
  position: relative;
  z-index: 1;
  height: 12px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.09);
}

.score-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lab), var(--brand));
  transition: width 220ms ease;
}

.score-details {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.score-details span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.promo-card {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
}

.promo-card span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.promo-card button {
  justify-self: end;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--lab-soft);
  color: var(--lab-dark);
}

.agent-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.agent-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  box-shadow: 0 12px 28px rgba(5, 5, 5, 0.06);
}

.agent-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-card-header strong,
.agent-card-header span {
  display: block;
}

.agent-card-header span,
.offer-box span,
.offer-box small {
  color: var(--muted);
  line-height: 1.35;
}

.distance-pill {
  display: inline-flex !important;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--lab-soft);
  color: var(--lab-dark) !important;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.preference-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preference-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.offer-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(234, 248, 216, 0.48));
}

.offer-preview {
  position: relative;
  z-index: 1;
}

.negotiation-result {
  position: relative;
  z-index: 1;
}

.offer-preview-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.offer-preview-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.offer-preview-card small {
  color: var(--muted);
  line-height: 1.35;
}

.offer-price-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.offer-price-row strong {
  color: var(--brand-dark);
}

.negotiation-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(5, 5, 5, 0.08);
  box-shadow: 0 12px 28px rgba(5, 5, 5, 0.06);
}

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

.negotiation-details div,
.retailer-public-message,
.next-step-box {
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(247, 249, 244, 0.78);
  border: 1px solid rgba(5, 5, 5, 0.08);
}

.negotiation-details dt,
.retailer-public-message span,
.next-step-box span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

.negotiation-details dd,
.retailer-public-message p {
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
}

.negotiation-details dd,
.next-step-box strong {
  font-weight: 780;
}

.next-step-box {
  background: var(--brand-soft);
  border-color: rgba(95, 148, 23, 0.2);
}

.next-step-box strong {
  color: var(--brand-dark);
  line-height: 1.35;
}

.app-footer {
  padding: 18px 0 0;
  color: rgba(5, 5, 5, 0.48);
  font-size: 0.72rem;
  text-align: center;
}

.app-footer a {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--ink);
  color: #FFFFFF;
  box-shadow: var(--shadow);
  font-weight: 750;
}

@media (max-width: 820px) {
  .app-header,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

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

  .brand-lockup img {
    width: 42px;
    height: 42px;
  }

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

  .two-fields {
    grid-template-columns: 1fr;
  }

  .capability-list {
    grid-template-columns: 1fr;
  }

  .negotiation-details {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 220px;
  }
}
