/* Analysis (Legacy). Loaded only by legacy.html, after portal.css, so the memo
   pages cannot shift by a pixel because of anything in here. Every selector is
   prefixed .lg- for the same reason. Colours and type come from portal.css's
   variables where they exist; the few literals below are the accounting
   greens and reds, which are semantic rather than decorative. */

:root {
  --lg-pos: #1f5f43;
  --lg-neg: #8c2f26;
  --lg-warn: #8a6d1f;
  --lg-rule: rgba(0, 0, 0, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --lg-pos: #6fbb92;
    --lg-neg: #d98b80;
    --lg-warn: #d4b45e;
    --lg-rule: rgba(255, 255, 255, .16);
  }
}

.lg-h { margin: 2rem 0 .8rem; display: flex; align-items: baseline;
        justify-content: space-between; gap: 1rem; }

/* ---------- headline tiles ---------- */
.lg-metrics {
  display: grid; gap: .8rem; margin: 1.2rem 0 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.lg-tile { border: 1px solid var(--lg-rule); padding: .8rem .9rem; }
.lg-fig { font-family: Georgia, "Times New Roman", serif;
          font-size: 1.45rem; line-height: 1.2; margin: .25rem 0 .15rem;
          font-variant-numeric: tabular-nums; }
.lg-fig.pos { color: var(--lg-pos); }
.lg-fig.neg { color: var(--lg-neg); }
.lg-fig.warn { color: var(--lg-warn); }
.lg-fig.neut { opacity: .75; }

/* ---------- deal structure strip ---------- */
.lg-structure { border: 1px solid var(--lg-rule); margin: 0 0 1.4rem; }
.lg-structure-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .6rem .9rem; border-bottom: 1px solid var(--lg-rule);
}
.lg-structure-body {
  display: grid; gap: .9rem; padding: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.lg-sf { font-family: Georgia, "Times New Roman", serif;
         font-variant-numeric: tabular-nums; }

/* ---------- two column body ---------- */
.lg-cols { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .lg-cols { grid-template-columns: 1.1fr .9fr; } }

/* ---------- the statement ---------- */
.lg-statement { border: 1px solid var(--lg-rule); }
.lg-sec {
  font-variant: small-caps; letter-spacing: .06em; font-size: .78rem;
  padding: .55rem .9rem .35rem; opacity: .72;
  border-top: 1px solid var(--lg-rule);
}
.lg-statement .lg-sec:first-child { border-top: 0; }
.lg-row {
  display: flex; justify-content: space-between; gap: 1.2rem;
  padding: .32rem .9rem; align-items: baseline;
}
.lg-row.sub { border-top: 1px solid var(--lg-rule); font-weight: 600; }
.lg-row.total {
  border-top: 2px solid currentColor; margin-top: .2rem;
  padding: .6rem .9rem; font-size: 1.05rem;
}
.lg-lab { flex: 1 1 auto; }
.lg-val { font-family: Georgia, "Times New Roman", serif;
          font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-val.neg { color: var(--lg-neg); }
.lg-val.pos { color: var(--lg-pos); }

.lg-toggle { display: inline-flex; border: 1px solid var(--lg-rule); }
.lg-toggle button {
  background: none; border: 0; padding: .25rem .7rem; cursor: pointer;
  font: inherit; font-size: .8rem; color: inherit; opacity: .6;
}
.lg-toggle button.on { opacity: 1; font-weight: 600;
                       background: rgba(127, 127, 127, .12); }

/* ---------- projection ---------- */
.lg-bars {
  display: flex; align-items: flex-end; gap: .35rem; height: 150px;
  border-bottom: 1px solid var(--lg-rule); padding-bottom: .3rem;
}
.lg-bar { flex: 1 1 0; display: flex; flex-direction: column;
          justify-content: flex-end; align-items: center; height: 100%; }
.lg-bar-fill { width: 100%; background: currentColor; opacity: .35; }
.lg-bar:hover .lg-bar-fill { opacity: .6; }
.lg-proj-sum { border: 1px solid var(--lg-rule); border-top: 0; }

/* ---------- renovation ---------- */
.lg-reno-head {
  display: grid; gap: .9rem; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* ---------- tables ---------- */
.lg-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.lg-table th, .lg-table td {
  text-align: left; padding: .4rem .55rem; border-bottom: 1px solid var(--lg-rule);
  white-space: nowrap;
}
.lg-table th { font-variant: small-caps; letter-spacing: .05em; opacity: .7;
               font-weight: 500; }
.lg-table td:first-child { white-space: normal; min-width: 200px; }
.lg-grade { font-variant: small-caps; letter-spacing: .04em; }
.lg-grade.pos { color: var(--lg-pos); }
.lg-grade.warn { color: var(--lg-warn); }
.lg-grade.neg { color: var(--lg-neg); }

.lg-prov { border: 1px solid var(--lg-rule); padding: .3rem 0 .1rem; }
.lg-prov .formnote { padding: 0 .9rem; }

/* ---------- earlier worksheets ---------- */
.lg-recent { margin-top: 2.4rem; }
.lg-recent-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem .1rem; border-bottom: 1px solid var(--lg-rule);
  text-decoration: none; color: inherit;
}
.lg-recent-row:hover { background: rgba(127, 127, 127, .07); }

/* ---------- the drawer ---------- *
   A right edge slide-over, which is what the old product used: the results
   stay on screen behind it, so a change to an assumption is visible the
   instant it is typed rather than after a dialog is dismissed. */
.lg-scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .38);
  opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 40;
}
.lg-scrim.on { opacity: 1; pointer-events: auto; }
.lg-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(400px, 92vw);
  background: Canvas; color: CanvasText; border-left: 1px solid var(--lg-rule);
  transform: translateX(100%); transition: transform .2s ease; z-index: 41;
  display: flex; flex-direction: column;
  box-shadow: -12px 0 32px rgba(0, 0, 0, .12);
}
.lg-panel.on { transform: translateX(0); }
.lg-panel-head, .lg-panel-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--lg-rule);
}
.lg-panel-foot { border-bottom: 0; border-top: 1px solid var(--lg-rule); }
.lg-panel-body { flex: 1 1 auto; overflow-y: auto; padding: .4rem 1rem 1rem; }
.lg-x { background: none; border: 0; font-size: 1.4rem; line-height: 1;
        cursor: pointer; color: inherit; padding: 0 .2rem; }
