.lbs41Page {
  --green: #4d8d5b;
  --red: #c44747;
  --blue: #4b78a8;
  --line: #cfd6dd;
  --text: #1f2937;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: #f3f4f6;
  min-height: 100vh;
  margin: 0;
  padding: 14px;
}

.lbs41Shell {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  background: #ffffff;
  border: 1px solid #d8dde3;
  border-radius: 8px;
  padding: 10px;
  isolation: isolate;
}

/* The Lemonade Game logo — faint center watermark */
.lbs41Watermark {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(560px, 82vw);
  height: min(400px, 52vh);
  max-width: 95%;
  background: url("../../images/logo.png") no-repeat center center;
  background-size: contain;
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

.lbs41Shell > .lbs41Toolbar,
.lbs41Shell > .lbs41Top,
.lbs41Shell > .lbs41Creator,
.lbs41Shell > .lbs41Equation {
  position: relative;
  z-index: 2;
}

.lbs41TopBalanceIcon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2px 0 8px;
}

.lbs41TopBalanceIcon img {
  width: 88px;
  height: auto;
  display: block;
}

.lbs41Toolbar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  perspective: 1000px;
  perspective-origin: 60% 40%;
  row-gap: 8px;
}

.lbs41ToggleBtn {
  border: 1px solid #b9c3cd;
  background: #eef2f6;
  color: #1f2937;
  border-radius: 6px;
  font: 700 12px/1 Arial, Helvetica, sans-serif;
  padding: 7px 10px;
  cursor: pointer;
  position: relative;
  z-index: 11;
  transform-style: preserve-3d;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.15s ease,
    border-color 0.15s ease;
  box-shadow:
    0 3px 0 rgba(15, 23, 42, 0.14),
    0 10px 18px rgba(15, 23, 42, 0.1);
}

.lbs41ToggleBtn:hover {
  background: #e4eaf1;
  transform: translateY(-3px) translateZ(14px) rotateX(6deg);
  box-shadow:
    0 5px 0 rgba(15, 23, 42, 0.16),
    0 16px 28px rgba(15, 23, 42, 0.16);
}

.lbs41ToggleBtn:active {
  transform: translateY(1px) translateZ(4px) rotateX(3deg);
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.22),
    0 6px 12px rgba(15, 23, 42, 0.12);
}

.lbs41ToggleBtn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
  z-index: 12;
}

.lbs41BtnDetail {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
}

.lbs41BtnDetail:hover {
  background: #bfdbfe;
}

.lbs41BtnPreview {
  border-color: #a7f3d0;
  background: #d1fae5;
  color: #065f46;
}

.lbs41BtnPreview:hover {
  background: #a7f3d0;
}

.lbs41BtnSave {
  border-color: #fde68a;
  background: #fef3c7;
  color: #92400e;
}

.lbs41BtnSave:hover {
  background: #fde68a;
}

.lbs41BtnExample {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #ede9fe, #fee2e2);
  color: #6d28d9;
}

.lbs41BtnExample:hover {
  background: linear-gradient(135deg, #ddd6fe, #fecaca);
}

.lbs41SaveMsg {
  min-width: 150px;
  text-align: right;
  font: 700 11px/1.2 Arial, Helvetica, sans-serif;
  color: #334155;
}

.lbs41SaveMsg.ok {
  color: #166534;
}

.lbs41SaveMsg.warn {
  color: #92400e;
}

.lbs41SaveMsg.err {
  color: #b91c1c;
}

.lbs41ExampleModal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lbs41ExampleModal.show {
  display: flex;
}

.lbs41ExampleBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
}

.lbs41ExampleDialog {
  position: relative;
  width: min(1260px, 96vw);
  height: min(860px, 92vh);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.lbs41ExampleHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #111827;
  font-weight: 800;
  font-size: 18px;
}

.lbs41ExampleClose {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}

.lbs41ExampleBody {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #f8fafc;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.lbs41ExampleBody img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  background: #fff;
}

