/* Prop ledger (stage P4). Built from the v12 parts that already exist: the quiet
   windows and the tabs under them (css/components/desk.css), the tiles, the sheet
   forms of the New trade form (.jf-*, css/components/form.css). Only what none of
   them has is here. All classes are lg-*. */

.lg-view {
  gap: 14px;
}

/* ---- The desk (2026-10-26: the summary screens' pattern, as Analytics) ----
   The period and the two actions on top; the screen's name, its one line, the
   period's net result and four figures on the left; the net per month on the
   right. */
.vdesk.lg-desk {
  min-height: 0;
}

.lg-desk__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.lg-desk__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lg-desk__main {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 24px 56px;
  margin-top: 28px;
  align-items: start;
}

.lg-desk__lead {
  min-width: 0;
}

.lg-desk__title {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.lg-desk__sub {
  margin: 6px 0 0;
  max-width: 40ch;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}

.lg-lead-fig {
  margin-top: 24px;
}

.lg-lead-fig .vlead__figure.text-profit {
  color: var(--color-profit);
}

.lg-lead-fig .vlead__figure.text-loss {
  color: var(--color-loss);
}

.lg-figs {
  margin-top: 24px;
}

.lg-desk__chart {
  position: relative;
  min-width: 0;
  height: 240px;
}

@container vdesk (max-width: 900px) {
  .lg-desk__main {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .lg-desk__sub {
    max-width: none;
  }
}

/* Phone: the period row on its own line, the actions under it, a size down. */
@container vdesk (max-width: 640px) {
  .lg-desk__status {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .lg-desk__actions .btn {
    flex: 1 1 0;
    min-height: 44px;
  }

  .lg-desk__title {
    font-size: 20px;
  }

  .lg-desk__sub {
    margin-top: 2px;
    font-size: 12px;
  }

  .lg-desk__main {
    margin-top: 12px;
    gap: 14px;
  }

  .lg-lead-fig,
  .lg-figs {
    margin-top: 12px;
  }

  .lg-desk__chart {
    height: 160px;
  }
}

/* The phone's top bar already carries the screen's name (as on an account's page). */
@media (max-width: 880px) {
  .lg-desk__title {
    display: none;
  }

  .lg-desk__sub {
    margin-top: 0;
  }
}

/* ---- The prop panel (TJ.PropRules) ----
   One block per running prop account: its name and the rules button, then
   four cells - floor, room, best day, target - in a row on a computer, two by
   two on a phone. Flat: no frame round a cell, a hairline between accounts. */
.lgp-acct + .lgp-acct {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lgp-acct__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lgp-acct__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
}

.lgp-cells {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 20px;
}

.lgp-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.lgp-cell__k {
  font-size: 13px;
  color: var(--text-2);
}

.lgp-cell__v {
  font-size: 20px;
  font-weight: var(--fw-value, 500);
  letter-spacing: -0.01em;
  color: var(--text-1);
  overflow-wrap: anywhere;
}

.lgp-cell__cap {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-2);
}

.lgp-bar {
  margin: 4px 0 2px;
}

.lgp-total {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lgp-total__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.lgp-total__row + .lgp-total__row {
  margin-top: 8px;
}

.lgp-note {
  margin-top: 14px;
  font-size: 12px;
}

.lgr-f[hidden] {
  display: none;
}

/* The rules sheet's floor: four kinds side by side (the form kit has two and three). */
.lg-form .jf-seg--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lg-form .jf-seg--4 .jf-seg__opt {
  padding: 6px 4px;
}

@container vwins (max-width: 760px) {
  .lgp-cells {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Nothing yet ---- */
.lg-empty {
  gap: 10px;
  max-width: 560px;
}

.lg-empty p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-2);
}

.lg-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.lg-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* A window with only its "nothing yet" sentence is not drawn (the view sets this). */
.lg-view .win.lg-win.is-empty {
  display: none;
}

.lg-view .win.lg-win,
.lg-view .win.lg-empty {
  border-radius: 22px;
  background: var(--window);
  box-shadow: var(--window-edge);
}

.lg-view .win.lg-win {
  padding: 18px 20px;
}

.lg-view .win__title {
  font-size: 15px;
  font-weight: 600;
}

.lg-view .win__note {
  font-size: 13px;
  color: var(--text-2);
}

/* ---- Windows ---- */
.lg-win__aside {
  margin-left: auto;
}

.lg-none {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

.lg-muted {
  color: var(--text-2);
}

.lg-lead {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

.lg-wrow__l {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lg-wrow__v {
  flex: none;
  font-weight: 600;
}

.lg-cap::first-letter {
  text-transform: uppercase; /* the first letter of a sentence, not a label in capitals */
}

/* ---- Entries ---- */
.lg-month + .lg-month {
  margin-top: 14px;
}

.lg-month__h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 2px 4px 8px;
  font-size: 13px;
  color: var(--text-2);
}

.lg-month__h b {
  font-weight: 600;
  color: var(--text-1);
}

.lg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin-top: 6px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--jv-item, var(--tile));
  font: inherit;
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}

.lg-row:hover {
  background: var(--tile);
}

.lg-row:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
}

.lg-row__main,
.lg-row__end {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lg-row__main {
  flex: 1 1 auto;
}

.lg-row__end {
  flex: none;
  align-items: flex-end;
}

.lg-row b {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.lg-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
}

.lg-sub__note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.lg-row__end .lg-sub {
  justify-content: flex-end;
}

/* ---- Accounts ---- */
.lg-acct {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.lg-acct:first-child {
  border-top: 0;
  padding-top: 2px;
}

.lg-acct__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lg-acct__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 500;
}

/* The row's one control: the round menu button of the chart window (account.css .ac-menu), its popover a list. */
.lg-acct__menu {
  flex: none;
}

.lg-acct__menu.is-open {
  z-index: 5;
}

.lg-menu {
  align-items: stretch;
  gap: 2px;
  min-width: 180px;
  padding: 6px;
}

/* Opened upwards: no room under the row (the view sets it). */
.lg-menu.is-up {
  top: auto;
  bottom: calc(100% + 8px);
}

.lg-desk__chart[hidden] {
  display: none;
}

.lg-menu__item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: var(--fs-body);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}

.lg-menu__item:hover {
  background: var(--tile);
}

.lg-menu__item:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: -2px;
}

.lg-acct.is-blown .acct-tag {
  opacity: 0.75;
}

/* ---- The forms ---- */
.lg-form .lg-lead {
  margin: 0 4px 2px;
}

.lg-form .jf-msg--error {
  margin: 0 4px;
}

.lg-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lg-block__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 4px;
}

