/* Ledger: main view, entry drawer, reconciliation and settings.
   Colours come from the tokens in app.css, so dark mode follows automatically. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.lg-gap { margin-bottom: 16px; }
.lg-grow { flex: 1 1 260px; margin: 0; }
.lg-bar { align-items: center; justify-content: space-between; }
.lg-head-actions { justify-content: flex-end; }
.linklike { border: 0; background: none; padding: 0; color: var(--navy); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.linklike:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }

/* company and account switchers */
.lg-company, .lg-accounts { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; scrollbar-width: thin; }
.lg-company { margin-bottom: 0; }
.lg-company button { font-size: 15px; white-space: nowrap; flex: none; }
.lg-accounts { margin-top: 0; }
.lg-accounts button { white-space: nowrap; flex: none; }
.lg-cur { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; }
.lg-company-sel { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.lg-company-sel select { width: auto; min-width: 220px; }

/* filters */
.lg-filters .lg-date { display: inline-flex; align-items: center; gap: 6px; }
.lg-filters .lg-date .input { min-width: 140px; }
.lg-filters input[type="search"] { min-width: 260px; }

/* summary cards, one per account, never added across currencies */
.lg-cards { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.lg-card { flex: 1 1 280px; min-width: 0; max-width: 420px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.lg-card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lg-card-name { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-curpill { flex: none; white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--navy); background: var(--navy-tint); border-radius: 999px; padding: 2px 8px; }
.lg-k { font-size: 12px; color: var(--text-2); line-height: 16px; }
.lg-big { font-size: 26px; line-height: 34px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-big.neg { color: var(--crimson-text); }
.lg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0; }
.lg-v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-v.in, .lg-num.in, .lg-amt.in { color: var(--st-dn-fg); }
.lg-v.out, .lg-num.out, .lg-amt.out { color: var(--crimson-text); }
.lg-note { flex: 1 1 100%; }

/* table: the shared .tbl rule lets any cell break anywhere, which squeezed the columns and cut words in half. Here a cell breaks only at spaces;
   only the free-text columns (description, reference) may split a long unbroken word. If the card is still too narrow it scrolls sideways
   instead of clipping the status pill. */
.lg-tbl td { overflow-wrap: normal; }
.lg-tbl td .lg-desc, .lg-tbl td.lg-c-ref { overflow-wrap: anywhere; }
.lg-tbl td.lg-c-ref { min-width: 90px; }
.lg-tbl th.num, .lg-tbl td.num { text-align: right; }
.lg-tbl tr.static { cursor: default; }
.lg-tbl tbody tr.static:hover td { background: none; }
.lg-tbl tbody tr:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #1E4FBF; }
.lg-c-date { white-space: nowrap; }
.lg-main { font-weight: 600; font-size: 14px; }
.lg-memo { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lg-lock { display: inline-grid; place-items: center; color: var(--text-2); }
.lg-void td { color: var(--text-3); background: var(--surface-2); }
.lg-void .lg-main, .lg-void .lg-num, .lg-void .lg-memo, .lg-void td:nth-child(-n+6) > * { text-decoration: line-through; }
.lg-void td:last-child > *, .lg-void td:nth-child(7) > * { text-decoration: none; }
.lg-void .lg-num.in, .lg-void .lg-num.out { color: var(--text-3); }
.lg-struck { text-decoration: line-through; }
.lg-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 10px; }
.lg-tbl th.lg-c-act, .lg-tbl td.lg-c-act { white-space: nowrap; width: 1%; text-align: right; }
.lg-tbl td.lg-c-act .row { justify-content: flex-end; }
.lg-rowbtns { gap: 6px; flex-wrap: wrap; }
/* On a wide screen the three buttons of a row stay in one line; the cell is as wide as they need. */
@media (min-width: 768px) {
  .lg-tbl td.lg-c-act .lg-rowbtns { flex-wrap: nowrap; }
  .lg-tbl td.lg-c-act .lg-rowbtns .btn { flex: none; white-space: nowrap; }
}
.lg-rec { margin: 8px 0 24px; }
.lg-rec h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.lg-rec, .lg-card, .lg-wrap, .lg-filters > * { min-width: 0; }
.lg-filters select.input, .lg-filters .input { max-width: 100%; }
.lg-clear { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.lg-clear p { margin: 0; }
.lg-mx-ctl { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.lg-mx-ctl select.input { width: auto; min-width: 150px; padding: 4px 28px 4px 8px; font-size: 13px; min-height: 0; height: 32px; }
.lg-flag { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: var(--st-wt-bg); color: var(--st-wt-fg); font-size: 11px; font-weight: 700; }

/* Where the card is narrower than the table (tablet and small laptop widths), the table scrolls sideways inside the card instead of being clipped. A scroll
   container would pin a sticky header to itself, so the header is plain there; on wide screens the header still sticks under the top bar. */
@media (max-width: 1259px) {
  .lg-wrap:not(.lg-matrix) { overflow-x: auto; scrollbar-width: thin; }
  .lg-wrap .lg-tbl th { position: static; }
}

/* the form */
.lg-form .hint:empty { display: none; }
/* the amount and its currency sit side by side, at every width */
.lg-amtrow { display: flex; align-items: center; gap: 8px; }
.lg-amtrow .input { flex: 1 1 auto; min-width: 0; }
.lg-amtrow .lg-curpill { flex: none; }
.lg-static { height: 36px; display: flex; align-items: center; font-weight: 600; }
.lg-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); overflow: hidden; align-self: flex-start; }
.lg-seg-b { border: 0; background: var(--surface); color: var(--text-2); font: inherit; font-weight: 600; font-size: 14px; height: 36px; padding: 0 18px; cursor: pointer; }
.lg-seg-b + .lg-seg-b { border-left: 1px solid var(--border-strong); }
.lg-seg-b.on { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .lg-seg-b.on { color: #0B1220; }
.lg-seg-b:focus-visible { outline: none; box-shadow: inset var(--focus); }

/* the entry drawer */
.lg-title { margin: 6px 0 0; font-size: 20px; line-height: 28px; font-weight: 600; overflow-wrap: anywhere; }
.lg-amt { font-size: 20px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: pre; }
.lg-dl { margin: 0 0 20px; display: flex; flex-direction: column; }
.lg-kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 20px; }
.lg-kv:last-child { border-bottom: 0; }
.lg-kv dt { color: var(--text-2); font-size: 13px; }
.lg-kv dd { margin: 0; overflow-wrap: anywhere; }
.lg-sec { margin-top: 24px; }
.lg-sec h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.lg-rel { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lg-actions { justify-content: flex-start; }

/* settings */
.lg-tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
.lg-tabs button { white-space: nowrap; flex: none; }
/* the access matrix scrolls sideways when there are many companies; a soft shadow at the edge says there is more */
.lg-matrix { overflow-x: auto; background: linear-gradient(to right, var(--surface) 30%, transparent) 0 0 / 40px 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
  radial-gradient(farthest-side at 0 50%, rgba(15, 27, 51, .22), transparent) 0 0 / 12px 100% no-repeat scroll, radial-gradient(farthest-side at 100% 50%, rgba(15, 27, 51, .22), transparent) 100% 0 / 12px 100% no-repeat scroll, var(--surface); }
.lg-mx tbody tr:last-child th { border-bottom: 0; }
.lg-mx th, .lg-mx td { position: static; }
.lg-mx-c { text-align: center; min-width: 130px; }
.lg-tbl th.lg-mx-p { text-align: left; min-width: 160px; font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface); }
.lg-tbl th.lg-mx-p .faint { font-weight: 400; }
.lg-mx-box { flex-direction: column; gap: 4px; text-align: center; }
.lg-mx-box input { width: 20px; height: 20px; flex: none; }
.lg-det summary { cursor: pointer; color: var(--navy); font-weight: 600; font-size: 13px; }
.lg-pre { margin: 4px 0 8px; padding: 8px; background: var(--surface-2); border-radius: 6px; font-size: 12px; line-height: 16px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 1100px) {
  .lg-memo { max-width: 220px; }
}
@media (max-width: 767px) {
  .lg-filters .input, .lg-filters select.input { flex: 1 1 140px; min-width: 0; }
  .lg-filters input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .lg-filters .lg-date { flex: 1 1 140px; }
  .lg-filters .lg-date .input { flex: 1; min-width: 0; }
  .lg-card { max-width: none; }
  .lg-head-actions { justify-content: flex-start; }
  /* Stacked cards: every cell names its column, nothing scrolls sideways. */
  .lg-wrap:not(.lg-matrix) { background: none; border: 0; box-shadow: none; }
  .lg-tbl:not(.lg-mx) thead { display: none; }
  .lg-tbl:not(.lg-mx) tbody { display: flex; flex-direction: column; gap: 10px; padding: 0; }
  .lg-tbl:not(.lg-mx) tr { display: block; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 10px 12px; }
  .lg-tbl:not(.lg-mx) tr:last-child { border-bottom: 1px solid var(--border); }
  .lg-tbl:not(.lg-mx) tr.lg-void { background: var(--surface-2); }
  .lg-tbl:not(.lg-mx) td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 4px 0; border: 0; text-align: right; min-width: 0; background: none !important; }
  .lg-tbl:not(.lg-mx) td:empty { display: none; }
  .lg-tbl:not(.lg-mx) td::before { content: attr(data-label); flex: none; color: var(--text-3); font-size: 12px; font-weight: 600; text-align: left; padding-top: 1px; }
  .lg-tbl:not(.lg-mx) td > * { min-width: 0; text-align: right; }
  .lg-memo { max-width: 55vw; }
  .lg-tbl td { overflow-wrap: anywhere; }
  .lg-status { justify-content: flex-end; }
  .lg-rowbtns { justify-content: flex-end; }
  .lg-kv { grid-template-columns: 100px minmax(0, 1fr); }
  .lg-company-sel select { min-width: 0; flex: 1; }
  .lg-seg-b { flex: 1; }
  .lg-seg { align-self: stretch; }
  /* the settings tabs stay on one row and scroll sideways (the active one is scrolled into view), so a last tab is never left alone on a second row */
  .lg-tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .lg-tabs button { flex: none; text-align: center; min-height: 44px; }
  /* the reconciliation filters are full width, so a company name is never cut */
  .lg-rec-filters select.input, .lg-rec-filters .btn { flex: 1 1 100%; }
  .lg-tbl td.lg-c-act .lg-rowbtns { flex-wrap: wrap; }
  /* the access matrix becomes one card per person: the person on top, then each company with its box at the right edge */
  .lg-matrix { background: none; border: 0; box-shadow: none; overflow: visible; }
  .lg-tbl.lg-mx thead { display: none; }
  .lg-tbl.lg-mx tbody { display: flex; flex-direction: column; gap: 12px; padding: 0; }
  .lg-tbl.lg-mx tr { display: block; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 4px 12px 6px; }
  .lg-tbl.lg-mx th.lg-mx-p { display: block; min-width: 0; padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); text-align: left; }
  .lg-tbl.lg-mx td.lg-mx-c { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-width: 0; padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); text-align: left; background: none; }
  .lg-tbl.lg-mx tr td.lg-mx-c:last-child { border-bottom: 0; }
  /* the company name takes the whole first line and breaks only between words; the box and its note sit on the line below, the controls below that */
  .lg-tbl.lg-mx td.lg-mx-c::before { content: attr(data-label); flex: 0 0 100%; min-width: 0; font-weight: 600; font-size: 14px; overflow-wrap: normal; }
  .lg-mx-box { flex: 1 1 100%; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 10px; text-align: right; min-height: 44px; }
  .lg-mx-box .faint { font-size: 12px; line-height: 16px; min-width: 0; margin-right: auto; text-align: left; }
  .lg-mx-ctl { flex: 1 1 100%; }
  .lg-mx-ctl select.input { height: 44px; min-height: 44px; font-size: 16px; flex: 1 1 160px; }
  .lg-mx-ctl .check { min-height: 44px; }
}

/* 2.23.0: totals per currency in two groups, and the list of approved expenses not yet in the ledger */
.lg-total { max-width: 420px; }
.lg-trow { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.lg-unposted { margin-bottom: 16px; padding: 12px 16px; }
.lg-unposted > summary { cursor: pointer; font-weight: 600; }
.lg-unposted > summary:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }
.lg-unposted > p { margin: 8px 0; }

/* 2.26.0: the Share dialog, its preview and the list of shared links */
.lg-share-check { display: flex; margin: 4px 0; min-height: 28px; }
.lg-share-url, .lg-share-code { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.lg-share-code { letter-spacing: .12em; font-size: 18px; font-weight: 600; }
.lg-share-preview { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #f4f5f7; }
.lg-share-preview .sh-preview { padding: 12px; font-size: 14px; line-height: 1.45; color: #1b2430; }
@media (max-width: 640px) { .lg-share-check { min-height: 44px; } .lg-share-preview { max-height: 46vh; } }
/* The Shared links list: a row's buttons have no label, so no stray ": " in front of them on a phone. */
.tbl td[data-label]:has(.lg-rowbtns)::before, .tbl td[data-label]:has(.lg-rowbtns):not(:empty)::before { content: none; }

/* 2.28.0: attachments on an entry */
.lg-clip { display: inline-flex; align-items: center; gap: 2px; margin-top: 2px; font-size: 12px; color: var(--muted, #5b6770); }
.lg-attach-h { align-items: center; }
.lg-attach-h h4 { margin: 0; }
.lg-attach-toggle { margin: 8px 0; }
.lg-att-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.lg-att { border: 1px solid var(--line, #dde3e8); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; }
.lg-att-removed { background: var(--bg-soft, #f6f7f8); opacity: 0.85; }
.lg-att-main { align-items: center; gap: 8px; flex-wrap: wrap; }
.lg-att-name { overflow-wrap: anywhere; }
.lg-att-sub { margin: 14px 0 0; font-size: 13px; }