.lg-group {
  font-variant: small-caps; letter-spacing: .06em; font-size: .78rem;
  opacity: .7; margin: 1.1rem 0 .4rem; padding-top: .6rem;
  border-top: 1px solid var(--lg-rule);
}
.lg-panel-body .lg-group:first-child { border-top: 0; margin-top: .4rem; }
.lg-field { margin-bottom: .6rem; }
.lg-field .formnote { margin: .2rem 0 0; }
.lg-input { display: flex; align-items: stretch; border: 1px solid var(--lg-rule); }
.lg-input span {
  padding: .35rem .5rem; opacity: .6; border-right: 1px solid var(--lg-rule);
  min-width: 2rem; text-align: center;
}
.lg-input input {
  flex: 1 1 auto; border: 0; background: none; color: inherit;
  padding: .35rem .5rem; font: inherit; width: 100%;
}
.lg-input input:focus { outline: 2px solid rgba(127, 127, 127, .35);
                        outline-offset: -2px; }
.lg-seg { display: flex; border: 1px solid var(--lg-rule); }
.lg-seg button {
  flex: 1 1 0; background: none; border: 0; padding: .35rem .5rem;
  font: inherit; cursor: pointer; color: inherit; opacity: .6;
}
.lg-seg button.on { opacity: 1; font-weight: 600;
                    background: rgba(127, 127, 127, .12); }

/* ---------- print: the drawer and the controls are not part of the file --- */
@media print {
  .tabs, .lg-scrim, .lg-panel, .btnrow, #openpanel, .lg-toggle { display: none !important; }
  .lg-cols { grid-template-columns: 1fr 1fr; }
  .lg-table td, .lg-table th { white-space: normal; }
}