.lg-skips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lg-skips:empty {
  display: none;
}

.lg-skip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 12px;
  border-radius: 999px;
  background: var(--tile);
  font-size: 13px;
}

.lg-skipinput {
  flex: 1 1 auto;
}

.lg-delete {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.lg-delete__ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tile);
}

.lg-delete__q {
  font-size: 15px;
  font-weight: 600;
}

.lg-delete__btns {
  display: flex;
  gap: 8px;
}

.jf-link.lg-link--danger {
  align-self: flex-start;
  color: var(--loss);
}

/* The "skip only this month" link inside the delete question (audit H3). */
.lg-delete__ask .jf-link {
  align-self: flex-start;
}

/* One month of a monthly entry, opened from its row: that month alone, or the whole series below (audit H3). */
.lg-occ {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tile);
}

.lg-form .lg-occ .lg-lead {
  margin: 0;
}

.lg-occ .btn {
  align-self: flex-start;
}

/* The monthly entries still charging after a blown date (audit H2). */
.lg-endlist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0 4px;
  list-style: none;
  font-size: 13px;
}

/* ---- Narrow screens ---- */
@container vwins (max-width: 760px) {
  .lg-wins .lg-win {
    padding: 18px 18px 20px;
  }
}

/* ---- Path (stage P5): the next 30 days, the history of rules, the rule forms ---- */
.lg-foot {
  margin-top: 10px;
  margin-bottom: 0;
}

.lg-due {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.lg-due:first-of-type {
  border-top: 0;
}

.lg-due__d {
  font-size: 13px;
  color: var(--text-2);
}

.lg-due__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lg-due__main b,
.lg-due__v {
  font-weight: 600;
}

.lg-due__v {
  white-space: nowrap;
}

.lg-hist {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.lg-hist > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 15px;
  color: var(--text-2);
  cursor: pointer;
}

.lg-hist > summary:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
  border-radius: 10px;
}

/* The baskets of a payout split: name and percentage, then what they count toward. */
.pf-baskets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pf-basket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px minmax(0, 150px) 28px;
  align-items: center;
  gap: 8px;
}

.pf-basket .jf-field {
  display: flex;
  align-items: center;
  min-height: 48px;
}

.pf-total {
  font-size: 13px;
  color: var(--loss);
}

.pf-total.is-ok {
  color: var(--text-2);
}

.modal--lgform .jf-go:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

@media (max-width: 560px) {
  .pf-basket {
    grid-template-columns: minmax(0, 1fr) 84px 28px;
    grid-template-areas:
      "name name x"
      "pct role role";
  }

  .pf-basket__name {
    grid-area: name;
  }

  .pf-basket__pct {
    grid-area: pct;
  }

  .pf-basket__role {
    grid-area: role;
  }

  .pf-basket__x {
    grid-area: x;
  }
}

.pf-form [hidden] {
  display: none !important;
}

.lg-ms__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lg-ms__name b {
  font-weight: 600;
}

/* ---- The plain summary: sentences in the neutral text colour, no tone ---- */
.lg-say {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-1);
  overflow-wrap: anywhere;
}

.lg-say:last-child {
  margin-bottom: 0;
}