.lbs41Top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lbs41RightCol {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lbs41Panel {
  border: 1px solid #c9d0d7;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.lbs41PanelAssets {
  position: relative;
}

.lbs41Head.green {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lbs41HeadTitle {
  flex: 1 1 auto;
  min-width: 0;
}

.lbs41AssetsCornerLogo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.lbs41Head {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.1;
  padding: 7px 12px;
}

.lbs41Head.green {
  border-bottom: 2px solid white;
  background: #7bd11f;
}

.lbs41Head.red {
  border-bottom: 2px solid white;
  background: #ef4444;
}

.lbs41Body {
  padding: 6px 10px 8px;
}

.lbs41Top > .lbs41Panel .lbs41Body {

  background: #7bd11f;
}

.lbs41RightCol > .lbs41Panel .lbs41Body {
  background: #ef4444;
}

.lbs41Row {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) minmax(0, 2.15fr);
  gap: 6px;
  align-items: center;
  border-top: 1px solid #e3e7eb;
  padding: 5px 0;
}

.lbs41Row.lbs41RowWithSide {
  grid-template-columns: minmax(140px, 0.8fr) minmax(0, 1.85fr) minmax(120px, 0.7fr);
  gap: 6px;
}

.lbs41SideCell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.lbs41SideLabel {
  font-size: 12px;
  font-weight: 700;
  color: #1e3a8a;
}

.lbs41Row:first-child {
  border-top: 0;
}

.lbs41LabelMain {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}

.lbs41IamBtn{
  border:1px solid #93c5fd;
  background:#dbeafe;
  color:#1e3a8a;
  border-radius:6px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.2px;
  line-height:1;
  padding:7px 10px;
  cursor:pointer;
  box-shadow:
    0 3px 0 rgba(15, 23, 42, 0.14),
    0 10px 18px rgba(15, 23, 42, 0.1);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}
.lbs41IamBtn:hover{
  background:#bfdbfe;
  transform: translateY(-3px) translateZ(14px) rotateX(6deg);
  box-shadow:
    0 5px 0 rgba(15, 23, 42, 0.16),
    0 16px 28px rgba(15, 23, 42, 0.16);
}
.lbs41IamBtn:active{
  transform: translateY(1px) translateZ(4px) rotateX(3deg);
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.22),
    0 6px 12px rgba(15, 23, 42, 0.12);
}
.lbs41IamBtn:focus-visible{
  outline:2px solid #2563eb;
  outline-offset:3px;
}

.lbs41LabelSub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: #323a44;
  line-height: 1.2;
}

.lbs41Input,
.lbs41MiniInput {
  width: 87%;
  border: 1px solid #c8d0d8;
  border-radius: 6px;
  background: #f7f8fa;
  color: #111827;
  font: 600 12px/1.2 Arial, Helvetica, sans-serif;
  padding: 5px 8px;
}

.lbs41Input {
  min-height: 28px;
  resize: vertical;
  overflow: auto;
}

.lbs41MiniInput {
  min-height: 24px;
  padding: 4px 6px;
  resize: vertical;
  overflow: auto;
}

.lbs41Table {
  border-top: 1px solid #e3e7eb;
  margin-top: 5px;
  padding-top: 5px;
}

.lbs41TableTitle {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.lbs41TableGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.lbs41TableGridFear {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* .lbs41CellHead,
.lbs41CellInput {
  border-right: 1px solid #c8d0d8;
} */

.lbs41CellHead:last-child,
.lbs41CellInput:last-child {
  border-right: 0;
}

.lbs41CellHead {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f6f8;
  font-size: 11px;
  font-weight: 600;
}

.lbs41CellHeadSmall {
  font-size: 8px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  padding: 4px 3px;
  white-space: normal;
  hyphens: auto;
}

.lbs41CellInput {
  padding: 3px;
}

.lbs41CellInput .lbs41MiniInput {
  width: 91%;
}

.lbs41Equity {
  margin-top: 0;
  border: 1px solid #52525b;
  border-radius: 8px;
  overflow: hidden;
  background: #3f3f46;
}

.lbs41EquityHead {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  padding: 10px 14px;
  border-bottom: 2px solid white;
}

.lbs41EquityBody {
  background: #3f3f46;
  padding: 14px 14px 16px;
}

.lbs41Note {
  margin: 0 0 6px;
  font-size: 12px;
  color: #1f2937;
}

/* GOALS & EQUITY — dark panel (match worksheet reference) */
.lbs41Equity .lbs41Note {
  color: #fff;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
}

.lbs41Equity .lbs41Note:first-of-type {
  font-weight: 700;
  margin-bottom: 4px;
}

.lbs41Equity .lbs41EquityNoteSub {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.95;
  margin: 0 0 12px;
}

.lbs41FootRow {
  display: grid;
  grid-template-columns: minmax(170px, 0.95fr) minmax(0, 2.05fr);
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.lbs41Equity .lbs41FootRow:first-of-type {
  margin-top: 2px;
}

.lbs41FootLabel {
  font-size: 13px;
  font-weight: 600;
}

.lbs41Equity .lbs41FootLabel {
  color: #fff;
  font-weight: 700;
}

.lbs41Equity textarea.lbs41Input {
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  color: #111827;
  font-weight: 600;
  padding: 8px 10px;
  min-height: 56px;
  resize: vertical;
}

.lbs41Equity textarea.lbs41Input:focus-visible {
  outline: 2px solid #a1a1aa;
  outline-offset: 2px;
  border-color: #a1a1aa;
}

.lbs41Equation {
  margin-top: 12px;
  border-top: 5px solid #4d8d5b;
  border-bottom: 5px solid #4f73a4;
  text-align: center;
  padding: 6px 8px;
  font-size: 24px;
  font-weight: 800;
}

.lbs41Equation .g {
  color: #3d874f;
}

.lbs41Equation .r {
  color: #c44747;
}

/* Creator credit — bottom right */
.lbs41Creator {
  margin-top: 10px;
  margin-bottom: 8px;
  text-align: right;
  max-width: 100%;
  line-height: 1.35;
  font-size: 12px;
  color: #111827;
}

.lbs41CreatorLine1 {
  margin-bottom: 2px;
}

.lbs41CreatorScript {
  font-family: "Segoe Script", "Brush Script MT", "Apple Chancery", cursive;
  font-size: 13px;
  font-weight: 400;
  color: #6b7280;
  margin-right: 4px;
}

.lbs41CreatorName {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: 12px;
  color: #111827;
}

.lbs41CreatorEmail {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  color: #111827;
}

.lbs41CreatorPhone {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  color: #111827;
}

.lbs41CreatorPhoneNum {
  font-weight: 800;
  color: #1d4ed8;
  text-decoration: none;
}

.lbs41CreatorPhoneNum:hover {
  text-decoration: underline;
}

.lbs41Page.lbs41DetailMode .lbs41Input {
  min-height: 92px;
}

.lbs41Page.lbs41DetailMode .lbs41MiniInput {
  min-height: 92px;
}

@media (max-width: 1100px) {
  .lbs41Head,
  .lbs41LabelMain,
  .lbs41TableTitle,
  .lbs41EquityHead,
  .lbs41FootLabel,
  .lbs41Equation {
    font-size: 16px;
  }

  .lbs41LabelSub {
    font-size: 10px;
  }
}

@media (max-width: 840px) {
  .lbs41Page {
    padding: 8px;
  }

  .lbs41Shell {
    padding: 8px;
  }

  .lbs41Toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .lbs41ToggleBtn {
    padding: 7px 9px;
    font-size: 12px;
  }

  .lbs41SaveMsg {
    min-width: 0;
    width: 100%;
    text-align: left;
    margin-top: 2px;
  }

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

  .lbs41Row,
  .lbs41FootRow {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .lbs41Row.lbs41RowWithSide {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lbs41SideCell {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .lbs41Input,
  .lbs41MiniInput,
  .lbs41CellInput .lbs41MiniInput {
    width: 100%;
    box-sizing: border-box;
  }

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

  .lbs41CellHead,
  .lbs41CellInput {
    border: 1px solid #d8dee5;
    border-right: 1px solid #d8dee5;
    border-radius: 4px;
  }

  .lbs41CellHead:last-child,
  .lbs41CellInput:last-child {
    border-right: 1px solid #d8dee5;
  }

  .lbs41ExampleModal {
    padding: 0;
  }

  .lbs41ExampleDialog {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .lbs41ExampleHead {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 10px;
    font-size: 16px;
  }

  .lbs41ExampleBody {
    padding: 8px;
  }

  .lbs41Equation {
    font-size: 18px;
    line-height: 1.2;
  }
}

@media (max-width: 480px) {
  .lbs41ExampleHead {
    font-size: 15px;
  }

  .lbs41ExampleClose {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 14px;
  }

  .lbs41ExampleBody {
    padding: 6px;
  }

  .lbs41ToggleBtn {
    font-size: 11px;
    padding: 6px 8px;
  }

  .lbs41Head,
  .lbs41EquityHead {
    font-size: 16px;
  }

  .lbs41LabelMain {
    font-size: 12px;
  }

  .lbs41LabelSub {
    font-size: 10px;
  }

  .lbs41Equation {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lbs41Toolbar {
    perspective: none;
  }

  .lbs41ToggleBtn {
    transform: none !important;
    transition: none !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
  }

  .lbs41ToggleBtn:hover,
  .lbs41ToggleBtn:active {
    transform: none !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
  }
}
