/* RITS Portfolio - every page's styles. Colours are tokens on :root; dark mode follows the device (data-theme="auto")
   or the user's choice on their Profile (data-theme="light" / "dark", plus data-palette for a named scheme). */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #1c2430;
  --muted: #5f6b7a;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --accent-soft: #e3f3f1;
  --on-accent: #ffffff;
  --negative: #b42318;
  --positive: #067647;
  --warning-bg: #fff4e0;
  --warning-text: #8a4b00;
  --danger-bg: #fdecea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  --topbar-h: 64px; /* includes the 6px strip along the top */
  --nav-w: 190px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f141a; --surface: #161d25; --surface-2: #1d2630; --border: #2a3542; --text: #e6ebf1; --muted: #9aa7b6;
    --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #123a37; --on-accent: #062a27;
    --negative: #f97066; --positive: #47cd89; --warning-bg: #3a2a10; --warning-text: #fbc56b; --danger-bg: #3b1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #161d25; --surface-2: #1d2630; --border: #2a3542; --text: #e6ebf1; --muted: #9aa7b6;
  --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #123a37; --on-accent: #062a27;
  --negative: #f97066; --positive: #47cd89; --warning-bg: #3a2a10; --warning-text: #fbc56b; --danger-bg: #3b1714;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* Named colour schemes (Profile): each sits on light or dark (data-theme) and repaints the surfaces and accent (data-palette) */
:root[data-palette="ocean"]    { --bg: #f2f6fb; --surface-2: #ecf2f9; --border: #d6e0ec; --accent: #1d5fb8; --accent-strong: #164a91; --accent-soft: #e5eefb; }
:root[data-palette="forest"]   { --bg: #f3f6f1; --surface-2: #edf2ea; --border: #d7e0d2; --accent: #2f6b2f; --accent-strong: #245424; --accent-soft: #e6f1e3; }
:root[data-palette="sunset"]   { --bg: #faf5f2; --surface-2: #f5eee9; --border: #e8dbd2; --accent: #b8461b; --accent-strong: #963714; --accent-soft: #fcebe2; }
:root[data-palette="berry"]    { --bg: #faf3f6; --surface-2: #f4ecf0; --border: #e7d7df; --accent: #a3195b; --accent-strong: #841248; --accent-soft: #f9e4ee; }
:root[data-palette="lavender"] { --bg: #f6f4fb; --surface-2: #efecf7; --border: #dfd9ee; --accent: #6b46c1; --accent-strong: #553599; --accent-soft: #efe9fb; }
:root[data-palette="honey"]    { --bg: #faf7f0; --surface-2: #f4efe3; --border: #e6dcc6; --accent: #8a5a00; --accent-strong: #6e4700; --accent-soft: #fbf0d9; }
:root[data-palette="mocha"]    { --bg: #f7f3ee; --surface: #fffdfa; --surface-2: #f1ebe3; --border: #e2d8cc; --accent: #7a4f2d; --accent-strong: #613e22; --accent-soft: #f3e9df; }
:root[data-palette="slate"]    { --bg: #eef1f4; --surface-2: #e9ecef; --border: #d3d9df; --accent: #3f5468; --accent-strong: #2f4050; --accent-soft: #e4e9ef; }
:root[data-palette="midnight"] { --bg: #0b1220; --surface: #111a2e; --surface-2: #18233b; --border: #26334f; --text: #e4eaf5; --muted: #93a1bb;
  --accent: #60a5fa; --accent-strong: #93c5fd; --accent-soft: #15284a; --on-accent: #061428; }
:root[data-palette="graphite"] { --bg: #121212; --surface: #1b1b1b; --surface-2: #242424; --border: #333333; --text: #ececec; --muted: #a3a3a3;
  --accent: #f5b041; --accent-strong: #f8c471; --accent-soft: #3a2c12; --on-accent: #241800; }
:root[data-palette="plum"]     { --bg: #16111d; --surface: #1e1728; --surface-2: #271e33; --border: #3a2d4a; --text: #ece6f4; --muted: #a99bbd;
  --accent: #c084fc; --accent-strong: #d8b4fe; --accent-soft: #2f1d47; --on-accent: #1d0a33; }
:root[data-palette="pine"]     { --bg: #0e1612; --surface: #142019; --surface-2: #1b2a21; --border: #2a3d31; --text: #e3eee7; --muted: #95ab9c;
  --accent: #5fd38d; --accent-strong: #8be3ae; --accent-soft: #163a26; --on-accent: #052814; }

* { box-sizing: border-box; }
html, body { margin: 0; }
html { font-size: var(--text-size, 13px); }   /* compact: rem sizes follow this (Profile -> Appearance -> Text size) */
body {
  background: var(--bg); color: var(--text);
  font: 1rem/1.4 var(--font-ui, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
}
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: 0 0 2px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ===== App shell: top bar, side navigation, main area */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-top: 6px solid var(--accent); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; white-space: nowrap; flex: none; width: calc(var(--nav-w) - 28px); overflow: hidden; }
.brand svg { width: 26px; height: 26px; }
.topbar .spacer { flex: 1; }
.sections { display: flex; align-self: stretch; gap: 2px; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
.sections > a, .sections > span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 12px; white-space: nowrap; color: var(--muted); text-decoration: none; font-weight: 550; font-size: .85rem; border-bottom: 3px solid transparent; }
.sec-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.sec-icon svg { width: 16px; height: 16px; }
.sections > a:hover .sec-icon { transform: translateY(-1px); }
.sections > a:hover { color: var(--text); }
.sections > a.active { color: var(--text); font-weight: 650; border-bottom-color: var(--accent); background: var(--surface-2); }
.sections > span.soon { opacity: .45; cursor: default; }
.mobile-sections { display: none; }
.sidenav a.quick { color: var(--accent-strong); font-weight: 500; }
.sidenav a.quick svg { width: 15px; height: 15px; }
.menu-toggle { display: none; }
.user-button { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
.user-ws { font-size: .85rem; color: var(--muted); border-left: 1px solid var(--border); padding-left: 8px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A demo workspace (made-up data): marked in the header on every page; what would reach outside RITS Portfolio is hidden
   (the API refuses it anyway) - Xero and bank feed connecting and downloading, emailing invoices, fetching prices (LINZ and valuations: their boxes) */
.demo-badge { flex: none; align-self: center; margin-left: 8px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap;
  max-width: 360px; overflow: hidden; text-overflow: ellipsis; background: var(--warning-bg); color: var(--warning-text); border: 1px solid color-mix(in srgb, var(--warning-text) 30%, transparent); text-decoration: none; }
.demo-badge:hover { text-decoration: underline; }
.is-sandbox #connectBar, .is-sandbox #syncAll, .is-sandbox #addPanel, .is-sandbox #emailInvoice, .is-sandbox #updatePrices, .is-sandbox #checkPrice { display: none !important; }

.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidenav {
  width: var(--nav-w); flex: none; padding: 8px 6px; background: var(--surface); border-right: 1px solid var(--border);
}
.sidenav a, .sidenav span {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.sidenav span.soon { color: var(--muted); cursor: default; }
.sidenav span.soon small { margin-left: auto; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.sidenav .section { margin: 12px 10px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.main { flex: 1; min-width: 0; padding: 14px 18px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }   /* (always at the right, even when it wraps under the title) */
/* (a wide screen: the heading's buttons and drop-downs on one line, on the right - the title and its line under it wrap instead) */
@media (min-width: 900px) {
  .page-head { flex-wrap: nowrap; }
  .page-head > div:first-child { min-width: 0; flex: 1 1 auto; }
  .page-head .actions { flex-wrap: nowrap; flex: 0 0 auto; justify-content: flex-end; }
  .page-head .actions input[type="search"] { min-width: 0; }
  .page-head h1 { white-space: nowrap; }
}
/* (a list kept to one line a row - it scrolls sideways instead: Tenants & Leases) */
.grid.nowrap th, .grid.nowrap td { white-space: nowrap; }
.footer { padding: 24px 0 8px; font-size: .8rem; color: var(--muted); text-align: center; }

@media (max-width: 800px) {
  .menu-toggle { display: inline-flex; }
  .sidenav {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 15; transform: translateX(-100%);
    transition: transform .15s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidenav { transform: none; }
  .main { padding: 16px; }
  .brand span { display: none; }
  .sections { display: none; }
  .mobile-sections { display: block; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
  .user-ws { max-width: 120px; }
  .demo-badge { font-size: .7rem; padding: 1px 7px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}

/* ===== Phones (and the app on a phone): under 700px wide - by width, never by the device, so "Request desktop site"
   (a desktop-wide screen) gets the normal layout. The sections go in a bar along the bottom; More opens the full menu. */
.bottombar { display: none; }
/* (notches and the home bar: kept clear - viewport-fit=cover) */
.topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (max-width: 700px) {
  .topbar .menu-toggle { display: none; }
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  }
  .bottombar > a, .bottombar > button {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 50px; padding: 2px; border: 0; background: none; border-radius: 8px; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 550;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bottombar .sec-icon { width: 28px; height: 28px; }
  .bottombar .bb-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottombar > .active, body.nav-open .bottombar > .bb-more { color: var(--text); background: var(--surface-2); }
  .bottombar .bb-more-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-2); color: var(--text); }
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  html.in-frame body { padding-bottom: 0; }
  html.in-frame .bottombar { display: none !important; }
  .sidenav { bottom: calc(58px + env(safe-area-inset-bottom)); width: min(320px, 86vw); overflow-y: auto; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .main { padding: 12px max(10px, env(safe-area-inset-right)) 12px max(10px, env(safe-area-inset-left)); }
  .page-head { margin-bottom: 8px; }
  .page-head .actions { width: 100%; }
}
/* (phones: lists that take "the rest of the screen" just run on down the page - one scroll, not one inside another) */
@media (max-width: 700px) { [data-fit], .sticky-table { max-height: none !important; } }
/* Bank feeds, To review, on a phone: each bank transaction a card - date and amount, what the bank said, then Payee,
   Category and Tag one under another, then Add / ✕ / ⋯ (Memo, Split, Rule and Details are in ⋯) */
@media (max-width: 700px) {
  .feed-table:has(#reviewRows) { display: block; }
  .feed-table:has(#reviewRows) > thead { display: none; }
  #reviewRows { display: block; }
  #reviewRows > tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
  #reviewRows > tr > td { display: block; border: 0; padding: 0; min-width: 0; }
  #reviewRows > tr[data-item] > td:has(> [data-pick]) { order: 0; }
  #reviewRows > tr[data-item] > td.nowrap:not(.feed-acts) { order: 1; color: var(--muted); font-size: .85rem; }
  #reviewRows > tr[data-item] > td.num { order: 2; margin-left: auto; font-weight: 650; font-size: 1.05rem; }
  #reviewRows > tr[data-item] > td:not(.nowrap):not(.num):not(.feed-tagcol):not(.feed-bizcol):not(:has(input, select)) { order: 3; flex-basis: 100%; }
  #reviewRows > tr[data-item] > td:has([data-payee]) { order: 4; flex-basis: 100%; }
  #reviewRows > tr[data-item] > td:has(.feed-cats) { order: 5; flex-basis: 100%; }
  #reviewRows > tr[data-item] > td.feed-tagcol { order: 6; flex-basis: 100%; }
  #reviewRows > tr[data-item] > td.feed-bizcol { order: 7; flex-basis: 100%; }
  #reviewRows > tr[data-item] > td.feed-acts { order: 8; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  #reviewRows > tr[data-item] > td:has([data-payee])::before { content: 'Payee'; }
  #reviewRows > tr[data-item] > td:has(.feed-cats)::before { content: 'Category'; }
  #reviewRows > tr[data-item] > td.feed-tagcol::before { content: 'Tag'; }
  #reviewRows > tr[data-item] > td.feed-bizcol::before { content: 'Business account'; }
  #reviewRows > tr[data-item] > td:is(:has([data-payee]), :has(.feed-cats), .feed-tagcol, .feed-bizcol)::before { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
  #reviewRows > tr[data-item] input[data-payee], #reviewRows > tr[data-item] select { width: 100%; }
  #reviewRows .feed-acts > :is([data-memo], [data-split], [data-details], [data-rule], [data-edit-rule]) { display: none; }
  #reviewRows .feed-acts > [data-add] { min-width: 88px; }
}
/* The Register on a phone: each transaction a card - payee and amount, then category, then date, number, cleared and
   the balance; tap it to open it, ⋯ for the rest. The list scrolls in its own box (newest at the bottom, as on a computer). */
@media (max-width: 700px) {
  #registerWrap { max-height: calc(100dvh - 150px - env(safe-area-inset-bottom)) !important; min-height: 300px; }
  table.register { display: block; }
  table.register > thead { display: none; }
  table.register > tbody { display: block; }
  table.register > tbody > tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
  table.register > tbody > tr > td { display: block; border: 0; padding: 0 !important; min-width: 0; max-width: none !important; width: auto !important; }
  table.register > tbody > tr > td:empty { display: none; }
  table.register > tbody > tr[data-id] > td.col-payee { order: 1; flex: 1 1 60%; font-weight: 600; }
  table.register > tbody > tr[data-id] > td.col-pay, table.register > tbody > tr[data-id] > td.col-dep { order: 2; font-weight: 650; font-size: 1.02rem; }
  table.register > tbody > tr[data-id] > td.col-pay { color: var(--negative); }
  table.register > tbody > tr[data-id] > td.col-pay::before { content: '-'; }
  table.register > tbody > tr[data-id] > td.col-cat { order: 3; flex-basis: 100%; font-size: .88rem; color: var(--muted); }
  table.register > tbody > tr[data-id] > td.date { order: 4; font-size: .82rem; color: var(--muted); }
  table.register > tbody > tr[data-id] > td.col-num { order: 5; font-size: .82rem; color: var(--muted); }
  table.register > tbody > tr[data-id] > td.col-biz { order: 3; flex-basis: 100%; font-size: .8rem; }
  table.register > tbody > tr[data-id] > td.col-status { order: 7; margin-left: auto; }
  table.register > tbody > tr[data-id] > td.col-proc { order: 4; font-size: .82rem; color: var(--muted); }
  table.register > tbody > tr[data-id] > td.col-proc::before { content: 'Processed '; }
  table.register > tbody > tr[data-id] > td.col-bal { order: 8; font-size: .82rem; }
  table.register > tbody > tr[data-id] > td.col-bal::before { content: 'Balance '; color: var(--muted); font-weight: 400; }
  table.register > tbody > tr[data-id] > td.row-dots { order: 9; }
  table.register > tbody > tr.month-row > td { flex: 1 1 100%; }
  table.register > tbody > tr.before > td:last-child { margin-left: auto; }
  .register-tools input:not([type="checkbox"]):not([type="radio"]) { min-width: 0; flex-basis: 100%; }
  /* (a pop-up - a transaction, a bill, a question: the phone's whole width) */
  dialog:not(.ai-panel) { width: calc(100vw - 12px); max-width: calc(100vw - 12px); max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
/* Bills & Deposits: each group (Overdue, Due soon, Upcoming, each year...) its own table - all with the same column widths, so
   the columns line up down the page */
@media (min-width: 701px) {
  #billGroups table.grid { table-layout: fixed; width: 100%; }
  #billGroups table.grid > thead th:nth-child(1) { width: 140px !important; }
  #billGroups table.grid > thead th:nth-child(2) { width: auto; }
  #billGroups table.grid > thead th:nth-child(3) { width: 19%; }
  #billGroups table.grid > thead th:nth-child(4) { width: 18%; }
  #billGroups table.grid > thead th:nth-child(5) { width: 95px; }
  #billGroups table.grid > thead th:nth-child(6) { width: 55px; }
  #billGroups table.grid > thead th:nth-child(7) { width: 130px; }
  #billGroups table.grid > thead th:nth-child(8) { width: 140px !important; }
  #billGroups table.grid td { overflow-wrap: anywhere; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(3) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* (the account on one line: the whole name on hover) */
}
/* Bills & Deposits on a phone: each one a card - who and the amount, then the category, then when it's due, the account
   and how often, then Enter / Skip / ⋯ */
@media (max-width: 700px) {
  #billGroups table.grid { display: block; }
  #billGroups table.grid > thead { display: none; }
  #billGroups table.grid > tbody { display: block; }
  #billGroups tr:is([data-bill], [data-psched]) { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
  #billGroups tr:is([data-bill], [data-psched]) > td { display: block; border: 0; padding: 0 !important; min-width: 0; width: auto !important; }
  #billGroups tr:is([data-bill], [data-psched]) > td:empty { display: none; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(2) { order: 1; flex: 1 1 60%; font-weight: 600; overflow-wrap: anywhere; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(7) { order: 2; font-weight: 650; font-size: 1.02rem; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(4) { order: 3; flex-basis: 100%; font-size: .88rem; color: var(--muted); }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(1) { order: 4; font-size: .82rem; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(1) .sub { display: inline; margin-left: 4px; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(3) { order: 5; font-size: .82rem; color: var(--muted); }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(5) { order: 6; font-size: .82rem; color: var(--muted); }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(6) { display: none; }
  #billGroups tr:is([data-bill], [data-psched]) > td:nth-child(8) { order: 7; margin-left: auto; white-space: nowrap; }
}
/* Fingers, not a mouse: buttons big enough to tap, and boxes at 16px so the phone doesn't zoom in on each one */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: max(16px, 1rem); }
}
@media (pointer: coarse) and (max-width: 700px) {
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; padding-left: 10px; padding-right: 10px; }
  .row-dots-btn { min-width: 36px; }
}

/* ===== Cards, stats, tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.card + .card { margin-top: 16px; }
.stats > .card + .card { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat .label { font-size: .8rem; color: var(--muted); }
/* (smaller boxes, all on one line where they fit) */
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 6px; }
.stats.compact .stat { padding: 6px 8px; }
.stats.compact .stat .label { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats.compact .stat .value { font-size: 1rem; white-space: nowrap; }
.stats.compact .stat .muted { font-size: .75rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.grid th { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr.clickable:hover { background: var(--surface-2); }
table.grid tfoot td { font-weight: 650; border-bottom: 0; }
table.grid .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.negative { color: var(--negative); }
.group-title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 8px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge.warn { background: var(--warning-bg); color: var(--warning-text); }
.badge.danger { background: var(--danger-bg); color: var(--negative); }

.empty { text-align: center; padding: 20px 12px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--warning-bg); color: var(--warning-text); margin-bottom: 16px; }

/* ===== Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--negative); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.small { padding: 2px 8px; font-size: .9rem; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: auto; }
.field { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.field > span { font-size: .9rem; font-weight: 550; }
.field .hint { font-size: .8rem; color: var(--muted); }
.field > .secret-input { display: flex; gap: 6px; align-items: center; font-size: inherit; font-weight: normal; }
.secret-input input { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { color: var(--negative); font-size: .9rem; min-height: 1.2em; margin: 4px 0 8px; }

/* ===== Dialogs and messages */
dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(var(--dlg-w, 560px), calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 15, 20, .45); }
dialog form { padding: 14px 16px; background: var(--bg); }
dialog h2 { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
dialog .dlg-top { position: sticky; top: -14px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -14px -16px 10px; padding: 12px 16px 8px; box-sizing: border-box; width: calc(100% + 32px); max-width: calc(100% + 32px);
  background: var(--bg); border-bottom: 1px solid var(--border); }
dialog .dlg-top h2 { margin: 0; padding: 0; border: 0; flex: 1; min-width: 180px; }
dialog .dlg-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.help-button { gap: 6px; white-space: nowrap; flex: none; }
.help-button .req-count { padding: 0 6px; font-size: .7rem; line-height: 1.5; }
@media (max-width: 1400px) { .topbar .help-button span { display: none; } }
/* Feature requests: a vote button beside each */
.badge.prop { background: color-mix(in srgb, #eb5757 16%, var(--surface)); color: #b42318; }
tr.prop-sched td { background: color-mix(in srgb, #eb5757 4%, transparent); }
/* Settings' danger zone: a row per thing to delete, its button on the right */
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; }
.danger-row + .danger-row, #dangerOne .danger-row { border-top: 1px solid var(--border); }
.danger-row .btn { flex: none; }
.danger-note { font-size: .85rem; margin: 4px 0 16px; }
.danger-note p { margin: 0 0 6px; }
/* About: a few facts, label and value */
.about p { margin: 0 0 8px; line-height: 1.5; }
.about-facts { border-collapse: collapse; }
.about-facts th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 18px 4px 0; vertical-align: top; white-space: nowrap; }
.about-facts td { padding: 4px 0; }
.change h3 { font-size: .95rem; margin: 0 0 4px; }
.change ul { margin: 0 0 12px; padding-left: 20px; line-height: 1.5; }
.change li { margin-bottom: 2px; }
.change-entry + .change-entry { border-top: 1px solid var(--border); padding-top: 10px; }
.change-when { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.change-time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; min-width: 4.5em; }
.change-entry ul { margin-bottom: 10px; }
/* A heading that sorts its table */
table.acc-table { table-layout: fixed; }
table.acc-table td { overflow: hidden; text-overflow: ellipsis; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable .sort-mark { font-size: .8em; }
th.sortable:hover { color: var(--accent-strong); }
th.sortable.sorted { color: var(--text); }
.feature { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; }
.feature + .feature { margin-top: 8px; }
.feature .vote { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; font: inherit; line-height: 1.1; }
.feature .vote b { font-size: 1.15rem; color: var(--text); }
.feature .vote small { font-size: .7rem; }
.feature .vote:hover { border-color: var(--accent); }
.feature .vote.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.feature .vote.on b { color: var(--accent-strong); }
.feature-body { flex: 1; min-width: 0; }
.feature-title { font-size: 1rem; margin-bottom: 4px; }
.feature-details { white-space: normal; margin-bottom: 6px; line-height: 1.45; }
.feature-reply { background: var(--surface-2); border-left: 3px solid var(--accent); padding: 6px 10px; margin-bottom: 6px; border-radius: 4px; }
.feature-meta { font-size: .8rem; }
.help-q { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; align-self: center; padding: 0; border-radius: 50%; border: 1px solid var(--accent);
  background: var(--surface); color: var(--accent-strong); font: 700 .95rem/1 inherit; cursor: pointer; }
.help-q:hover { background: var(--accent); color: var(--on-accent); }
.tabs .help-q { margin: 0 2px 4px auto; text-decoration: none; }
.page-head .help-q { text-decoration: none; }
.help-toc b { color: var(--muted); font-weight: 600; }
.help-dialog { width: min(760px, calc(100vw - 32px)); }
.help-dialog { padding: 0; }
.help-dialog > .dlg-top { top: 0; margin: 0; width: 100%; max-width: 100%; padding: 12px 16px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.help-dialog > .help-page { padding: 12px 18px 16px; }
.help-dialog .dlg-top h2 { margin: 0; font-size: 1.1rem; }
.help-dialog .dlg-top .spacer { flex: 1; }
.help-page ul, .help-page ol { margin: 0 0 8px; padding-left: 20px; line-height: 1.5; max-width: 900px; }
.help-page li { margin-bottom: 4px; }
.help-page li > ul { margin-top: 4px; }
.fc-amt { width: 110px; text-align: right; padding: 3px 6px; }
.fc-amt[data-edited] { border-color: var(--accent); background: var(--accent-soft); }
tr.total-row td { border-top: 1px solid var(--border); }
/* Choosing a budget line: property and filter above a list that keeps the chosen line highlighted */
.line-pick .lp-tools { display: flex; gap: 6px; margin-bottom: 4px; }
.line-pick .lp-tools select { width: auto; max-width: 45%; }
.line-pick .lp-tools input { flex: 1; min-width: 0; }
.line-pick .lp-tools select:not(.lp-prop) { flex: 1; min-width: 0; max-width: none; }   /* (a drop-down line, beside the property) */
.line-pick select[size] { width: 100%; height: auto; padding: 2px; }
.line-pick select[size] optgroup { font-weight: 650; color: var(--muted); }
.line-pick select[size] option { color: var(--text); font-weight: 400; padding: 3px 6px; }
.line-pick select[size] option:checked { background: var(--accent) linear-gradient(0deg, var(--accent), var(--accent)); color: var(--on-accent); }
.line-pick .lp-chosen { font-size: .85rem; margin-top: 4px; }
tr.level-row td { font-weight: 600; color: var(--muted); background: var(--surface-2); }
@media (max-width: 800px) { .help-button span { display: none; } }
dialog .dlg-status { margin: -4px 0 10px; color: var(--muted); }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
dialog .buttons .left { margin-right: auto; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; padding: 10px; background: var(--surface-2); border-radius: 8px; user-select: all; word-break: break-all; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 8px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.error { background: var(--negative); color: #fff; }
/* Another tab switched workspace (site.js): across the top until the page is reloaded */
.page-alert {
  position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--warning-bg); color: var(--warning-text); border-bottom: 1px solid var(--border); font-weight: 600;
}
/* The page couldn't start (the service down): the message and Retry in place of its content */
.boot-error { text-align: center; padding: 24px 16px; }
/* Loading: the activity bar across the top, the opening card, and a dashboard box waiting for its data */
.busy-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity .2s; }
.busy-bar.on { opacity: 1; }
.busy-bar .busy-track { height: 3px; }
.busy-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease-out; }
.busy-label { position: absolute; top: 7px; right: 12px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1px 9px; }
.boot-wait { text-align: center; padding: 28px 16px; }
.boot-wait p { margin: 0 0 12px; color: var(--muted); }
.boot-wait .busy-track { height: 4px; max-width: 320px; margin: 0 auto; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.busy-fill.moving { width: 35%; animation: busy-slide 1.2s ease-in-out infinite; }
@keyframes busy-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.dash-wait { min-height: 120px; }
.wait-line { height: 12px; margin: 12px 0; border-radius: 6px; background: var(--surface-2); animation: wait-pulse 1.4s ease-in-out infinite; }
.wait-line.short { width: 40%; height: 14px; margin-top: 2px; }
.wait-line.mid { width: 70%; }
@keyframes wait-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .busy-fill.moving { animation: none; width: 100%; opacity: .5; } .wait-line { animation: none; } }
.boot-error p { margin: 0 0 12px; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.dropdown-menu a, .dropdown-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; border: 0; background: none; font: inherit; color: var(--text); text-decoration: none; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu .menu-section { padding: 6px 10px 2px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dropdown-menu .menu-current { display: block; padding: 6px 10px; font-weight: 600; color: var(--accent-strong); }
.dropdown-menu .menu-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown-menu .who { padding: 6px 10px 8px; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { border: 0; background: none; font: inherit; padding: 6px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 550; }
.tabs button.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

/* ===== Sign-in page */
.signin-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: min(400px, 100%); }
.signin-card .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 20px; }
.signin-card .brand svg { width: 34px; height: 34px; }
.signin-card .brand { width: auto; }
.signin-card h2 { font-size: 1.15rem; margin: 0 0 8px; }
.signin-foot { text-align: center; margin: 16px 0 0; font-size: .9rem; }
.forgot { margin: -4px 0 10px; text-align: right; font-size: .85rem; }
.site-banner { background: var(--warning-bg); color: var(--warning-text); text-align: center; padding: 8px 16px; font-size: .9rem; font-weight: 600; border-bottom: 1px solid color-mix(in srgb, var(--warning-text) 25%, transparent); }
.ms-btn { width: 100%; justify-content: center; gap: 10px; font-weight: 600; padding: 10px 12px; }
.ms-btn svg { width: 18px; height: 18px; flex: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* The public home page */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px max(16px, calc((100% - 1100px) / 2)); border-top: 6px solid var(--accent); background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.landing-top .brand { width: auto; font-size: 1.15rem; }
.landing-actions { display: flex; gap: 8px; }
.landing main { flex: 1; width: min(1100px, 100% - 32px); margin: 0 auto; }
.hero { text-align: center; padding: 64px 0 40px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.9rem); line-height: 1.15; margin: 0 0 18px; letter-spacing: -.02em; }
.hero h1 span { color: var(--accent); }
.hero .lead { font-size: 1.12rem; max-width: 720px; margin: 0 auto 26px; color: var(--muted); line-height: 1.55; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.btn.big { padding: 11px 22px; font-size: 1rem; }
.small { font-size: .85rem; }
a.btn { text-decoration: none; }
.pillars > .card + .card { margin-top: 0; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; padding: 12px 0 32px; }
.pillar { padding: 22px; }
.pillar h2 { font-size: 1.15rem; margin: 12px 0 10px; }
.pillar ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.6; }
.pillar-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.pillar-icon svg { width: 24px; height: 24px; }
/* AI: the Ask AI panel (a drawer on the right), and AI buttons on pages */
.ai-button svg, .ai-btn svg { color: #8b5cf6; }
/* a small window in the bottom-right corner, over the page but not blocking it; Enlarge makes it bigger */
dialog.ai-panel { position: fixed; inset: auto 16px 16px auto; margin: 0; z-index: 50; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 96px));
  max-width: none; max-height: none; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .22); display: none; flex-direction: column; background: var(--surface); color: var(--text); }
dialog.ai-panel.big { width: min(760px, calc(100vw - 32px)); height: calc(100vh - 96px); }
dialog.ai-panel[open] { display: flex; }
.ai-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); border-top: 4px solid var(--accent); }
.ai-panel .ai-msg { font-size: .9rem; }
@media (max-width: 520px) { dialog.ai-panel { inset: auto 8px 8px 8px; width: auto; } }
.ai-head strong { font-size: 1.05rem; }
.ai-head .muted { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 92%; padding: 9px 12px; border-radius: 10px; line-height: 1.5; font-size: .95rem; position: relative; }
.ai-msg p { margin: 0 0 8px; } .ai-msg p:last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: 0 0 8px; padding-left: 20px; }
.ai-msg.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.ai-msg.ai { align-self: flex-start; background: var(--surface-2); }
.ai-msg.thinking { opacity: .75; font-style: italic; }
.ai-msg .ai-copy { margin-top: 4px; font-size: .8rem; }
.ai-msg .table-wrap { margin: 4px 0 8px; } .ai-table { font-size: .88rem; background: var(--surface); }
.ai-hello { color: var(--muted); } .ai-hello p { margin-top: 0; }
.ai-example { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.ai-example:hover { border-color: var(--accent); }
.ai-ask { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.ai-ask textarea { flex: 1; resize: vertical; min-height: 44px; max-height: 200px; }
.ai-foot { font-size: .78rem; padding: 0 14px 10px; }
.ai-sub { font-size: 1rem; margin: 18px 0 6px; }
.ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.ai-row .muted { font-size: .85rem; }
.ai-suggest td select { max-width: 260px; }
.conf-high { color: var(--positive); } .conf-medium { color: var(--warning-text); } .conf-low { color: var(--negative); }

.budget-step { display: inline-flex; gap: 4px; align-items: center; }
.budget-step input { width: 80px; text-align: right; }
.em-when { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin: 8px 0; }
.em-label { color: var(--muted); font-size: .9rem; margin-right: 8px; }
.day-boxes { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; }
.day-box { margin: 0; }
.email-kinds { display: grid; gap: 4px; margin-bottom: 8px; }
.email-kinds .muted { font-size: .85rem; }

/* Settings -> Billing */
.bill-plan { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.bill-plan-name { font-size: 1.15rem; font-weight: 650; }
.bill-plan-price { font-size: 1.4rem; font-weight: 700; }
.bill-plan-price .muted { font-size: .9rem; font-weight: 400; }
.bill-includes { margin: 12px 0; padding-left: 20px; line-height: 1.7; }

/* An invoice from RITS (invoice.html): a white page, printable */
.invoice-page { background: var(--bg); }
.invoice-tools { display: flex; gap: 8px; padding: 12px 16px; max-width: 860px; margin: 0 auto; }
.invoice-tools .spacer { flex: 1; }
.invoice-doc { position: relative; background: #fff; color: #1c2430; max-width: 820px; margin: 0 auto 32px; padding: 40px 44px; border: 1px solid #dde1e7; border-radius: 6px; font-size: 14px; line-height: 1.5; }
.invoice-doc .muted { color: #5f6b7a; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.inv-from { font-size: 18px; font-weight: 700; color: #0f766e; margin-bottom: 4px; }
.inv-title { text-align: right; } .inv-title h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: .02em; }
.inv-meta th { text-align: right; color: #5f6b7a; font-weight: 500; padding: 1px 10px 1px 0; } .inv-meta td { text-align: right; padding: 1px 0; }
.inv-to { margin-bottom: 22px; }
.inv-lines { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.inv-lines th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #5f6b7a; border-bottom: 2px solid #1c2430; padding: 6px 8px; }
.inv-lines td { padding: 8px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.inv-lines .num, .inv-totals td { text-align: right; white-space: nowrap; }
.inv-totals { margin-left: auto; min-width: 280px; border-collapse: collapse; }
.inv-totals th { text-align: right; font-weight: 500; padding: 4px 16px 4px 8px; color: #5f6b7a; } .inv-totals td { padding: 4px 8px; }
.inv-totals .grand th, .inv-totals .grand td { border-top: 2px solid #1c2430; font-weight: 700; color: #1c2430; font-size: 16px; padding-top: 8px; }
.inv-pay { margin-top: 26px; padding: 12px 14px; background: #f5f6f8; border-radius: 6px; }
.inv-foot { margin-top: 30px; font-size: 12px; text-align: center; }
.inv-stamp { position: absolute; top: 18px; left: 50%; transform: translateX(-50%) rotate(-4deg); border: 3px solid #b42318; color: #b42318; padding: 2px 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; border-radius: 6px; opacity: .8; }
.inv-stamp.paid { border-color: #067647; color: #067647; } .inv-stamp.void { border-color: #5f6b7a; color: #5f6b7a; }
@media print { .invoice-tools { display: none; } .invoice-doc { border: 0; margin: 0; max-width: none; padding: 0; } .invoice-page { background: #fff; } }
@media (max-width: 640px) { .invoice-doc { padding: 22px 16px; } .inv-head { flex-direction: column; } .inv-title { text-align: left; } .inv-meta th, .inv-meta td { text-align: left; } }

/* The privacy statement and terms */
.legal { width: min(820px, 100% - 32px); margin: 0 auto; padding: 32px 0 40px; line-height: 1.6; }
.legal h1 { font-size: 1.8rem; margin: 0 0 4px; }
.legal h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.log-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.log-filters input[type="search"] { flex: 1 1 220px; min-width: 0; }
.log-filters select { max-width: 190px; }
.log-filters .inline-label { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.ev-detail { max-width: 420px; overflow-wrap: anywhere; font-size: .9rem; }
.audience { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: -8px 0 24px; }
.audience span { padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .85rem; font-weight: 600; }
.business { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 8px 32px; padding: 24px; margin-bottom: 32px; }
.business h2 { margin: 0 0 8px; font-size: 1.25rem; }
.business p { margin: 0; line-height: 1.55; }
.business ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.7; }
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 20px; padding: 12px 0 36px; }
.why h3 { font-size: 1rem; margin: 0 0 6px; }
.why p { margin: 0; line-height: 1.5; }
.closing { text-align: center; padding: 32px 20px; margin-bottom: 40px; }
.closing h2 { margin: 0 0 16px; font-size: 1.35rem; }
.landing-foot { text-align: center; padding: 18px 16px 24px; font-size: .85rem; }
@media (max-width: 520px) { .landing-top .brand { font-size: 1rem; } .landing-actions .btn { padding: 6px 10px; } .hero { padding-top: 36px; } }

/* ===== The register */
.register-tools { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.register-tools select { width: auto; }
.register-tools input:not([type="checkbox"]):not([type="radio"]) { flex: 1; min-width: 200px; }
#registerWrap { max-height: calc(100vh - 330px); min-height: 240px; overflow-y: auto; }
#registerWrap thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.register td { padding: 3px 8px; }
/* (it fills the space it has: dates, numbers and amounts whole; Payee, Category and Business account share the rest, cut
   short with … - their shares set in register.js) */
table.register { width: 100%; table-layout: auto; }
table.register td.date, table.register th[data-col="date"], table.register td.num, table.register th.num { width: 1%; white-space: nowrap; }
table.register td.col-payee, table.register td.col-cat, table.register td.col-biz, table.register th[data-col="payee"], table.register th[data-col="category"], table.register th[data-col="biz"] {
  max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.register td.col-payee .sub, table.register td.col-cat .sub { overflow: hidden; text-overflow: ellipsis; }
/* (columns sized by hand: P.columnWidths) */
th[data-col] { position: relative; }
.col-grip { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 1; }
.col-grip:hover, body.col-resizing .col-grip { background: var(--accent-soft); }
body.col-resizing { cursor: col-resize; user-select: none; }
table.cols-sized { table-layout: fixed; }
table.cols-sized td, table.cols-sized th { overflow: hidden; text-overflow: ellipsis; }
table.register .sub { font-size: .8rem; color: var(--muted); }
table.register .col-num, table.register .col-status { width: 1%; white-space: nowrap; }
table.register.no-biz .col-biz { display: none; }   /* (Business account: only on accounts that hold business transactions) */
table.register .col-biz { color: var(--muted); font-size: .9rem; }
table.register tr.before td { color: var(--muted); font-style: italic; }
table.register td.date { white-space: nowrap; }
.status-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font: inherit; font-size: .75rem; font-weight: 700; color: var(--muted); padding: 0;
}
.status-btn.c { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.status-btn.r { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.status-btn:disabled { cursor: default; }

/* ===== Transaction dialog */
dialog.wide-dialog { width: min(var(--wide-dlg-w, 860px), calc(100vw - 32px)); }
dialog.wide-dialog .form-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }   /* as many fields on a line as fit */
dialog.item-dialog { width: min(max(1200px, var(--wide-dlg-w, 0px)), calc(100vw - 32px)); padding: 18px 22px; }
.item-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
.item-cols h3 { margin: 0 0 8px; font-size: 1rem; }
.item-facts { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 10px; }
.item-candidates tr.picked-row td { background: var(--accent-soft); }
#applyRows tr.sub-row td { border-top: 0; padding-top: 2px; }
#applyRows tr.sub-row td.what { padding-left: 30px; position: relative; }
#applyRows tr.sub-row td.what::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 6px; width: 3px; border-radius: 2px; background: var(--accent); opacity: .55; }
.item-candidates tr.split-parent td { border-bottom: 0; }
.item-candidates tr.split-line td { border-top: 0; padding-top: 3px; padding-bottom: 3px; }
.item-candidates tr.split-line td:nth-child(3) { padding-left: 26px; position: relative; }
.item-candidates tr.split-line td:nth-child(3)::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 3px; border-radius: 2px; background: var(--accent); opacity: .55; }
#applyRows tr.context-row td { opacity: .62; }
.apply-runs { margin-top: 6px; }
.apply-runs summary { cursor: pointer; font-size: .9rem; }
.apply-runs table { margin-top: 6px; }
.item-sources { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.item-sources select[data-rest] { width: auto; max-width: 220px; margin-top: 4px; display: block; }
@media (max-width: 800px) { .item-cols { grid-template-columns: 1fr; } }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; width: 1px !important; height: 1px; margin: 0; padding: 0; }   /* (tiny: a full-width one sticks out of a dialog, which then scrolls sideways as you type) */
.segmented span { display: block; padding: 4px 12px; cursor: pointer; font-weight: 550; color: var(--muted); }
.segmented input:checked + span { background: var(--accent); color: var(--on-accent); }
/* Settings → Encryption: the key flow chart */
.sec-flow { --sec-private: #8e44d6; --sec-vault: #2f80ed; }
:root[data-theme="dark"] .sec-flow { --sec-private: #c084fc; --sec-vault: #60a5fa; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sec-flow { --sec-private: #c084fc; --sec-vault: #60a5fa; } }
.sec-flow svg { display: block; width: 100%; height: auto; max-width: 780px; }
.sec-flow text { font: 13px system-ui, sans-serif; fill: var(--text); }
.sec-flow text.sub { font-size: 11.5px; fill: var(--muted); }
.sec-flow text.head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); }
.sec-flow text.b { font-weight: 600; }
.sec-flow .step rect { fill: var(--accent-soft); stroke: var(--accent); }
.sec-flow .num { fill: var(--accent); } .sec-flow text.numt { fill: var(--on-accent); font-size: 12px; font-weight: 700; }
.sec-flow .db rect { fill: var(--surface-2); stroke: var(--border); }
.sec-flow .vault rect { fill: none; stroke: var(--sec-vault); stroke-width: 1.5; }
.sec-flow .priv rect { stroke: var(--sec-private); stroke-width: 1.5; stroke-dasharray: 5 3; fill: none; }
.sec-flow .priv .num { fill: var(--sec-private); }
.sec-flow .arrow { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.sec-flow .arrow.priv { stroke: var(--sec-private); stroke-dasharray: none; }
.sec-flow .tag { fill: var(--sec-private); font-size: 11px; font-weight: 600; }
.sec-now { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.sec-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sec-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.sec-card.private { border-color: #8e44d6; }
.sec-card p { margin: 6px 0 0; }
@media (max-width: 640px) { .sec-cards { grid-template-columns: 1fr; } }
.segmented button { border: 0; background: transparent; padding: 5px 14px; cursor: pointer; font: inherit; font-weight: 550; color: var(--muted); }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--accent); color: var(--on-accent); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.split-box { margin: 0 0 10px; }
table.splits td { padding: 4px; border-bottom: 0; }
table.splits input, table.splits select { padding: 6px 8px; }
table.splits td:nth-child(4) { width: 120px; }
table.splits td:last-child { width: 1%; }
.split-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 8px; }
.split-foot .bad { color: var(--negative); font-weight: 600; }
.stat-inline { font-size: 1.2rem; font-weight: 650; padding: 6px 0; font-variant-numeric: tabular-nums; }
.rec-list { max-height: 45vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.rec-list td:first-child { width: 1%; }

/* ===== Categories */
.cat-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.cat-columns .card + .card { margin-top: 0; }

/* ===== Import */
.map-wrap { max-height: 420px; overflow-y: auto; }
.map-wrap thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.map-wrap select, .import-files select { min-width: 260px; }
#catRows.only-new tr[data-new="0"] { display: none; }
.new-account { display: flex; gap: 6px; margin-top: 6px; }
.new-account select { min-width: 0; width: auto; }
.sub { font-size: .8rem; }

/* ===== Investments */
.invest-account + .invest-account { margin-top: 28px; }
.invest-account .stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat .value small { font-size: .8rem; font-weight: 500; }
table.holdings td { padding: 4px 8px; }
.price-add { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.price-add input { width: auto; flex: 1; min-width: 140px; }

tr.flag td { background: var(--accent-soft); }
.positive { color: var(--positive); }

/* ===== Documents box */
/* A screen's sections: a box with a title bar (details, lines, payments, documents...) */
.panel, .docs-box { --tone: #2f80ed; background: var(--surface); border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border)); border-left: 4px solid var(--tone);
  border-radius: 8px; margin: 0 0 10px; overflow: visible; }   /* visible: dropdowns inside can open over what's below */
.panel > .panel-head, .docs-box > .docs-head { border-radius: 7px 7px 0 0; }
.panel.collapsed > .panel-head, .docs-box.collapsed > .docs-head { border-radius: 7px; }
.panel > :last-child:not(.panel-head) { border-bottom-left-radius: 7px; border-bottom-right-radius: 7px; }
.panel .dropdown-menu { z-index: 40; }
section.panel:nth-of-type(4n+2) { --tone: #27ae60; }
section.panel:nth-of-type(4n+3) { --tone: #f2994a; }
section.panel:nth-of-type(4n+4) { --tone: #9b51e0; }
.docs-box { --tone: #00a3a3; }
.panel[data-tone="blue"] { --tone: #2f80ed; } .panel[data-tone="green"] { --tone: #27ae60; } .panel[data-tone="orange"] { --tone: #f2994a; }
.panel[data-tone="purple"] { --tone: #9b51e0; } .panel[data-tone="red"] { --tone: #eb5757; } .panel[data-tone="teal"] { --tone: #00a3a3; } .panel[data-tone="grey"] { --tone: #8a96a6; } .panel[data-tone="gold"] { --tone: #c58a12; }
.panel.collapsed > :not(.panel-head), .docs-box.collapsed > :not(.docs-head) { display: none; }
.panel.collapsed > .panel-head, .docs-box.collapsed > .docs-head { border-bottom: 0; }
.panel > .panel-head, .docs-box > .docs-head { cursor: pointer; user-select: none; }
.panel > .panel-head > strong:first-child::before, .docs-box > .docs-head > strong:first-child::before { content: '▾'; display: inline-block; width: 1.1em; color: var(--tone); transition: transform .12s; }
.panel.collapsed > .panel-head > strong:first-child::before, .docs-box.collapsed > .docs-head > strong:first-child::before { transform: rotate(-90deg); }
.panel-head, .docs-box .docs-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 6px 10px;
  background: color-mix(in srgb, var(--tone) 12%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--tone) 25%, var(--border)); }
.panel-head > strong:first-child, .docs-box .docs-head > strong:first-child { font-weight: 650; }
.panel-head .muted { font-weight: 400; font-size: .9rem; }
.panel-body { padding: 10px 10px 2px; }
.panel-body.flush { padding: 0; }
.panel-body.flush .table-wrap { margin: 0; }
.panel-body.flush table.grid tfoot td { background: var(--surface-2); }
.panel-foot { padding: 6px 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.panel-foot .register-tools, .panel-foot .event-add, .panel-foot .price-add, .panel-foot .split-foot { margin: 0; }
.panel-body > .check:last-child, .panel-body > .segmented:last-child { margin-bottom: 8px; }
.docs-box ul.docs { padding: 4px 10px 6px; }
/* (files being dragged over a Documents box, ready to drop) */
dialog.docs-dropping { outline: 3px dashed var(--accent); outline-offset: -3px; }
.docs-drop { outline: 2px dashed var(--accent); outline-offset: 2px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.docs-box > .empty, .docs-box > p { margin: 0; padding: 8px 10px; }
.docs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.docs-head label.btn { margin: 0; }
ul.docs { list-style: none; margin: 0; padding: 0; }
ul.docs li { display: flex; align-items: center; gap: 6px; padding: 4px 0; flex-wrap: wrap; }
ul.docs li .muted { font-size: .8rem; }
ul.docs li button { margin-left: auto; }

/* ===== Property */
.prop-card + .prop-card { margin-top: 16px; }
/* Properties: each level its own colour - property red, building blue, space green */
.prop-card { --p-tone: #eb5757; --b-tone: #2f80ed; --s-tone: #27ae60; border-top: 4px solid var(--p-tone); }
.prop-card .building { margin-top: 12px; padding: 8px 10px 10px; border: 1px solid color-mix(in srgb, var(--b-tone) 30%, var(--border)); border-left: 4px solid var(--b-tone);
  border-radius: 8px; background: color-mix(in srgb, var(--b-tone) 5%, var(--surface)); }
.prop-card .building-title { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.prop-card .building .table-wrap { background: var(--surface); border-radius: 6px; }
.prop-card .building table.grid thead th { background: color-mix(in srgb, var(--s-tone) 12%, var(--surface)); }
.prop-card .building table.grid tbody td:first-child { border-left: 3px solid var(--s-tone); }
.kind-chip { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 999px; font-size: .7rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; vertical-align: middle; color: #fff; }
.kind-chip.p { background: #c0392b; } .kind-chip.b { background: #1f6fd1; } .kind-chip.s { background: #1e8a4c; } .kind-chip.z { background: #6b4fbb; }
/* (Properties: each business at the top, its properties under it) */
.biz-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.biz-group-title:first-child { margin-top: 0; }
.biz-group-title h2 { margin: 0; font-size: 1.15rem; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }
.vacant { color: var(--warning-text); font-weight: 600; }
.checklist { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.checklist .group { font-size: .8rem; color: var(--muted); margin: 6px 0 2px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 2px 0; }
.event-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.event-add input, .event-add select { width: auto; flex: 1; min-width: 110px; padding: 6px 8px; }
tr.group-row td { font-weight: 650; background: var(--surface-2); }
tr.detail td { font-size: .9rem; }

/* Side bar date */
.nav-date { padding: 4px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .95rem; color: var(--text); }

/* Bills & Deposits: calendar */
.calendar .cal-head, .calendar .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar .cal-head div { padding: 6px 8px; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 92px; padding: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--surface-2); opacity: .6; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.today .cal-num { color: var(--accent-strong); }
.cal-num { font-size: .8rem; font-weight: 600; color: var(--muted); }
.cal-item { display: flex; justify-content: space-between; gap: 4px; width: 100%; border: 0; border-radius: 4px; padding: 1px 4px; font: inherit; font-size: .78rem; cursor: pointer; text-align: left; }
.cal-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item b { font-weight: 600; white-space: nowrap; }
.cal-item.out { background: var(--danger-bg); color: var(--negative); }
.cal-item.in { background: var(--accent-soft); color: var(--positive); }
.cal-item.xfer { background: var(--surface-2); color: var(--text); }
@media (max-width: 800px) { .cal-day { min-height: 60px; } .cal-item span { display: none; } }

/* Bills & Deposits: forecast */
.fc-accounts { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.fc-chart svg { display: block; max-width: 100%; }
.fc-card { padding: 8px 8px 6px; }
.segmented.fc-left { margin-bottom: 0; }
.acc-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.acc-bulk.hidden { display: none; }
.acc-bulk-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.acc-bulk-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.acc-bulk .spacer { flex: 1; }
.segmented.fc-left button { padding: 3px 10px; font-size: .85rem; }
.fc-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }
.fc-grid { stroke: var(--border); stroke-width: 1; }
.fc-vgrid { stroke-dasharray: 2 4; opacity: .7; }
.fc-warn { stroke: var(--negative); stroke-width: 1.5; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.fc-warn-text { fill: var(--negative); }
.fc-cross { stroke: var(--muted); stroke-dasharray: 2 3; opacity: 0; pointer-events: none; }
.fc-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; opacity: 0; pointer-events: none; }
.fc-hit { cursor: pointer; }
.fc-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8rem; padding: 2px 6px 0; align-items: center; }
.fc-sw { display: inline-block; width: 18px; border-top: 2px solid var(--muted); vertical-align: middle; }
.fc-sw-future { border-top-style: dashed; }
.watch-layout:not(.hidden) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .watch-layout:not(.hidden) { grid-template-columns: 1fr; } }
.watch-side { position: sticky; top: 70px; }
.watch-side .panel + .panel { margin-top: 12px; }
#watchRows tr.selected td { background: var(--accent-soft); }
.wl-ranges { display: flex; gap: 2px; margin-bottom: 6px; }
.wl-ranges button { border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .8rem; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.wl-ranges button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ws-chart svg { display: block; max-width: 100%; }
.ws-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.ws-line.up { stroke: var(--positive); } .ws-line.down { stroke: var(--negative); }
.ws-area.up { fill: color-mix(in srgb, var(--positive) 10%, transparent); } .ws-area.down { fill: color-mix(in srgb, var(--negative) 10%, transparent); }
.ws-level { stroke-width: 1.2; stroke-dasharray: 5 4; }
.ws-level.buy { stroke: #2a78d6; } .ws-level.sell { stroke: #d9822b; }
.ws-level-text.buy { fill: #2a78d6; } .ws-level-text.sell { fill: #d9822b; }
.ws-trade { stroke: var(--surface); stroke-width: 2; }
.ws-trade.buy { fill: #2a78d6; } .ws-trade.sell { fill: #d9822b; }
.ws-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.ws-key.buy { background: #2a78d6; } .ws-key.sell { background: #d9822b; }
tr.estimate td { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); font-style: italic; }
tr.below td:last-child { box-shadow: inset 3px 0 0 var(--negative); }
.fc-mark line { stroke: #7a5af8; stroke-width: 1.5; }
.fc-mark circle { fill: #7a5af8; stroke: var(--surface); stroke-width: 2; }
.fc-mark text { fill: #7a5af8; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
tr.picked td { background: color-mix(in srgb, #7a5af8 14%, var(--surface)) !important; }
.mr-notes { margin: 0; padding-left: 18px; } .mr-notes li { margin: 3px 0; }
.mr-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 12px; }
.mr-sub td { font-weight: 600; color: var(--muted); border-top: 1px solid var(--border); }
.mr-total td { font-weight: 700; border-top: 2px solid var(--border); }
tr.mr-top { cursor: pointer; } .mr-tw { display: inline-block; width: 10px; color: var(--muted); }
a.report-card { text-decoration: none; color: inherit; }
tr.flash td { background: color-mix(in srgb, var(--accent) 22%, var(--surface)) !important; transition: background .3s; }
.fc-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.fc-zero { stroke: var(--negative); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.fc-axis { font-size: 11px; fill: var(--muted); }

/* A dropdown of tick boxes (e.g. which accounts) */
.check-menu { min-width: 260px; max-height: 60vh; overflow-y: auto; right: auto; left: 0; }
.check-menu .menu-section { padding: 6px 6px 2px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.check-menu .menu-section { display: block; }
.check-menu label { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; width: 100%; padding: 3px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; text-align: left; }
.check-menu label input { flex: none; width: auto; min-width: 0; margin: 0; padding: 0; }
.check-menu label span { flex: 1; }
.check-menu label:hover { background: var(--surface-2); }
.check-menu .menu-links a { display: inline; width: auto; padding: 2px 4px; }
.check-menu .menu-links { display: flex; gap: 10px; padding: 4px 6px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* Dashboards */
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
a.stat-link { color: inherit; text-decoration: none; transition: border-color .12s, transform .12s; }
a.stat-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.alert { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 12px; margin-bottom: 8px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); }
.alert.warn { border-left-color: #f2994a; background: var(--warning-bg); color: var(--warning-text); }
.alert.danger { border-left-color: #eb5757; background: var(--danger-bg); }
/* Help */
.help-page p { margin: 0 0 8px; line-height: 1.5; max-width: 900px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.help-page .panel { scroll-margin-top: calc(var(--head-h, 60px) + 50px); }

/* Forms with labels to the left of their fields, two pairs to a row */
.hgrid { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 6px 10px; align-items: center; margin-bottom: 8px; }
.hgrid > .hl { font-weight: 550; white-space: nowrap; }
.hgrid > .span3 { grid-column: span 3; }
.hgrid > div > input, .hgrid > div > select { width: 100%; }
.hline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; }
input.tiny { width: 64px; padding: 3px 6px; }
.req { color: var(--negative); font-weight: 700; }
.end-row { padding-left: 24px; }
.end-row.dim .hl { opacity: .5; }
@media (max-width: 700px) { .hgrid { grid-template-columns: max-content minmax(0, 1fr); } .hgrid > .span3 { grid-column: span 1; } }

/* Pop-ups never scroll sideways - anything wide scrolls inside its own box */
dialog { overflow-x: hidden; overflow-y: auto; }
dialog form { max-width: 100%; box-sizing: border-box; }
dialog .table-wrap { overflow-x: auto; }
dialog .hgrid, dialog .form-grid { min-width: 0; }
/* Month headings in dated lists */
tr.month-row td { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); font-weight: 650; padding-top: 4px; padding-bottom: 4px; position: sticky; top: 0; z-index: 1; }
thead + tbody tr.month-row td { top: calc(var(--thead-h, 28px) - 1px); }
.month-head { display: flex; justify-content: space-between; gap: 10px; }
.month-head .muted { font-weight: 400; }
tr.scheduled td { background: color-mix(in srgb, #f2994a 6%, var(--surface)); }
.fc-future { stroke-dasharray: 5 4; opacity: .85; }
.fc-today { stroke: var(--muted); stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.register-tools input.date-input { flex: none; min-width: 0; width: auto; }
.register-tools .inline-label { display: flex; align-items: center; gap: 6px; }

/* Investment groups: a row of tabs */
.group-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.group-tabs button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 3px 12px; font: inherit; cursor: pointer; }
.group-tabs button.active { background: #00a3a3; border-color: #00a3a3; color: #fff; font-weight: 600; }
.group-tabs button.add { border-style: dashed; color: var(--accent-strong); }

/* ===== Charts (reports). Colours from the validated palette in its fixed order: blue, orange, aqua, yellow, magenta, green; dark steps for dark mode. */
.viz-root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; --viz-grid: #e6e8ec; --viz-axis: #6b7280;
  --heat-1: #cde2fb; --heat-2: #9ec5f4; --heat-3: #6da7ec; --heat-4: #3987e5; --heat-5: #256abf; --heat-6: #184f95; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --viz-grid: #2a3542; --viz-axis: #9aa7b6;
    --heat-1: #104281; --heat-2: #184f95; --heat-3: #1c5cab; --heat-4: #256abf; --heat-5: #2a78d6; --heat-6: #3987e5; }
}
:root[data-theme="dark"] .viz-root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --viz-grid: #2a3542; --viz-axis: #9aa7b6;
  --heat-1: #104281; --heat-2: #184f95; --heat-3: #1c5cab; --heat-4: #256abf; --heat-5: #2a78d6; --heat-6: #3987e5; }
.viz-svg { width: 100%; height: auto; display: block; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-zero { stroke: var(--viz-axis); stroke-width: 1; stroke-dasharray: 3 3; }
.viz-axis { font-size: 11px; fill: var(--viz-axis); }
.viz-svg .s1 { fill: var(--series-1); }
.viz-svg .s2 { fill: var(--series-2); }
.viz-svg .s3 { fill: var(--series-3); } .viz-svg .s4 { fill: var(--series-4); } .viz-svg .s5 { fill: var(--series-5); } .viz-svg .s6 { fill: var(--series-6); }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.viz-line.s1 { stroke: var(--series-1); fill: none; }
/* (every series a line, never a filled shape - the second's fill had turned lines into red wedges) */
.viz-svg .viz-line { fill: none; }
.viz-line.s2 { stroke: var(--series-2); } .viz-line.s3 { stroke: var(--series-3); } .viz-line.s4 { stroke: var(--series-4); } .viz-line.s5 { stroke: var(--series-5); } .viz-line.s6 { stroke: var(--series-6); }
.viz-cross { stroke: var(--viz-axis); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; }
.viz-dot { opacity: 0; stroke: var(--surface); stroke-width: 2; }
.viz-hit { cursor: pointer; }
.viz-hit:hover .viz-cross, .viz-hit:hover .viz-dot { opacity: 1; }
.viz-hit:hover path { filter: brightness(1.08); }
.viz-legend { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.viz-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.viz-legend .sw.s1 { background: var(--series-1); } .viz-legend .sw.s2 { background: var(--series-2); }
.viz-legend .sw.s3 { background: var(--series-3); } .viz-legend .sw.s4 { background: var(--series-4); } .viz-legend .sw.s5 { background: var(--series-5); } .viz-legend .sw.s6 { background: var(--series-6); }
.viz-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 6px 10px; font-size: .9rem; min-width: 150px; }
.viz-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
.viz-tip .tip-row b { font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 4px; }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 220px) 1fr max-content; align-items: center; gap: 10px; padding: 2px 4px; border-radius: 6px; }
.hbar-row.clickable:hover { background: var(--surface-2); }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 14px; display: block; }
.hbar { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar-value { font-variant-numeric: tabular-nums; text-align: right; min-width: 90px; }
table.heat td.heat-cell { font-variant-numeric: tabular-nums; }
table.heat td.heat-cell[style*="--heat:1"] { background: var(--heat-1); } table.heat td.heat-cell[style*="--heat:2"] { background: var(--heat-2); }
table.heat td.heat-cell[style*="--heat:3"] { background: var(--heat-3); } table.heat td.heat-cell[style*="--heat:4"] { background: var(--heat-4); color: #fff; }
table.heat td.heat-cell[style*="--heat:5"] { background: var(--heat-5); color: #fff; } table.heat td.heat-cell[style*="--heat:6"] { background: var(--heat-6); color: #fff; }
table.heat td.heat-cell:hover { outline: 2px solid var(--text); outline-offset: -2px; }
table.heat td:first-child, table.heat th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
.toggle { cursor: pointer; }

/* Tick-box dropdowns (report filters) */
.check-dd { display: inline-block; }
.check-dd-btn { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-content: flex-start; }
.check-dd .check-menu { min-width: 300px; }
.check-dd .check-search { width: 100%; margin-bottom: 4px; }
.check-dd .check-items { max-height: 50vh; overflow-y: auto; }
.check-menu label.indent { padding-left: 22px; }
.pick-row { display: flex; gap: 6px; align-items: center; }
.hgrid > div[id$="Pick"], .hgrid > .pick-row { min-width: 0; }
/* Report gallery */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 8px; }
.report-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; }
.report-card:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.report-card .rc-name { font-weight: 650; }
.report-card .rc-desc { font-size: .85rem; color: var(--muted); }
.report-card.fav { border-left: 4px solid #f2994a; }

.spend-cell select { width: auto; padding: 1px 6px; font-size: .9rem; }
.spend-cell select.spend-discretionary { border-color: #f2994a; }
.spend-cell select.spend-essential { border-color: #27ae60; }

/* Reports: the chart-type switch, and charts drawn at their real size */
.chart-type { margin: 0; }
.viz-svg.fixed { width: auto; max-width: 100%; }
.viz { min-height: 40px; }
.viz-label { font-size: 11px; fill: var(--text); }

/* Icon toolbars (like PMS): a coloured icon over a short label */
.icon-toolbar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 2px; padding: 4px; margin: 0 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.tb-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 58px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--text); font: inherit; font-size: .8rem; cursor: pointer; }
.tb-btn svg { width: 22px; height: 22px; color: var(--tb); }
.tb-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--tb) 10%, var(--surface)); border-color: color-mix(in srgb, var(--tb) 30%, var(--border)); }
.tb-btn.on { background: color-mix(in srgb, var(--tb) 16%, var(--surface)); border-color: var(--tb); font-weight: 600; }
.tb-btn:disabled { opacity: .35; cursor: default; }
.tb-gap { width: 1px; margin: 4px 6px; background: var(--border); }
/* Right-click menus */
.ctx-menu { position: fixed; z-index: 70; min-width: 190px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.ctx-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 5px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ctx-menu button:hover:not(:disabled) { background: var(--surface-2); }
.ctx-menu button:disabled { opacity: .4; cursor: default; }
.ctx-menu svg { width: 16px; height: 16px; color: var(--tb); flex: none; }
.ctx-menu .ctx-pad { width: 16px; }
.ctx-sep { height: 1px; margin: 3px 4px; background: var(--border); }
.ctx-menu:focus { outline: none; }
.ctx-menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx-menu .ctx-bold { font-weight: 650; }
.ctx-menu .ctx-arrow { margin-left: auto; padding-left: 14px; color: var(--muted); }
.ctx-menu button[aria-expanded="true"] { background: var(--surface-2); }
.ctx-menu.ctx-sub { z-index: 71; }
/* The Record dialog (Enter in Register, as Money's "Record Payment to ..."): two columns of label + field rows */
.record-dialog .rec-head { margin: 0 0 10px; }
.record-dialog .rec-head .muted { font-size: .9rem; }
.record-dialog .rec-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 18px; }
.record-dialog .rec-row { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 6px; }
.record-dialog .rec-row > label { font-weight: 550; }
.record-dialog .rec-row .hint { font-size: .8rem; margin-top: 1px; }
.record-dialog .rec-static { padding: 5px 0; }
.record-dialog .rec-pick { display: flex; gap: 6px; align-items: center; }
.record-dialog .rec-pick > select { flex: 1; min-width: 0; }
.record-dialog .rec-split-sum { flex: 1; color: var(--muted); }
.record-dialog .rec-split { margin: 4px 0 8px; }
.record-dialog .rec-split td input, .record-dialog .rec-split td select { padding: 3px 6px; }
.record-dialog .rec-foot { margin: 6px 0; font-size: .9rem; color: var(--muted); }
.record-dialog .docs-box { margin-top: 6px; }
@media (max-width: 640px) { .record-dialog .rec-cols { grid-template-columns: 1fr; } .record-dialog .rec-row { grid-template-columns: 7em minmax(0, 1fr); } }
/* A selected row (lists you pick from, like PMS) */
tr.selected td { background: color-mix(in srgb, var(--accent) 14%, var(--surface)) !important; }
.records-found { font-size: .85rem; color: var(--muted); align-self: center; }
/* Printing: just the page's content */
/* Making a PDF of a report (reports.js savePdf): just the report, whole tables, no toolbars */
body.pdf-render #repToolbar, body.pdf-render #reportView > .page-head .actions, body.pdf-render #customise, body.pdf-render #backToGallery, body.pdf-render #repError { display: none !important; }
body.pdf-render .fit-screen, body.pdf-render [data-fit] { max-height: none !important; overflow: visible !important; }
body.pdf-render .doc-only { display: block !important; } body.pdf-render #stScreen, body.pdf-render #osScreen { display: none !important; }
body.pdf-render .pdf-letter { padding: 0 0 4px; max-width: none; box-shadow: none; border: 0; background: transparent; }
body.pdf-render .pdf-letter .st-letter { margin: 0 0 8px; } body.pdf-render .pdf-letter .st-date { margin-bottom: 4px; } body.pdf-render .pdf-letter .st-contact { margin-top: 4px; }
body.pdf-render .statement { box-shadow: none; border: 0; }
/* (the PDF maker skips empty coloured boxes: the legend's squares as coloured characters instead) */
body.pdf-render .viz-legend .sw { width: auto; height: auto; background: none !important; font-size: 14px; line-height: 1; }
body.pdf-render .viz-legend .sw::before { content: "\25A0"; }
body.pdf-render .viz-legend .sw.s1 { color: #2a78d6; } body.pdf-render .viz-legend .sw.s2 { color: #eb6834; }
/* The document version of a report (statement, opex summary): only for PDF and Print */
.doc-only { display: none; }
/* A tenant statement, laid out as a document like PMS's Monthly Report (fixed paper colours, whatever the scheme) */
.statement { padding: 28px 32px; max-width: 1000px; background: #fff; color: #111; font-size: 12px; --st-line: #d4d8de;
  --border: #d4d8de; --surface: #fff; --surface-2: #f3f4f6; --text: #111; --muted: #666; --accent: #0f766e; }
.statement .muted { color: #666; }
.statement .negative { color: #d0021b; }
.st-letter { margin: 0 6% 22px; }
.st-date { margin-bottom: 18px; }
.st-parties { display: flex; justify-content: space-between; gap: 24px; line-height: 1.45; }
.st-parties b { font-size: 14px; }
.st-from { text-align: right; }
.st-contact { margin-top: 14px; }
.st-contact b { font-size: inherit; }
.st-titlebox { border: 1px solid var(--st-line); margin-bottom: 18px; }
.st-title { font-size: 20px; font-weight: 700; padding: 6px 6px 8px; border-bottom: 1px solid var(--st-line); margin-bottom: 14px; }
.st-meta { border-collapse: collapse; width: 100%; }
.st-meta th { text-align: left; width: 110px; white-space: nowrap; padding: 2px 4px; font-weight: 700; border-top: 1px solid var(--st-line); border-right: 1px solid var(--st-line); }
.st-meta td { padding: 2px 4px; border-top: 1px solid var(--st-line); }
.st-grid { width: 100%; border-collapse: collapse; margin-bottom: 22px; }
.st-grid th, .st-grid td { border: 1px solid var(--st-line); padding: 2px 4px; text-align: left; font-weight: 400; }
.st-grid .num { text-align: right; white-space: nowrap; }
.st-grid thead tr:not(.st-sec) th { background: #f0f0f0; font-weight: 700; }
.st-grid tr.st-sec th { font-weight: 700; text-transform: uppercase; padding: 5px 10px; }
.st-blue tr.st-sec th { background: #c5e4f3; }
.st-peach tr.st-sec th { background: #fbe1d3; }
.st-grid tfoot td, .st-grid tr.st-bold td { font-weight: 700; background: #f0f0f0; }
.st-grid tr.st-gap td { height: 12px; }
.st-band { background: #fbe1d3; border: 1px solid var(--st-line); text-align: center; font-weight: 700; text-transform: uppercase; padding: 6px; margin-bottom: 18px; }
.st-note { margin: 0 0 6px; }
/* The statement itself: title, running-balance table and how overdue */
.st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 4px 0 14px; }
.st-head .st-title { font-size: 24px; border: 0; padding: 0; margin: 0 0 2px; }
.st-table { margin-bottom: 18px; font-size: 12px; }
.st-table tr.st-open td { font-style: italic; }
.st-table tfoot td { font-weight: 600; border-top: 2px solid var(--border); }
.st-age { width: auto; min-width: 60%; margin-left: auto; margin-bottom: 12px; font-size: 12px; }
.st-page { margin-top: 36px; padding-top: 28px; border-top: 2px dashed var(--st-line); }
@media print {
  /* Paper is white: light colours whatever the screen's scheme */
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --border: #d0d5dd; --text: #111; --muted: #555; color-scheme: light; }
  #backToGallery, body.doc-report #reportView > .page-head { display: none !important; }
  /* A report on paper: what's on screen (the chart or the table) in full; a statement or opex summary as its document */
  .fit-screen, [data-fit] { max-height: none !important; overflow: visible !important; }
  .doc-only { display: block !important; } #stScreen, #osScreen { display: none !important; }
  .statement { border: 0; padding: 0; max-width: none; box-shadow: none; }
  .st-page { break-before: page; margin-top: 0; padding-top: 0; border-top: 0; }
  /* Tighter on paper, so a month fits on a page */
  .statement { font-size: 11px; }
  .st-letter { margin: 0 4% 12px; } .st-date { margin-bottom: 10px; } .st-contact { margin-top: 6px; }
  .st-titlebox, .st-grid, .st-band { margin-bottom: 12px; } .st-title { font-size: 18px; margin-bottom: 8px; padding: 4px 6px 6px; }
  .st-grid th, .st-grid td { padding: 1px 4px; } .st-grid tr.st-sec th { padding: 3px 8px; }
  .st-grid tr { break-inside: avoid; }
  .statement, .statement * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .sidenav, .icon-toolbar, .register-tools, .tabs, .page-head .actions, .footer, .viz-tip, #customise, .help-button { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; max-width: none; }
  .table-wrap { max-height: none !important; overflow: visible !important; }
  .panel, .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}

/* Classic columns (single series): square, outlined, soft shadow */
.viz-root { --col-money: #fcc164; --col-money-edge: #2b2b2b; --col-shadow: rgba(60, 60, 60, .28); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .viz-root { --col-money: #e8a646; --col-money-edge: #0b0b0b; --col-shadow: rgba(0, 0, 0, .45); } }
:root[data-theme="dark"] .viz-root { --col-money: #e8a646; --col-money-edge: #0b0b0b; --col-shadow: rgba(0, 0, 0, .45); }
.viz-svg .col-money { fill: var(--col-money); stroke: var(--col-money-edge); stroke-width: 1; }
.viz-svg .col-shadow { fill: var(--col-shadow); }
.viz-hit:hover .col-money { filter: brightness(1.06); }
.viz-baseline { stroke: var(--viz-axis); stroke-width: 1; }

/* All income vs expenses */
table.incexp th { white-space: nowrap; text-transform: none; font-size: .8rem; line-height: 1.2; vertical-align: bottom; background: color-mix(in srgb, #2a78d6 14%, var(--surface)); }
table.incexp td { white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; padding-bottom: 2px; border-bottom: 0; }
table.incexp tr.ie-section td { font-weight: 700; padding-top: 10px; border-bottom: 1px solid var(--border); }
table.incexp tr.ie-subtotal td { color: #2a78d6; border-top: 1px solid var(--border); }
table.incexp tr.ie-grand td { color: #2a78d6; font-weight: 700; border-top: 2px solid var(--border); padding-top: 6px; }
table.incexp tr.ie-gap td { padding: 4px; }
table.incexp td.negative { color: var(--negative); }
table.incexp td.ie-total { font-weight: 600; }
table.incexp td:first-child, table.incexp th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.incexp thead th:first-child { background: color-mix(in srgb, #2a78d6 14%, var(--surface)); }

/* Report tables that scroll on their own: headings and the first column stay put */
.table-wrap.fit-screen { overflow: auto; }
.table-wrap.fit-screen thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
table.incexp thead th { background: color-mix(in srgb, #2a78d6 14%, var(--surface)); }
.table-wrap.fit-screen thead th:first-child { z-index: 3; }
/* Report-style tables on a page (data-fit: they take the rest of the screen and scroll on their own): headings stay at
   the top and totals at the bottom while the rows scroll */
.table-wrap.sticky-table { overflow: auto; }
.table-wrap.sticky-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.table-wrap.sticky-table tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); }
#reportView .panel-foot { margin-bottom: 0; }

.viz.fit-screen { overflow-y: auto; overflow-x: hidden; }
#reportView .panel { margin-bottom: 8px; }

.topbar .menu-toggle { display: none; }
@media (max-width: 800px) { .topbar .menu-toggle { display: inline-flex; } .brand { width: auto; } }
@media (max-width: 700px) {
  .topbar .menu-toggle { display: none; }
  /* (the top bar on a phone: the logo, Help, and the account button with just the workspace - Requests is on the Home section's menu) */
  .topbar { gap: 6px; }
  #requestsButton { display: none; }
  #userButton > span:first-child { display: none; }
  #userButton .user-ws { border-left: 0; padding-left: 0; max-width: 34vw; }
  #bankPane .feed-table > thead { display: none !important; }
}
/* Header shortcuts: a group with a sideways label (like PMS) */
.hdr-shortcuts { display: flex; align-self: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.hdr-shortcuts:empty { display: none; }
@media (max-width: 800px) { .hdr-shortcuts { display: none; } }
.hdr-shortcuts > a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 10px; white-space: nowrap; color: var(--muted);
  text-decoration: none; font-weight: 550; font-size: .85rem; border-bottom: 3px solid transparent; max-width: 130px; }
.hdr-shortcuts > a .sec-label { overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.hdr-shortcuts > a:hover { color: var(--text); }
.sec-group-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .66rem; font-weight: 650; color: var(--muted); letter-spacing: .02em; white-space: nowrap; line-height: 1;
  padding: 4px 3px; margin-left: 8px; border-right: 1px solid var(--border); align-self: center; }
/* Icon and colour pickers */
.icon-pick, .colour-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.icon-pick button { width: 34px; height: 34px; border-radius: 8px; border: 2px solid transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-pick button svg { width: 18px; height: 18px; }
.icon-pick button.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.colour-pick button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.colour-pick button.on { border-color: var(--text); }

.date-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.hgrid .date-row select, .hgrid .date-row input[type="date"] { width: auto; flex: none; }
.rep-summary { font-size: .9rem; font-weight: 600; margin-top: 2px; }

/* On a computer the header and side bar stay put and only the page scrolls; the page's heading and its toolbar stay at the top of it */
@media (min-width: 801px) {
  .layout { height: calc(100vh - var(--topbar-h)); min-height: 0; }
  .sidenav { overflow-y: auto; }
  .main { overflow-y: auto; max-width: none; }
  .main > * { max-width: 1464px; }
  .main .page-head { position: sticky; top: -14px; z-index: 6; background: var(--bg); margin: -14px -18px 3px; padding: 14px 18px 9px; }   /* (a gap under it: at some zooms it rounded over the tops of the buttons below) */
  .main .icon-toolbar { position: sticky; top: calc(var(--head-h, 14px) - 14px); z-index: 6; }
  /* A page's tabs stay under its heading too */
  .main .tabs { position: sticky; top: calc(var(--head-h, 14px) - 14px); z-index: 6; background: var(--bg); }
}

/* Business: businesses as cards, a business's accounts and properties to tick, invoice lines, GST returns */
.biz-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.biz-card { margin: 0; }
.biz-card .group-title h2 { font-size: 1.1rem; }
.biz-links { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.biz-links .checklist { max-height: 220px; overflow: auto; }
.inline-pick { display: flex; gap: 6px; align-items: center; }
.inline-pick select { flex: 1; min-width: 0; }
.inv-edit textarea { width: 100%; min-height: 0; resize: none; font: inherit; field-sizing: content; }   /* one line; grows only when the words wrap */
.inv-edit td { vertical-align: middle; }
.inv-edit td[data-f="amount"] { white-space: nowrap; }
/* (a supplier bill: wider, so a line's description fits on its one line and the Amount sits at the right) */
dialog.bill-dialog { width: min(max(1120px, var(--wide-dlg-w, 0px)), calc(100vw - 32px)); }
.bill-dialog .inv-edit { width: 100%; }
.bill-dialog .inv-edit input[data-f="description"] { width: 100%; min-width: 220px; }
select.warn { border-color: var(--warning-text); background: var(--warning-bg); }
tr.muted-row td { color: var(--muted); }
.gst-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.gst-periods { margin: 0; }
.gst-periods tr.selected td { background: var(--accent-soft); }
.gst-detail > .card:first-child { margin-top: 0; }
.gst-net { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 4px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); }
.gst-net b { font-size: 1.5rem; }
.gst-net.positive b { color: var(--positive); }
.gst-boxes td.box-no { width: 44px; text-align: center; font-weight: 700; color: var(--muted); }
.gst-boxes tr.strong td { font-weight: 700; }
.gst-file { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
@media (max-width: 900px) { .gst-layout { grid-template-columns: 1fr; } .biz-links { grid-template-columns: 1fr; } }
@media print { .gst-periods, .gst-detail .tabs, .gst-file, [data-panel="items"], [data-panel="categories"] { display: none !important; } .gst-layout { display: block; } }

/* Xero: each organisation as a card (the one picked outlined), its facts, what it holds by kind, links, the raw item */
#connectBar { flex-wrap: nowrap; }
#connectBar select { width: auto; min-width: 200px; }
.xero-org { margin-bottom: 12px; cursor: pointer; }
.xero-org.picked { box-shadow: 0 0 0 2px #c58a12; }
.xero-org .panel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xero-org .panel-head .spacer { flex: 1; }
.xero-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 18px; margin-bottom: 10px; }
.xero-facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.xero-facts .muted { font-size: .8rem; }
.xero-links td.pick:first-child, .xero-apply .pick { width: 1%; padding-right: 0; }
.xero-links td.pick + td { width: 45%; }
.panel-head .pick-all { margin: 0 auto 0 12px; font-weight: normal; }
.paid-from { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.paid-from select { flex: 1; min-width: 140px; }
.paid-from input[type="number"] { width: 5em; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 1px 4px 1px 10px; font-size: .85rem; }
.chip:first-of-type { border-color: var(--accent); }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0 4px; line-height: 1; }
.chip button:hover { color: var(--text); }
.link-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.link-bulk select { width: auto; max-width: 100%; }
.split-biz { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.split-biz select { width: auto; max-width: 100%; }
.xero-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.xero-kind { border: 1px solid var(--border); background: var(--surface-2); color: inherit; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: .82rem; cursor: pointer; }
.xero-kind b { margin-left: 4px; }
.xero-kind.problem { border-color: #f2994a; }
.xero-links td:first-child { width: 45%; }
.xero-links select { max-width: 100%; }
.xero-json { max-height: 60vh; overflow: auto; background: var(--surface-2); border-radius: 8px; padding: 12px; font-size: .8rem; white-space: pre-wrap; word-break: break-word; }
.xero-apply-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; margin-bottom: 8px; }
.xero-apply-settings .field { margin: 0; }
.xero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.doc-clip { font-size: .8rem; opacity: .75; }

/* Valuations (valuation-box.js): the values now, matches to choose from, a match's preview */
.val-box .docs-head { display: flex; align-items: center; gap: 6px; }
.val-box .docs-head .spacer { flex: 1; }
.val-now { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.val-now > div { display: flex; flex-direction: column; gap: 1px; }
.val-now b { font-size: 1.15rem; }
.val-now small { font-size: .78rem; }
.val-matches { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.val-matches .btn { text-align: left; }
.val-preview { display: flex; gap: 12px; align-items: flex-start; margin-top: 6px; }
.val-preview img { width: 140px; height: 100px; object-fit: cover; border-radius: 6px; flex: none; background: var(--surface-2); }
.val-box { padding-bottom: 10px; }
.val-box > :not(.docs-head) { margin-left: 12px; margin-right: 12px; }

/* Profit and loss (business-pl.js) */
.pl-table tr.strong td { font-weight: 600; }
.pl-table tr.pl-net td { border-top: 2px solid var(--border); }
.pl-table td:first-child { white-space: nowrap; }
@media print { #plBusiness, #plPeriod, #plFrom, #plTo, .register-tools .check { display: none !important; } }

/* Bank feeds (bank-feeds.html) */
.feed-page .spacer, [data-panel] .register-tools .spacer, #connections .panel-head .spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.feed-table td { vertical-align: top; }
.feed-table input[data-payee], .feed-table select[data-target] { width: 100%; min-width: 160px; max-width: 240px; }
.feed-cats { display: flex; gap: 4px; }   /* (the account's categories, and the other use's) */
.feed-table select[data-chart] { width: 100%; min-width: 130px; max-width: 200px; }
table.no-chart .chart-col { display: none; }
.cat-all { margin: 0 8px 0 0; font-weight: 400; font-size: .85rem; }
.reg-switch { margin-bottom: 8px; }
.reg-switch select { width: auto; min-width: 220px; max-width: 100%; }
.feed-acts .btn { margin-left: 4px; }
.feed-table tr.feed-matched td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* (one account picked: its register's last few above, its balance below) */
.feed-table tr.feed-section td { background: var(--surface-2); font-weight: 600; font-size: .85rem; padding-top: 6px; padding-bottom: 6px; }
.feed-table tr.feed-section a { font-weight: 400; margin-left: 12px; }
.feed-table tr.feed-reg td { color: var(--muted); font-size: .9rem; }
.feed-table tr.feed-total td { border-top: 2px solid var(--border); background: var(--surface-2); }
.feed-sum { display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: flex-end; }
.feed-h { font-size: .95rem; margin: 14px 0 6px; }
.feed-when { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-bottom: 8px; }
.feed-cond { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; align-items: center; }
.feed-when > select, .feed-cond select { width: auto; flex: 0 0 auto; }
.feed-cond input { width: auto; }
.feed-cond input { flex: 1; min-width: 140px; }
/* (the condition rows take the full width, so each one's text box reaches the right side) */
#condRows { align-self: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }   /* (two conditions across - one on a phone) */
#condRows .feed-cond { flex-wrap: nowrap; min-width: 0; }
#condRows .feed-cond select { min-width: 0; flex: 0 1 auto; }
#condRows .feed-cond select[data-f="field"] { max-width: 30%; }
#condRows .feed-cond select[data-f="op"] { max-width: 26%; }
#condRows .feed-cond input { min-width: 60px; }
@media (max-width: 700px) { #condRows { grid-template-columns: minmax(0, 1fr); } #condRows .feed-cond { flex-wrap: wrap; } #condRows .feed-cond select { max-width: none; } }
.feed-splits input[data-f="memo"] { width: 100%; }
/* (Bill & deposit and Also enter's boxes the same width: each with room for a remove button beside it) */
.feed-bill-row { display: grid; grid-template-columns: minmax(0, 1fr) 30px; gap: 6px; align-items: center; font-weight: normal; font-size: inherit; }
.feed-bill-row .btn { padding-left: 0; padding-right: 0; }
button.badge-btn { border: 0; font: inherit; font-size: .8rem; cursor: pointer; }
button.badge-btn:hover { text-decoration: underline; }
.cat-xero { font-weight: 400; font-size: .8rem; margin-left: 4px; }
td.pl-cell { cursor: pointer; }
.report-card { position: relative; }
.report-card .rc-pin { position: absolute; top: 4px; right: 6px; font-size: 1.05rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.report-card .rc-pin:hover { background: var(--surface-2); color: var(--accent-strong); }
.report-card .rc-pin.on { color: #e8a100; }
.report-card .rc-name { padding-right: 22px; }
td.pl-cell:hover { text-decoration: underline; color: var(--accent-strong); }
#alsoRows { display: flex; flex-direction: column; gap: 6px; }
#alsoRows:not(:empty) + div { margin-top: 4px; }
.feed-test { margin: 10px 0; }
.feed-test table { margin-top: 6px; font-size: .88rem; }
.feed-steps { margin: 0 0 12px; padding-left: 20px; }
.feed-steps li { margin-bottom: 4px; }

/* Sub-tabs inside a settings tab (External data sources) */
.tabs.subtabs { margin-top: -4px; }
.tabs.subtabs button { font-size: .92rem; padding: 4px 10px; }

/* ===== Appearance (Profile, kept on this computer): text size, pop-up width, flat or 3D */
:root[data-text="xs"] { --text-size: 11px; }
:root[data-text="s"]  { --text-size: 12px; }
:root[data-text="l"]  { --text-size: 14px; }
:root[data-text="xl"] { --text-size: 15px; }
:root[data-popups="wide"]   { --dlg-w: 700px; --wide-dlg-w: 1150px; }
:root[data-popups="morewide"] { --dlg-w: 780px; --wide-dlg-w: 1380px; }
:root[data-popups="widest"] { --dlg-w: 860px; --wide-dlg-w: 1600px; }

/* Flat: no shadows anywhere, borders only */
:root[data-look="flat"] { --shadow: none; }
:root[data-look="flat"] dialog, :root[data-look="flat"] .sec-icon, :root[data-look="flat"] dialog.ai-panel { box-shadow: none; }

/* 3D: raised cards, panels and buttons, sunken inputs */
:root[data-look="3d"] { --shadow: 0 2px 4px rgba(16, 24, 40, .12), 0 4px 10px rgba(16, 24, 40, .10); }
:root[data-look="3d"] .panel, :root[data-look="3d"] .docs-box { box-shadow: var(--shadow); }
:root[data-look="3d"] .topbar { box-shadow: 0 2px 6px rgba(16, 24, 40, .14); }
:root[data-look="3d"] .sidenav { box-shadow: 2px 0 6px rgba(16, 24, 40, .08); }
:root[data-look="3d"] .btn:not(.ghost) { background-image: linear-gradient(rgba(255, 255, 255, .22), rgba(0, 0, 0, .06)); box-shadow: 0 1px 2px rgba(16, 24, 40, .22), inset 0 1px 0 rgba(255, 255, 255, .35); }
:root[data-look="3d"] .btn:not(.ghost):active { background-image: linear-gradient(rgba(0, 0, 0, .08), rgba(255, 255, 255, .1)); box-shadow: inset 0 1px 3px rgba(16, 24, 40, .3); }
:root[data-look="3d"] input:not([type=checkbox]):not([type=radio]), :root[data-look="3d"] select, :root[data-look="3d"] textarea { box-shadow: inset 0 1px 2px rgba(16, 24, 40, .14); }
:root[data-look="3d"] .panel > .panel-head, :root[data-look="3d"] .docs-box > .docs-head { background-image: linear-gradient(rgba(255, 255, 255, .25), rgba(0, 0, 0, .04)); }
:root[data-look="3d"] .tabs button.active { background: var(--surface); border-radius: 6px 6px 0 0; box-shadow: 0 -2px 4px rgba(16, 24, 40, .08); }
:root[data-look="3d"] dialog { box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
:root[data-look="3d"][data-theme="dark"] { --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 4px 10px rgba(0, 0, 0, .4); }
@media (prefers-color-scheme: dark) { :root[data-look="3d"][data-theme="auto"] { --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 4px 10px rgba(0, 0, 0, .4); } }
@media print { :root[data-look="3d"] .btn, :root[data-look="3d"] .panel { box-shadow: none; background-image: none; } }

/* Compact (Appearance -> Spacing): tighter rows, boxes and gaps, to fit more on the screen */
:root[data-density="compact"] table.grid th, :root[data-density="compact"] table.grid td { padding: 2px 6px; }
:root[data-density="compact"] table.register td { padding: 1px 6px; }
:root[data-density="compact"] table.grid td > div.sub { display: inline; margin-left: 6px; }   /* a second line (business, payee...) beside the first */
:root[data-density="compact"] input, :root[data-density="compact"] select, :root[data-density="compact"] textarea { padding: 2px 6px; border-radius: 4px; }
:root[data-density="compact"] table.splits input, :root[data-density="compact"] table.splits select { padding: 2px 6px; }
:root[data-density="compact"] .btn { padding: 3px 10px; }
:root[data-density="compact"] .btn.small { padding: 1px 7px; }
:root[data-density="compact"] .badge { padding: 0 6px; }
:root[data-density="compact"] .field { margin-bottom: 4px; gap: 1px; }
:root[data-density="compact"] .form-grid { gap: 0 8px; }
:root[data-density="compact"] .card { padding: 8px; }
:root[data-density="compact"] .card + .card { margin-top: 10px; }
:root[data-density="compact"] :is(.stats, .pillars, .cat-columns) > .card + .card { margin-top: 0; }
:root[data-density="compact"] .stats { gap: 6px; margin-bottom: 8px; }
:root[data-density="compact"] .panel, :root[data-density="compact"] .docs-box { margin-bottom: 6px; }
:root[data-density="compact"] .panel-head, :root[data-density="compact"] .docs-box .docs-head { padding: 3px 8px; }
:root[data-density="compact"] .panel-body { padding: 6px 8px 0; }
:root[data-density="compact"] .panel-foot { padding: 4px 8px; }
:root[data-density="compact"] dialog form { padding: 10px 12px; }
:root[data-density="compact"] dialog .dlg-top { top: -10px; margin: -10px -12px 6px; padding: 8px 12px 6px; width: calc(100% + 24px); max-width: calc(100% + 24px); }
:root[data-density="compact"] dialog h2 { margin-bottom: 6px; padding-bottom: 4px; }
:root[data-density="compact"] .tabs { margin-bottom: 8px; }
:root[data-density="compact"] .tabs button { padding: 4px 10px; }
:root[data-density="compact"] .main { padding-top: 10px; }

/* Layout style: Classic (Appearance) - in pop-ups each label sits beside its box, with a colon; fields in two columns;
   choices like Payment / Deposit / Transfer are tabs; transactions, invoices and bills put who and what on the left, number / date / amount on the right */
@media (min-width: 640px) {
  :root[data-layout="classic"] dialog .field { display: grid; grid-template-columns: var(--label-w, 118px) minmax(0, 1fr); align-items: center; gap: 0 8px; }
  :root[data-layout="classic"] dialog .field > :is(span, .hl):first-child { font-weight: 450; }
  :root[data-layout="classic"] dialog .field > :is(span, .hl):first-child::after { content: ':'; }
  :root[data-layout="classic"] dialog .field > :not(:is(span, .hl):first-child) { grid-column: 2; }
  :root[data-layout="classic"] dialog .form-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 28px; }
  :root[data-layout="classic"] dialog .form-grid .field.wide { grid-column: 1 / -1; }

  /* who / what on the left, number, date and amount on the right */
  :root[data-layout="classic"] #tranForm .form-grid { grid-template-columns: minmax(0, 1fr) max-content; }
  :root[data-layout="classic"] #tranForm .field:has([name="payeeName"]) { order: 0; }

  /* every pop-up: who / what down the left; dates, numbers, amounts and status down the right (only as wide as they need);
     memo and notes across the bottom */
  :root[data-layout="classic"] dialog.wide-dialog .form-grid:has(> .field > :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"])) {
    grid-template-columns: minmax(0, 1fr) max-content; grid-auto-flow: row dense; }
  :root[data-layout="classic"] dialog.wide-dialog .form-grid:has(> .field > :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"])) > .field { grid-column: 1; }
  :root[data-layout="classic"] dialog.wide-dialog .form-grid:has(> .field > :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"])) > .field:has(> :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"], [name="status"])) { grid-column: 2; }
  :root[data-layout="classic"] dialog.wide-dialog .form-grid:has(> .field > :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"])) > .field:has(> :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"], [name="status"])) > :is(input, select) { width: 150px; }
  :root[data-layout="classic"] dialog.wide-dialog .form-grid:has(> .field > :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"])) > .field:has(:is([name="customerId"], [name="supplierId"], [name="tenantId"])) { order: -1; }
  :root[data-layout="classic"] dialog.wide-dialog .form-grid:has(> .field > :is(input[type="date"], input[type="number"], [name="number"], [name="xeroNumber"])) > .field.wide:has(> :is([name="memo"], [name="notes"])) { grid-column: 1 / -1; order: 20; }
  /* (the right-hand number, date, amount and status boxes only as wide as they need) */
  :root[data-layout="classic"] #tranForm .form-grid > .field:is(:has([name="reference"]), :has([name="date"]), :has([name="amount"]), :has([name="status"])) > :is(input, select),
  /* transactions: payee, transfer account, category, tag, memo down the left; number, date, amount, status down the right */
  :root[data-layout="classic"] #tranForm .form-grid { grid-auto-flow: row dense; }
  :root[data-layout="classic"] #tranForm .form-grid > .field { grid-column: 1; }
  :root[data-layout="classic"] #tranForm .form-grid > .field:is(:has([name="reference"]), :has([name="date"]), :has([name="amount"]), :has([name="status"]), :has([name="transferAmount"])) { grid-column: 2; }
  :root[data-layout="classic"] #tranForm .field:has(#xferFrom) { order: 1; } :root[data-layout="classic"] #tranForm .field:has(#xferTo) { order: 2; }
  :root[data-layout="classic"] #tranForm .field:has([name="categoryId"]) { order: 3; } :root[data-layout="classic"] #tranForm #tranSubField { order: 4; }
  :root[data-layout="classic"] #tranForm .field:has([name="tagId"]) { order: 5; } :root[data-layout="classic"] #tranForm #tranSubTagField { order: 6; }
  :root[data-layout="classic"] #tranForm .field:has([name="chartAccountId"]) { order: 7; }   /* (payee, category, subcategory, tag, sub-tag, then business account down the left) */
  :root[data-layout="classic"] #tranForm .field:has([name="memo"]) { order: 20; grid-column: 1 / -1; }   /* (the memo across the bottom of the box) */
  :root[data-layout="classic"] #tranForm .field:has([name="reference"]) { order: -1; } :root[data-layout="classic"] #tranForm .field:has([name="transferAmount"]) { order: 6; }
  :root[data-layout="classic"] #tranForm .split-sum { flex: 1; padding: 3px 8px; border: 1px dashed var(--border); border-radius: 6px; color: var(--muted); }
}
/* choices as tabs (Payment / Deposit / Transfer, Bill / Credit note / Purchase order...) */
/* (Strip uses the tabs too) */
:root[data-layout="strip"] dialog .segmented, :root[data-layout="classic"] dialog .segmented { display: flex; gap: 2px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; overflow: visible; margin-bottom: 10px; }
:root:is([data-layout="classic"], [data-layout="strip"]) dialog .segmented span, :root:is([data-layout="classic"], [data-layout="strip"]) dialog .segmented button { padding: 3px 18px; border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0;
  background: var(--surface-2); color: var(--muted); margin-bottom: -1px; }
:root:is([data-layout="classic"], [data-layout="strip"]) dialog .segmented button + button { border-left: 1px solid var(--border); }
:root:is([data-layout="classic"], [data-layout="strip"]) dialog .segmented input:checked + span, :root:is([data-layout="classic"], [data-layout="strip"]) dialog .segmented button.active { background: var(--surface); color: var(--text); font-weight: 650;
  border-bottom: 1px solid var(--surface); box-shadow: inset 0 2px 0 var(--accent); }

/* Layout style: Single column - each label beside its box, one field per line */
@media (min-width: 640px) {
  :root[data-layout="single"] dialog .field { display: grid; grid-template-columns: var(--label-w, 150px) minmax(0, 1fr); align-items: center; gap: 0 10px; }
  :root[data-layout="single"] dialog .field > :is(span, .hl):first-child { font-weight: 450; text-align: right; }
  :root[data-layout="single"] dialog .field > :not(:is(span, .hl):first-child) { grid-column: 2; }
  :root[data-layout="single"] dialog .form-grid { grid-template-columns: minmax(0, 680px); }
}
/* Layout style: Strip - small capital labels, as many fields across as fit */
:root[data-layout="strip"] dialog .form-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; }
:root[data-layout="strip"] dialog .form-grid .field.wide { grid-column: span 2; }
:root[data-layout="strip"] dialog .field > :is(span, .hl):first-child { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
/* Layout style: Outlined - each label sits in the top border of its box */
:root[data-layout="outlined"] dialog .field { position: relative; margin-top: 8px; }
:root[data-layout="outlined"] dialog .field > :is(span, .hl):first-child { position: absolute; top: -.65em; left: 8px; z-index: 1; padding: 0 4px; background: var(--surface);
  font-size: .75rem; font-weight: 550; line-height: 1.2; color: var(--muted); pointer-events: none; max-width: calc(100% - 16px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
:root[data-layout="outlined"] dialog .field:focus-within > span:first-child { color: var(--accent-strong); }
:root[data-layout="outlined"] dialog .field > :is(input, select, textarea, .inline-pick) { padding-top: 7px; }
:root[data-layout="outlined"] dialog .field > .inline-pick { padding-top: 0; }
:root[data-layout="outlined"] dialog .field > .inline-pick > select { padding-top: 7px; }
:root[data-layout="outlined"] dialog form > .field > :is(span, .hl):first-child { background: var(--bg); }   /* (outside a panel: the pop-up's own background) */


/* the split pop-up (Classic layout) */
dialog.split-dialog .split-box { margin: 0; }
/* (a split's lines - category, tag, business account, memo, amount: room for them all) */
dialog.split-dialog, dialog#tranDialog.splitting { width: min(1180px, calc(100vw - 32px)); resize: horizontal; max-width: calc(100vw - 32px); min-width: 560px; }
.split-box select[data-f="target"] { min-width: 210px; }
#ruleForm .split-sum { flex: 1; padding: 3px 8px; border: 1px dashed var(--border); border-radius: 6px; color: var(--muted); }
.rule-split-form { padding: 4px 2px; }
.split-box select[data-f="tagId"] { min-width: 120px; }
.split-box select[data-f="chart"] { min-width: 200px; }
.split-box input[data-f="memo"] { min-width: 160px; }
.split-box input[data-f="amount"] { width: 110px; text-align: right; }
.split-box table.cols-sized select, .split-box table.cols-sized input { min-width: 0; width: 100%; }   /* (sized by hand: the boxes fill their columns) */

/* a recurring bill's label / box pairs, as fields (site.js followLayout) */
.field > label.hl { font-size: .9rem; font-weight: 550; }
.field:not(:has(> :not(.hidden))) { display: none; }   /* (its label and box both hidden) */
.field > span:first-child:empty { display: none; }
@media (min-width: 640px) { :root[data-layout="single"] dialog .field:has(> span:first-child:empty) > :last-child { grid-column: 2; } }
/* a tick box in a field's place (e.g. Paid) is not a label: no colon, not beside / in the border */
dialog .field > span.check:first-child { position: static !important; font-size: inherit !important; font-weight: inherit !important; background: none !important; padding: 0 !important;
  text-transform: none !important; letter-spacing: 0 !important; color: inherit !important; max-width: none !important; }
dialog .field > span.check:first-child::after { content: none !important; }
:root:is([data-layout="classic"], [data-layout="single"]) dialog .field:has(> span.check:first-child) { display: flex; }
/* Flat pop-ups: no thick coloured bar down a panel's left edge (a plain border all round), and square corners -
   except what is round on purpose (badges, chips, round buttons, tick boxes) */
:root[data-look="flat"] dialog :is(.panel, .docs-box) { border-left: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border)); }
:root[data-look="flat"] dialog, :root[data-look="flat"] dialog *:not(.badge, .chip, .kind-chip, .help-q, .colour-pick button, input[type="checkbox"], input[type="radio"]) { border-radius: 0 !important; }
/* Appearance: who the choices are from, and Restore defaults */
.look-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }

/* Classic layout: the trade pop-up as one compact box (investments.js) - account, date, investment, activity, category and memo
   down the left; units, price, fees and total down the right */
@media (min-width: 640px) {
  :root[data-layout="classic"] dialog#tradeDialog { width: min(900px, calc(100vw - 32px)); }
  :root[data-layout="classic"] #tradeForm .form-grid { grid-template-columns: minmax(0, 1fr) 300px; grid-auto-flow: row dense; gap: 0 24px; }
  /* (the amounts column a set width - a Buy's long hint under its total wraps, rather than squeezing the left) */
  :root[data-layout="classic"] #tradeForm #totalHint { display: block; white-space: normal; max-width: 100%; }
  :root[data-layout="classic"] #tradeForm .form-grid > :is(.field, .wide) { grid-column: 1; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="accountId"]) { order: 1; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="date"]) { order: 2; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="securityId"]) { order: 3; }
  :root[data-layout="classic"] #tradeForm .form-grid > #newSecurity { order: 4; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="action"]) { order: 5; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="cashCategoryId"]) { order: 6; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="memo"]) { order: 7; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:is(:has([name="quantity"]), :has([name="price"]), :has([name="commission"]), :has([name="total"])) { grid-column: 2; }
  /* units and price beside the account and date; fees and total beside the category and memo, as the fees are apart from units x price */
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="quantity"]) { grid-row: 1; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="price"]) { grid-row: 2; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="commission"]) { grid-row: 5; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="total"]) { grid-row: 6; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field > :is(input[type="number"], input[type="date"]) { width: 150px; }
  /* (the amounts at the right edge, their figures right-aligned; the left boxes wider - an account's whole name - and the memo across) */
  :root[data-layout="classic"] #tradeForm .form-grid > .field:is(:has([name="quantity"]), :has([name="price"]), :has([name="commission"]), :has([name="total"])) { justify-self: stretch; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:is(:has([name="quantity"]), :has([name="price"]), :has([name="commission"]), :has([name="total"])) > input { justify-self: end; }
  :root[data-layout="classic"] #tradeForm #totalHint { text-align: right; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:is(:has([name="accountId"]), :has([name="securityId"]), :has([name="action"]), :has([name="cashCategoryId"]), :has([name="cashAccountId"])) > select { width: min(380px, 100%); }
  :root[data-layout="classic"] #tradeForm .form-grid > #cashField { order: 1; grid-column: 1; }
  :root[data-layout="classic"] #tradeForm .form-grid > .field:has([name="memo"]) > input { width: min(380px, 100%); }
  :root[data-layout="classic"] #tradeForm #newSecurity .form-grid { grid-template-columns: 1fr; }
  :root[data-layout="classic"] #tradeForm #cashNote { margin: 4px 0 6px; font-size: .85rem; }
}
/* A list in a pop-up that scrolls in its own box keeps its column headings at the top */
dialog .table-wrap thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--border); }

/* ===== Dashboards (dash.js): a top row, then a wide and a narrow column of boxes */
.dash-top > .dash-box { margin-bottom: 10px; }
.dash-box:empty { display: none; }
iframe.dash-report { display: block; width: 100%; height: 320px; border: 0; background: var(--surface); }
dialog.dash-dialog { width: min(1100px, calc(100vw - 32px)); }
.dash-custom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
@media (max-width: 760px) { .dash-custom { grid-template-columns: 1fr; } }
.dash-tree { max-height: 60vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: var(--surface); }
.dash-tree details { margin: 2px 0; }
.dash-tree summary { cursor: pointer; padding: 2px 0; }
.dash-tree-sub { margin-left: 16px !important; }
.dash-tree-item { display: flex; margin: 2px 0 2px 18px; }
.dash-arrange { display: flex; flex-direction: column; gap: 8px; }
.dash-zone-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; align-items: start; }   /* (as the dashboard: wide, then narrow) */
.dash-zone-cols .dash-zone-item { flex-wrap: wrap; }
.dash-zone { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.dash-zone-head { padding: 4px 8px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.dash-zone-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px 2px 8px; border-bottom: 1px solid var(--border); }
.dash-zone-item:last-child { border-bottom: 0; }
.dash-zone-tools { display: flex; gap: 2px; align-items: center; flex: none; }
.dash-zone-tools select { width: auto; padding: 1px 4px; }
.dash-zone-empty { padding: 6px 8px; }
/* reports.html?embed=1: just the report, in a dashboard box */
html.embed .topbar, html.embed .sidenav, html.embed .footer, html.embed #reportView > .page-head, html.embed #galleryView > .page-head, html.embed #repToolbar,
html.embed #customise, html.embed .ai-panel, html.embed .help-q { display: none !important; }
html.embed #galleryView { display: none !important; }   /* (the list of reports: never - not even for a moment while the report loads) */
html.embed .main { padding: 6px 8px; max-width: none; }
html.embed .layout { display: block; min-height: 0; }
html.embed .fit-screen, html.embed .sticky-table { max-height: none !important; overflow-y: visible !important; }   /* (the box grows to fit it instead) */
html.embed body { background: var(--surface); }
/* Flat on the pages too: boxes, cards and lists square, with a plain border instead of the thick coloured bar down the left */
:root[data-look="flat"] :is(.panel, .docs-box) { border-left: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border)); }
:root[data-look="flat"] :is(.panel, .docs-box, .card, .stat, .panel > .panel-head, .docs-box > .docs-head, .panel > :last-child, .dash-zone, .dash-tree, .report-card) { border-radius: 0 !important; }

table.grid tr.sort-away { display: none; }   /* (a heading or subtotal, while its list is sorted) */
tr.line-covered td { text-decoration: line-through; color: var(--muted); }   /* (a bill line a ticked share covers) */
/* Xero item pop-up: In Xero (left) and Match it to (right) scroll on their own, the pop-up's heading and buttons staying put */
@media (min-width: 801px) {
  dialog.item-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
  dialog.item-dialog .item-cols { flex: 1; min-height: 0; align-items: stretch; }
  dialog.item-dialog .item-cols > section { min-height: 0; overflow-y: auto; padding-right: 6px; }
}
/* Xero item pop-up: working on it */
.item-busy { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 6px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 550; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Bring in: a transaction shown read only */
.tx-view th { text-align: left; width: 7em; font-weight: 600; white-space: nowrap; }
#txViewDialog h3 { margin: 12px 0 4px; font-size: 1rem; }
/* (over the Bring in pop-up: padded, and a firmer edge so it stands out from the one behind, even in the flat look) */
#txViewDialog { padding: 14px 16px; border: 2px solid color-mix(in srgb, var(--text) 45%, var(--border)); }
:root[data-look] #txViewDialog { box-shadow: 0 8px 28px rgba(0, 0, 0, .35); }

/* Bring in: a deposit's difference written off */
.writeoff-row { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--border); background: var(--bg); }
.writeoff-row select { margin-left: 6px; max-width: 320px; }

/* Bring in: payments banked together as one deposit */
.badge.together { background: color-mix(in srgb, var(--accent, #2a7) 18%, transparent); }
.together-box { margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--accent, #2a7); background: var(--bg); }
.together-box h3 { margin: 0 0 4px; }
.together-box .together-total td { font-weight: 600; border-top: 1px solid var(--border); }

/* The register: a month's label at the bottom of the month */
tr.month-foot td { border-top: 1px solid var(--border); }

/* A trade's amounts: figures right-aligned, as in a column of numbers (every layout) */
#tradeForm input[type="number"] { text-align: right; }

/* Accounts: a shares account under its cash account */
.acc-table tr.acc-shares td:first-child:not(.acc-check) { padding-left: 18px; }

/* A trade: its cash account (site admins) */
#tradeForm .cash-account { padding: 4px 0; }

/* Bring in's item pop-up: the payment's Paid from line */
.paid-from-box { padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 6px; line-height: 1.45; }

/* A report in a dashboard box: just its chart, just its table, or no summary boxes */
html.embed-chart .stats, html.embed-chart [data-role="table"],
html.embed-table .stats, html.embed-table [data-role="chart"],
html.embed-nostats .stats, html.embed-stats [data-role="chart"], html.embed-stats [data-role="table"] { display: none !important; }
/* (just the chart, or just the table: the dashboard box is its box - no second box, nor heading, inside it) */
html.embed-chart [data-role="chart"], html.embed-table [data-role="table"] { border: 0 !important; box-shadow: none !important; background: transparent !important; margin: 0 !important; }
html.embed-chart [data-role="chart"] > .panel-head, html.embed-table [data-role="table"] > .panel-head { display: none !important; }
html.embed-chart [data-role="chart"] > .panel-body, html.embed-table [data-role="table"] > .panel-body { padding: 0 !important; }
html.embed .panel.collapsed > :not(.panel-head) { display: block !important; }
.dash-zone-opts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.dash-zone-opts select { width: auto; font-size: .8rem; padding: 1px 4px; }

/* The register's transaction pop-up: opened from one line of a split in another account */
.tran-note { margin: -4px 0 10px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 6px; font-size: .9rem; }

/* Bring in: the Kind column (as Xero names it) */
.xero-apply td.kind { white-space: nowrap; }

/* Bring in: what an item brought in already is here, under it */
.xero-apply td.match-to { padding-left: 24px; color: var(--muted); font-size: .85rem; }
.xero-apply tr.match-row td { border-top: 0; padding-top: 0; }
.xero-apply tr:has(+ tr.match-row) td { border-bottom: 0; }

/* Bring in: the lines under an invoice or bill - its payments as they are here, and the transfers for them */
.xero-apply tr.chain-row td.chain { padding-left: 28px; }
.xero-apply tr.chain-row td.chain::before, .xero-apply tr.chain-row td.date::before { content: "↳ "; color: var(--muted); }
.xero-apply tr.chain-row td { border-top: 0; }
.xero-apply tr.chain-row td.kind.muted { font-size: .85rem; }
.xero-apply tr.chain-row td.date, .xero-apply tr.chain-row td.kind { padding-left: 28px; }

/* Bring in: an invoice or bill its payments add up to exactly */
.badge.good { background: color-mix(in srgb, #1baf7a 18%, var(--surface)); color: #0f7a54; }

/* Bring in's item pop-up: Xero's side and the match side, each its own colour (mixed with the surface, so right in every theme) */
dialog.item-dialog .item-cols > section { border-radius: 8px; padding: 12px 14px; border: 1px solid var(--border); }
dialog.item-dialog .item-cols > section:first-child { background: color-mix(in srgb, #13b5ea 9%, var(--surface)); }
dialog.item-dialog .item-cols > #itemMatchBox, dialog.item-dialog .item-cols > #itemBankBox { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
/* Bring in: a card payment's fee lines (Stripe), one step further in, under their payment */
.xero-apply tr.chain-row.fee-row td.chain, .xero-apply tr.chain-row.fee-row td.date, .xero-apply tr.chain-row.fee-row td.kind { padding-left: 48px; }

/* Pick lists (site.js): a box with a list drops down the whole of it, at the box's own text size; the highlight moves with the keys */
input.combo-input, input[list], :root input.combo-input, :root[data-density] input.combo-input { padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23555' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; text-overflow: ellipsis; }
.combo-menu { position: fixed; z-index: 1000; overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.combo-menu .combo-item { padding: 5px 8px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-menu .combo-item:hover { background: var(--surface-2); }
.combo-menu .combo-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.combo-menu .combo-empty { padding: 5px 8px; color: var(--muted); }

/* Invoice and bill lines: alternate rows shaded, so each line is easy to follow across */
table.inv-edit > tbody > tr:nth-child(even) > td { background: var(--surface-2); }
/* (a dashboard forecast box's left axis: labels placed down beside its chart) */
.dash-cf-axis { position: relative; width: 40px; flex: none; font-size: 11px; color: var(--muted); }
.dash-cf-axis span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* (a forecast's balance: green above zero, red below) */
.fc-pos .fc-line { stroke: var(--positive); } .fc-pos .fc-area { fill: color-mix(in srgb, var(--positive) 12%, transparent); }
.fc-neg .fc-line { stroke: var(--negative); } .fc-neg .fc-area { fill: color-mix(in srgb, var(--negative) 12%, transparent); }
.biz-new-prop { display: inline-block; margin-top: 6px; font-size: .9rem; }
/* (an amount's "incl GST" tick box: Settings -> amounts entered with GST) */
.gst-incl { display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 0; font-size: .8rem; font-weight: 400; white-space: nowrap; }
.panel-head .gst-incl { margin: 0 10px 0 0; }
.gst-note:empty { display: none; }
/* (Opex: each tab's GST statement - stands out, in the warning colours, underlined) */
.gst-disclaimer { margin: 0 0 12px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--warning-text) 35%, transparent); border-left: 4px solid var(--warning-text); background: var(--warning-bg); color: var(--warning-text); border-radius: 6px; font-size: .92rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.gst-disclaimer b { text-transform: uppercase; letter-spacing: .04em; }
.gst-disclaimer:empty { display: none; }
/* (Properties: a business's heading folds its properties away) */
.biz-group-title { flex-wrap: wrap; align-items: center; }
.biz-fold { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; border: 0; background: none; color: inherit; font: inherit; font-size: 1.15rem; font-weight: 650; cursor: pointer; border-radius: 6px; }
.biz-fold:hover { background: var(--surface-2); }
.biz-fold .fold-arrow { display: inline-block; width: 1em; transition: transform .15s; }
.biz-group.folded .fold-arrow { transform: rotate(-90deg); }
.biz-group.folded .biz-group-body { display: none; }
.biz-group-title .spacer { flex: 1; }
.biz-group-title:first-child { margin-top: 18px; }
.biz-group:first-child > .biz-group-title { margin-top: 0; }
/* (Properties: a coloured bar across the page for each business, property and building - instead of the little tags) */
.kind-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; border-radius: 8px; color: #fff; }
.kind-bar.z { background: #6b4fbb; margin: 18px 0 10px; font-size: 1.1rem; cursor: pointer; }
.biz-group:first-child > .kind-bar.z { margin-top: 0; }
.kind-bar.z.none { background: #6b7280; }
.kind-bar.p { background: #c0392b; font-size: 1.05rem; margin-bottom: 8px; cursor: pointer; }
.kind-bar.b { background: #1f6fd1; padding: 5px 12px; margin: 12px 0 6px; }
.kind-bar .bar-kind { font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; opacity: .85; }
.kind-bar .bar-name, .kind-bar .bar-name .linkish { font-weight: 650; color: #fff; }
.kind-bar .bar-name .linkish:hover { text-decoration: underline; }
.kind-bar .bar-note { font-size: .85rem; opacity: .9; }
.kind-bar .spacer { flex: 1; }
.kind-bar .badge { background: rgba(255, 255, 255, .22); color: #fff; }
.kind-bar .btn { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .4); }
.kind-bar .btn:hover { background: rgba(255, 255, 255, .28); }
.bar-fold { border: 0; background: none; color: inherit; font-size: 1em; line-height: 1; padding: 2px 4px; cursor: pointer; transition: transform .15s; }
.foldable.folded > .kind-bar > .bar-fold { transform: rotate(-90deg); }
.foldable.folded > .fold-body { display: none; }
.prop-card.folded > .kind-bar.p { margin-bottom: 0; }
.prop-card:has(> .kind-bar.p) { border-top: 0; }
.prop-card .building .kind-bar.b { margin: -8px -10px 8px; border-radius: 6px 6px 0 0; }
/* (subtler: a soft tint of each one's colour, a coloured edge, the usual text) */
.kind-bar { color: var(--text); --tone: #6b4fbb; background: color-mix(in srgb, var(--tone) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--border)); border-left: 4px solid var(--tone); }
.kind-bar.z { --tone: #8f80c4; background: color-mix(in srgb, var(--tone) 7%, var(--surface)); }
.kind-bar.z.none { --tone: #8a93a0; background: color-mix(in srgb, var(--tone) 8%, var(--surface)); }
.kind-bar.p { --tone: #c46a5f; background: color-mix(in srgb, var(--tone) 8%, var(--surface)); }
.kind-bar.b { --tone: #5b8fcf; background: color-mix(in srgb, var(--tone) 7%, var(--surface)); }
.kind-bar .bar-kind { color: color-mix(in srgb, var(--tone) 75%, var(--text)); opacity: 1; }
.kind-bar .bar-name, .kind-bar .bar-name .linkish { color: var(--text); }
.kind-bar .bar-note { color: var(--muted); opacity: 1; }
.kind-bar .badge { background: var(--surface-2); color: var(--muted); }
.kind-bar .btn { background: var(--surface); color: var(--text); border-color: var(--border); }
.kind-bar .btn:hover { background: var(--surface-2); }
.bar-fold { color: color-mix(in srgb, var(--tone) 75%, var(--text)); }
.prop-card .building .kind-bar.b { border-width: 0 0 1px; }   /* (the building box has its blue edge already) */
#pmProperties tr.under-biz > td:first-child { padding-left: 28px; }   /* (the dashboard: properties indented under their business) */
/* (Category boxes, Money style - site.js: a Category box you can type in to find one, and a Subcategory box beside it) */
.catpick { display: flex; gap: 6px; width: 100%; min-width: 0; position: relative; align-items: center; }
.catpick-catbox { flex: 3 1 0; min-width: 90px; position: relative; display: block; }
.catpick-cat { width: 100%; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.catpick-sub { flex: 2 1 0; min-width: 80px; width: auto; }
.catpick-sub:disabled { opacity: .55; }
.catpick > select.catpick-hidden { position: absolute; left: 0; bottom: 0; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.catpick-list { position: fixed; z-index: 1000; overflow-y: auto; padding: 4px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(16, 24, 40, .18); font-size: .92rem; text-align: left; }
.catpick-group { padding: 6px 8px 2px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.catpick-item { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catpick-item:hover { background: var(--surface-2); }
.catpick-item.hi { background: var(--accent-soft); }
.catpick-item.sub { padding-left: 14px; }
.catpick-n { margin-left: auto; font-size: .75rem; color: var(--muted); }
.catpick-none { padding: 6px 8px; color: var(--muted); }
/* (in a pop-up window: Subcategory on the line under Category - but side by side in a table's row, e.g. splits) */
dialog .catpick { flex-direction: column; align-items: stretch; }
dialog .catpick > .catpick-catbox, dialog .catpick > .catpick-sub { flex: none; width: 100%; }
dialog td .catpick { flex-direction: row; align-items: center; }
dialog td .catpick > .catpick-catbox { flex: 3 1 0; width: auto; }
dialog td .catpick > .catpick-sub { flex: 2 1 0; width: auto; }
/* (the split pop-up: the columns share the width - Category and Subcategory the most room, then tag, business account,
   memo; everything inside its box. A column dragged to a width keeps it.) */
dialog.split-dialog table.splits:not(.cols-sized) { table-layout: fixed; width: 100%; }
dialog.split-dialog table.splits:not(.cols-sized) th[data-col="target"] { width: 38%; }
dialog.split-dialog table.splits:not(.cols-sized) th[data-col="tag"] { width: 17%; }
dialog.split-dialog table.splits:not(.cols-sized) th[data-col="chart"] { width: 17%; }
dialog.split-dialog table.splits:not(.cols-sized) th[data-col="amount"] { width: 110px; }
dialog.split-dialog table.splits:not(.cols-sized) th:last-child { width: 34px; }
dialog.split-dialog table.splits td > select, dialog.split-dialog table.splits td > input { width: 100%; min-width: 0; }
dialog.split-dialog .split-box select[data-f="tagId"] { min-width: 0; }
/* (a pop-up's category with a Split… button - transaction, rule: Category the full width, the same as the boxes around
   it; Subcategory under it, with Split… beside that) */
dialog .inline-pick:has(> .catpick) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; position: relative; }
dialog .inline-pick > .catpick { display: contents; }
dialog .inline-pick > .catpick.hidden > * { display: none; }
dialog .inline-pick > .catpick > .catpick-catbox { grid-column: 1 / -1; }
dialog .inline-pick > .catpick > .catpick-sub { grid-column: 1; }
dialog .inline-pick > .catpick.hidden ~ .split-sum { grid-column: 1; }
.also-count { text-decoration: underline dotted; cursor: help; }
table.grid th.center, table.grid td.center { text-align: center; }
/* (the category box: what the one picked is - Expense, Income or Transfer - on its right) */
.catpick-kind { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: .68rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.catpick-kind:empty { display: none; }
.catpick-kind[data-kind="expense"] { color: var(--negative); }
.catpick-kind[data-kind="income"] { color: var(--positive); }
.catpick-kind[data-kind="transfer"] { color: #2a78d6; }
.catpick-catbox.has-kind > .catpick-cat { padding-right: 96px; }
@media (max-width: 700px) { .catpick-kind { display: none; } .catpick-catbox.has-kind > .catpick-cat { padding-right: 26px; } }   /* (phones: room for the category's name - not its Expense / Income label) */
/* (a rule's Bill & deposit lines: the bill, Edit, and remove) */
.feed-bill-row { grid-template-columns: minmax(0, 1fr) auto 30px; }
.feed-bill-row [data-edit-bill] { padding-left: 10px; padding-right: 10px; }
/* (a Subcategory box in a field of its own - data-sub-in: the rule form) */
.catpick-subhost { display: block; }
.catpick-subhost > .catpick-sub { width: 100%; }
dialog .inline-pick > .catpick.sub-out > .catpick-catbox { grid-column: 1; }
/* (a bill's pop-up over another pop-up - a rule's Edit: Bills & Deposits' own, in a frame) */
dialog.bill-pop { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden; }
dialog.bill-pop iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; visibility: hidden; }
dialog.bill-pop.ready iframe { visibility: visible; }
dialog.bill-pop .bill-pop-wait { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 12px 18px; border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.bill-pop.ready .bill-pop-wait { display: none; }
/* (the page inside it: only its pop-up shows) */
html.embed-popup, html.embed-popup body { background: transparent !important; }
html.embed-popup body { visibility: hidden; }
html.embed-popup dialog[open] { visibility: visible; }
html.embed-popup dialog::backdrop { background: transparent; }
/* (bank feeds: a transfer's other side, waiting for the one in the other account) */
.feed-side { margin-top: 3px; font-size: .85rem; color: #2a78d6; }
tr.feed-waiting > td { background: color-mix(in srgb, #2a78d6 5%, transparent); }
.catpick-off { display: none !important; }
/* (Bills & Deposits, rules: the last payment was a different amount from the bill's) */
.last-differs { color: var(--warning-text); font-weight: 600; cursor: help; }
div.sub.last-differs { font-size: .78rem; }
/* (every pop-up moves: dragged by its title - site.js) */
dialog[open] h2, dialog[open] > form > .panel:first-of-type > .panel-head, dialog[open] > .panel:first-of-type > .panel-head { cursor: move; user-select: none; }
dialog.bill-pop h2 { cursor: auto; }
dialog.dragging { user-select: none; }
/* (bank feeds: where the rules stopped in an account - the first one that needs someone) */
.feed-bill { margin-top: 3px; font-size: .85rem; color: var(--success-text, #1f7a3a); }
.feed-bill.no { color: var(--warning-text); font-weight: 600; }
.feed-stop { margin-top: 3px; font-size: .85rem; color: var(--warning-text); font-weight: 600; }
tr.feed-stopped > td:first-child { box-shadow: inset 3px 0 0 var(--warning-text); }
#rulesWaiting { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
#rulesWaiting.hidden { display: none; }
#rulesWaiting > span { flex: 1; }
/* (Bills & Deposits: split across categories - its lines under Category) */
.hgrid > .bill-split-wrap { grid-column: 1 / -1; }
.hgrid > .bill-split-wrap.hidden { display: none; }
.bill-split-wrap > #billSplitBtn { margin: 2px 0 4px; }
.bill-splits { margin: 4px 0 6px; }
.bill-splits td > select, .bill-splits td > input { width: 100%; min-width: 0; }
.bill-splits table.splits { table-layout: fixed; width: 100%; }
.bill-splits table.splits th:nth-child(1) { width: 34%; }
.bill-splits table.splits th:nth-child(2) { width: 22%; }
/* (the bill's split: a pop-up of its own, a summary where the category goes) */
.bill-split-wrap { display: flex; align-items: center; gap: 8px; }
.bill-split-wrap > .split-sum { flex: 1; padding: 3px 8px; border: 1px dashed var(--border); border-radius: 6px; color: var(--muted); }
.bill-split-wrap > .hidden { display: none; }
form.bill-splitting .hgrid > #billSubCatHost, form.bill-splitting .hgrid > label.hl:has(+ #billSubCatHost) { visibility: hidden; }
/* (the bill's Category field: the box - or, split, the summary - with Split… beside it, in the field's own column) */
.hgrid > .bill-cat-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hgrid > .bill-cat-cell.hidden { display: none; }
.bill-cat-cell > .catpick { flex: 1; min-width: 0; }
.bill-cat-cell > .split-sum { flex: 1; min-width: 0; padding: 4px 8px; border: 1px dashed var(--border); border-radius: 6px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-cat-cell > .hidden { display: none !important; }
form.bill-splitting .bill-cat-cell > .catpick { display: none; }
/* (split: Project / tag and Business account are each line's - N/A here) */
.hgrid > .bill-na-cell { min-width: 0; }
.hgrid > .bill-na-cell.hidden { display: none; }
.bill-na { display: none; color: var(--muted); font-style: italic; padding: 4px 0; }
form.bill-splitting .bill-na-cell > .catpick, form.bill-splitting .bill-na-cell > select { display: none; }
form.bill-splitting .bill-na-cell > .bill-na { display: block; }
form.bill-splitting .bill-subtag { visibility: hidden; }   /* (split: no sub-tag to choose - its place kept, so nothing moves) */
form.bill-splitting .hgrid > #billSubTagHost, form.bill-splitting .hgrid > label.hl:has(+ #billSubTagHost) { visibility: hidden; }
#billSplitDialog.no-chart .split-chart { display: none; }
/* (the bill's split pop-up: padded like every pop-up; a line's category and tag each with its sub one under it, so the
   columns fit without scrolling across) */
#billSplitDialog { width: min(1060px, calc(100vw - 32px)); }
#billSplitDialog > .bill-splits { padding: 14px 16px; background: var(--bg); margin: 0; }
#billSplitDialog .table-wrap { overflow-x: visible; }
#billSplitDialog table.splits { table-layout: fixed; width: 100%; }
#billSplitDialog table.splits th:nth-child(1) { width: 27%; }
#billSplitDialog table.splits th:nth-child(2) { width: 20%; }
#billSplitDialog table.splits th:nth-child(3) { width: 18%; }
#billSplitDialog table.splits th:nth-child(5) { width: 110px; }
#billSplitDialog table.splits th:nth-child(6) { width: 36px; }
#billSplitDialog.no-chart table.splits th:nth-child(1) { width: 33%; }
#billSplitDialog.no-chart table.splits th:nth-child(2) { width: 25%; }
#billSplitDialog table.splits td { vertical-align: top; }
dialog#billSplitDialog td .catpick { flex-direction: column; align-items: stretch; }
dialog#billSplitDialog td .catpick > .catpick-catbox, dialog#billSplitDialog td .catpick > .catpick-sub { flex: none; width: 100%; }
#billSplitDialog .split-foot { margin-top: 6px; }
/* (more room round the bill's split pop-up) */
#billSplitDialog > .bill-splits { padding: 20px 26px 18px; }
#billSplitDialog > .bill-splits > h2 { margin: 0 0 6px; }
#billSplitDialog table.splits td { padding: 5px 6px; }
#billSplitDialog .buttons { margin-top: 12px; }
/* (the Enter / Record pop-up: Split… beside the category; split, a summary there and the lines in a pop-up of their own;
   Tags, Sub-tag and Business account N/A - each line has its own) */
.rec-pick { display: flex; align-items: center; gap: 6px; }
.rec-pick > .catpick { flex: 1; min-width: 0; }
.rec-pick > .hidden { display: none !important; }
.rec-pick > .rec-split-sum { flex: 1; min-width: 0; padding: 4px 8px; border: 1px dashed var(--border); border-radius: 6px; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
form.rec-splitting .rec-pick > .catpick { display: none; }
form.rec-splitting .rec-row:has(.catpick-subhost[id$="categoryId_sub"]), form.rec-splitting .rec-row:has(.catpick-subhost[id$="tagId_sub"]) { display: none; }
.rec-na { display: none; color: var(--muted); font-style: italic; padding: 4px 0; }
form.rec-splitting .rec-row:has(> div > .rec-na) > div > :not(.rec-na):not(.hint) { display: none !important; }
form.rec-splitting .rec-na { display: block; }
.rec-split-dlg { width: min(1060px, calc(100vw - 32px)); }
.rec-split-dlg > .rec-split-in { padding: 20px 26px 18px; background: var(--bg); }
.rec-split-dlg > .rec-split-in > h2 { margin: 0 0 6px; }
.rec-split-dlg .table-wrap { overflow-x: visible; }
.rec-split-dlg table.splits { table-layout: fixed; width: 100%; }
.rec-split-dlg table.splits td { padding: 5px 6px; vertical-align: top; }
.rec-split-dlg table.splits th:nth-last-child(2) { width: 110px; }
.rec-split-dlg table.splits th:last-child { width: 36px; }
.rec-split-dlg table.splits th:first-child { width: 30%; }
.rec-split-dlg td > select, .rec-split-dlg td > input { width: 100%; min-width: 0; }
dialog.rec-split-dlg td .catpick { flex-direction: column; align-items: stretch; }
dialog.rec-split-dlg td .catpick > .catpick-catbox, dialog.rec-split-dlg td .catpick > .catpick-sub { flex: none; width: 100%; }
.rec-split-dlg .split-foot { margin-top: 6px; }
.rec-split-dlg .buttons { margin-top: 12px; }
/* (a split that doesn't add up: Make the amount … beside what's wrong) */
.take-total { margin-left: 6px; }
.split-foot .bad, .split-foot .negative { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
/* (a split line's copy and remove, side by side) */
.split-copy { margin-right: 2px; }
.rec-split-dlg table.splits th:last-child, #billSplitDialog table.splits th:last-child { width: 64px; }
table.splits td.nowrap { white-space: nowrap; }
/* (a bill & deposit's next 24: a click changes just that one) */
.upcoming-wrap { max-height: 280px; overflow-y: auto; }
#upcomingRows tr.occ-changed td:first-child { box-shadow: inset 3px 0 0 #2a78d6; }
/* Budgets */
.budget-tools { align-items: center; }
.budget-month { min-width: 150px; text-align: center; }
.budget-table td { vertical-align: middle; }
.budget-table tr.budget-top > td:first-child { font-weight: 600; }
.budget-table tr.budget-sub > td:first-child { padding-left: 26px; }
.budget-amt { width: 110px; text-align: right; }
.budget-freq { width: auto; }
.budget-table .bar-col { width: 120px; }
.budget-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.budget-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.budget-bar.over > span { background: var(--negative); }
.budget-bar.income > span { background: var(--positive); }
/* Budgets: folding a category's subcategories; the dashboard */
.budget-table tr[data-fold] > td:first-child { cursor: pointer; }
.budget-fold { color: var(--muted); margin-right: 4px; }
tr[data-fold] .budget-fold[aria-expanded="false"] { transform: rotate(-90deg); }
.budget-fold-space { display: inline-block; width: 22px; }
.budget-kids { font-weight: normal; }
.budget-fold-btns { display: inline-flex; gap: 2px; }
.dash-chart { width: 100%; overflow: hidden; }
.dash-chart svg { display: block; }
.dash-grid { stroke: var(--border); stroke-width: 1; }
.dash-axis { fill: var(--muted); font-size: 11px; }
.dash-axis.now { fill: var(--text); font-weight: 700; }
.dash-bar { fill: var(--accent); }
.dash-bar.over { fill: var(--negative); }
.dash-bar.income { fill: var(--positive); }
.dash-budget { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.dash-hit { fill: transparent; cursor: default; }
.dash-hit:hover { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.dash-sw-actual { background: var(--accent); } .dash-sw-over { background: var(--negative); } .dash-sw-income { background: var(--positive); }
.dash-sw-budget { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--text); margin: 0 4px 0 8px; vertical-align: middle; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }
.dash-big { margin-bottom: 10px; }
.dash-big-head { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; margin-bottom: 3px; }
/* Mortgage plans */
.plan-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.plan-periods td { vertical-align: top; }
.plan-periods input[type="number"] { width: 84px; text-align: right; }
.plan-periods input.pp-lump { width: 110px; }
.plan-periods input[type="date"] { width: 140px; }
.plan-bills { min-width: 260px; }
.plan-bill { font-size: .88rem; margin: 2px 0; }
.plan-bill.off { color: var(--warning-text); }
.plan-role { display: inline-block; min-width: 72px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.plan-pick { position: fixed; z-index: 80; width: 380px; }
.plan-pick button { white-space: normal; text-align: left; }
.plan-sched summary { cursor: pointer; padding: 4px 0; }
.plan-sched tr.sched-period td { border-top: 2px solid var(--border); }
.budget-set-btns { display: inline-flex; gap: 2px; }
.budget-set-btns.hidden { display: none; }
.plan-periods input.pp-pay, .plan-periods input.pp-int, .plan-periods input.pp-prin { width: 96px; }
.plan-periods input.manual { border-color: var(--accent); font-weight: 600; }
.main.full-width { max-width: none; }   /* (a page that uses the whole width: Mortgage plans) */
.main.full-width > * { max-width: none; }   /* (Mortgage plans: its contents the whole width too) */
.plan-periods input[type="number"] { width: 78px; }
.plan-periods input.pp-pay, .plan-periods input.pp-int, .plan-periods input.pp-prin, .plan-periods input.pp-odamt, .plan-periods input.pp-lump { width: 92px; }
.plan-periods input[type="date"] { width: 128px; }
.plan-periods th, .plan-periods td { padding-left: 5px; padding-right: 5px; }
.plan-bills { min-width: 220px; }
/* (the periods table, tighter so it fits the page) */
.plan-periods { font-size: .88rem; }
.plan-periods input { font-size: .88rem; padding: 4px 6px; }
.plan-periods input[type="number"] { width: 68px; }
.plan-periods input.pp-pay, .plan-periods input.pp-int, .plan-periods input.pp-prin, .plan-periods input.pp-odamt, .plan-periods input.pp-lump { width: 86px; }
.plan-periods input[type="date"] { width: 122px; }
.plan-periods th { white-space: normal; line-height: 1.15; }
.plan-bills { min-width: 190px; }
.plan-periods th, .plan-periods td { padding-left: 4px; padding-right: 4px; }
.plan-bills { min-width: 170px; }
.plan-periods input[type="date"] { width: 118px; }
.plan-bills { min-width: 150px; }
.plan-role { min-width: 0; margin-right: 4px; }
.plan-periods input[type="number"] { width: 64px; }
.plan-periods input.pp-odpay { width: 86px; }
.plan-periods th { vertical-align: bottom; }
.plan-bill > .plan-role.linkish { color: inherit; text-decoration: none; min-width: 64px; text-align: left; }
.plan-bill > .plan-role.linkish:hover { text-decoration: underline; }
.plan-bill { white-space: nowrap; }
/* (Link…: the bills & deposits that fit first, then the rest, with a search box) */
.plan-pick { width: 430px; padding: 6px; display: flex; flex-direction: column; max-height: 420px; }
.plan-pick-find { margin-bottom: 6px; }
.plan-pick-list { overflow-y: auto; }
.plan-pick-head { padding: 6px 8px 2px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.plan-pick-list button { display: block; width: 100%; line-height: 1.35; padding: 5px 8px; }
.lump-kept { opacity: .6; }
.lump-record { font-weight: 600; }
/* (a period's links: chips side by side) */
.plan-chips { display: flex; flex-wrap: nowrap; gap: 4px; }
.plan-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 2px 9px; font-size: .8rem; white-space: nowrap; cursor: pointer; line-height: 1.5; }
.plan-chip.ok { background: color-mix(in srgb, var(--positive) 14%, transparent); border-color: color-mix(in srgb, var(--positive) 45%, transparent); }
.plan-chip.off { background: var(--warning-bg); color: var(--warning-text); border-color: color-mix(in srgb, var(--warning-text) 45%, transparent); }
.plan-chip.add { border-style: dashed; color: var(--muted); }
.plan-chip.add:hover { color: var(--accent); border-color: var(--accent); }
.plan-chip.none { opacity: .45; cursor: default; }
.plan-chip-menu { position: fixed; z-index: 80; min-width: 210px; }
.plan-bills { min-width: 0; }
/* (a mortgage plan: the period we're in now) */
.plan-periods tr.plan-now > td { background: var(--accent-soft); }
.plan-periods tr.plan-now > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* (a mortgage plan: the what-if box under the periods) */
.plan-whatif { padding: 8px 12px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; }
.plan-whatif label { display: inline-flex; align-items: center; gap: 8px; }
.plan-whatif input { width: 120px; }
/* (Bills & Deposits: the Options button - the right-click menu on a touch screen) */
.bill-opts { min-width: 32px; font-weight: 700; letter-spacing: 1px; }
/* (Bills & Deposits - estimates: the accounts it applies to) */
.est-dialog { width: min(920px, 96vw); }
.est-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.est-side { border-left: 1px solid var(--border); padding-left: 14px; }
.est-acct-list { display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.est-acct-group { min-width: 0; }
@media (max-width: 720px) { .est-layout { grid-template-columns: 1fr; } .est-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 10px; } .est-acct-list { max-height: 30vh; } }
.est-acct-group .check { display: flex; margin: 2px 0; }
.est-when { margin-bottom: 8px; }
/* (the cash-flow chart: a line for each account, with the total) */
.fc-acct { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .9; }
.fc-acct-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 4px 0; font-size: .85rem; color: var(--text); }
.fc-acct-sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 2px; }
.fc-acct-total { background: linear-gradient(90deg, var(--positive) 50%, var(--negative) 50%); height: 3px; }
/* (a number box's calculator: the sum, under the box) */
.calc-pop { position: fixed; z-index: 1200; background: var(--surface); color: var(--text); border: 1px solid var(--accent); border-radius: 8px; box-shadow: var(--shadow); padding: 5px 9px; font-size: .9rem; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.calc-pop .calc-eq { font-weight: 700; color: var(--accent-strong, var(--accent)); }
.calc-pop .calc-hint { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
/* (a bill & deposit's payslip: its sections and the net pay) */
.pay-dialog .pay-sec { margin-bottom: 10px; }
.pay-dialog .pay-head { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; }
.pay-dialog .pay-head .pay-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.pay-dialog .pay-sec[data-sec="Earnings"] .pay-total { color: var(--positive); }
.pay-dialog .pay-sec:not([data-sec="Earnings"]) .pay-total::before { content: '- '; }
.pay-dialog .pay-net { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--border); padding-top: 8px; margin-top: 4px; font-size: 1.05rem; }
.pay-dialog .pay-net b { font-variant-numeric: tabular-nums; font-size: 1.15rem; }

/* (the payslip and the split of income, expenses and transfers: each section boxed; its columns sized - the category wide, the
   amounts a set width and right-aligned, the remove button seen) */
.pay-dialog .pay-sec { border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px 8px; }
.pay-dialog .pay-sec > .btn { margin-top: 6px; }
dialog.pay-dialog table.splits { table-layout: fixed !important; width: 100% !important; }
dialog.pay-dialog table.splits th:nth-child(1) { width: 46% !important; }
dialog.pay-dialog table.splits th:nth-child(3) { width: 140px !important; }
dialog.pay-dialog table.splits th:last-child { width: 40px !important; }
dialog.pay-dialog table.splits td > select, dialog.pay-dialog table.splits td > input, dialog.pay-dialog table.splits td > .catpick { width: 100%; min-width: 0; box-sizing: border-box; }
dialog.pay-dialog input[data-p="amt"], dialog.pay-dialog input[data-m="out"], dialog.pay-dialog input[data-m="in"] { text-align: right; font-variant-numeric: tabular-nums; }
dialog.pay-dialog table.splits th.num { text-align: right; }
dialog.mix-dialog table.splits.mix th:nth-child(1) { width: 110px !important; }
dialog.mix-dialog table.splits.mix th:nth-child(2) { width: 40% !important; }
dialog.mix-dialog table.splits.mix th:nth-child(3) { width: auto !important; }
dialog.mix-dialog table.splits.mix th:nth-child(4), dialog.mix-dialog table.splits.mix th:nth-child(5) { width: 120px !important; }
/* (a split with tags - a bank feed rule's, a bill's: Line, Category or account, Tag (and sub-tag), Memo, Out, In) */
dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(1) { width: 104px !important; }
dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(2) { width: 28% !important; }
dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(3) { width: 28% !important; }
dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(4) { width: auto !important; }
dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(5), dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(6) { width: 104px !important; }
dialog.mix-dialog table.splits.mix.mix-tag th:nth-child(7) { width: 34px !important; }
dialog.mix-dialog table.splits.mix.mix-tag td .catpick-catbox, dialog.mix-dialog table.splits.mix.mix-tag td .catpick-sub { min-width: 0; }
dialog.pay-dialog > .bill-splits { padding: 8px 14px 12px; }
dialog.pay-dialog .pay-net { padding-left: 2px; padding-right: 2px; }

/* Opex -> Expenses: one not cleared yet */
tr.uncleared td, tr.uncleared td .muted, tr.uncleared td .sub { color: var(--negative); }
/* An expense's Cleared choice: red when not, green when it is */
.segmented.cleared-pick { margin-bottom: 0; align-self: flex-start; }
.cleared-pick input[value="0"]:checked + span { background: var(--negative); color: #fff; }
.cleared-pick input[value="1"]:checked + span { background: var(--positive); color: #fff; }
/* A row's ⋯ button: the same menu as right-clicking it (P.contextMenu's dots) */
th.row-dots, td.row-dots { width: 40px; text-align: right; padding-left: 2px; padding-right: 6px; white-space: nowrap; }
.row-dots-btn { min-width: 30px; padding: 0 6px; font-weight: 700; letter-spacing: 1px; line-height: 1.4; }
/* Admin -> Event log: a detail that opens what it's about */
a.ev-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a.ev-link:hover { color: var(--accent); }

/* A pop-up with no form of its own inside: the same padding and background a form gives (Xero sync history, an item) */
dialog.padded { padding: 14px 16px; background: var(--bg); }

/* Issues (script 144): above an account's register, and the flag on a row */
.reg-issues { border: 1px solid var(--warning-text); border-left-width: 4px; border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; background: var(--surface, transparent); }
.reg-issues-head { font-weight: 600; color: var(--warning-text); margin-bottom: 4px; }
.reg-issue { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 4px 0; border-top: 1px solid var(--border, #dde1e7); }
.reg-issue:first-of-type { border-top: 0; }
.reg-issue .spacer { flex: 1; }
.issue-flag { color: var(--warning-text); cursor: help; }

/* A payslip in the register (script 145): its lines by section, the gross and the net */
.payslip-view { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 8px 0 10px; }
.payslip-title { font-weight: 600; margin-bottom: 4px; }
.payslip-table td { padding: 3px 6px; }
.payslip-table tr.payslip-head td { font-weight: 600; padding-top: 8px; border-bottom: 1px solid var(--border); }
.payslip-table tr.payslip-total td { font-weight: 600; border-top: 1px solid var(--border); }
.payslip-table tr.payslip-total.net td { border-top: 2px solid var(--border); font-size: 1.05em; }

/* Accounts: the columns - Name takes what's left; Details and ⋯ on one line; drag a heading's edge to size them (P.columnWidths) */
table.acc-table:not(.cols-sized) th[data-col="type"] { width: 11%; }
table.acc-table:not(.cols-sized) th[data-col="institution"] { width: 11%; }
table.acc-table:not(.cols-sized) th[data-col="number"] { width: 12%; }
table.acc-table:not(.cols-sized) th[data-col="bought"] { width: 105px; }
table.acc-table:not(.cols-sized) th[data-col="linked"] { width: 14%; }
table.acc-table:not(.cols-sized) th[data-col="status"] { width: 80px; }
table.acc-table:not(.cols-sized) th[data-col="balance"] { width: 120px; }
table.acc-table th.acc-actions { width: 100px; }
table.acc-table th.acc-check { width: 36px; }
table.acc-table .acc-check { text-align: center; padding-left: 6px; padding-right: 2px; overflow: visible; }
table.acc-table .acc-check input { width: 16px; height: 16px; margin: 0; cursor: pointer; vertical-align: middle; }
.acc-table tr.acc-shares td.acc-check + td { padding-left: 18px; }
table.acc-table td.acc-actions { white-space: nowrap; overflow: visible; text-align: right; }

/* Accounts: a group's title collapses it (accounts.js) - not while searching */
.acc-toggle { cursor: pointer; user-select: none; }
.acc-toggle:hover { color: var(--accent); }
.acc-chev { display: inline-block; width: 1em; transition: transform .15s; }
.acc-n { font-size: .85rem; font-weight: 400; }
#list:not(.acc-searching) .acc-collapsed .table-wrap { display: none; }
#list:not(.acc-searching) .acc-collapsed .group-title { margin-bottom: 0; }
#list:not(.acc-searching) .acc-collapsed .acc-chev { transform: rotate(-90deg); }
/* Accounts: the Total's line for each currency (its own total, and roughly what it is in the workspace's currency) */
.acc-cur-table { margin: 6px 0 4px auto; border-collapse: collapse; font-size: .9rem; }
.acc-cur-table td { padding: 2px 0 2px 18px; white-space: nowrap; }
.acc-cur-table td:first-child { padding-left: 0; }
.acc-cur-line { margin-left: auto; margin-right: 24px; font-size: .9rem; text-align: right; }
/* Bank feeds, Connections: each bank named once, beside its accounts */
td.bf-bank { vertical-align: top; white-space: nowrap; background: var(--surface-2); }
tr.bf-bank-first td { border-top: 2px solid var(--border); }

/* Suggestions (suggestions.js): a panel down the right, under the header - pinned, the page makes room for it */
.sugg-panel { position: fixed; top: var(--topbar-h, 56px); right: 0; bottom: 0; width: min(380px, 100vw); z-index: 45; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(16, 24, 40, .10); display: flex; flex-direction: column; }
.sugg-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.sugg-head .spacer { flex: 1; }
.sugg-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.sugg-card { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.sugg-card.sev-warn { border-left-color: #e0a100; }
.sugg-card.sev-alert { border-left-color: #e34948; }
.sugg-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sugg-title { font-weight: 600; margin: 2px 0 4px; }
.sugg-detail { font-size: .88rem; color: var(--text); }
.sugg-ex { font-size: .82rem; margin-top: 6px; }
.sugg-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.sugg-empty { padding: 16px 8px; }
@media (min-width: 1100px) { body.sugg-pinned .layout { margin-right: 380px; } }

/* Admin: the site admin's own sections and tabs (hidden for workspace owners) */
body:not(.site-admin) .site-only { display: none !important; }
h2.admin-sub { font-size: 1.05rem; margin: 0 0 8px; }

/* The header short of room (site.js tightTop): Ask AI, Help and Requests show just their icons */
.topbar.tight .help-button > span:not(.badge) { display: none; }

/* Register: the transaction gone to (Go to it in the other account), lit up for a moment */
@keyframes rowFlash { from { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); } to { background: transparent; } }
table.register tr.flash td { animation: rowFlash 2.5s ease-out; }

/* Screen lock (lock.js): everything behind blurred, a card asking for the lock password */
dialog.lock-screen { border: 0; background: transparent; box-shadow: none; padding: 0; max-width: none; }
dialog.lock-screen::backdrop { background: rgba(15, 23, 42, .35); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.lock-card { background: var(--surface); color: var(--text); border-radius: 14px; padding: 24px 26px; width: min(360px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(15, 23, 42, .35); text-align: left; }
.lock-card h2 { margin: 8px 0 4px; }
.lock-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent, #fff); }
.lock-icon svg { width: 24px; height: 24px; }

/* The public demo's visitor (site.js, demo.js): their own sign-in, the workspace's people, emails, Private and the like aren't part of the demo */
.demo-signup { flex: none; align-self: center; margin-left: 6px; }
.demo-visitor [data-tab="sandbox"], .demo-visitor [data-tab="people"], .demo-visitor [data-tab="security"], .demo-visitor [data-tab="ai"],
.demo-visitor [data-tab="billing"], .demo-visitor [data-tab="sending"], .demo-visitor [data-tab="emails"], .demo-visitor [data-tab="danger"],
.demo-visitor #lockPanel, .demo-visitor #requestsButton, .demo-visitor #askAiButton { display: none !important; }
.demo-keep .choice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.demo-keep .choice input { width: auto; margin-top: 3px; }
.landing-demo-note { margin-top: 10px; }
/* (a rule's Bill & deposit and Also enter: a box to type in, over the drop-down; its list in two lines - who and how much, then account, due and memo) */
.bill-pick-wrap { display: block; min-width: 0; }
.bill-pick-wrap > .bill-pick { width: 100%; text-overflow: ellipsis; }
.pick-menu .pick-group { padding: 6px 8px 2px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pick-menu .pick-item { white-space: normal; padding: 4px 8px; }
.pick-menu .pick-item .pick-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-menu .pick-item .pick-sub { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-menu .pick-item.active .pick-sub { color: inherit; font-weight: 400; opacity: .8; }
/* (a rule: When's All/Any beside its title; Fill in Then from this bill under the bill) */
#ruleForm .panel-head > strong { white-space: nowrap; }
#ruleForm .panel-head > .head-select { width: auto; flex: 0 0 auto; margin-right: auto; }
.bill-fill { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-weight: normal; }
.bill-fill .muted { font-size: .85rem; }
/* (bank feeds: a bank transaction's Details - a summary at the top, then label / value lists in two columns;
   the register's lines' Edit) */
dialog.feed-detail { width: min(880px, calc(100vw - 32px)); padding: 20px 24px; }
/* (Bank feeds, Balances: wide enough for each account on one line - name, number, both balances, when and the difference) */
dialog#balDialog { width: min(1300px, calc(100vw - 32px)); max-width: none; }
dialog#btDialog { width: min(1100px, calc(100vw - 32px)); max-width: none; }
#btTable tfoot td { font-weight: 600; border-top: 2px solid var(--border); }
#balTable td, #balTable th { white-space: nowrap; }
#balTable td .sub { display: inline; margin-left: 8px; }
dialog.feed-detail h2 { margin-bottom: 12px; }
.fd-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.fd-desc { font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.fd-sub { margin-top: 4px; font-size: .88rem; color: var(--muted); }
.fd-amt { font-size: 1.35rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fd-state { display: inline-block; margin-top: 6px; }
.fd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; align-items: start; }
@media (max-width: 720px) { .fd-cols { grid-template-columns: 1fr; } }
.fd-sec h3 { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 4px; }
.fd-list { display: grid; grid-template-columns: 130px minmax(0, 1fr); margin: 0; font-size: .9rem; }
.fd-list dt, .fd-list dd { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--border); }
.fd-list dt { color: var(--muted); padding-right: 10px; }
.fd-list dd { overflow-wrap: anywhere; }
.fd-list dt:last-of-type, .fd-list dd:last-of-type { border-bottom: 0; }
.fd-refs { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 18px; }
.fd-refs b { font-weight: 500; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.feed-reg .reg-edit { padding: 0 6px; min-height: 0; line-height: 1.6; }
/* (Details: a suggested bill & deposit, and New rule with this bill beside it) */
.fd-bill { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 4px; }
.fd-bill:last-child { margin-bottom: 0; }
.fd-bill .linkish { text-align: left; }
.fd-rule-bill { padding: 1px 8px; min-height: 0; font-size: .78rem; }
/* (Details: New rule with this bill on the right of its bill) */
.fd-bill { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 12px; }
.fd-rule-bill { white-space: nowrap; justify-self: end; }
/* (Details: Here centred in the space between Bank account and Suggested - the left column as tall as From the bank) */
.fd-cols > .fd-left { align-self: stretch; display: flex; flex-direction: column; }
.fd-left > .fd-here { margin: auto 0; }
.fd-left > .fd-here { transform: translateY(5px); }   /* (evens out the headings' own margins: the same space above and below) */
/* (Bank feeds, To review: In the register and From the bank - each its own list, half the screen each, a bar between them to drag) */
.feed-split { display: flex; flex-direction: column; height: 100vh; min-height: 240px; }   /* (data-fit caps it to the rest of the screen) */
.feed-pane { display: flex; flex-direction: column; min-height: 0; margin: 0; overflow: hidden; }
#regPane { flex: 0 0 var(--reg-h, 50%); }
#bankPane { flex: 1 1 0; }
.feed-pane > .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
.feed-pane-head { display: flex; align-items: baseline; gap: 10px; padding: 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .9rem; }
.feed-pane-head .spacer { flex: 1; }
.feed-splitter { flex: 0 0 12px; cursor: row-resize; display: flex; align-items: center; justify-content: center; touch-action: none; user-select: none; }
.feed-splitter > span { width: 56px; height: 4px; border-radius: 2px; background: var(--border); }
.feed-splitter:hover > span, .feed-splitter:focus-visible > span, .feed-splitter.dragging > span { background: var(--accent); }
.feed-splitter:focus { outline: none; }
.feed-reg-table tbody td { color: var(--muted); font-size: .9rem; }
/* (Bank feeds → Rules: # - the order they're tried in) */
td.rule-order { color: var(--muted); font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
/* (Bank feeds, To review: the Tag column - or, too narrow for it, a little Tag button by the category) */
.feed-tagbtn { display: none; margin-top: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-tagbtn > span { font-size: .85rem; }
.feed-narrow .feed-tagcol { display: none; }
.feed-narrow .feed-tagbtn { display: inline-block; }
.feed-tag-dialog { width: min(520px, calc(100vw - 32px)); }

/* + New category / tag in a picker (site.js makeNew) */
.catpick-item.catpick-new { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; color: var(--accent); font-weight: 600; }
.catnew-dialog { width: min(420px, calc(100vw - 32px)); }

/* To review: Rule... is on Details (and the right-click menu) - not on the line. Still there, hidden: those press it. */
.feed-acts [data-rule], .feed-acts [data-edit-rule] { display: none; }

/* Bank feeds - In the register: a transaction no bank line is */
.feed-pane-head .feed-notbank-only { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; margin-right: 12px; cursor: pointer; white-space: nowrap; }
.feed-pane-head .feed-notbank-only.hidden { display: none; }
tr.feed-notbank td:first-child { box-shadow: inset 3px 0 0 #e8a100; }

/* P.wait: the hourglass while something's being done */
html.is-waiting, html.is-waiting * { cursor: wait !important; }

/* Bank feeds: a pending bank transaction (not cleared yet) - shown, not to act on */
.feed-table tr.feed-pending td { color: var(--muted); font-style: italic; background: var(--surface-2); }
.feed-table tr.feed-pending .badge { font-style: normal; }

/* Investments - by sector: each sector's line */
table.by-sector tr.sector-head td { background: var(--surface-2); border-top: 2px solid var(--border); }

/* Appearance - summary boxes on one line (the default): every box in the row, narrower to fit, its words cut short
   with … (on a phone: as many lines as they need) */
@media (min-width: 701px) {
  :root[data-stats="one"] .stats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  :root[data-stats="one"] .stats > .stat { min-width: 0; }
  :root[data-stats="one"] .stats > .stat :is(.label, .value, .muted) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Dashboard - How your investing has gone: two columns (best | worst) */
.inv-two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; padding: 8px 10px; }
@media (max-width: 560px) { .inv-two-cols { grid-template-columns: 1fr; } }

/* Dashboard - Since you sold: a sentence a share */
.sold-lines { list-style: none; margin: 0; padding: 8px 12px; }
.sold-lines li { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.sold-lines li:last-child { border-bottom: 0; }
.sold-lines li > b { width: 14px; text-align: center; flex: none; }

/* P.progress: one at a time, "Deleting 3 of 12…" */
.progress-pop { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 10000; min-width: 260px; max-width: calc(100vw - 32px);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); padding: 10px 14px; }
.progress-pop .progress-text { font-size: .9rem; margin-bottom: 6px; }
.progress-pop .progress-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress-pop .progress-fill { height: 100%; width: 0; background: var(--accent, #2a78d6); transition: width .15s; }
.progress-pop .progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.progress-pop .progress-row .progress-text { flex: 1; margin-bottom: 0; }
html.is-waiting .progress-pop [data-stop] { cursor: pointer !important; }

/* Bank feeds rule: Then against its bill & deposit - matching (green) or not (red); the hover says what does */
.feed-cond input.cond-day { max-width: 130px; }
.change-many-dialog { width: min(560px, calc(100vw - 24px)); }
.change-many-dialog .cm-row { margin-bottom: 12px; }
.change-many-dialog .cm-on { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 4px; }
.memo-none-row { display: flex; align-items: center; gap: 10px; }
.memo-none-row > input { flex: 1; min-width: 0; }
.memo-none-row > .check { margin: 0; white-space: nowrap; }
.then-match { font-size: .85rem; margin-left: 8px; cursor: help; }
.rule-bill-only { align-self: center; font-size: .9rem; }
.bill-used { color: var(--warning-text); font-size: .85rem; margin: 2px 0 4px; }
/* (a split rule's Tag and Sub-tag: the lines' own, in their places - the boxes put away) */
.field .line-tag-sum { display: none; }
.field.by-line > :not(:first-child):not(.line-tag-sum) { display: none !important; }
#ruleSubTagField.by-line { visibility: hidden; }   /* (as a bill's: hidden, its place kept) */
.field.by-line > .line-tag-sum { display: block; padding: 4px 0; color: var(--muted); font-style: italic; }
.then-match.ok { color: var(--positive); }
.then-match.bad { color: var(--negative); }

/* Bank feeds rule: Tag always starts a line of its own (a hidden Subcategory doesn't pull it up beside the category) */
#ruleForm .form-grid > #ruleTagField { grid-column-start: 1; }

/* Categories: the ▾ / ▸ on a category with sub-categories (click it, or double-click the row, to fold them away) */
.cat-caret { display: inline-block; width: 1.1em; color: var(--muted); font-weight: 400; cursor: pointer; user-select: none; }

/* Register: Pay invoices - the deposit on the left, the invoices owing to tick on the right */
dialog.pay-inv-dialog { width: min(1060px, calc(100vw - 32px)); }
.pay-inv { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.pay-inv h3 { margin: 0 0 8px; font-size: .95rem; }
.pay-inv-left { padding: 12px 14px; background: var(--surface-2); border-radius: 8px; }
.pay-inv-sum { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.pay-inv-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.pay-inv-tools input[type=search] { flex: 1; }
.pay-inv-list { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.pay-inv-list input[type=number] { width: 7.5em; text-align: right; }
.pay-inv-list tr.mine td:nth-child(3) { font-weight: 600; }
@media (max-width: 760px) { .pay-inv { grid-template-columns: 1fr; } }

/* Xero Bring in: payments banked together - the deposit (left) and the payments in it (right) */
.paygroup .pg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.paygroup h4 { margin: 6px 0 4px; font-size: .85rem; }
.paygroup .pg-sum { margin-top: 8px; }
@media (max-width: 760px) { .paygroup .pg-cols { grid-template-columns: 1fr; } }

/* Xero pop-up: an invoice line's description - 3 lines of it, all of it when clicked */
.line-desc { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.line-desc.open { display: block; -webkit-line-clamp: unset; line-clamp: unset; }

/* Xero pop-up: the right-hand side - what a payment applies to, then its match */
dialog.item-dialog .item-right { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
dialog.item-dialog .item-right > section { border-radius: 8px; padding: 12px 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
dialog.item-dialog .item-right > section.hidden { display: none; }
#itemApplies { background: var(--surface) !important; }
.applies-doc { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; background: color-mix(in srgb, #13b5ea 6%, var(--surface)); }
.applies-doc .apd-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.applies-doc .apd-full { margin-top: 8px; }

/* Find transactions: the words found, picked out */
#rows mark { background: color-mix(in srgb, #f2c94c 45%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* Reminders: every group's table the same columns, so they line up */
.sched-table { table-layout: fixed; width: 100%; }
.sched-table td { overflow-wrap: anywhere; }

/* ===== Detail screen ("master-detail with an action sidebar"): the record's details in a card on the left (.ds-main),
   its actions as a column of full-width buttons on the right (.ds-side, Delete / Close / Save on top in .ds-top), the
   label-then-value facts (.ds-facts: <dt>/<dd> pairs, two lists side by side in .ds-facts-row), the lines below grouped
   with subtotals (a normal table.grid), and the totals strip at the bottom (.ds-summary, each figure a .ds-fig). On a
   phone the side column drops under the details. */
.ds-layout { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.ds-main { flex: 999 1 560px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ds-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ds-side { flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; }
.ds-side > .btn { width: 100%; justify-content: center; padding: 10px 14px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.ds-top { display: flex; gap: 8px; margin-bottom: 6px; }
.ds-top .btn { flex: 1; justify-content: center; font-weight: 600; }
.ds-facts-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; padding-top: 10px; border-top: 1px solid var(--surface-2); }
.ds-facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; align-content: start; margin: 0; }
.ds-facts dt { font-size: .8rem; color: var(--muted); padding-top: 2px; }
.ds-facts dd { margin: 0; }
.ds-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.ds-fig { padding: 14px 16px; border-right: 1px solid var(--surface-2); }
.ds-fig:last-child { border-right: 0; }
.ds-fig .label { font-size: .8rem; color: var(--muted); }
.ds-fig .value { font-size: 1.25rem; font-weight: 700; }
@media (max-width: 700px) { .ds-row, .ds-facts-row { grid-template-columns: minmax(0, 1fr); } }

/* (the Detail invoice screen: a wider pop-up, the .ds-* layout inside it) */
dialog.ds-dialog { width: min(1200px, calc(100vw - 32px)); }
dialog.ds-dialog .ds-layout > .ds-main { padding: 0; border: 0; background: none; }
dialog.ds-dialog .ds-main > section.panel { margin: 0; height: 100%; }
.ds-side > .btn, .ds-pair > .btn { box-shadow: 0 1px 2px rgba(16, 24, 40, .12); font-weight: 600; justify-content: center; }
.ds-side > .btn { width: 100%; padding: 9px 14px; }
.ds-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ds-pair > .btn { padding: 9px 8px; }
.ds-top .btn.danger { flex: 0 0 auto; }

/* (the Detail invoice screen's details: rows of two, notes, the facts with the ticks under Status, the strip under the lines) */
dialog.ds-dialog .ds-row { margin-bottom: 8px; }
dialog.ds-dialog .ds-notes { margin-bottom: 4px; }
dialog.ds-dialog .ds-facts dd.ds-ticks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; padding-top: 2px; }
dialog.ds-dialog .ds-facts dd.ds-ticks .check { margin: 0; }
dialog.ds-dialog .ds-summary { margin-top: 12px; }

/* (the Detail invoice screen as designed: white cards, no panel bars; the grouped lines) */
dialog.ds-dialog .ds-main > section.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
dialog.ds-dialog .ds-main > section.panel > .panel-head { display: none; }
dialog.ds-dialog .ds-main > section.panel > .panel-body { padding: 0; }
dialog.ds-dialog table.ds-lines tr.ds-head.group-row td { font-weight: 700; color: var(--accent-strong); padding-top: 10px; border-bottom: 1px solid var(--border); }
dialog.ds-dialog table.ds-lines tr.ds-sub td { font-weight: 700; background: var(--surface-2); }
dialog.ds-dialog table.ds-lines td.ds-x { white-space: nowrap; }
dialog.ds-dialog table.ds-lines tbody tr:not(.ds-head) > td:first-child { padding-left: 18px; white-space: nowrap; }
dialog.ds-dialog table.ds-lines .ds-kind { width: 84px; margin-right: 6px; }
dialog.ds-dialog table.ds-lines .ds-kind + input[data-f="description"] { width: calc(100% - 94px); }
dialog.ds-dialog .ds-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }

/* (the Detail invoice screen, closer to the design: the title bar keeps only its x - Delete / Close / Save are down the
   right; labels above their boxes; the lines in a white card with a plain heading; raised buttons; a bigger title) */
dialog.ds-dialog .dlg-tools > .btn:not(.ghost) { display: none; }
dialog.ds-dialog .dlg-top h2 { font-size: 1.35rem; }
dialog.ds-dialog .dlg-status { display: none; }
dialog.ds-dialog .ds-main .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; }
dialog.ds-dialog .ds-main .field > :is(span, .hl):first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-dialog .ds-main .field > :is(span, .hl):first-child::after { content: none !important; }
dialog.ds-dialog .ds-main .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-dialog .ds-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
dialog.ds-dialog section.panel:has(#lineRows) { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 14px; }
dialog.ds-dialog section.panel:has(#lineRows) > .panel-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; }
dialog.ds-dialog section.panel:has(#lineRows) > .panel-head strong { font-size: 1rem; }
dialog.ds-dialog .ds-side .btn, dialog.ds-dialog .ds-top .btn, dialog.ds-dialog .ds-pair .btn { border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); font-weight: 600; min-height: 38px; }
dialog.ds-dialog .ds-side .btn.primary, dialog.ds-dialog .ds-top .btn.primary { border-color: var(--accent); }
dialog.ds-dialog .ds-top .btn.danger { color: var(--negative); }
dialog.ds-dialog .ds-facts dd { font-size: .95rem; }

/* (an invoice's opex line: from the budget, not to be changed - shown as plain text) */
#lineRows input.ro { border-color: transparent; background: transparent; box-shadow: none; cursor: default; }

/* (the Detail invoice screen: a fifth taller than a new invoice needs - about 800px, or the window's height - the lines
   card taking the room) */
dialog.ds-dialog[open] { min-height: min(800px, calc(100vh - 32px)); display: flex; flex-direction: column; }
dialog.ds-dialog > form { flex: 1; display: flex; flex-direction: column; }
dialog.ds-dialog > form > section.panel:has(#lineRows) { flex: 1; }
dialog.ds-dialog .ds-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
dialog.ds-dialog .ds-trio > .btn { width: 100%; padding: 9px 6px; justify-content: center; white-space: normal; line-height: 1.2; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); font-weight: 600; min-height: 38px; }
dialog.ds-dialog .ds-trio > .btn.primary { border-color: var(--accent); }
dialog.ds-dialog .ds-row.ds-row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* (the lines card fills its room, the subtotal / GST / total rows pinned to its bottom - a filler row takes the slack) */
dialog.ds-dialog section.panel:has(#lineRows) { display: flex; flex-direction: column; }
dialog.ds-dialog section.panel:has(#lineRows) > .panel-body { flex: 1; display: flex; flex-direction: column; }
dialog.ds-dialog section.panel:has(#lineRows) .table-wrap { flex: 1; display: flex; flex-direction: column; }
dialog.ds-dialog table.ds-lines { flex: 1; height: 100%; }
dialog.ds-dialog table.ds-lines tr { height: 1px; }
dialog.ds-dialog table.ds-lines tr.ds-fill { height: auto; }
dialog.ds-dialog table.ds-lines tr.ds-fill td { border: 0; padding: 0; background: none; }
dialog.ds-dialog .ds-row.ds-row4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
dialog.ds-dialog .ds-notesrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 18px; margin-bottom: 4px; }
dialog.ds-dialog .ds-notesrow > .ds-notes { flex: 1 1 320px; min-width: 0; margin: 0; }
dialog.ds-dialog .ds-notesrow > .ds-ticks { display: flex; gap: 6px 16px; flex-wrap: wrap; padding-bottom: 6px; }
dialog.ds-dialog .ds-notesrow > .ds-ticks .check { margin: 0; white-space: nowrap; }
/* (the facts under Notes: three across, each label above its value) */
dialog.ds-dialog .ds-facts3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; padding-top: 10px; border-top: 1px solid var(--surface-2); }
dialog.ds-dialog .ds-facts3 .ds-fact { margin: 0; }
dialog.ds-dialog .ds-facts3 dt { font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
dialog.ds-dialog .ds-facts3 dd { margin: 0; font-size: .95rem; }
@media (max-width: 700px) { dialog.ds-dialog .ds-facts3 { grid-template-columns: minmax(0, 1fr); } }
/* (the Detail invoice's Payments and Documents pop-ups: three times their old height; Owing pinned to the bottom) */
dialog.ds-sub[open] { min-height: min(576px, calc(100vh - 32px)); display: flex; flex-direction: column; }
dialog.ds-sub > form { flex: 1; display: flex; flex-direction: column; }
dialog.ds-sub #invoiceDocs, dialog.ds-sub #paymentsBox { flex: 1; display: flex; flex-direction: column; margin-bottom: 10px; }
dialog.ds-sub #paymentsBox > .panel-body { flex: 1; display: flex; flex-direction: column; }
dialog.ds-sub #paymentsBox .table-wrap { flex: 1; display: flex; flex-direction: column; }
dialog.ds-sub #paymentsBox table { flex: 1; height: 100%; }
dialog.ds-sub #paymentsBox tr { height: 1px; }
dialog.ds-sub #paymentsBox tr.ds-fill { height: auto; }
dialog.ds-sub #paymentsBox tr.ds-fill td { border: 0; padding: 0; background: none; }
dialog.ds-sub #invoiceDocs > :last-child { flex: 1; }
dialog.ds-sub #rechargePick { margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
dialog.ds-sub #rechargePick label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
dialog.ds-sub[open]:has(#rechargePick) { min-height: 0; }

/* (the Detail invoice: a line's Rent / Other box isn't needed - lines aren't typed in) */
dialog.ds-dialog table.ds-lines .ds-kind { display: none; }
dialog.ds-dialog table.ds-lines .ds-kind + input[data-f="description"] { width: 100%; }
/* (a fixed line's memo and amount: plain text like the other columns - nothing to click into) */
#lineRows input.ro { pointer-events: none; padding-left: 0; padding-right: 0; outline: none; color: inherit; font: inherit; min-height: 0; height: auto; }
#lineRows input.ro[data-f="amount"] { padding-right: 0; }
/* (the lines table edge to edge in its card - the totals' shading reaching both sides; text kept off the edges) */
dialog.ds-dialog section.panel:has(#lineRows) > .panel-body,
dialog.ds-dialog section.panel:has(#lineRows) .table-wrap { padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; }
dialog.ds-dialog table.ds-lines { width: 100%; margin: 0; border-collapse: collapse; }
dialog.ds-dialog table.ds-lines :is(th, td):first-child { padding-left: 16px; }
dialog.ds-dialog table.ds-lines :is(th, td):last-child { padding-right: 12px; }
#lineRows input.ro[data-f="amount"] { display: none; }
#lineRows .ds-amt { display: block; text-align: right; }
/* (the lines' money headings and figures all right-aligned, the same way) */
dialog.ds-dialog table.ds-lines th.num, dialog.ds-dialog table.ds-lines th.num .sub, dialog.ds-dialog table.ds-lines td.num { text-align: right; }
dialog.ds-dialog table.ds-lines td.num .ds-amt { text-align: right; }

/* (the Expense pop-up, Detail look: the mock-up's size; one card; labels above; the money right-aligned; buttons along the bottom) */
dialog.ds-expense { width: min(1312px, calc(100vw - 32px)); }
dialog.ds-expense[open] { min-height: min(760px, calc(100vh - 32px)); }
dialog.ds-expense .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
dialog.ds-expense .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-expense .ds-xcard .field > :is(span, .hl):first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-expense .ds-xcard .field > :is(span, .hl):first-child::after { content: none !important; }
dialog.ds-expense .ds-xcard .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-expense .ds-amts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
dialog.ds-expense .ds-num, dialog.ds-expense .ds-num > span:first-child { text-align: right; }
dialog.ds-expense .ds-num input { text-align: right; }
dialog.ds-expense .ds-num .ds-val { padding: 8px 0; font-size: .95rem; }
dialog.ds-expense .ds-amts .field:has(.cleared-pick) { align-items: flex-end; }
dialog.ds-expense .ds-pays { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--surface-2); }
dialog.ds-expense .ds-pays .ds-k { font-size: .8rem; color: var(--muted); }
dialog.ds-expense .ds-pays > .segmented { align-self: flex-start; }
dialog.ds-expense .ds-pays .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
dialog.ds-expense .ds-pays .form-grid .field.wide { grid-column: 1 / -1; }
dialog.ds-expense .ds-xbar { align-items: center; margin-top: 12px; }
dialog.ds-expense .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-expense .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-expense .ds-amts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
dialog.ds-expense #aiReadRow { display: none !important; }
dialog.ds-expense .ds-xcard .field.hidden, dialog.ds-expense .ds-xcard .hidden { display: none !important; }
dialog.ds-expense label.gst-incl, dialog.ds-expense .gst-note { display: none !important; }
/* (the Expense pop-up: as wide as it needs - not the mock-up's whole page - and only as tall as its contents) */
dialog.ds-expense { width: min(1000px, calc(100vw - 32px)); }
dialog.ds-expense[open] { min-height: 0; }
dialog.ds-expense .ds-xcard { flex: 0 0 auto; }
/* (a little smaller; Recharge to a tenant: Tenant, Category and Subcategory on one line) */
dialog.ds-expense { width: min(900px, calc(100vw - 32px)); }
dialog.ds-expense .ds-pays .form-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
dialog.ds-expense .ds-pays .form-grid .field.wide { grid-column: auto; }
dialog.ds-expense .ds-pays .form-grid .field.line-pick { grid-column: 1 / -1; }
/* (a quarter narrower; Date / Due, Vendor and Reference down the left, the money and Cleared down the right) */
dialog.ds-expense { width: min(680px, calc(100vw - 32px)); }
dialog.ds-expense .ds-xtop { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px 24px; align-items: start; }
dialog.ds-expense .ds-xleft, dialog.ds-expense .ds-xright { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-expense .ds-xright .field { align-items: flex-end !important; }
dialog.ds-expense .ds-xright .field > input { width: 160px !important; }
dialog.ds-expense .ds-xright .ds-val { padding: 2px 0; }
dialog.ds-expense .ds-pays .form-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 560px) { dialog.ds-expense .ds-xtop { grid-template-columns: minmax(0, 1fr); } }
dialog.ds-expense .ds-pays .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* (room for the category name) */
/* (the fields above Who pays for it: each label to the left of its box; GST a box like the others; Cleared beside Notes) */
dialog.ds-expense :is(.ds-xtop, .ds-xnotes) .field { flex-direction: row !important; align-items: center !important; gap: 8px; }
dialog.ds-expense :is(.ds-xtop, .ds-xnotes) .field > :is(span, .hl):first-child { flex: 0 0 auto; width: 74px; text-align: left; }
dialog.ds-expense :is(.ds-xtop, .ds-xnotes) .field > :is(input, select, .catpick) { flex: 1 1 auto; width: auto !important; min-width: 0; }
dialog.ds-expense .ds-xleft .ds-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
dialog.ds-expense .ds-xleft .ds-row .field > :is(span, .hl):first-child { width: auto; }
dialog.ds-expense .ds-xleft > .field > :is(span, .hl):first-child { width: 74px; }
dialog.ds-expense .ds-xright .field { justify-content: flex-end; }
dialog.ds-expense .ds-xright .field > :is(span, .hl):first-child { width: auto; text-align: right; }
dialog.ds-expense .ds-xright .field > input { flex: 0 0 140px; width: 140px !important; text-align: right; }
dialog.ds-expense input.ds-gst { background: var(--surface-2); color: var(--text); }
dialog.ds-expense .ds-xnotes { display: flex; align-items: center; gap: 14px; }
dialog.ds-expense .ds-xnotes > .field:first-child { flex: 1 1 auto; }
dialog.ds-expense .ds-xnotes > .field:has(.cleared-pick) { flex: 0 0 auto; }
dialog.ds-expense .ds-xnotes > .field:has(.cleared-pick) > span:first-child { display: none; }
dialog.ds-expense .ds-xright input { flex: 0 0 140px !important; width: 140px !important; max-width: 140px; }   /* (the three money boxes the same width, lined up) */
/* (Notes the same as Reference - the left column's width, its label lined up; Cleared under the amounts on the right) */
dialog.ds-expense .ds-xnotes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px 24px; align-items: center; }
dialog.ds-expense .ds-xnotes > .field:first-child > :is(span, .hl):first-child { width: 74px; }
dialog.ds-expense .ds-xnotes > .field:has(.cleared-pick) { justify-self: end; }
dialog.ds-expense .ds-pays .form-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }   /* (Tenant a little wider) */

/* (the Reminder pop-up, Detail look - the Expense one's, plus: What it makes on top, the ticks beside Notes, the Next 24 under) */
dialog.ds-sched { width: min(760px, calc(100vw - 32px)); }
dialog.ds-sched .ds-xcard > .segmented { align-self: flex-start; }
dialog.ds-sched .ds-xnotes .ds-ticks { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-self: end; }
dialog.ds-sched .ds-xnotes .ds-ticks .check { margin: 0; white-space: nowrap; }
dialog.ds-sched #schedNextPanel { margin-top: 12px; }
dialog.ds-sched .ds-xleft > .field > :is(span, .hl):first-child { width: 96px; }
dialog.ds-sched .ds-xnotes > .field:first-child > :is(span, .hl):first-child { width: 96px; }
/* (the amounts in Expenses and Reminders: flush right in their boxes - no up/down arrows taking the right-hand end) */
dialog.ds-expense .ds-xright input { text-align: right !important; padding-right: 10px; -moz-appearance: textfield; appearance: textfield; }
dialog.ds-expense .ds-xright input::-webkit-inner-spin-button, dialog.ds-expense .ds-xright input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* (a reminder's How often, Next due and Ends on one line, labels beside their boxes) */
dialog.ds-sched .ds-xwhen { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding-top: 10px; border-top: 1px solid var(--surface-2); }
dialog.ds-sched .ds-xwhen > .field { flex: 1 1 150px; flex-direction: row !important; align-items: center !important; gap: 8px; }
dialog.ds-sched .ds-xwhen > .field.hidden { display: none !important; }
dialog.ds-sched .ds-xwhen > .field > :is(span, .hl):first-child { flex: 0 0 auto; width: auto; white-space: nowrap; }
dialog.ds-sched .ds-xwhen > .field > :is(input, select) { flex: 1 1 auto; width: auto !important; min-width: 0; }
/* (a reminder: Notes under Reference; the two ticks side by side, on the right just above the line) */
dialog.ds-sched .ds-xticks { display: flex; justify-content: flex-end; }
dialog.ds-sched .ds-xticks .ds-ticks { display: flex; flex-wrap: wrap; gap: 4px 20px; }
dialog.ds-sched .ds-xticks .check { margin: 0; white-space: nowrap; }
dialog.ds-sched .ds-xleft > .field:has([name="notes"]) { flex-direction: row !important; align-items: center !important; }
/* (a reminder's two ticks: under Notes, in line with its box) */
dialog.ds-sched .ds-xleft > .ds-xticks { justify-content: flex-start; padding-left: 104px; }
/* (a reminder's Next 24: the same white card as the details above it) */
dialog.ds-sched #schedNextPanel.ds-card { background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none; }
dialog.ds-sched #schedNextPanel .ds-card-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
dialog.ds-sched #schedNextPanel .ds-card-head strong { font-size: 1rem; }
dialog.ds-sched #schedNextPanel > .panel-body { background: var(--surface); }
dialog.ds-sched #schedNextPanel .ds-fold { padding: 0 6px; min-height: 0; font-size: 1rem; line-height: 1; box-shadow: none; border: 0; }
dialog.ds-sched #schedNextPanel.ds-folded > .panel-body { display: none; }
dialog.ds-sched #schedNextPanel.ds-folded .ds-card-head { border-bottom: 0; }
dialog.ds-sched .ds-xticks .ds-ticks { flex-direction: row !important; flex-wrap: wrap; } dialog.ds-sched .ds-xticks .ds-ticks > .check { display: inline-flex !important; width: auto !important; flex: 0 0 auto; }   /* (the two ticks side by side) */
/* (Next 24's heading: on the left, the whole of it a click to fold or open) */
dialog.ds-sched #schedNextPanel .ds-card-head { justify-content: flex-start !important; text-align: left; cursor: pointer; user-select: none; }
dialog.ds-sched #schedNextPanel .ds-card-head > * { margin-left: 0 !important; }
dialog.ds-sched #schedNextPanel .ds-card-head > .muted { flex: 1 1 auto; text-align: left; }

/* Edit this Occurrence - the Detail look: two even columns, amounts right-aligned, what's changed outlined */
html[data-record="detail"] dialog.record-dialog.ds-occ { width: min(860px, calc(100vw - 32px)); }
html[data-record="detail"] dialog.ds-occ .rec-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 8px; }
html[data-record="detail"] dialog.ds-occ .rec-row { grid-template-columns: 9em minmax(0, 1fr); }
html[data-record="detail"] dialog.ds-occ .rec-row:has(input[type="checkbox"]) { margin-bottom: 2px; }
html[data-record="detail"] dialog.ds-occ input[name="amount"], html[data-record="detail"] dialog.ds-occ .ds-gst, html[data-record="detail"] dialog.ds-occ .ds-inc { text-align: right; }
html[data-record="detail"] dialog.ds-occ .ds-gst { background: var(--surface-2); }
html[data-record="detail"] dialog.ds-occ .ds-chg { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent); }
html[data-record="detail"] dialog.ds-occ .ds-occ-chg b { color: var(--accent-strong); }
html[data-record="detail"] dialog.ds-occ .gst-incl, html[data-record="detail"] dialog.ds-occ .gst-note { display: none !important; }
dialog.ds-occ-docs .ds-occ-docbox { flex: 1; margin-bottom: 10px; }

/* Documents pop-ups (invoice, expense, reminder occurrence): the newer card style - a white rounded card, a plain
   heading row with Add… on the right (no coloured edge, no fold), filling the pop-up with Close pinned at the bottom */
dialog.ds-sub .ds-occ-docbox { display: flex; flex-direction: column; }
dialog.ds-sub .docs-box { flex: 1; display: flex; flex-direction: column; margin: 0 0 10px; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-sub .docs-box > .docs-head { cursor: default; padding: 10px 16px; margin: 0; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-sub .docs-box > .docs-head > strong:first-child { font-size: 1rem; }
dialog.ds-sub .docs-box > .docs-head > strong:first-child::before { content: none; }
dialog.ds-sub .docs-box.collapsed > :not(.docs-head) { display: revert; }
dialog.ds-sub .docs-box > .muted, dialog.ds-sub .docs-box > p, dialog.ds-sub .docs-box > .empty { padding: 12px 16px !important; }
dialog.ds-sub .docs-box ul.docs { padding: 6px 16px 8px; margin: 0; }
dialog.ds-sub .docs-box ul.docs > li { padding: 6px 0; border-bottom: 1px solid var(--border); }
dialog.ds-sub .docs-box ul.docs > li:last-child { border-bottom: 0; }
dialog.ds-sub > form > .buttons { margin-top: auto; }
/* (Tenant Monthly Rent / Opex: the Tenant box at the top of the left side, lined up with Notes) */
dialog.ds-sched .ds-invtenant:empty { display: none; }
dialog.ds-sched .ds-invtenant > .field { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 8px; margin: 0; }
dialog.ds-sched .ds-invtenant > .field > :is(span, .hl):first-child { width: 96px; flex: 0 0 96px; }
dialog.ds-sched .ds-invtenant > .field > select { flex: 1; min-width: 0; }

/* A tenant invoice reminder's Opex total / Rent total (or Unknown) under Tenant */
.ds-invtotal .ds-invtotal-v { padding: 5px 0; }
dialog.ds-sched .ds-invtenant { display: flex; flex-direction: column; gap: 8px; }
dialog.ds-sched .ds-invtenant > .ds-invtotal.hidden { display: none !important; }
/* (the Opex / Rent total: across the whole pop-up, not wrapping in its column) */
html[data-record="detail"] dialog.ds-occ .rec-cols > .ds-occ-wide { grid-column: 1 / -1; }
html[data-record="detail"] dialog.ds-occ .ds-occ-wide .rec-row { grid-template-columns: 9em minmax(0, 1fr); }
dialog.ds-sched .ds-invtotal .ds-invtotal-v, dialog.ds-sched .ds-invtotal .ds-invtotal-v .hint { white-space: nowrap; }
dialog.ds-sched .ds-xleft, dialog.ds-sched .ds-invtenant, dialog.ds-sched .ds-invtotal { overflow: visible; }

/* Tenants & Leases - a tenant in the Detail look: one card, the buttons along the bottom, Documents and Leases in pop-ups */
dialog.ds-tenant { width: min(980px, calc(100vw - 32px)); }
dialog.ds-tenant .ds-tcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
dialog.ds-tenant .ds-trow { display: grid; gap: 12px 14px; }
dialog.ds-tenant .ds-trow-a { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
dialog.ds-tenant .ds-trow-b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); }
dialog.ds-tenant .ds-trow-notes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 18px; }
dialog.ds-tenant .ds-trow-notes > .field { flex: 1 1 320px; margin: 0; }
dialog.ds-tenant .ds-trow-notes > .check { margin: 0 0 8px; white-space: nowrap; }
dialog.ds-tenant .ds-tcard .field { margin: 0; }
dialog.ds-tenant .ds-xbar { align-items: center; margin-top: 12px; }
dialog.ds-tenant .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-tenant .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-tenant .ds-xbar .btn.danger { color: #b42318; }
dialog.ds-tleases #tenantLeases { flex: 1; display: flex; flex-direction: column; margin: 0 0 10px; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-tleases #tenantLeases > .panel-head { cursor: default; padding: 10px 16px; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-tleases #tenantLeases > .panel-head > strong:first-child { font-size: 1rem; }
dialog.ds-tleases #tenantLeases > .panel-head > strong:first-child::before { content: none; }
dialog.ds-tleases #tenantLeases.collapsed > :not(.panel-head) { display: revert; }
dialog.ds-tleases > form > .buttons { margin-top: auto; }

/* (the tenant's summary boxes at the top, and the lease summary under the details) */
dialog.ds-tenant .ds-k { font-size: .8rem; color: var(--muted); }
dialog.ds-tenant .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
dialog.ds-tenant .ds-tbox { padding: 12px 16px; border-right: 1px solid var(--border); }
dialog.ds-tenant .ds-tbox:last-child { border-right: 0; }
dialog.ds-tenant .ds-tv { font-size: 1.3rem; font-weight: 700; margin: 2px 0; }
dialog.ds-tenant .ds-tfacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; padding-top: 10px; border-top: 1px solid var(--border); }
@media (max-width: 700px) { dialog.ds-tenant .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-tenant .ds-tfacts { grid-template-columns: 1fr; } }

/* Tenants & Leases - a lease in the Detail look (with the tenant's .ds-tenant styles) */
dialog.ds-lease .ds-lrow2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog.ds-lease .ds-lrow4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
dialog.ds-lease .ds-trow .field { margin: 0; }
dialog.ds-lease #eventsBox.ds-lcard { background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; margin: 0 0 10px; }
dialog.ds-lease #eventsBox.ds-lcard > .panel-head { cursor: default; padding: 10px 16px; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-lease #eventsBox.ds-lcard > .panel-head > strong:first-child { font-size: 1rem; }
dialog.ds-lease #eventsBox.ds-lcard > .panel-head > strong:first-child::before { content: none; }
dialog.ds-lease #eventsBox.ds-lcard.collapsed > :not(.panel-head) { display: revert; }
dialog.ds-lease input[name="rentAnnual"], dialog.ds-lease input[name="outgoingsAnnual"], dialog.ds-lease input[name="bond"], dialog.ds-lease input[name="remindDays"] { text-align: right; }
@media (max-width: 760px) { dialog.ds-lease .ds-lrow4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-lease .ds-lrow2 { grid-template-columns: 1fr; } }
dialog.ds-lease .ds-tcard .gst-incl { display: none !important; }

/* A lease in a pop-up over another screen (P.openLeasePopup): a frame showing Tenants & Leases' lease pop-up alone */
dialog.lease-frame-dlg { padding: 0; border: 0; background: transparent; box-shadow: none; width: min(1240px, 98vw); height: 96vh; max-width: none; max-height: none; overflow: hidden; }
dialog.lease-frame-dlg iframe { width: 100%; height: 100%; border: 0; background: transparent; color-scheme: normal; }
/* (embed-lease only - a dashboard's report boxes are embed pages too, and must show) */
html.embed-lease, html.embed-lease body { background: transparent !important; }
html.embed-lease body > :not(dialog) { visibility: hidden; }
html.embed-lease dialog { visibility: visible; }
html.embed-lease dialog::backdrop { background: transparent; }
/* (the summary boxes first in the pop-up: a gap under its title bar, so their top edge isn't hidden under it) */
dialog.ds-tenant .ds-tboxes { margin-top: 8px; }
/* (the lease pop-up's frame: the whole window - the lease pop-up inside centres itself and dims behind, as on Tenants & Leases) */
dialog.lease-frame-dlg { position: fixed !important; inset: 0 !important; margin: 0 !important; width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; overflow: hidden !important; }
dialog.lease-frame-dlg::backdrop { background: transparent; }
html.embed-lease dialog::backdrop { background: rgba(15, 23, 42, .45); }
/* Payments pop-up (an invoice's): the newer card style, as Documents - a white rounded card, a plain heading (no
   coloured edge, no fold), the add-a-payment row in a light strip at its foot */
dialog.ds-sub #paymentsBox { margin: 0 0 10px; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-sub #paymentsBox > .panel-head { cursor: default; padding: 10px 16px; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-sub #paymentsBox > .panel-head > strong:first-child { font-size: 1rem; }
dialog.ds-sub #paymentsBox > .panel-head > strong:first-child::before { content: none; }
dialog.ds-sub #paymentsBox.collapsed > :not(.panel-head) { display: revert; }
dialog.ds-sub #paymentsBox table.grid th:first-child, dialog.ds-sub #paymentsBox table.grid td:first-child { padding-left: 16px; }
dialog.ds-sub #paymentsBox tfoot td { font-weight: 700; background: var(--surface-2); }
dialog.ds-sub #paymentsBox > .panel-foot { padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--border); }

/* A locked invoice (a payment on it, or entered into Xero): the line and the greyed-out parts */
#invoiceDialog .inv-lock-note { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: #fff7e6; border: 1px solid #f3d19e; color: #7a4d00; font-size: .9rem; }
#invoiceDialog.inv-locked #lineRows button[data-remove] { visibility: hidden; }
#invoiceDialog.inv-locked .btn:disabled { opacity: .45; cursor: not-allowed; }
#invoiceDialog .btn:disabled { opacity: .45; cursor: not-allowed; }

/* An invoice's type (Detail look): Load rent / Load opex items / Custom invoice - the one it is shown on, Add recharges below */
dialog.ds-dialog .ds-trio > .btn.ds-on { background: var(--accent-soft, #e3f3f1); border-color: var(--accent) !important; color: var(--accent-strong, #0b5f58); }
dialog.ds-dialog .ds-rechrow { display: grid; grid-template-columns: minmax(0, 1fr); }
dialog.ds-dialog .ds-rechrow > .btn { width: 100%; padding: 9px 6px; justify-content: center; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); font-weight: 600; min-height: 38px; }
dialog.ds-dialog table.ds-lines input[data-f="description"]:not(.ro), dialog.ds-dialog table.ds-lines input[data-f="amount"]:not(.ro) { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 4px 6px; }

/* An invoice line typed in (Detail look): Category / Sub category boxes, Amount with GST a box too */
dialog.ds-dialog table.ds-lines .ds-catsel { width: 100%; min-width: 0; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
dialog.ds-dialog table.ds-lines .ds-catwrap { display: inline-flex; gap: 6px; margin-right: 6px; }
dialog.ds-dialog table.ds-lines .ds-catwrap .ds-catsel { width: 130px; }
dialog.ds-dialog table.ds-lines .ds-incin { width: 100%; text-align: right; border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; background: var(--surface); }
dialog.ds-dialog table.ds-lines input[data-f="amount"]:not(.ro) { text-align: right; }
/* Credits (Apply a credit) in the Payments pop-up: the same card style as Payments */
dialog.ds-sub #applyBox { margin: 0 0 10px; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-sub #applyBox > .panel-head { cursor: default; padding: 10px 16px; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; gap: 10px; justify-content: flex-start; }
dialog.ds-sub #applyBox > .panel-head > strong:first-child { font-size: 1rem; }
dialog.ds-sub #applyBox > .panel-head > strong:first-child::before { content: none; }
dialog.ds-sub #applyBox.collapsed > :not(.panel-head) { display: revert; }
dialog.ds-sub #applyBox table.grid th:first-child, dialog.ds-sub #applyBox table.grid td:first-child { padding-left: 16px; }
/* (the invoice lines' own incl GST tick: never in the Detail look - ex GST and with GST each have a box) */
dialog.ds-dialog .ds-card-head label.gst-incl { display: none !important; }
/* (an invoice line typed in: the searchable Category box and its Subcategory box, filling their columns) */
dialog.ds-dialog table.ds-lines .ds-catbox, dialog.ds-dialog table.ds-lines .ds-catsub { display: block; min-width: 0; }
dialog.ds-dialog table.ds-lines .ds-catbox .catpick, dialog.ds-dialog table.ds-lines .ds-catsub select { width: 100%; }
dialog.ds-dialog table.ds-lines .ds-catwrap .ds-catbox, dialog.ds-dialog table.ds-lines .ds-catwrap .ds-catsub { display: inline-block; width: 200px; }
dialog.ds-dialog table.ds-lines .ds-catwrap ~ input[data-f="description"] { width: calc(100% - 420px); min-width: 140px; }

/* Link a bank deposit (an invoice's payment): the deposits to choose from */
dialog.dep-pick { width: min(980px, calc(100vw - 32px)); }
dialog.dep-pick .dep-wrap { flex: 1; overflow: auto; max-height: 55vh; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
dialog.dep-pick table.grid th:first-child, dialog.dep-pick table.grid td:first-child { padding-left: 12px; }

/* Tenant Statement: From and To half as wide, the Activity tick beside To; the Xero-style Activity view */
#stFrom, #stTo { width: 9.5em; min-width: 0; }
.st-activity-tick { white-space: nowrap; }
.st-act { padding: 24px 28px; }
.st-act-top { display: grid; grid-template-columns: 5fr 2fr 3fr; gap: 16px; margin-bottom: 28px; }
.st-act-title { font-size: 2rem; font-weight: 300; letter-spacing: .01em; }
.st-act-to { padding: 6px 0 0 36px; }
.st-act-table th { border-bottom: 1.5px solid var(--text, #1c2430); }
.st-act-due { text-align: right; font-size: 1.25rem; font-weight: 700; border-top: 1.5px solid var(--text, #1c2430); padding-top: 10px; margin-top: 6px; }
.st-act-due span { margin-left: 14px; }
.st-act-advice { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; padding-top: 14px; border-top: 1.5px dashed var(--muted); }
.st-act-adv-row { display: flex; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.st-act-adv-row > b { min-width: 9em; }
.st-act-adv-row.three > div { flex: 1; }
.st-act-line { flex: 1; border-bottom: 1.5px solid var(--text, #1c2430); }
/* (Link a bank deposit: the filters on one line; wider, lines that don't wrap, a white table) */
dialog.dep-pick { width: min(1180px, calc(100vw - 32px)); }
dialog.dep-pick .dep-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
dialog.dep-pick .dep-filters .dep-acct { max-width: 280px; }
dialog.dep-pick .dep-filters .dep-find { flex: 1 1 220px; min-width: 180px; }
dialog.dep-pick .dep-wrap, dialog.dep-pick .dep-wrap table, dialog.dep-pick .dep-wrap tbody tr, dialog.dep-pick .dep-wrap td { background: #fff; }
dialog.dep-pick .dep-wrap th, dialog.dep-pick .dep-wrap td { white-space: nowrap; }
dialog.dep-pick .dep-wrap td:nth-child(4) { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
/* (the heading: as wide as what's under it - it reaches 18px past each side to cover while it sticks, so its limit is 36px more;
   its buttons then end where the content below ends) */
@media (min-width: 0px) { .main > .page-head { max-width: calc(1464px + 36px); } }
dialog.dep-pick .dep-filters > select { width: auto; flex: 0 0 auto; }
dialog.dep-pick .dep-filters > .check { width: auto; flex: 0 0 auto; white-space: nowrap; }
dialog.dep-pick .dep-filters > .dep-find { width: auto; }
/* Tenant Statement: the top and the summary as the PDF has them */
.st-pdf { padding: 22px 26px; }
.st-pdf-top { display: flex; justify-content: space-between; gap: 24px; }
.st-pdf-co { text-align: right; }
.st-pdf-name { font-size: 1.15rem; font-weight: 700; }
.st-pdf-hint { font-size: .85rem; margin-top: 2px; }
.st-pdf-title { font-size: 1.5rem; font-weight: 700; margin: 18px 0 6px; }
.st-pdf-info { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 2px 8px; margin-bottom: 14px; }
.st-pdf-h { font-size: 1.05rem; margin: 6px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.st-pdf-sum td:first-child { width: 50%; }

/* Tenant Statement: Portrait / Landscape PDF */
.st-orient { flex: 0 0 auto; }
.st-orient label span { white-space: nowrap; }

/* ===== Appearance (Settings / My profile / Admin): tabs of choices, each a small picture; tried on this page, kept on Save.
   (The pictures use fixed sizes and colours of their own, so the choices compare the same whatever's chosen.) */
.lk-tabsbar { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.lk-tab { font: inherit; font-size: 14px; padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: none; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.lk-tab.on { background: var(--surface); border-color: var(--border); color: var(--text, #1c2430); font-weight: 600; }
.lk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.lk-card { font: inherit; font-size: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--text, #1c2430); }
.lk-card:hover { border-color: #9aa6b4; }
.lk-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.lk-card:disabled { cursor: default; opacity: .8; }
.lk-t { font-weight: 600; font-size: 14px; }
.lk-s { font-size: 12px; color: var(--muted); line-height: 1.3; }
.lk-pic { height: 96px; border: 1px solid #dde1e7; border-radius: 6px; background: #f7f8fa; padding: 8px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; font-size: 11px; color: #1c2430; font-family: Inter, 'Segoe UI', system-ui, sans-serif; }
.lk-box { display: inline-block; height: 11px; border: 1px solid #b9c1cc; background: #fff; vertical-align: middle; }
.lk-lab { display: inline-block; font-size: 9.5px; color: #5f6b7a; min-width: 34px; }
.lk-col { display: flex; flex-direction: column; gap: 2px; }
.lk-two { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; }
.lk-two > div, .lk-rows > div { display: flex; align-items: center; gap: 4px; }
.lk-rows { display: flex; flex-direction: column; gap: 6px; }
.lk-tabs { display: flex; gap: 2px; margin-bottom: 6px; font-size: 9.5px; }
.lk-tabs > * { padding: 1px 6px; border: 1px solid #dde1e7; border-bottom: 0; border-radius: 4px 4px 0 0; background: #eef1f5; }
.lk-tabs > b { background: #fff; }
.lk-across { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.lk-across small { display: block; font-size: 8px; color: #5f6b7a; }
.lk-out { position: relative; display: block; height: 15px; border: 1px solid #b9c1cc; border-radius: 4px; background: #fff; margin-top: 5px; }
.lk-out i { position: absolute; top: -6px; left: 6px; font-style: normal; font-size: 8px; background: #f7f8fa; padding: 0 2px; color: #5f6b7a; }
.lk-table > div { padding: var(--pad) 4px; border-bottom: 1px solid #dde1e7; background: #fff; }
.lk-screen { height: 100%; border: 1px solid #b9c1cc; border-radius: 4px; background: #e9ecf1; display: flex; align-items: center; justify-content: center; }
.lk-screen span { height: 70%; background: #fff; border: 1px solid #9aa6b4; border-radius: 3px; }
.lk-look { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lk-btn { padding: 4px 10px; background: #0f766e; color: #fff; font-weight: 600; border: 1px solid #0f766e; }
.lk-btn.ghost { background: #fff; color: #1c2430; border-color: #b9c1cc; }
.lk-look .lk-card { display: block; width: 100%; padding: 8px; border: 1px solid #dde1e7; background: #fff; cursor: default; font-size: 11px; }
.lk-look.flat .lk-btn, .lk-look.flat .lk-card, .lk-look.flat .lk-box { border-radius: 0 !important; box-shadow: none; }
.lk-look.normal .lk-btn { border-radius: 6px; } .lk-look.normal .lk-card { border-radius: 8px; }
.lk-look[class~="3d"] .lk-btn { border-radius: 6px; box-shadow: 0 2px 3px rgba(16, 24, 40, .25); background-image: linear-gradient(rgba(255,255,255,.18), rgba(0,0,0,.06)); }
.lk-look[class~="3d"] .lk-card { border-radius: 8px; box-shadow: 0 3px 6px rgba(16, 24, 40, .18); }
.lk-stats { display: flex; gap: 4px; }
.lk-stats.wrap { flex-wrap: wrap; } .lk-stats.wrap span { flex: 0 0 calc(50% - 2px); }
.lk-stats span { flex: 1; min-width: 0; padding: 6px 4px; background: #fff; border: 1px solid #dde1e7; border-radius: 4px; font-size: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lk-rec { display: grid; grid-template-columns: 2fr 1fr; gap: 6px; height: 100%; }
.lk-rec span { display: block; background: #fff; border: 1px solid #dde1e7; border-radius: 3px; height: 14px; margin-bottom: 4px; }
.lk-recside span { background: #e3f3f1; border-color: #0f766e; height: 11px; }
.lk-rec.one { display: block; }
.lk-follow { font-size: 13px; color: #5f6b7a; text-align: center; }
.lk-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.lk-foot .spacer { flex: 1; }
.lk-trying { color: #7a4d00; background: #fff7e6; border: 1px solid #f3d19e; border-radius: 8px; padding: 6px 10px; font-size: .9rem; }

/* The register: a transaction's property invoices paid */
dialog.inv-paid-dlg { width: min(860px, calc(100vw - 32px)); }
dialog.inv-paid-dlg td, dialog.inv-paid-dlg th { white-space: nowrap; }
dialog.inv-paid-dlg .table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 10px; }

/* The register's transaction (Detail look): one white card, two columns of fields with labels beside, Memo across;
   the buttons along the bottom; Documents in a pop-up; a drop anywhere adds to Documents */
dialog.ds-tran { width: min(900px, calc(100vw - 32px)); }
dialog.ds-tran .ds-tcard { background: var(--surface); border: 1px solid var(--border) !important; border-left-width: 1px !important; border-radius: 10px !important; box-shadow: none !important; margin-bottom: 10px; }
dialog.ds-tran .ds-tcard > .panel-head { display: none; }
dialog.ds-tran .ds-tcard > .panel-body { padding: 14px 16px; }
dialog.ds-tran .ds-tcard .segmented { margin-bottom: 12px; }
dialog.ds-tran .ds-tgrid { display: block !important; }
dialog.ds-tran .ds-tcols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 24px; align-items: start; }
dialog.ds-tran .ds-tcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
dialog.ds-tran .ds-tgrid .field { display: grid !important; grid-template-columns: 112px minmax(0, 1fr) !important; align-items: center; gap: 8px; margin: 0 !important; }
dialog.ds-tran .ds-tgrid .field.hidden { display: none !important; }
dialog.ds-tran .ds-tgrid .field > span:first-child { font-size: .85rem; color: var(--muted); }
dialog.ds-tran .ds-tgrid .ds-tmemo { margin-top: 8px !important; }
dialog.ds-tran input[name="amount"], dialog.ds-tran input[name="transferAmount"] { text-align: right; }
dialog.ds-tran .ds-gone { display: none !important; }
dialog.ds-tran .ds-xbar { align-items: center; margin-top: 12px; }
dialog.ds-tran .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-tran .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-tran .ds-xbar .btn.danger { color: #b42318; }
dialog.ds-tran.ds-dropping { outline: 3px dashed var(--accent); outline-offset: -6px; }
dialog.ds-tran section.panel:not(.ds-tcard) { display: none; }
/* (the transaction pop-up: its buttons only along the bottom - none copied into the title bar; the × stays) */
dialog.ds-tran .dlg-tools > .btn:not(.ghost) { display: none !important; }
/* The register's split (Transaction with multiple categories), Detail look: the lines in a white card, Add line and
   what's left under them, the buttons along the bottom as the transaction's */
dialog.ds-splitdlg > form { display: flex; flex-direction: column; }
dialog.ds-splitdlg .split-here .split-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-splitdlg .split-here .table-wrap { border: 0; border-radius: 0; margin: 0; }
dialog.ds-splitdlg table.splits th { background: var(--surface-2); }
dialog.ds-splitdlg table.splits th:first-child, dialog.ds-splitdlg table.splits td:first-child { padding-left: 12px; }
dialog.ds-splitdlg table.splits td input[data-f="amount"], dialog.ds-splitdlg table.splits td input[type="number"] { text-align: right; }
dialog.ds-splitdlg .split-foot { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
dialog.ds-splitdlg .split-foot #splitRemaining { margin-left: auto; font-weight: 600; }
dialog.ds-splitdlg > form > .buttons { margin-top: 12px; align-items: center; }
dialog.ds-splitdlg > form > .buttons .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-splitdlg > form > .buttons .btn.primary { border-color: var(--accent); }
dialog.ds-splitdlg > form > .buttons [data-clear] { color: #b42318; }
/* (Link a bank deposit: the row clicked or right-clicked, picked out) */
dialog.dep-pick .dep-wrap tbody tr { cursor: default; }
dialog.dep-pick .dep-wrap tbody tr.sel td { background: #e3f3f1 !important; }
/* Tenant Statement: the controls along the top one height, lined up */
.register-tools:has(#stTenant) { align-items: center; }
.register-tools:has(#stTenant) > select, .register-tools:has(#stTenant) > .btn, .register-tools:has(#stTenant) > .inline-label input,
.register-tools:has(#stTenant) > .segmented, .register-tools:has(#stTenant) .btn { height: 25px; min-height: 25px; box-sizing: border-box; margin-top: 0; margin-bottom: 0; }
.register-tools:has(#stTenant) > .btn, .register-tools:has(#stTenant) .btn { padding-top: 0; padding-bottom: 0; display: inline-flex; align-items: center; }
.register-tools:has(#stTenant) > .inline-label, .register-tools:has(#stTenant) > .check { display: inline-flex; align-items: center; gap: 6px; height: 25px; margin: 0; }
.register-tools:has(#stTenant) > .segmented { display: inline-flex; align-items: stretch; }
.register-tools:has(#stTenant) > .segmented label { display: inline-flex; align-items: center; }
/* (Portrait / Landscape PDF beside Download PDF, the same height) */
.page-head .actions .st-orient { display: inline-flex; align-items: stretch; height: 25px; }
.page-head .actions .st-orient label { display: inline-flex; align-items: center; }

/* (the Tenant Statement controls: as Download PDF - 25px, its text size and padding) */
.register-tools:has(#stTenant) > select, .register-tools:has(#stTenant) .inline-label input { padding-top: 0; padding-bottom: 0; font-size: 12px; }
.register-tools:has(#stTenant) .btn, .page-head .actions .st-orient label { font-size: 12px; }
.register-tools:has(#stTenant) .btn { padding-left: 10px; padding-right: 10px; }
.page-head .actions .st-orient { margin: 0 !important; }   /* (the segmented control's own bottom margin off: the same top as Download PDF) */
/* (Invoices: the → copying the date to Due) */
dialog.ds-dialog .ds-dueline { display: flex; align-items: center; gap: 4px; min-width: 0; }
dialog.ds-dialog .ds-dueline > input { flex: 1; min-width: 0; }
dialog.ds-dialog .ds-copydate { padding: 2px 6px; font-size: 14px; line-height: 1; flex: 0 0 auto; }

/* Invoices: Date, Due and For narrower, Tenant wider, Xero number; every label on one line, lined up */
dialog.ds-dialog .ds-row.ds-row5 { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.9fr) minmax(0, .9fr); align-items: end; }
dialog.ds-dialog .ds-row.ds-row5 > .field { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; margin: 0; }
dialog.ds-dialog .ds-row.ds-row5 > .field > span:first-child { white-space: nowrap; line-height: 1.2; min-height: 1.2em; }
dialog.ds-dialog .ds-row.ds-row5 select#invForMonth { width: 100%; }
/* (the row's labels exactly level: one fixed height each; Due's label over its box, not over the →) */
dialog.ds-dialog .ds-row.ds-row5 > .field > span:first-child { display: block; height: 16px; line-height: 16px; min-height: 0; margin: 0; padding: 0; font-size: .8rem; }
dialog.ds-dialog .ds-row.ds-row5 > .field:has(.ds-dueline) > span:first-child { padding-left: 30px; }
/* (and the boxes one height, the row lined up from the top - so the labels sit exactly level) */
dialog.ds-dialog .ds-row.ds-row5 { align-items: start; }
dialog.ds-dialog .ds-row.ds-row5 > .field input, dialog.ds-dialog .ds-row.ds-row5 > .field select { height: 30px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
dialog.ds-dialog .ds-row.ds-row5 .ds-copydate { height: 30px; }
/* (Payments: Link to bank deposit / Enter manually, the manual boxes on the same line once chosen) */
.pay-manual { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pay-manual.hidden { display: none; }
#payManualBtn.ds-on { background: var(--accent-soft, #e3f3f1); border-color: var(--accent); color: var(--accent-strong, #0b5f58); }
/* (Link to bank deposit: several ticked - their total, and Use the ticked deposits once it matches) */
dialog.dep-pick .dep-multi { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: -4px 0 10px; background: #f1faf8; border: 1px solid #9fd3cc; border-radius: 8px; font-size: .9rem; }
dialog.dep-pick .dep-multi.hidden { display: none; }
dialog.dep-pick .dep-tick-col.hidden { display: none; }
/* (Link to bank deposit: the table fits the pop-up - long memos and payers cut short, the whole on hover) */
dialog.dep-pick .dep-wrap { overflow-x: hidden; }
dialog.dep-pick .dep-wrap td:nth-child(4), dialog.dep-pick .dep-wrap td:nth-child(5) { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
dialog.dep-pick .dep-wrap td:nth-child(3) { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }

/* Invoices: interim opex (last year's rate) and catch-up lines marked; the catch-up box under the load buttons */
dialog.ds-dialog table.ds-lines tr[data-interim="1"] > td:first-child::after { content: 'Interim'; margin-left: 6px; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: #fff7e6; color: #7a4d00; border: 1px solid #f3d19e; }
dialog.ds-dialog table.ds-lines tr[data-catchup="1"] > td:first-child::after { content: 'Catch-up'; margin-left: 6px; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: #e3f3f1; color: #0b5f58; border: 1px solid #9fd3cc; }
dialog.ds-dialog .ds-catchup { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid #f3d19e; background: #fff7e6; border-radius: 8px; font-size: .9rem; }
dialog.ds-dialog .ds-catchup.hidden { display: none; }

/* Invoices: an Interim / Catch-up line's memo leaves room for its badge (it sat over the next column once a typed-in line widened the others) */
dialog.ds-dialog table.ds-lines tr:is([data-interim="1"], [data-catchup="1"]) > td:first-child input[data-f="description"] { width: calc(100% - 80px); min-width: 120px; }

/* Opex: the Budget line pop-up in the new look (the Expense one's layout) - its labels a little wider; the shares below */
dialog.ds-bline { width: min(1000px, calc(100vw - 32px)); }
dialog.ds-bline :is(.ds-xtop, .ds-xnotes) .field > :is(span, .hl):first-child, dialog.ds-bline .ds-xleft > .field > :is(span, .hl):first-child { width: 96px; }
dialog.ds-bline .ds-xnotes .field { flex: 1 1 auto; }
dialog.ds-bline .ds-xcard .field.ds-bpy { flex-direction: row !important; align-items: center !important; gap: 8px; flex-wrap: wrap; }
dialog.ds-bline .ds-xcard .field.ds-bpy > span:first-child { width: 96px; }
dialog.ds-bline .ds-xcard .field.ds-bpy .hint { flex-basis: 100%; padding-left: 104px; }
dialog.ds-bline form > section.panel { margin-top: 12px; }
dialog.ds-bline .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 8px 0 10px; }
dialog.ds-bline .ds-tbox { padding: 12px 16px; border-right: 1px solid var(--border); }
dialog.ds-bline .ds-tbox:last-child { border-right: 0; }
dialog.ds-bline .ds-tbox .ds-k { font-size: .8rem; color: var(--muted); }
dialog.ds-bline .ds-tv { font-size: 1.3rem; font-weight: 700; margin: 2px 0; }
@media (max-width: 700px) { dialog.ds-bline .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Opex Budget line: Shared between spaces as a card of the new look */
dialog.ds-bline section.panel.ds-bshare { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-bline .ds-bshare > .panel-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; border-radius: 0; }
dialog.ds-bline .ds-bshare > .panel-head strong { font-size: .95rem; }
dialog.ds-bline .ds-bshare > .panel-head .btn { padding: 5px 12px; font-weight: 600; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
dialog.ds-bline .ds-bshare table.grid { margin: 0; }
dialog.ds-bline .ds-bshare table.grid th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface); }
dialog.ds-bline .ds-bshare table.grid :is(th, td):first-child { padding-left: 16px; }
dialog.ds-bline .ds-bshare table.grid :is(th, td):last-child { padding-right: 16px; }
dialog.ds-bline .ds-bshare table.grid input[data-space] { border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; max-width: 110px; }
dialog.ds-bline .ds-bshare tfoot td { font-weight: 700; background: var(--surface-2); }
dialog.dep-pick th.dep-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
dialog.dep-pick th.dep-sortable:hover { color: var(--accent-strong); }
dialog.dep-pick th.dep-sortable[data-arrow]:not([data-arrow=""])::after { content: " " attr(data-arrow); font-size: .75em; }
dialog.use-amt { width: min(440px, calc(100vw - 32px)); }
dialog.use-amt .field { display: flex; flex-direction: column; gap: 4px; }
dialog.use-amt .buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
dialog.use-amt .buttons .left { margin-right: auto; }
/* Tenant Washup: the final bill card */
.fb-card { margin-bottom: 12px; }
.fb-card .fb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.fb-card tfoot td { background: var(--surface-2); }

/* Property / building / space pop-up, Detail look (property.js): boxes on top, the fields in one card, value / titles /
   documents as plain white cards, Delete - Cancel - Save along the bottom */
dialog.ds-prop { width: min(920px, calc(100vw - 32px)); }
dialog.ds-prop .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 8px 0 10px; }
dialog.ds-prop .ds-tbox { padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-prop .ds-tbox:last-child { border-right: 0; }
dialog.ds-prop .ds-tbox .ds-k { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
dialog.ds-prop .ds-tv { font-size: 1.3rem; font-weight: 700; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-prop .ds-tboxes.hidden { display: none; }
dialog.ds-prop .ds-xcard .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin: 0; }
dialog.ds-prop .ds-xcard .form-grid > .field.wide { grid-column: 1 / -1; }
dialog.ds-prop .ds-xcard .field .hint { font-size: .78rem; }
dialog.ds-prop .ds-xcard > .check { margin: 0; }
dialog.ds-prop .docs-box { margin: 12px 0 0; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-prop .docs-box > .docs-head { padding: 10px 16px; margin: 0; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-prop .docs-box > .docs-head > strong:first-child { font-size: .95rem; }
dialog.ds-prop .docs-box > .docs-head .btn { padding: 5px 12px; font-weight: 600; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
dialog.ds-prop .docs-box ul.docs { padding: 6px 16px 8px; margin: 0; }
dialog.ds-prop .docs-box > .muted, dialog.ds-prop .docs-box > p, dialog.ds-prop .docs-box > .empty { padding: 10px 16px !important; }
dialog.ds-prop .val-box > :not(.docs-head) { margin-left: 16px; margin-right: 16px; }
@media (max-width: 700px) { dialog.ds-prop .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-prop .ds-xcard .form-grid { grid-template-columns: 1fr; } }

/* Appearance: Everyone uses this appearance (Admin / Settings) */
.lk-force { display: flex; align-items: baseline; gap: 6px; margin: 10px 0 0; font-weight: 600; flex-wrap: wrap; }
.lk-force .muted { font-weight: 400; }

/* Business pop-up, Detail look (businesses.js): as Property's (ds-prop), with GST / Invoices / its accounts and properties
   as plain white cards */
dialog.ds-biz { width: min(980px, calc(100vw - 32px)); }
dialog.ds-biz section.panel.ds-bcard { margin: 12px 0 0; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-biz section.panel.ds-bcard > .panel-head { cursor: default; padding: 10px 16px; margin: 0; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-biz section.panel.ds-bcard > .panel-head > strong:first-child { font-size: .95rem; }
dialog.ds-biz section.panel.ds-bcard > .panel-head > strong:first-child::before { content: none; }
dialog.ds-biz section.panel.ds-bcard.collapsed > :not(.panel-head) { display: block; }
dialog.ds-biz section.panel.ds-bcard > .panel-body { padding: 12px 16px; }
dialog.ds-biz .ds-bcard .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
dialog.ds-biz .ds-bcard .form-grid > .field.wide { grid-column: 1 / -1; }
dialog.ds-biz :is(.ds-xcard, .ds-bcard) .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-biz :is(.ds-xcard, .ds-bcard) .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-biz :is(.ds-xcard, .ds-bcard) .field > span:first-child::after { content: none !important; }
dialog.ds-biz :is(.ds-xcard, .ds-bcard) .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-biz .ds-bcard .form-grid { margin-top: 10px; }
dialog.ds-biz .ds-tv { font-size: 1.15rem; }
@media (max-width: 700px) { dialog.ds-biz .ds-bcard .form-grid { grid-template-columns: 1fr; } }

/* Copy a budget, Detail look (opex.js) */
dialog.ds-copy { width: min(720px, calc(100vw - 32px)); }
dialog.ds-copy .ds-tboxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
dialog.ds-copy .ds-tv { font-size: 1.05rem; white-space: normal; }
dialog.ds-copy .ds-cprev { padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: .92rem; min-height: 1.2em; }
dialog.ds-copy .ds-cnote { margin: 0; font-size: .8rem; }
dialog.ds-copy .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-copy .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-copy .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-copy .ds-xcard .field > :is(input, select) { width: 100% !important; box-sizing: border-box; }
@media (max-width: 700px) { dialog.ds-copy .ds-tboxes { grid-template-columns: 1fr; } }

/* Wash-up invoice, Detail look (billing.js) */
dialog.ds-wu { width: min(820px, calc(100vw - 32px)); }
dialog.ds-wu .ds-tboxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
dialog.ds-wu .ds-tv { font-size: 1.1rem; white-space: normal; }
dialog.ds-wu .ds-cnote { margin: 0; font-size: .8rem; }
dialog.ds-wu .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-wu .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-wu .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-wu .ds-xcard .field > input { width: 100% !important; box-sizing: border-box; }
dialog.ds-wu .ds-wulines { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-wu .ds-wuhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
dialog.ds-wu .ds-wuhead strong { font-size: .95rem; }
dialog.ds-wu .ds-wuhead .muted { font-size: .8rem; }
dialog.ds-wu .ds-wulines .table-wrap { max-height: 300px; overflow: auto; }
dialog.ds-wu .ds-wulines table.grid { margin: 0; }
dialog.ds-wu .ds-wulines table.grid th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface); position: sticky; top: 0; }
dialog.ds-wu .ds-wulines table.grid :is(th, td):first-child { padding-left: 16px; }
dialog.ds-wu .ds-wulines table.grid :is(th, td):last-child { padding-right: 16px; }
dialog.ds-wu .ds-wulines tfoot td { font-weight: 700; background: var(--surface-2); position: sticky; bottom: 0; }
@media (max-width: 700px) { dialog.ds-wu .ds-tboxes { grid-template-columns: 1fr; } }

/* Email the statement, Detail look (tenant-statement.js): attachments as a grouped table with a filter and a size bar */
dialog.ds-mail { width: min(860px, calc(100vw - 32px)); }
dialog.ds-mail .ds-tv { font-size: 1.05rem; white-space: normal; }
dialog.ds-mail .ds-mgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px 14px; }
dialog.ds-mail .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-mail .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-mail .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-mail .ds-xcard .field > :is(input, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-mail .ds-cnote { margin: 0; font-size: .8rem; }
dialog.ds-mail .ds-matt { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-mail .ds-mhead { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
dialog.ds-mail .ds-mhead strong { font-size: .95rem; }
dialog.ds-mail .ds-mhead .muted { font-size: .8rem; }
dialog.ds-mail .ds-mhead .spacer { flex: 1; }
dialog.ds-mail .ds-mhead input[type=search] { width: 180px; padding: 4px 8px; }
dialog.ds-mail .ds-mhead.few input[type=search] { display: none; }
dialog.ds-mail .ds-mhead .btn { padding: 4px 10px; }
dialog.ds-mail .ds-mfiles .table-wrap { max-height: 260px; overflow: auto; }
dialog.ds-mail .ds-mfiles table.grid { margin: 0; }
dialog.ds-mail .ds-mfiles th { position: sticky; top: 0; background: var(--surface); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); z-index: 1; }
dialog.ds-mail .ds-mfiles :is(th, td):first-child { padding-left: 16px; }
dialog.ds-mail .ds-mfiles :is(th, td):last-child { padding-right: 16px; }
dialog.ds-mail .ds-mfiles tr.ds-mgroup td { background: var(--surface-2); }
dialog.ds-mail .ds-mfiles tr[data-in] td.ds-mname { padding-left: 20px; word-break: break-all; }
dialog.ds-mail .ds-mfiles tr.hidden { display: none; }
dialog.ds-mail .ds-mfoot { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--border); }
dialog.ds-mail .ds-mfoot .check { margin: 0; }
dialog.ds-mail .ds-mbar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
dialog.ds-mail .ds-mbar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .15s; }
dialog.ds-mail .ds-mbar > span.over { background: var(--negative); }
dialog.ds-mail #emailSize { font-size: .8rem; }
@media (max-width: 700px) { dialog.ds-mail .ds-mgrid { grid-template-columns: 1fr; } }

/* Admin pop-ups, Detail look (admin.js detailLook) */
dialog.ds-adm { width: min(820px, calc(100vw - 32px)); }
dialog.ds-adm .ds-tv { font-size: 1.05rem; white-space: normal; }
dialog.ds-adm .ds-xcard .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin: 0; }
dialog.ds-adm .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-adm .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-adm .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-adm .ds-xcard .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-adm .ds-xcard > .check, dialog.ds-adm .ds-achecks .check { margin: 0; }
dialog.ds-adm .ds-achecks { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--surface-2); }
dialog.ds-adm .ds-acard { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-adm .ds-ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
dialog.ds-adm .ds-ahead strong { font-size: .95rem; }
dialog.ds-adm .ds-ahead .muted { font-size: .8rem; }
dialog.ds-adm .ds-abody { padding: 8px 16px 10px; max-height: 280px; overflow: auto; }
dialog.ds-adm .ds-abody .field { display: flex; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--surface-2); }
dialog.ds-adm .ds-abody .field:last-child { border-bottom: 0; }
dialog.ds-adm .ds-acard table.grid { margin: 0; }
dialog.ds-adm .ds-acard table.grid :is(th, td):first-child { padding-left: 16px; }
dialog.ds-adm .ds-acard table.grid :is(th, td):last-child { padding-right: 16px; }
dialog.ds-adm .ds-acard table.grid th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface); }
dialog.ds-adm .ds-aempty { margin: 0; padding: 10px 16px; }
@media (max-width: 700px) { dialog.ds-adm .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } dialog.ds-adm .ds-xcard .form-grid { grid-template-columns: 1fr; } }

/* Admin: Delete workspace, Detail look */
dialog.ds-adel { width: min(640px, calc(100vw - 32px)); }
dialog.ds-adel .ds-tv { font-size: 1.3rem; }
dialog.ds-adel .ds-xcard { border-left: 4px solid var(--negative); }
dialog.ds-adel .ds-delwarn { display: flex; flex-direction: column; gap: 2px; }
dialog.ds-adel .ds-delwarn strong { color: var(--negative); }
dialog.ds-adel .ds-delrest { margin: 0; font-size: .85rem; }
dialog.ds-adel .ds-delrest:empty { display: none; }
dialog.ds-adel .ds-tbox.hidden { display: none; }

/* Admin → Billing: Plan, Detail look (billing-admin.js) */
dialog.ds-plan { width: min(760px, calc(100vw - 32px)); }
dialog.ds-plan .ds-prow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; }
dialog.ds-plan .ds-xcard > .check { margin: 0; }
dialog.ds-plan table.ds-pinc td { vertical-align: middle; padding-top: 5px; padding-bottom: 5px; }
dialog.ds-plan table.ds-pinc td:first-child { font-weight: 600; white-space: nowrap; }
dialog.ds-plan table.ds-pinc td:first-child .sub { font-weight: 400; }
dialog.ds-plan table.ds-pinc td input { width: 100%; box-sizing: border-box; text-align: right; }
dialog.ds-plan table.ds-pinc th:not(:first-child), dialog.ds-plan table.ds-pinc td:not(:first-child) { width: 34%; }
dialog.ds-plan table.ds-pinc .hint { display: block; font-size: .75rem; text-align: right; }
dialog.ds-plan .ds-pnote { margin: 0; padding: 8px 16px 10px; font-size: .78rem; border-top: 1px solid var(--surface-2); }
@media (max-width: 700px) { dialog.ds-plan .ds-prow { grid-template-columns: 1fr; } }

/* Admin → Billing: Customer, Detail look (billing-admin.js) */
dialog.ds-cust { width: min(860px, calc(100vw - 32px)); }
dialog.ds-cust .ds-crow3 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; }
dialog.ds-cust .ds-crow2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
dialog.ds-cust .ds-cbody { padding: 12px 16px; }
dialog.ds-cust .ds-acard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-cust .ds-acard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-cust .ds-acard .field > span:first-child::after { content: none !important; }
dialog.ds-cust .ds-acard .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-cust .ds-cadd { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); margin: 0; }
dialog.ds-cust .ds-acard .table-wrap { max-height: 220px; overflow: auto; }
@media (max-width: 700px) { dialog.ds-cust :is(.ds-crow3, .ds-crow2) { grid-template-columns: 1fr; } dialog.ds-cust .ds-cadd { flex-wrap: wrap; } }
dialog.ds-cust .ds-cadd { display: grid !important; grid-template-columns: 150px minmax(0, 1fr) 150px auto; }
dialog.ds-cust .ds-cadd > * { width: 100% !important; margin: 0 !important; }
@media (max-width: 700px) { dialog.ds-cust .ds-cadd { grid-template-columns: 1fr 1fr; } }

/* Admin → Billing: site Invoice, Detail look (billing-admin.js) */
dialog.ds-binv { width: min(760px, calc(100vw - 32px)); }
dialog.ds-binv #billInvBody table.grid { margin: 0; }
dialog.ds-binv #billInvBody table.grid :is(th, td):first-child { padding-left: 16px; }
dialog.ds-binv #billInvBody table.grid :is(th, td):last-child { padding-right: 16px; }
dialog.ds-binv #billInvBody tfoot td { background: var(--surface-2); }
dialog.ds-binv #billInvBody tfoot tr.ds-btot td { font-weight: 700; }
dialog.ds-binv .ds-bxrow { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px; }
dialog.ds-binv .ds-bxrow .field { display: flex !important; flex-direction: column; gap: 4px; margin: 0; width: 260px; }
dialog.ds-binv .ds-bxrow .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-binv .ds-bxrow .field > span:first-child::after { content: none !important; }
dialog.ds-binv .ds-xbar { flex-wrap: wrap; gap: 8px; }
dialog.ds-binv .ds-bxrow .field > span:first-child { text-align: left !important; width: auto !important; justify-content: flex-start !important; }
dialog.ds-binv .ds-bxrow .field > span:first-child { display: none !important; }

/* A one-off secret (P.showSecret), Detail look */
dialog.ds-secret { width: min(560px, calc(100vw - 32px)); }
dialog.ds-secret .ds-tboxes { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 8px 0 10px; }
dialog.ds-secret .ds-tbox { padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-secret .ds-tbox:last-child { border-right: 0; }
dialog.ds-secret .ds-tbox .ds-k { font-size: .8rem; color: var(--muted); }
dialog.ds-secret .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; }
dialog.ds-secret .ds-cnote { margin: 0; font-size: .85rem; }
dialog.ds-secret .ds-secrow { display: flex; align-items: center; gap: 10px; }
dialog.ds-secret .ds-secrow .secret { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 1.35rem; letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; user-select: all; overflow-wrap: anywhere; }
dialog.ds-secret .ds-secrow .btn.copy { min-height: 42px; padding: 0 16px; font-weight: 600; }
dialog.ds-secret .ds-secrow .btn.copy.done { color: var(--positive); border-color: var(--positive); }

/* Settings: Letterhead, Detail look (settings.js) */
dialog.ds-letter { width: min(680px, calc(100vw - 32px)); }
dialog.ds-letter .ds-acard { margin: 8px 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-letter .ds-ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
dialog.ds-letter .ds-ahead strong { font-size: .95rem; }
dialog.ds-letter .ds-ahead .muted { font-size: .8rem; }
dialog.ds-letter .ds-lpbody { padding: 14px 18px; text-align: right; font-size: .88rem; color: var(--muted); line-height: 1.45; }
dialog.ds-letter .ds-lpname { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
dialog.ds-letter .ds-xcard .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin: 0; }
dialog.ds-letter .ds-xcard .form-grid > .field.wide { grid-column: 1 / -1; }
dialog.ds-letter .ds-xcard > .check { margin: 0; }
@media (max-width: 700px) { dialog.ds-letter .ds-xcard .form-grid { grid-template-columns: 1fr; } }

/* Settings → Danger zone pop-ups, Detail look (settings.js dangerLook) */
dialog.ds-adel .ds-xcard > .check { margin: 0; }
dialog.ds-adel .ds-xcard > .hint { margin: -6px 0 0 !important; }
dialog.ds-adel #dangerWhat { margin: 0; }
dialog.ds-adel .ds-xcard > .hint, dialog.ds-adel .ds-delrest { font-size: .82rem !important; }

/* Settings → Periods: Period, Detail look */
dialog.ds-period { width: min(620px, calc(100vw - 32px)); }
dialog.ds-period .ds-xcard .form-grid { gap: 12px 14px; }
dialog.ds-period .ds-plen { margin: 0; font-size: .85rem; }

/* Settings → People: Add a person, Detail look (settings-people.js) */
dialog.ds-member { width: min(640px, calc(100vw - 32px)); }
dialog.ds-member .ds-xcard .form-grid { gap: 12px 14px; }
dialog.ds-member .ds-xcard .field .hint { font-size: .75rem; }
dialog.ds-member .ds-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
dialog.ds-member .ds-role { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; }
dialog.ds-member .ds-role span { font-size: .78rem; color: var(--muted); }
dialog.ds-member .ds-role.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-member .ds-role.on b::before { content: '✓ '; color: var(--accent); }
@media (max-width: 700px) { dialog.ds-member .ds-roles { grid-template-columns: 1fr; } }

/* Requests and bugs: Request a feature / Report a bug, Detail look (features.js) */
dialog.ds-req { width: min(640px, calc(100vw - 32px)); }
dialog.ds-req .ds-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 10px; }
dialog.ds-req .ds-kinds label { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
dialog.ds-req .ds-kinds input { position: absolute; opacity: 0; pointer-events: none; }
dialog.ds-req .ds-kinds span { font-weight: 700; }
dialog.ds-req .ds-kinds small { font-size: .78rem; color: var(--muted); }
dialog.ds-req .ds-kinds label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-req .ds-kinds label:has(input:checked) span::before { content: '✓ '; color: var(--accent); }
dialog.ds-req .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-req .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-req .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-req .ds-xcard .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-req .ds-xcard textarea { min-height: 150px; }

/* Requests and bugs: Where it stands, Detail look (features.js) */
dialog.ds-stat { width: min(720px, calc(100vw - 32px)); }
dialog.ds-stat .ds-tv { font-size: 1.05rem; white-space: normal; }
dialog.ds-stat .ds-acard { margin-bottom: 12px; }
dialog.ds-stat .ds-sdetail { padding: 10px 16px; font-size: .9rem; max-height: 160px; overflow: auto; }
dialog.ds-stat .ds-xcard .field textarea { width: 100% !important; box-sizing: border-box; }
dialog.ds-stat .ds-stats5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
dialog.ds-stat .ds-stats5 button { padding: 8px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font: inherit; font-weight: 600; color: inherit; }
dialog.ds-stat .ds-stats5 button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
dialog.ds-stat .ds-xcard > .check { margin: 0; }
@media (max-width: 700px) { dialog.ds-stat .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } dialog.ds-stat .ds-stats5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Categories: Category and Merge, Detail look (categories.js) */
dialog.ds-cat { width: min(720px, calc(100vw - 32px)); }
dialog.ds-cat .ds-xcard .form-grid { gap: 12px 14px; }
dialog.ds-cat .ds-xcard .field .hint { font-size: .75rem; }
dialog.ds-cat .ds-xcard > .check { margin: 0; }
dialog.ds-cat .ds-acard { margin-top: 12px; }
dialog.ds-cat .ds-abody { padding: 10px 16px; max-height: none; }
dialog.ds-cat .ds-gone { display: none !important; }
dialog.ds-merge { width: min(560px, calc(100vw - 32px)); }
dialog.ds-merge .ds-tv { font-size: 1.05rem; white-space: normal; }
dialog.ds-merge .ds-cnote { margin: 0; font-size: .82rem; }

/* Payees: Payee, Detail look (payees.js; Merge uses ds-merge) */
dialog.ds-pay .ds-xcard .field textarea { width: 100% !important; box-sizing: border-box; }

/* Dashboards: Customise, Detail look (dash.js) */
dialog.ds-dashc .ds-tboxes { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 8px 0 10px; }
dialog.ds-dashc .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-dashc .ds-tbox:last-child { border-right: 0; }
dialog.ds-dashc .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-dashc .ds-tv { font-size: 1.15rem; font-weight: 700; margin: 2px 0; }
dialog.ds-dashc .ds-dlevel { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 0 0 10px; }
dialog.ds-dashc .ds-dlevel label { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
dialog.ds-dashc .ds-dlevel input { position: absolute; opacity: 0; pointer-events: none; }
dialog.ds-dashc .ds-dlevel span { font-weight: 700; }
dialog.ds-dashc .ds-dlevel small { font-size: .76rem; color: var(--muted); }
dialog.ds-dashc .ds-dlevel label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-dashc .ds-dlevel label:has(input:checked) span::before { content: '✓ '; color: var(--accent); }
dialog.ds-dashc .ds-dcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
dialog.ds-dashc .ds-ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
dialog.ds-dashc .ds-ahead strong { font-size: .95rem; }
dialog.ds-dashc .ds-ahead .muted { font-size: .78rem; }
dialog.ds-dashc .ds-dcard > .dash-tree, dialog.ds-dashc .ds-dcard > .dash-arrange { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; padding: 8px 12px; flex: 1; min-height: 0; overflow: auto; }
@media (max-width: 700px) { dialog.ds-dashc .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
dialog.ds-dashc { width: min(1120px, calc(100vw - 32px)) !important; }
dialog.ds-dashc[open] { min-height: 0; }
dialog.ds-dashc .dash-custom { min-height: 0; }
/* (the boxes and choices on top take room: the lists shorter, so the buttons stay on screen) */
dialog.ds-dashc .ds-dcard > .dash-tree, dialog.ds-dashc .ds-dcard > .dash-arrange { max-height: calc(100vh - 380px) !important; min-height: 160px; }
dialog.ds-dashc .ds-tboxes { margin: 4px 0 8px; }
dialog.ds-dashc .ds-tbox { padding: 6px 12px; }
dialog.ds-dashc .ds-tv { font-size: 1.05rem; margin: 0; }
dialog.ds-dashc .ds-dlevel label { padding: 6px 12px; }

/* The trade pop-up, Detail look (trade-dialog.js): boxes on top, the panels as white cards - the fields where they were */
dialog.ds-trade { width: min(1000px, calc(100vw - 32px)) !important; }
dialog.ds-trade .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 8px 0 10px; }
dialog.ds-trade .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-trade .ds-tbox:last-child { border-right: 0; }
dialog.ds-trade .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-trade .ds-tv { font-size: 1.1rem; font-weight: 700; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-trade form > section.panel:not(.hidden) { background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: none !important; margin: 0 0 10px; }
dialog.ds-trade form > section.panel > .panel-head { display: none; }
dialog.ds-trade form > section.panel > .panel-body { padding: 14px 16px; }
@media (max-width: 700px) { dialog.ds-trade .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* (a required field left empty: outlined red until it's filled) */
dialog .field.ds-missing > :is(input, select, textarea), dialog .field.ds-missing .inline-pick > input { border-color: var(--negative) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--negative) 20%, transparent); }

/* The Record pop-ups (P.recordDialog), Detail look: boxes, the columns and Documents as white cards - fields where they were */
dialog.ds-rec[open] { min-height: 0; }
dialog.ds-rec .rec-head { margin-bottom: 4px; }
dialog.ds-rec .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 10px; }
dialog.ds-rec .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-rec .ds-tbox:last-child { border-right: 0; }
dialog.ds-rec .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-rec .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-rec .rec-cols { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
dialog.ds-rec .docs-box { margin: 10px 0 0; background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-rec .docs-box > .docs-head { padding: 8px 16px; margin: 0; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-rec .docs-box > .docs-head > strong:first-child::before { content: none; }
dialog.ds-rec .docs-box > .muted, dialog.ds-rec .docs-box > p, dialog.ds-rec .docs-box > .empty { padding: 8px 16px !important; }
dialog.ds-rec .ds-xbar { margin-top: 12px; }
@media (max-width: 700px) { dialog.ds-rec .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* (Record pop-ups: no buttons in the title bar - they're along the bottom) */
dialog.ds-rec .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
/* (Record pop-ups: narrower - the two columns close together) */
dialog.ds-rec:not(.ds-occ) { width: min(820px, calc(100vw - 32px)) !important; max-width: none; }

/* + New category / tag from a picker, Detail look (site.js makeNew) */
dialog.ds-catnew { width: min(480px, calc(100vw - 32px)); }
dialog.ds-catnew[open] { min-height: 0; }
dialog.ds-catnew .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; margin: 6px 0 0; }
dialog.ds-catnew .ds-cnrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; }
dialog.ds-catnew .ds-cnrow:has(#catNewKindBox.hidden) { grid-template-columns: 1fr; }
dialog.ds-catnew .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-catnew .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-catnew .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-catnew .ds-xcard .field > :is(input, select) { width: 100% !important; box-sizing: border-box; }
dialog.ds-catnew .ds-cnwhat { margin: 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: .88rem; }
dialog.ds-catnew .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-catnew .ds-xbar { margin-top: 12px; display: flex; gap: 8px; }

/* Change several at once (P.changeMany), Detail look */
dialog.ds-cm { width: min(620px, calc(100vw - 32px)); }
dialog.ds-cm[open] { min-height: 0; }
dialog.ds-cm .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 16px 12px; margin: 6px 0 0; }
dialog.ds-cm .ds-cmrow { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px 14px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--surface-2); margin: 0; }
dialog.ds-cm .ds-cmrow .cm-on { margin: 4px 0 0; align-items: flex-start; gap: 8px; }
dialog.ds-cm .ds-cmrow .cm-on span { display: flex; flex-direction: column; }
dialog.ds-cm .ds-cmrow .cm-on small { font-size: .76rem; color: var(--muted); font-weight: 400; }
dialog.ds-cm .ds-cmrow:has([data-on]:checked) .cm-on b { color: var(--accent-strong); }
dialog.ds-cm .ds-cmpick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
dialog.ds-cm .ds-cmpick select, dialog.ds-cm .ds-cmpick .catpick { width: 100%; }
dialog.ds-cm .ds-cmwhat { margin: 10px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: .86rem; }
dialog.ds-cm .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-cm .ds-xbar { margin-top: 12px; display: flex; gap: 8px; }
@media (max-width: 600px) { dialog.ds-cm .ds-cmrow { grid-template-columns: 1fr; } }

/* Find a symbol (P.findSymbol), Detail look */
dialog.ds-fsym { width: min(780px, calc(100vw - 32px)); }
dialog.ds-fsym[open] { min-height: 0; }
dialog.ds-fsym .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
dialog.ds-fsym .ds-xcard .inline-pick { display: flex; gap: 8px; }
dialog.ds-fsym .ds-xcard .inline-pick input { flex: 1; }
dialog.ds-fsym #fsNote { margin: 0; font-size: .8rem; }
dialog.ds-fsym .ds-fsres { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-fsym .ds-ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
dialog.ds-fsym .ds-ahead strong { font-size: .95rem; }
dialog.ds-fsym .ds-ahead .muted { font-size: .8rem; }
dialog.ds-fsym .ds-fsres .table-wrap { max-height: 46vh; overflow-y: auto; }
dialog.ds-fsym .ds-fsres table.grid { margin: 0; }
dialog.ds-fsym .ds-fsres th { position: sticky; top: 0; background: var(--surface); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
dialog.ds-fsym .ds-fsres :is(th, td):first-child { padding-left: 16px; }
dialog.ds-fsym .ds-fsres :is(th, td):last-child { padding-right: 16px; }
dialog.ds-fsym .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-fsym .ds-xbar { margin-top: 12px; display: flex; gap: 8px; }

/* From the bank feed (P.feedItems), Detail look */
dialog.ds-feed { width: min(900px, calc(100vw - 32px)); }
dialog.ds-feed[open] { min-height: 0; }
dialog.ds-feed .ds-fdtitle { font-size: 1.1rem; font-weight: 700; margin: 6px 0 8px; }
dialog.ds-feed .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 0 0 10px; }
dialog.ds-feed .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-feed .ds-tbox:last-child { border-right: 0; }
dialog.ds-feed .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-feed .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-feed .fd-cols { gap: 10px; align-items: start; }
dialog.ds-feed .fd-left { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-feed .fd-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 0 6px; margin: 0; overflow: hidden; }
dialog.ds-feed .fd-sec h3 { margin: 0 0 4px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; text-transform: none; letter-spacing: 0; color: var(--text); }
dialog.ds-feed .fd-sec .fd-list { padding: 0 14px; }
dialog.ds-feed .fd-here { margin: 0; }
dialog.ds-feed .ds-xbar { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
dialog.ds-feed .ds-xbar .left { margin-right: 0; }
@media (max-width: 700px) { dialog.ds-feed .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Header bar (P.openHeaderBar), Detail look */
dialog.ds-hb { width: min(760px, calc(100vw - 32px)); }
dialog.ds-hb[open] { min-height: 0; }
dialog.ds-hb .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 10px; }
dialog.ds-hb .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-hb .ds-tbox:last-child { border-right: 0; }
dialog.ds-hb .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-hb .ds-tv { font-size: 1.15rem; font-weight: 700; margin: 2px 0; }
dialog.ds-hb form > section.panel { background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: none !important; overflow: hidden; margin: 0 0 10px; }
dialog.ds-hb form > section.panel > .panel-head { cursor: default; padding: 10px 16px; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-hb form > section.panel > .panel-head > strong:first-child::before { content: none; }
dialog.ds-hb form > section.panel.collapsed > :not(.panel-head) { display: block; }
dialog.ds-hb #hbRows td:first-child { padding-left: 16px; }
dialog.ds-hb #hbRows td:last-child { padding-right: 16px; }
dialog.ds-hb .ds-hbnote { order: 9; font-size: .8rem; margin: 0 0 10px; }
dialog.ds-hb form { display: flex; flex-direction: column; }
dialog.ds-hb form > .dlg-top, dialog.ds-hb form > #hbBoxes { order: 0; }
dialog.ds-hb form > section.panel { order: 5; }
dialog.ds-hb form > .buttons { order: 10; }
dialog.ds-hb .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
@media (max-width: 700px) { dialog.ds-hb .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Unlock a Private workspace, Detail look (site.js privateLocked) */
dialog.ds-lock { width: min(500px, calc(100vw - 32px)); max-width: none; }
dialog.ds-lock[open] { min-height: 0; }
dialog.ds-lock .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-lock .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-lock .ds-xcard .field.hidden { display: none !important; }
dialog.ds-lock .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-lock .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-lock .ds-xcard .field > input { width: 100% !important; box-sizing: border-box; }
dialog.ds-lock .ds-lockswap { align-self: flex-start; font-size: .85rem; }
dialog.ds-lock #plErr { margin: 8px 0 0; min-height: 1em; }
dialog.ds-lock .ds-xbar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
dialog.ds-lock .ds-locknote { font-size: .8rem; }
dialog.ds-lock .dlg-tools > .btn:not(.dlg-x) { display: none !important; }

/* Accounts: Account, Detail look (accounts.js) */
dialog.ds-acct { width: min(780px, calc(100vw - 32px)); }
dialog.ds-acct .ds-acard { margin: 0 0 10px; }
dialog.ds-acct .ds-acard.hidden { display: none; }
dialog.ds-acct .ds-abody.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 12px 16px; max-height: none; overflow: visible; }
dialog.ds-acct .ds-abody > .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; padding: 0; border: 0; }
dialog.ds-acct .ds-abody > .field.hidden { display: none !important; }
dialog.ds-acct .ds-abody > .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-acct .ds-abody > .field > span:first-child::after { content: none !important; }
dialog.ds-acct .ds-abody > .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-acct .ds-abody > .field:has([name="name"]), dialog.ds-acct .ds-abody > .field:has([name="notes"]), dialog.ds-acct .ds-abody > .ds-aticks { grid-column: 1 / -1; }
dialog.ds-acct .ds-aticks { display: flex; flex-direction: column; gap: 6px; }
dialog.ds-acct .ds-aticks .check { margin: 0; }
dialog.ds-acct .ds-aticks .check.hidden { display: none; }
dialog.ds-acct .docs-box { margin: 0 0 10px; }
@media (max-width: 700px) { dialog.ds-acct .ds-abody.form-grid { grid-template-columns: 1fr; } }
dialog.ds-acct .ds-acard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-acct .ds-ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
dialog.ds-acct .ds-ahead strong { font-size: .95rem; }
dialog.ds-acct .ds-ahead .muted { font-size: .8rem; }
dialog.ds-acct .ds-tboxes { margin: 6px 0 10px; }

/* Ask AI, Detail look: a plain white head, the chat on a light ground, suggestions and answers as white cards, the question box in a card */
dialog.ai-panel.ds-ai { padding: 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
dialog.ds-ai .ai-head { background: var(--surface); border-top: 0; padding: 12px 12px 12px 16px; }
dialog.ds-ai .ai-head strong::before { content: '✦ '; color: #8b5cf6; }
dialog.ds-ai .ai-log { background: var(--surface-2); padding: 14px 16px; }
dialog.ds-ai .ai-hello p { font-size: .88rem; }
dialog.ds-ai .ai-example { padding: 10px 12px; border-radius: 10px; box-shadow: 0 1px 2px rgba(16,24,40,.06); position: relative; padding-right: 28px; }
dialog.ds-ai .ai-example::after { content: '→'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
dialog.ds-ai .ai-example:hover::after { color: var(--accent); }
dialog.ds-ai .ai-msg.ai { background: var(--surface); border: 1px solid var(--border); }
dialog.ds-ai .ai-ask { background: var(--surface); margin: 0; padding: 10px 12px; }
dialog.ds-ai .ai-ask textarea { border-radius: 10px; }
dialog.ds-ai .ai-foot { background: var(--surface); padding: 0 12px 10px; margin: 0; }

/* Help pop-up (a page's ?), Detail look */
dialog.ds-help { width: min(760px, calc(100vw - 32px)); padding: 0; background: var(--surface-2); }
dialog.ds-help[open] { min-height: 0; display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
dialog.ds-help > .dlg-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
dialog.ds-help .ds-helpq { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); flex: none; }
dialog.ds-help .ds-helpt small { display: block; font-size: .75rem; color: var(--muted); }
dialog.ds-help .ds-helpt h2 { margin: 0; font-size: 1.1rem; }
dialog.ds-help .ds-helpbody { padding: 12px 16px 0; overflow: auto; flex: 1; }
dialog.ds-help .help-page { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 18px; }
dialog.ds-help .ds-xbar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; margin: 0; }
dialog.ds-help.help-dialog > .dlg-top { padding: 12px 14px 12px 16px !important; margin: 0 !important; width: auto !important; position: static; }
dialog.ds-help.help-dialog > .dlg-top .dlg-x { margin-left: auto; }

/* Own vs rent: Import a mortgage plan, Detail look */
dialog.ds-imp { width: min(640px, calc(100vw - 32px)); }
dialog.ds-imp[open] { min-height: 0; }
dialog.ds-imp .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 10px; }
dialog.ds-imp .ds-tboxes.hidden { display: none; }
dialog.ds-imp .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-imp .ds-tbox:last-child { border-right: 0; }
dialog.ds-imp .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-imp .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; }
dialog.ds-imp .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-imp .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-imp .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-imp .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-imp .ds-xcard .field > select { width: 100% !important; }
dialog.ds-imp .ds-impwhat .ds-k { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
dialog.ds-imp .ds-impwhat ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
dialog.ds-imp .ds-impwhat li::before { content: '✓ '; color: var(--accent); font-weight: 700; }
dialog.ds-imp .ds-impnote { margin: 0; font-size: .8rem; }
dialog.ds-imp .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-imp .ds-xbar { display: flex; gap: 8px; margin-top: 12px; }
@media (max-width: 600px) { dialog.ds-imp .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
dialog.ds-imp { padding: 14px 18px 16px; }
dialog.ds-imp > h2 { margin: 0 0 6px; font-size: 1.15rem; }

/* Reports: Transactions behind a figure, Detail look */
dialog.ds-drill { width: min(960px, calc(100vw - 32px)); }
dialog.ds-drill[open] { min-height: 0; }
dialog.ds-drill .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 10px; }
dialog.ds-drill .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-drill .ds-tbox:last-child { border-right: 0; }
dialog.ds-drill .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-drill .ds-tv { font-size: 1.1rem; font-weight: 700; margin: 2px 0; }
dialog.ds-drill form > section.panel { background: var(--surface); border: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: none !important; overflow: hidden; margin: 0; }
dialog.ds-drill form > section.panel > .panel-head { cursor: default; padding: 10px 16px; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-drill form > section.panel > .panel-head > strong:first-child::before { content: none; }
dialog.ds-drill form > section.panel.collapsed > :not(.panel-head) { display: block; }
dialog.ds-drill #detailRows td:first-child, dialog.ds-drill thead th:first-child { padding-left: 16px; }
dialog.ds-drill #detailRows td:last-child, dialog.ds-drill thead th:last-child { padding-right: 16px; }
dialog.ds-drill .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-drill .ds-xbar { display: flex; gap: 8px; margin-top: 12px; }
@media (max-width: 700px) { dialog.ds-drill .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Reports: Add to favourites / Rename, Detail look */
dialog.ds-fav { width: min(600px, calc(100vw - 32px)); }
dialog.ds-fav[open] { min-height: 0; }
dialog.ds-fav .ds-tboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 10px; }
dialog.ds-fav .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-fav .ds-tbox:last-child { border-right: 0; }
dialog.ds-fav .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-fav .ds-tv { font-size: 1rem; font-weight: 700; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.ds-fav .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
dialog.ds-fav .ds-xcard .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-fav .ds-xcard .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-fav .ds-xcard .field > span:first-child::after { content: none !important; }
dialog.ds-fav .ds-xcard .field > input { width: 100% !important; box-sizing: border-box; }
dialog.ds-fav .ds-xcard .hint { margin: 0; font-size: .78rem; }
dialog.ds-fav .ds-favwhere > .ds-k { font-size: .8rem; color: var(--muted); margin: 0 0 6px; }
dialog.ds-fav .ds-favopt { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
dialog.ds-fav .ds-favopt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
dialog.ds-fav .ds-favopt .check { margin: 0; align-items: flex-start; gap: 10px; }
dialog.ds-fav .ds-favopt .check > span { display: flex; flex-direction: column; }
dialog.ds-fav .ds-favopt small { font-size: .78rem; color: var(--muted); }
dialog.ds-fav #favPicker { margin-top: 10px; }
dialog.ds-fav .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-fav .ds-xbar { display: flex; gap: 8px; margin-top: 12px; }

/* Bills: the Bill pop-up - no buttons in the title bar (they're along the bottom); Next 24 in a pop-up of its own */
dialog.ds-bill .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-next24 { width: min(900px, calc(100vw - 32px)); }
dialog.ds-next24 #upcomingPanel { margin: 0 0 10px; }
dialog.ds-next24 #upcomingPanel > :not(.panel-head) { display: block !important; }
dialog.ds-next24 .upcoming-wrap { max-height: 60vh; overflow-y: auto; }
/* Bills: the Bill pop-up in the Detail look - the fields where they were, compact; the panels as white cards with plain
   headings on a light ground, the kind as three choice cards */
dialog.ds-bill #billInfo { display: block !important; margin: 0 0 6px; font-size: .85rem; }
dialog.ds-bill form > .segmented { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px !important; background: none; border: 0; padding: 0; }
dialog.ds-bill form > .segmented label { display: flex; align-items: center; justify-content: center; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; margin: 0; }
dialog.ds-bill form > .segmented label input { position: absolute; opacity: 0; pointer-events: none; }
dialog.ds-bill form > .segmented label span { font-weight: 600; background: none !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; color: inherit !important; }
dialog.ds-bill form > .segmented label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-bill form > .segmented label:has(input:checked) span::before { content: '✓ '; color: var(--accent); }
dialog.ds-bill form > section.panel { background: var(--surface) !important; border: 1px solid var(--border) !important; border-left: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: none !important; overflow: hidden; margin: 0 0 8px; }
dialog.ds-bill form > section.panel > .panel-head { background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; padding: 7px 12px; }
dialog.ds-bill form > section.panel > .panel-head strong { font-size: .92rem; }
dialog.ds-bill form > section.panel > .panel-head > strong:first-child::before { color: var(--muted); }
dialog.ds-bill .ds-xbar, dialog.ds-bill form > .buttons { margin-top: 8px; }
/* (Bill: its bottom buttons in the Detail look - outlined, a little taller and bolder, as the other Detail pop-ups) */
dialog.ds-bill form > .buttons { display: flex; align-items: center; gap: 8px; }
dialog.ds-bill form > .buttons .btn { padding: 9px 16px; font-weight: 600; min-height: 38px; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
dialog.ds-bill form > .buttons .btn.primary { border-color: var(--accent); }
dialog.ds-bill form > .buttons .btn.danger { color: var(--negative); }
dialog.ds-bill form > .buttons #next24Btn { margin-right: auto; }
dialog.ds-bill form > .buttons #deleteBill { margin-right: 0; }
/* (Bill: its cards don't fold - no arrow, the heading isn't a toggle, always open) */
dialog.ds-bill form > section.panel > .panel-head { cursor: default; pointer-events: none; }
dialog.ds-bill form > section.panel > .panel-head > strong:first-child::before { content: none !important; }
dialog.ds-bill form > section.panel > .panel-head button, dialog.ds-bill form > section.panel > .panel-head a { pointer-events: auto; }
dialog.ds-bill form > section.panel.collapsed > :not(.panel-head) { display: block !important; }
dialog.ds-bill form > section.panel.collapsed > .panel-head { border-bottom: 1px solid var(--border); }

/* Bill: the Schedule card as one grid - lined up with the date and frequency columns */
#billDialog .end-row { display: contents; padding: 0; }
#billDialog .end-row.hidden { display: none; }
#billDialog .hgrid > .sched-in { margin: 0; }
#billDialog .hgrid > .sched-wide { grid-column: span 3; }
@media (max-width: 700px) { #billDialog .hgrid > .sched-wide { grid-column: span 1; } }
#billDialog .hgrid > .sched-in { display: flex !important; flex-wrap: nowrap; align-items: center; gap: 6px; white-space: nowrap; }
#billDialog .hgrid > .sched-in input.tiny { width: 64px !important; flex: none; }
#billDialog .hgrid > .sched-in .check { white-space: nowrap; }
/* (Bill Schedule: the two ticks start at the left edge, under the labels; a line above "This series will end") */
#billDialog .hgrid > span:has(+ .sched-wide) { display: none; }
#billDialog .hgrid > .sched-wide { grid-column: 1 / -1; }
#billDialog .hgrid > .sched-wide:has(#billHasEnd) { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
/* (Bill Schedule: Remind me's row ends after it - its right half empty) */
#billDialog .hgrid > .sched-in:has([name="remindDays"]) { grid-column: span 3; }
#billDialog .hgrid > .sched-wide:has([name="isEnabled"]) { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
/* (no line above "This series will end" - just the one above Active) */
#billDialog .hgrid > .sched-wide:has(#billHasEnd) { border-top: 0; padding-top: 0; margin-top: 0; }
/* (Bill: every card the same label widths, so the boxes line up from From / To down to Schedule) */
#billDialog section.panel .panel-body > .hgrid { grid-template-columns: 118px minmax(0, 1fr) 112px minmax(0, 1fr); }
@media (max-width: 700px) { #billDialog section.panel .panel-body > .hgrid { grid-template-columns: max-content minmax(0, 1fr); } }

/* Bill: Split across categories, Detail look */
dialog.ds-split .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 10px; }
dialog.ds-split .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-split .ds-tbox:last-child { border-right: 0; }
dialog.ds-split .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-split .ds-tv { font-size: 1.1rem; font-weight: 700; margin: 2px 0; }
dialog.ds-split .ds-splitcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-split .ds-ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
dialog.ds-split .ds-ahead strong { font-size: .95rem; }
dialog.ds-split .ds-ahead .muted { font-size: .78rem; }
dialog.ds-split .ds-splitcard table.grid { margin: 0; }
dialog.ds-split .ds-splitcard :is(th, td):first-child { padding-left: 14px; }
dialog.ds-split .ds-splitcard .split-foot { padding: 8px 14px; border-top: 1px solid var(--border); margin: 0; }
dialog.ds-split .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
dialog.ds-split .ds-xbar .btn { padding: 9px 16px; font-weight: 600; min-height: 38px; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
dialog.ds-split .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-split .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* (one box for Category › Subcategory and Tag › Sub-tag: .pick-one) */
.catpick-one .catpick-sub { display: none !important; }
.catpick-one .catpick-cat { min-width: 0; }
/* (Split across categories: a little wider, so the joined boxes fit) */
dialog.ds-split { width: min(1402px, calc(100vw - 32px)) !important; max-width: none; }
dialog.ds-split.no-chart { width: min(1152px, calc(100vw - 32px)) !important; }
#billSplitDialog.ds-split table.splits th:nth-child(1) { width: 390px; }
#billSplitDialog.ds-split table.splits th:nth-child(2) { width: 310px; }
#billSplitDialog.ds-split table.splits th:nth-child(3) { width: 250px; }
#billSplitDialog.ds-split table.splits th:nth-child(4) { width: 252px; }
#billSplitDialog.ds-split table.splits th:nth-child(5) { width: 130px; }

/* Bill: Split: income, expenses & transfers - Detail look, white background */
dialog.ds-mix .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-mix .pay-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px 10px; }
dialog.ds-mix .pay-sec > .btn { margin-top: 8px; }
dialog.ds-mix .pay-net { border-top: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-top: 10px; }
dialog.ds-mix .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
dialog.ds-mix .ds-xbar .btn { padding: 9px 16px; font-weight: 600; min-height: 38px; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
dialog.ds-mix .ds-xbar .btn.primary { border-color: var(--accent); }

/* Bill: Payslip - Detail look, white (the cards from ds-mix); a gap between the section cards */
dialog.ds-pay .pay-sec { margin-bottom: 10px; }

/* The Detail look: a white background on every Detail pop-up (the cards keep their outlines) */
dialog[class*="ds-"], dialog[class*="ds-"] form, dialog[class*="ds-"] .dlg-top, dialog[class*="ds-"] > .bill-splits { background: var(--surface) !important; }

/* The shared split: one Amount column, a Business account column when the account holds business transactions */
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(1) { width: 104px !important; }
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(2) { width: 27% !important; }
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(3) { width: 21% !important; }
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(4) { width: 17% !important; }
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(5) { width: auto !important; }
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(6) { width: 120px !important; }
dialog.mix-dialog table.splits.mix.mix-tag.sp-table th:nth-child(7) { width: 34px !important; }
dialog.mix-dialog.sp-nochart .sp-chart { display: none; }
dialog.mix-dialog .sp-table input[data-m="amt"] { text-align: right; font-variant-numeric: tabular-nums; }
dialog.mix-dialog .sp-table td > select[data-m="chart"] { width: 100%; min-width: 0; }
dialog.ds-split, dialog.mix-dialog.ds-mix { width: min(1402px, calc(100vw - 32px)) !important; }
dialog.mix-dialog.ds-mix.sp-nochart { width: min(1180px, calc(100vw - 32px)) !important; }

/* The register: a split's lines are kept in the form out of sight - they're changed in the split form */
#splitBox.sp-store { display: none !important; }

/* Split Transaction, categories only (the record pop-ups): no Line column, no Add a transfer */
dialog.mix-dialog.sp-nox table.sp-table th:nth-child(1), dialog.mix-dialog.sp-nox table.sp-table td:nth-child(1), dialog.mix-dialog.sp-nox [data-addx] { display: none !important; }

/* Bills & Deposits: Estimated everyday spending, Detail look */
dialog.ds-est { width: min(980px, 96vw); }
dialog.ds-est [hidden] { display: none !important; }
dialog.ds-est .est-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-est .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
dialog.ds-est .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-est .segmented { align-self: flex-start; margin: 0; }
dialog.ds-est .est-when, dialog.ds-est .form-grid { margin: 0; }
dialog.ds-est .est-side { border-left: 1px solid var(--border); padding: 12px 14px; }
dialog.ds-est .est-side > p { margin: 0 0 4px !important; }
dialog.ds-est .est-acct-list { max-height: 52vh; }
dialog.ds-est .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-est .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
dialog.ds-est .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-est .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 720px) { dialog.ds-est .est-side { border-top: 1px solid var(--border); } }
dialog.ds-est .inline-label { display: flex; align-items: center; gap: 8px; margin: 0; }
dialog.ds-est .inline-label > select { width: auto; }
dialog.ds-est #estSpendBox .table-wrap { max-height: 32vh !important; margin-top: 0 !important; }
dialog.ds-est #estSpendBox > p { margin: 0 !important; }
/* (Applies to: as tall as the cards beside it, its list filling it) */
dialog.ds-est .est-layout { align-items: stretch; }
dialog.ds-est .est-side { min-height: 0; }
dialog.ds-est .est-acct-list { flex: 1 1 0; min-height: 120px; max-height: none !important; }

/* Investments: Investment group, Detail look */
dialog.ds-grp { width: min(640px, calc(100vw - 32px)); }
dialog.ds-grp form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-grp .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-grp .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-grp .ds-grp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
dialog.ds-grp .field { display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
dialog.ds-grp .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; }
dialog.ds-grp .field > span:first-child::after { content: none !important; }
dialog.ds-grp .field > input { width: 100%; }
dialog.ds-grp .ds-grp-ticks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog.ds-grp .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin: 0; }
dialog.ds-grp .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-grp .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-grp .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-grp .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; margin-top: 3px; }
dialog.ds-grp .checklist { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
dialog.ds-grp .checklist label { display: flex; gap: 8px; align-items: center; margin: 0; padding: 2px 0; }
dialog.ds-grp .ds-grp-note { margin: 0; font-size: .8rem; }
dialog.ds-grp .form-error:empty { display: none; }
dialog.ds-grp .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-grp .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-grp .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-grp .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-grp .ds-xbar .btn.danger { color: #b42318; }
@media (max-width: 600px) { dialog.ds-grp .ds-grp-row, dialog.ds-grp .ds-grp-ticks { grid-template-columns: 1fr; } }
dialog.ds-grp .field > span:first-child { text-align: left !important; width: auto !important; }
dialog.ds-grp .field { align-items: stretch !important; } dialog.ds-grp .field > span:first-child { align-self: flex-start !important; }

/* Investments: Security (watch), Detail look */
dialog.ds-ws { width: min(680px, calc(100vw - 32px)); }
dialog.ds-ws form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-ws .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-ws .ds-tboxes.hidden { display: none; }
dialog.ds-ws .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-ws .ds-tbox:last-child { border-right: 0; }
dialog.ds-ws .ds-tbox .ds-k { font-weight: 400; }
dialog.ds-ws .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-ws .ds-sub { font-size: .75rem; }
dialog.ds-ws .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-ws .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-ws .ds-ws-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog.ds-ws .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-ws .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-ws .field > span:first-child::after { content: none !important; }
dialog.ds-ws .field > input, dialog.ds-ws .field > textarea { width: 100%; }
dialog.ds-ws .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin: 0; }
dialog.ds-ws .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-ws .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-ws .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-ws .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; margin-top: 3px; }
dialog.ds-ws #wsListTicks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
dialog.ds-ws .form-error:empty { display: none; }
dialog.ds-ws .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-ws .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-ws .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-ws .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 600px) { dialog.ds-ws .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-ws .ds-ws-row { grid-template-columns: 1fr; } }

/* Investments: New watch list, Detail look */
dialog.ds-wl { width: min(460px, calc(100vw - 32px)); }
dialog.ds-wl form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-wl .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
dialog.ds-wl .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-wl .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-wl .field > span:first-child::after { content: none !important; }
dialog.ds-wl .field > input { width: 100%; }
dialog.ds-wl .ds-wl-note { margin: 0; font-size: .8rem; }
dialog.ds-wl .form-error:empty { display: none; }
dialog.ds-wl .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-wl .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-wl .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-wl .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-wl .ds-xbar .btn.danger { color: #b42318; }

/* Investments: Trades, Detail look */
dialog.ds-trades { width: min(900px, calc(100vw - 32px)); }
dialog.ds-trades form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-trades .ds-tboxes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-trades .ds-tboxes:empty { display: none; }
dialog.ds-trades .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-trades .ds-tbox:last-child { border-right: 0; }
dialog.ds-trades .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-trades .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-trades .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; min-width: 0; }
dialog.ds-trades .ds-xcard .table-wrap { max-height: 52vh; overflow-y: auto; }
dialog.ds-trades .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-trades .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-trades .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-trades .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-trades .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Securities & prices: the Security pop-up, Detail look (and its Trades / Prices pop-ups) */
dialog.ds-sec { width: min(900px, calc(100vw - 32px)); }
dialog.ds-sec > form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-sec .ds-tboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-sec .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-sec .ds-tbox:last-child { border-right: 0; }
dialog.ds-sec .ds-tbox[title] { cursor: help; }
dialog.ds-sec .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-sec .ds-sub { font-size: .75rem; }
dialog.ds-sec .ds-say { margin: 6px 2px 0; font-size: .88rem; }
dialog.ds-sec .ds-more { cursor: help; text-decoration: underline dotted; }
dialog.ds-sec #sumBody .table-wrap { margin-top: 8px; }
dialog.ds-sec .ds-xcard, dialog.ds-sec-sub .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-sec .ds-k, dialog.ds-sec-sub .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-sec .ds-tbox .ds-k { font-weight: 400; font-size: .78rem; }
dialog.ds-sec .ds-sec-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
dialog.ds-sec .ds-sec-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-sec .ds-sec-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog.ds-sec .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-sec .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-sec .field > span:first-child::after { content: none !important; }
dialog.ds-sec .field > input, dialog.ds-sec .field > select, dialog.ds-sec .field > textarea, dialog.ds-sec .inline-pick { width: 100%; }
dialog.ds-sec .inline-pick { display: flex; gap: 6px; } dialog.ds-sec .inline-pick > input { flex: 1; min-width: 0; }
dialog.ds-sec .field .hint { font-size: .75rem; }
dialog.ds-sec .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin: 0; }
dialog.ds-sec .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-sec .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-sec .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-sec .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
dialog.ds-sec .form-error:empty, dialog.ds-sec-sub .form-error:empty { display: none; }
dialog.ds-sec .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-sec .ds-xbar, dialog.ds-sec-sub .ds-xbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
dialog.ds-sec .ds-xbar .btn, dialog.ds-sec-sub .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-sec .ds-xbar .btn.primary, dialog.ds-sec-sub .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-sec .ds-xbar .btn.danger { color: #b42318; }
dialog.ds-sec-sub { width: min(820px, calc(100vw - 32px)); padding: 0; background: var(--surface) !important; }
dialog#secPricesDialog { width: min(520px, calc(100vw - 32px)); }
dialog.ds-sec-sub .ds-sub-in { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-sec-sub .ds-sub-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-sec-sub .ds-sub-top h2 { margin: 0; font-size: 1.1rem; }
dialog.ds-sec-sub .ds-xcard { padding: 4px 8px; }
dialog.ds-sec-sub .ds-xcard.ds-price-add { padding: 10px 12px; gap: 6px; }
dialog.ds-sec-sub .price-add { margin: 0; }
dialog.ds-sec-sub .table-wrap { max-height: 55vh; overflow-y: auto; }
@media (max-width: 700px) { dialog.ds-sec .ds-sec-cols { grid-template-columns: 1fr; } }
dialog.ds-sec #tradesButton { gap: 0; }

/* Securities & prices: Check symbols, Detail look */
dialog.ds-chk { width: min(900px, calc(100vw - 32px)); }
dialog.ds-chk form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-chk .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-chk .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-chk .ds-tbox:last-child { border-right: 0; }
dialog.ds-chk .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-chk .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; }
dialog.ds-chk .ds-chk-intro { display: flex; gap: 16px; align-items: flex-start; }
dialog.ds-chk .ds-chk-intro p { margin: 0; flex: 1; font-size: .85rem; cursor: help; }
dialog.ds-chk .ds-chk-intro .check { margin: 0; white-space: nowrap; font-size: .88rem; }
dialog.ds-chk .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 0 4px; min-width: 0; overflow: hidden; }
dialog.ds-chk .ds-chk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
dialog.ds-chk .table-wrap { max-height: 26vh; overflow-y: auto; padding: 0 8px; }
dialog.ds-chk .form-error:empty { display: none; }
dialog.ds-chk .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-chk .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-chk .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-chk .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-chk .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-chk .ds-chk-intro { flex-direction: column; } }

/* Securities & prices: Merge, Detail look */
dialog.ds-merge { width: min(640px, calc(100vw - 32px)); }
dialog.ds-merge form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-merge .ds-merge-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
dialog.ds-merge .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
dialog.ds-merge .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
dialog.ds-merge .ds-merge-gone { color: #b42318; font-weight: 400; }
dialog.ds-merge .ds-merge-arrow { align-self: center; font-size: 1.4rem; color: var(--muted); }
dialog.ds-merge .ds-merge-sub { font-size: .8rem; }
dialog.ds-merge .field { margin: 0; display: block !important; }
dialog.ds-merge .field > select { width: 100%; }
dialog.ds-merge .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog.ds-merge .ds-merge-note { margin: 0; font-size: .85rem; }
dialog.ds-merge .form-error:empty { display: none; }
dialog.ds-merge .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-merge .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-merge .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-merge .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 600px) { dialog.ds-merge .ds-merge-row { grid-template-columns: 1fr; } dialog.ds-merge .ds-merge-arrow { transform: rotate(90deg); justify-self: center; } }

/* Register: Reconcile, Detail look */
dialog.ds-recon { width: min(900px, calc(100vw - 32px)); }
dialog.ds-recon form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-recon .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-recon .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; display: flex; flex-direction: column; margin: 0; }
dialog.ds-recon .ds-tbox:last-child { border-right: 0; }
dialog.ds-recon .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-recon .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-recon .ds-sub { font-size: .75rem; }
dialog.ds-recon .ds-tbox-in { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); cursor: text; }
dialog.ds-recon .ds-tbox-in input { margin-top: 4px; font-size: 1rem; font-weight: 600; width: 100%; }
dialog.ds-recon .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 0 4px; min-width: 0; overflow: hidden; }
dialog.ds-recon .ds-recon-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
dialog.ds-recon .rec-list { max-height: 48vh; overflow-y: auto; padding: 0 8px; }
dialog.ds-recon .form-error:empty { display: none; }
dialog.ds-recon .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-recon .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-recon .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-recon .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-recon .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* (Reconcile: the statement balance box white like the rest, its amount typed on an underline - not a box in a box) */
dialog.ds-recon .ds-tbox-in { background: var(--surface) !important; }
dialog.ds-recon .ds-tbox-in input { border: 0 !important; border-bottom: 2px solid var(--accent) !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important;
  padding: 0 0 2px !important; margin: 2px 0 0 !important; font-size: 1.05rem !important; font-weight: 700 !important; height: auto !important; outline: none; -moz-appearance: textfield; appearance: textfield; }
dialog.ds-recon .ds-tbox-in input::-webkit-outer-spin-button, dialog.ds-recon .ds-tbox-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
dialog.ds-recon .ds-tbox-in input::placeholder { font-weight: 400; font-size: .9rem; }
dialog.ds-recon .ds-tbox-in:focus-within { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--accent) 25%, transparent); }

/* (Reconcile: the list fills its card - no border of its own; the tick-all box in the heading) */
dialog.ds-recon .rec-list { border: 0 !important; border-radius: 0 !important; padding: 0 !important; margin: 0; }
dialog.ds-recon .rec-list table { margin: 0; }
dialog.ds-recon .rec-list th:first-child, dialog.ds-recon .rec-list td:first-child { padding-left: 14px; }
dialog.ds-recon .rec-list th:last-child, dialog.ds-recon .rec-list td:last-child { padding-right: 14px; }
dialog.ds-recon .rec-list thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog.ds-recon .ds-xcard { padding: 0 !important; }

/* Chart of accounts: Account, Detail look */
dialog.ds-coa { width: min(680px, calc(100vw - 32px)); }
dialog.ds-coa form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-coa .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-coa .ds-tboxes:empty { display: none; }
dialog.ds-coa .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-coa .ds-tbox:last-child { border-right: 0; }
dialog.ds-coa .ds-tbox .ds-k { font-weight: 400; font-size: .78rem; }
dialog.ds-coa .ds-tv { font-size: 1rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-coa .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-coa .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-coa .ds-coa-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog.ds-coa .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-coa .field.hidden { display: none !important; }
dialog.ds-coa .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-coa .field > span:first-child::after { content: none !important; }
dialog.ds-coa .field > input, dialog.ds-coa .field > select, dialog.ds-coa .field > .catpick { width: 100%; }
dialog.ds-coa .field .hint { font-size: .75rem; }
dialog.ds-coa .ds-coa-note { margin: 0; font-size: .8rem; }
dialog.ds-coa .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; margin: 0; background: var(--surface); }
dialog.ds-coa .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-coa .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-coa .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-coa .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
dialog.ds-coa .form-error:empty { display: none; }
dialog.ds-coa .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-coa .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-coa .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-coa .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-coa .ds-xbar .btn.danger { color: #b42318; }
@media (max-width: 600px) { dialog.ds-coa .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-coa .ds-coa-pair { grid-template-columns: 1fr; } }

/* Chart of accounts: What uses it, Detail look */
dialog.ds-uses { width: min(1000px, calc(100vw - 32px)); padding: 0; background: var(--surface) !important; }
dialog.ds-uses .ds-uses-in { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-uses .ds-uses-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-uses .ds-uses-top h2 { margin: 0; font-size: 1.1rem; }
dialog.ds-uses .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-uses .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-uses .ds-tbox:last-child { border-right: 0; }
dialog.ds-uses .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-uses .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; }
dialog.ds-uses .ds-sub { font-size: .75rem; }
dialog.ds-uses .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-width: 0; overflow: hidden; }
dialog.ds-uses .ds-uses-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
dialog.ds-uses .ds-uses-head .muted { font-size: .85rem; }
dialog.ds-uses .table-wrap { max-height: 52vh; overflow-y: auto; }
dialog.ds-uses table { margin: 0; }
dialog.ds-uses thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog.ds-uses th:first-child, dialog.ds-uses td:first-child { padding-left: 14px; }
dialog.ds-uses th:last-child, dialog.ds-uses td:last-child { padding-right: 14px; }
dialog.ds-uses .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-uses .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-uses .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-uses .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Business: Invoice, Detail look (from the property invoice) - details top left, actions down the right, lines, totals strip */
dialog.ds-binv { width: min(1200px, calc(100vw - 32px)); }
dialog.ds-binv > form { display: flex; flex-direction: column; gap: 12px; }
dialog.ds-binv .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-binv .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
dialog.ds-binv .ds-binv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 12px; align-items: start; }
dialog.ds-binv .ds-binv-main { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-binv .form-grid { display: grid; gap: 10px 12px; margin: 0; }
dialog.ds-binv .ds-binv-row { grid-template-columns: 140px 22px 140px minmax(0, 1fr) 130px; align-items: end; }
dialog.ds-binv .ds-binv-row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
dialog.ds-binv .ds-binv-arrow { padding-bottom: 4px; text-align: center; }
dialog.ds-binv .ds-binv-arrow .btn { padding: 2px 4px; }
dialog.ds-binv .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-binv .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-binv .field > span:first-child::after { content: none !important; }
dialog.ds-binv .field > :is(input, select, textarea), dialog.ds-binv .inline-pick { width: 100% !important; box-sizing: border-box; }
dialog.ds-binv .inline-pick { display: flex; gap: 6px; } dialog.ds-binv .inline-pick > select { flex: 1; min-width: 0; }
dialog.ds-binv .ds-binv-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; padding-top: 10px; border-top: 1px solid var(--surface-2); }
dialog.ds-binv .ds-binv-facts dl { margin: 0; } dialog.ds-binv .ds-binv-facts dt { font-size: .8rem; color: var(--muted); margin-bottom: 2px; } dialog.ds-binv .ds-binv-facts dd { margin: 0; font-size: .92rem; }
dialog.ds-binv .ds-binv-side { display: flex; flex-direction: column; gap: 8px; }
dialog.ds-binv .ds-binv-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
dialog.ds-binv .ds-binv-pair:not(:has(> .btn:not(.hidden))) { display: none; }
dialog.ds-binv .ds-binv-side .btn { width: 100%; padding: 10px 8px; justify-content: center; font-weight: 600; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); white-space: normal; line-height: 1.2; }
dialog.ds-binv .ds-binv-side .btn.primary { border-color: var(--accent); }
dialog.ds-binv .ds-binv-side .btn.danger { color: var(--negative); }
dialog.ds-binv .ds-binv-side .btn.ds-on { background: var(--accent-soft, #e3f3f1); border-color: var(--accent) !important; color: var(--accent-strong, #0b5f58); }
dialog.ds-binv .ds-binv-side .btn:disabled { opacity: .55; }
dialog.ds-binv .ds-binv-end { margin-top: 4px; }
dialog.ds-binv .ds-binv-lines { overflow: hidden; }
dialog.ds-binv .ds-binv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
dialog.ds-binv .ds-binv-lines .table-wrap { padding: 0; margin: 0; border: 0; max-height: 42vh; overflow-y: auto; }
dialog.ds-binv .ds-binv-lines table { margin: 0; width: 100%; }
dialog.ds-binv .ds-binv-lines :is(th, td):first-child { padding-left: 16px; } dialog.ds-binv .ds-binv-lines :is(th, td):last-child { padding-right: 12px; }
dialog.ds-binv .ds-binv-lines tfoot td { background: var(--surface-2); }
dialog.ds-binv .ds-tboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-binv .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-binv .ds-tbox:last-child { border-right: 0; }
dialog.ds-binv .ds-tbox .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-binv .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; }
dialog.ds-binv .form-error:empty { display: none; }
dialog.ds-binv-sub { width: min(560px, calc(100vw - 32px)); padding: 0; background: var(--surface) !important; }
dialog#invPayDialog { width: min(820px, calc(100vw - 32px)); }
dialog.ds-binv-sub .ds-sub-in { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-binv-sub .ds-sub-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-binv-sub .ds-sub-top h2 { margin: 0; font-size: 1.1rem; }
dialog.ds-binv-sub .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-binv-sub .table-wrap { max-height: 50vh; overflow-y: auto; }
dialog.ds-binv-sub table { margin: 0; }
dialog.ds-binv-sub :is(th, td):first-child { padding-left: 14px; }
dialog.ds-binv-sub .panel-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0 0; background: none; border: 0; }
dialog.ds-binv-sub .panel-foot .muted { font-size: .8rem; }
dialog.ds-binv-sub .field { display: flex !important; flex-direction: column; gap: 4px; margin: 0; }
dialog.ds-binv-sub .field > span:first-child { font-size: .8rem; color: var(--muted); }
dialog.ds-binv-sub .field > span:first-child::after { content: none !important; }
dialog.ds-binv-sub .ds-binv-rep { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
dialog.ds-binv-sub .ds-binv-rep.hidden { display: none; }
dialog.ds-binv-sub .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin: 0; }
dialog.ds-binv-sub .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-binv-sub .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-binv-sub .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-binv-sub .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
dialog.ds-binv-sub .ds-binv-note { margin: 0; font-size: .8rem; }
dialog.ds-binv-sub .ds-xbar { display: flex; gap: 8px; align-items: center; }
dialog.ds-binv-sub .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-binv-sub .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 900px) { dialog.ds-binv .ds-binv-layout { grid-template-columns: 1fr; } dialog.ds-binv .ds-binv-row { grid-template-columns: 1fr 22px 1fr; } }
/* (Business invoice: the top line - Date → Due, Customer, Number - and Business / Their reference: their own grid, whatever the general form-grid says) */
dialog.ds-binv .form-grid.ds-binv-row { display: grid !important; grid-template-columns: 140px 24px 140px minmax(0, 1fr) 130px !important; grid-auto-flow: row !important; align-items: end; }
dialog.ds-binv .form-grid.ds-binv-row2 { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; grid-auto-flow: row !important; }
dialog.ds-binv .form-grid > * { grid-column: auto !important; grid-row: auto !important; }
@media (max-width: 900px) { dialog.ds-binv .form-grid.ds-binv-row { grid-template-columns: 1fr 24px 1fr !important; } }
dialog.ds-binv .form-grid > * { order: 0 !important; }

/* (Business invoice: the property invoice's height - the lines fill it; Delete / Close / Save three across; Status and Repeats right of Notes) */
dialog.ds-binv[open] { min-height: min(800px, calc(100vh - 32px)); display: flex; flex-direction: column; }
dialog.ds-binv > form { flex: 1; }
dialog.ds-binv .ds-binv-lines { flex: 1; display: flex; flex-direction: column; }
dialog.ds-binv .ds-binv-lines .table-wrap { flex: 1; max-height: none; }
dialog.ds-binv .ds-binv-top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
dialog.ds-binv .ds-binv-top:has(#deleteInvoice.hidden) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog.ds-binv .ds-binv-notesrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 22px; align-items: end; }
dialog.ds-binv .ds-binv-notesrow .ds-binv-facts { display: flex; gap: 22px; border-top: 0; padding: 0 0 6px; }
dialog.ds-binv .ds-binv-notesrow .ds-binv-facts dl { min-width: 70px; }
@media (max-width: 700px) { dialog.ds-binv .ds-binv-notesrow { grid-template-columns: 1fr; } }
/* (Business invoice: Subtotal / GST / Total at the bottom of the Lines card - an empty row between takes up the room) */
dialog.ds-binv .ds-binv-lines .table-wrap { display: flex; flex-direction: column; }
dialog.ds-binv .ds-binv-lines table { flex: 1; height: 100%; }
dialog.ds-binv .ds-binv-lines #lineRows tr, dialog.ds-binv .ds-binv-lines thead tr, dialog.ds-binv .ds-binv-lines tfoot tr { height: 1px; }
dialog.ds-binv .ds-binv-fill tr { height: auto; }
dialog.ds-binv .ds-binv-fill td { border: 0; padding: 0; background: none; }
dialog.ds-binv .ds-binv-fill tr { height: 100% !important; }
/* (Business invoice: the lines scroll above; Subtotal / GST / Total pinned to the bottom of the Lines card) */
dialog.ds-binv .ds-binv-lines .table-wrap { display: block; flex: 1 1 0; min-height: 60px; overflow-y: auto; }
dialog.ds-binv .ds-binv-lines .table-wrap > table { height: auto; flex: none; }
dialog.ds-binv table.ds-binv-foot { width: 100%; margin: 0; border-top: 1px solid var(--border); background: var(--surface-2); }
dialog.ds-binv table.ds-binv-foot td { background: var(--surface-2); padding-top: 4px; padding-bottom: 4px; font-weight: 700; }
dialog.ds-binv table.ds-binv-foot td:first-child { padding-left: 16px; }
dialog.ds-binv table.ds-binv-foot td.num { width: 120px; text-align: right; }
dialog.ds-binv table.ds-binv-foot td.ds-binv-x { width: 36px; padding-right: 12px; }
dialog.ds-binv .ds-binv-lines table.ds-binv-foot { flex: none !important; height: auto !important; } dialog.ds-binv table.ds-binv-foot tr { height: auto !important; }
dialog.ds-binv table.inv-edit > tbody > tr > td { background: var(--surface) !important; }   /* (white lines, a line between - as the property invoice) */

/* (Business invoice: the lock note, as the property invoice's) */
dialog.ds-binv .inv-lock-note { font-size: .85rem; color: #8a5a00; background: #fff7e6; border: 1px solid #f3d9a4; border-radius: 8px; padding: 6px 10px; }
dialog.ds-binv .inv-lock-note.hidden { display: none; }
dialog.ds-binv > form > .inv-lock-note { margin: 0; font-size: .9rem; padding: 8px 12px; }
/* (Business invoice: read-only lines - locked, void or view-only - as plain text, not boxes) */
dialog.ds-binv #lineRows :is(input, textarea, select):disabled { border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--text) !important;
  -webkit-appearance: none; -moz-appearance: none; appearance: none; padding-left: 0; padding-right: 0; opacity: 1; cursor: default; resize: none; }
dialog.ds-binv #lineRows input[type="number"]:disabled::-webkit-inner-spin-button, dialog.ds-binv #lineRows input[type="number"]:disabled::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
dialog.ds-binv #lineRows td.num :is(input):disabled { text-align: right; }
/* (Business invoice: a read-only price as money - $52.53) */
dialog.ds-binv #lineRows td.ds-price:has(input:disabled) { white-space: nowrap; }
dialog.ds-binv #lineRows td.ds-price:has(input:disabled)::before { content: '$'; }
dialog.ds-binv #lineRows td.ds-price input:disabled { field-sizing: content; width: auto !important; min-width: 0; }

/* Business: Customer, Detail look */
dialog.ds-cust { width: min(720px, calc(100vw - 32px)); }
dialog.ds-cust form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-cust .ds-tboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-cust .ds-tboxes:empty { display: none; }
dialog.ds-cust .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-cust .ds-tbox:last-child { border-right: 0; }
dialog.ds-cust .ds-tbox .ds-k { font-weight: 400; font-size: .78rem; }
dialog.ds-cust .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; }
dialog.ds-cust .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-cust .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-cust .ds-cust-row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
dialog.ds-cust .ds-cust-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
dialog.ds-cust .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-cust .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-cust .field > span:first-child::after { content: none !important; }
dialog.ds-cust .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-cust .ds-cust-hint { font-size: .75rem; }
dialog.ds-cust .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; margin: 0; background: var(--surface); }
dialog.ds-cust .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-cust .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-cust .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-cust .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
dialog.ds-cust .form-error:empty { display: none; }
dialog.ds-cust .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-cust .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-cust .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-cust .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-cust .ds-xbar .btn.danger { color: #b42318; }
@media (max-width: 640px) { dialog.ds-cust .ds-cust-row2, dialog.ds-cust .ds-cust-row3 { grid-template-columns: 1fr; } }

/* Business: Email the invoice, Detail look */
dialog.ds-mail { width: min(640px, calc(100vw - 32px)); }
dialog.ds-mail form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-mail .ds-tboxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-mail .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-mail .ds-tbox:last-child { border-right: 0; }
dialog.ds-mail .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-mail .ds-tv { font-size: 1rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-mail .ds-mail-warn { font-size: .88rem; color: #7a4d00; background: #fff7e6; border: 1px solid #f3d19e; border-radius: 8px; padding: 8px 12px; }
dialog.ds-mail .ds-mail-warn.hidden { display: none; }
dialog.ds-mail .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-mail .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-mail .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-mail .field > span:first-child::after { content: none !important; }
dialog.ds-mail .field > :is(input, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-mail .ds-mail-note { margin: 0; font-size: .82rem; }
dialog.ds-mail .form-error:empty { display: none; }
dialog.ds-mail .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-mail .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-mail .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-mail .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 600px) { dialog.ds-mail .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Supplier bill, Detail look - the business invoice's (ds-binv), plus its kind */
dialog.ds-sbill .ds-sbill-kind { display: flex; align-items: center; gap: 10px; }
dialog.ds-sbill .ds-sbill-kind .segmented { margin: 0; }
dialog.ds-sbill table.ds-binv-foot td.num { width: 110px; }
dialog.ds-sbill .ds-binv-top:has(#deleteBill.hidden) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog.ds-sbill #lineRows td.ds-price:has(input:disabled)::before { content: '$'; }
dialog.ds-sbill #lineRows td.ds-price:has(input:disabled) { white-space: nowrap; }
dialog.ds-sbill #lineRows td.ds-price input:disabled { field-sizing: content; width: auto !important; min-width: 0; }
dialog.ds-binv #lineRows button[data-remove]:disabled { visibility: hidden; }   /* (read-only: no ✕ to take a line off) */

/* Business invoice / supplier bill: Documents pop-up in the property invoice's card style - a white rounded card,
   plain heading with Add… on the right (no teal edge or fold) */
dialog.ds-binv-sub .docs-box { min-height: 160px; display: flex; flex-direction: column; margin: 0; background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
dialog.ds-binv-sub .docs-box > .docs-head { cursor: default; padding: 10px 16px; margin: 0; background: var(--surface) !important; background-image: none !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
dialog.ds-binv-sub .docs-box > .docs-head > strong:first-child { font-size: 1rem; }
dialog.ds-binv-sub .docs-box > .docs-head > strong:first-child::before { content: none; }
dialog.ds-binv-sub .docs-box > .docs-head .btn { padding: 5px 12px; font-weight: 600; border: 1px solid #b9c1cc; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
dialog.ds-binv-sub .docs-box.collapsed > :not(.docs-head) { display: revert; }
dialog.ds-binv-sub .docs-box > .muted, dialog.ds-binv-sub .docs-box > p, dialog.ds-binv-sub .docs-box > .empty { padding: 12px 16px !important; }
dialog.ds-binv-sub .docs-box ul.docs { padding: 6px 16px 8px; margin: 0; }
dialog.ds-binv-sub .docs-box ul.docs > li { padding: 6px 0; border-bottom: 1px solid var(--border); }
dialog.ds-binv-sub .docs-box ul.docs > li:last-child { border-bottom: 0; }

/* Business: Supplier, Detail look */
dialog.ds-sup { width: min(720px, calc(100vw - 32px)); }
dialog.ds-sup form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-sup .ds-tboxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-sup .ds-tboxes:empty { display: none; }
dialog.ds-sup .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-sup .ds-tbox:last-child { border-right: 0; }
dialog.ds-sup .ds-tbox .ds-k { font-weight: 400; font-size: .78rem; }
dialog.ds-sup .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; }
dialog.ds-sup .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-sup .ds-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-sup .ds-sup-row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
dialog.ds-sup .ds-sup-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
dialog.ds-sup .field { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 4px; margin: 0; }
dialog.ds-sup .field > span:first-child { font-size: .8rem; color: var(--muted); font-weight: 400; text-align: left !important; width: auto !important; align-self: flex-start !important; }
dialog.ds-sup .field > span:first-child::after { content: none !important; }
dialog.ds-sup .field > :is(input, select, textarea) { width: 100% !important; box-sizing: border-box; }
dialog.ds-sup .ds-tcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; margin: 0; background: var(--surface); }
dialog.ds-sup .ds-tcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
dialog.ds-sup .ds-tcard input { margin-top: 3px; flex: none; }
dialog.ds-sup .ds-tcard b { display: block; font-weight: 600; }
dialog.ds-sup .ds-tcard small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
dialog.ds-sup .form-error:empty { display: none; }
dialog.ds-sup .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-sup .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-sup .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-sup .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-sup .ds-xbar .btn.danger { color: #b42318; }
@media (max-width: 640px) { dialog.ds-sup .ds-sup-row2, dialog.ds-sup .ds-sup-row3 { grid-template-columns: 1fr; } }

/* Business P&L: What makes this (a figure's lines), Detail look - boxes on top, one white card with the lines (Total pinned at the bottom), Close along the bottom */
dialog.ds-pld { width: min(980px, calc(100vw - 32px)); }
dialog.ds-pld form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-pld .ds-tboxes { display: grid; grid-template-columns: 1.3fr .6fr 1.2fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-pld .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-pld .ds-tbox:last-child { border-right: 0; }
dialog.ds-pld .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-pld .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-pld .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-pld .table-wrap { max-height: 55vh; overflow-y: auto; border: 0; margin: 0; }
dialog.ds-pld table { margin: 0; }
dialog.ds-pld :is(th, td):first-child { padding-left: 14px; }
dialog.ds-pld :is(th, td):last-child { padding-right: 14px; }
dialog.ds-pld tbody > tr > td { background: var(--surface) !important; }
dialog.ds-pld thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
dialog.ds-pld tfoot td { position: sticky; bottom: 0; background: var(--surface) !important; border-top: 2px solid var(--border); }
dialog.ds-pld .ds-pld-note { margin: 0; font-size: .8rem; }
dialog.ds-pld .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-pld .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-pld .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid var(--accent); }
@media (max-width: 640px) { dialog.ds-pld .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Xero: Item, Detail look - boxes on top (in place of the grey line), In Xero and Match it to as white cards, buttons along the bottom */
dialog.ds-item { background: var(--surface) !important; }
dialog.ds-item #itemSub { display: none; }
dialog.ds-item .ds-tboxes { display: grid; grid-template-columns: repeat(3, minmax(0, .8fr)) minmax(0, 1.6fr); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; flex: none; }
dialog.ds-item .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-item .ds-tbox:last-child { border-right: 0; }
dialog.ds-item .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-item .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-item .ds-tv .badge { font-size: .85rem; }
dialog.ds-item .ds-item-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-item .item-cols > section, dialog.ds-item .item-right > section, dialog.ds-item .item-cols > #itemMatchBox, dialog.ds-item .item-cols > #itemBankBox { background: var(--surface) !important; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
dialog.ds-item .item-cols h3 { font-size: .8rem; color: var(--muted); font-weight: 600; }
dialog.ds-item .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-item .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex: none; }
dialog.ds-item .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-item .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-item .ds-xbar .btn.hidden { display: none; }
@media (max-width: 700px) { dialog.ds-item .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Xero: Sync history, Detail look */
dialog.ds-hist { width: min(980px, calc(100vw - 32px)); background: var(--surface) !important; padding: 16px 20px; }
dialog.ds-hist[open] { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-hist .ds-hist-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-hist .ds-hist-top h2 { margin: 0; }
dialog.ds-hist #historyTitle:empty { display: none; }
dialog.ds-hist .ds-tboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-hist .ds-tboxes:empty { display: none; }
dialog.ds-hist .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-hist .ds-tbox:last-child { border-right: 0; }
dialog.ds-hist .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-hist .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-hist .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-height: 0; }
dialog.ds-hist .table-wrap { max-height: 55vh; overflow-y: auto; border: 0; margin: 0; }
dialog.ds-hist table { margin: 0; }
dialog.ds-hist :is(th, td):first-child { padding-left: 14px; }
dialog.ds-hist :is(th, td):last-child { padding-right: 14px; }
dialog.ds-hist tbody > tr > td { background: var(--surface) !important; }
dialog.ds-hist thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
dialog.ds-hist .ds-hist-note { margin: 0; font-size: .8rem; }
dialog.ds-hist .dlg-tools { display: none !important; }
dialog.ds-hist .ds-xbar { display: flex; gap: 8px; align-items: center; margin: 0; }
dialog.ds-hist .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid var(--accent); }
@media (max-width: 640px) { dialog.ds-hist .ds-tboxes { grid-template-columns: 1fr; } dialog.ds-hist .ds-tbox { border-right: 0; border-bottom: 1px solid var(--border); } }

/* Xero: Transaction (read-only), Detail look */
dialog.ds-txv { width: min(760px, calc(100vw - 32px)); background: var(--surface) !important; padding: 16px 20px; }
dialog.ds-txv[open] { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-txv .ds-hist-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-txv .ds-hist-top h2 { margin: 0; }
dialog.ds-txv #txViewBody { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-txv .ds-tboxes { display: grid; grid-template-columns: .8fr .8fr 1.4fr .8fr; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-txv .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-txv .ds-tbox:last-child { border-right: 0; }
dialog.ds-txv .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-txv .ds-tv { font-size: 1.02rem; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; }
dialog.ds-txv .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
dialog.ds-txv .ds-txv-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
dialog.ds-txv .ds-f { padding: 4px 0 8px; }
dialog.ds-txv .ds-f > div:last-child { overflow-wrap: anywhere; }
dialog.ds-txv .ds-txv-split { padding: 0; overflow: hidden; }
dialog.ds-txv .ds-txv-h { font-weight: 600; padding: 10px 14px 4px; }
dialog.ds-txv .ds-txv-split table { margin: 0; }
dialog.ds-txv .ds-txv-split :is(th, td):first-child { padding-left: 14px; }
dialog.ds-txv .ds-txv-split :is(th, td):last-child { padding-right: 14px; }
dialog.ds-txv .ds-txv-split tbody > tr > td { background: var(--surface) !important; }
dialog.ds-txv .dlg-tools { display: none !important; }
dialog.ds-txv .ds-xbar { display: flex; gap: 8px; align-items: center; margin: 0; }
dialog.ds-txv .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-txv .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-txv .ds-xbar .btn.hidden { display: none; }
@media (max-width: 640px) { dialog.ds-txv .ds-tboxes, dialog.ds-txv .ds-txv-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Xero: Record, Detail look - Organisation / Downloaded / Changed boxes, Xero's data in a white card, Documents… and Close along the bottom */
dialog.ds-xrec { width: min(900px, calc(100vw - 32px)); background: var(--surface) !important; padding: 16px 20px; }
dialog.ds-xrec[open] { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-xrec .ds-hist-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-xrec .ds-hist-top h2 { margin: 0; }
dialog.ds-xrec > .ds-tboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-xrec > .ds-tboxes .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-xrec > .ds-tboxes .ds-tbox:last-child { border-right: 0; }
dialog.ds-xrec > .ds-tboxes .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-xrec > .ds-tboxes .ds-tv { font-size: 1.02rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-xrec > .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-height: 0; }
dialog.ds-xrec .xero-json { margin: 0; max-height: 55vh; overflow: auto; background: var(--surface) !important; border: 0 !important; padding: 12px 16px; }
dialog.ds-xrec .dlg-tools { display: none !important; }
dialog.ds-xrec > .ds-xbar { display: flex; gap: 8px; align-items: center; margin: 0; }
dialog.ds-xrec > .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-xrec > .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 640px) { dialog.ds-xrec > .ds-tboxes { grid-template-columns: 1fr; } dialog.ds-xrec > .ds-tboxes .ds-tbox { border-right: 0; border-bottom: 1px solid var(--border); } }

/* Tenant: the details in two even columns, every label the same width, so the fields line up (Address under Contact person) */
#tenantDialog.ds-tenant .ds-trow-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; }
#tenantDialog.ds-tenant .ds-tcard .field { display: grid !important; grid-template-columns: 130px minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 2px; }
#tenantDialog.ds-tenant .ds-tcard .field > span:first-child { grid-column: 1; width: auto !important; text-align: left !important; }
#tenantDialog.ds-tenant .ds-tcard .field > :is(input, select, textarea) { grid-column: 2; width: 100% !important; box-sizing: border-box; }
#tenantDialog.ds-tenant .ds-tcard .field > .hint { grid-column: 2; margin: 0; }
#tenantDialog.ds-tenant .ds-trow-notes > .field { flex: 1 1 420px; }
@media (max-width: 700px) { #tenantDialog.ds-tenant .ds-trow-2 { grid-template-columns: 1fr; } }

/* Link a bank deposit: Show more (the next 100) and the count, bottom left */
dialog.dep-pick .dep-bar { display: flex; gap: 8px; align-items: center; }
dialog.dep-pick .dep-bar .dep-count { font-size: .82rem; }
dialog.dep-pick .dep-bar .btn.hidden { display: none; }

/* A property bill reminder's Edit this Occurrence / Record Expense: Date → Due on one row */
.ds-date-due { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ds-date-due > input[type="date"] { flex: 1 1 0; min-width: 0; width: auto !important; }
.ds-date-due > .btn { flex: none; padding: 2px 8px; }
.ds-date-due > .ds-due-lab { flex: none; font-size: .8rem; color: var(--muted); }

/* Tenant Monthly Opex: what's on the invoice - Opex / Recharges ticks, under the total */
.ds-parts { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; margin-top: 6px; }
.ds-parts.hidden { display: none; }
.ds-parts > .ds-k { font-size: .8rem; color: var(--muted); }
.ds-parts > .check { margin: 0; }

/* Tenant invoice reminders: Recharges from (all vendors, or ticked ones) and the blank-invoice tick */
.ds-rvend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.ds-rvend.hidden, .ds-blank.hidden { display: none !important; }
.ds-rvend > .ds-k { font-size: .8rem; color: var(--muted); }
.ds-rvend > .check, .ds-blank { margin: 0; }
.ds-rvlist { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 16px; max-height: 120px; overflow-y: auto; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.ds-rvlist.hidden { display: none; }
.ds-rvlist > .check { margin: 0; }
.ds-blank { display: flex; align-items: center; gap: 6px; margin-top: 6px; }

/* Tenant invoice reminders: On the invoice / Recharges from / blank-invoice - each a row of its own, the label lined up */
.ds-xrow.hidden { display: none !important; }
.ds-xrow > div { min-width: 0; flex: 1; }
.ds-xrow .ds-parts, .ds-xrow .ds-rvend { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 18px; }
.ds-xrow .ds-blank { margin: 0; display: flex; align-items: center; gap: 6px; white-space: normal; }
.ds-xrow .check { margin: 0; white-space: nowrap; }
dialog.ds-sched .ds-invtenant > .ds-xrow { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 8px; margin: 0; }
dialog.ds-sched .ds-invtenant > .ds-xrow > span:first-child { width: 96px; flex: 0 0 96px; }

/* Account register: Suggested categories (AI), Detail look */
dialog.ds-aicat { width: min(1000px, calc(100vw - 32px)); }
dialog.ds-aicat form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-aicat .ds-tboxes { display: grid; grid-template-columns: .7fr .7fr 1.6fr .7fr; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-aicat .ds-tboxes:empty { display: none; }
dialog.ds-aicat .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-aicat .ds-tbox:last-child { border-right: 0; }
dialog.ds-aicat .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-aicat .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-aicat .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-aicat .table-wrap { max-height: 55vh; overflow-y: auto; border: 0; margin: 0; }
dialog.ds-aicat table { margin: 0; }
dialog.ds-aicat :is(th, td):first-child { padding-left: 14px; }
dialog.ds-aicat :is(th, td):last-child { padding-right: 14px; }
dialog.ds-aicat tbody > tr > td { background: var(--surface) !important; }
dialog.ds-aicat thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
dialog.ds-aicat .ds-aicat-note { margin: 0; font-size: .82rem; }
dialog.ds-aicat .form-error:empty { display: none; }
dialog.ds-aicat .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-aicat .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-aicat .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-aicat .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-aicat .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Account register: Pay invoices with this deposit, Detail look */
dialog.ds-payinv { width: min(1000px, calc(100vw - 32px)); background: var(--surface) !important; }
dialog.ds-payinv form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-payinv .ds-pi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-payinv .ds-pi-top h2 { margin: 0; }
dialog.ds-payinv .ds-tboxes { display: grid; grid-template-columns: 1.2fr .9fr 1.1fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-payinv .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-payinv .ds-tbox:last-child { border-right: 0; }
dialog.ds-payinv .ds-k { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-payinv .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-payinv .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; padding: 0; }
dialog.ds-payinv .pay-inv-tools { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); margin: 0; }
dialog.ds-payinv .pay-inv-tools input[type=search] { flex: 1; min-width: 0; }
dialog.ds-payinv .pay-inv-tools .check { margin: 0; white-space: nowrap; }
dialog.ds-payinv .pay-inv-list { max-height: 50vh; overflow-y: auto; border: 0; margin: 0; }
dialog.ds-payinv .pay-inv-list table { margin: 0; }
dialog.ds-payinv .pay-inv-list :is(th, td):first-child { padding-left: 14px; }
dialog.ds-payinv .pay-inv-list :is(th, td):last-child { padding-right: 14px; }
dialog.ds-payinv .pay-inv-list thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
dialog.ds-payinv .pay-inv-list tbody > tr > td { background: var(--surface) !important; }
dialog.ds-payinv .pay-inv-list tbody > tr.picked > td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)) !important; }
dialog.ds-payinv .pay-inv-right > p { padding: 12px 16px; margin: 0; }
dialog.ds-payinv .pay-inv-note { margin: 0; font-size: .82rem; }
dialog.ds-payinv .form-error:empty { display: none; }
dialog.ds-payinv .dlg-tools { display: none !important; }
dialog.ds-payinv .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-payinv .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-payinv .ds-xbar .btn.primary { border-color: var(--accent); }
@media (max-width: 700px) { dialog.ds-payinv .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Account register: Invoices paid by this, Detail look */
dialog.ds-invpaid { width: min(880px, calc(100vw - 32px)); background: var(--surface) !important; }
dialog.ds-invpaid form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-invpaid .ds-ip-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-invpaid .ds-ip-top h2 { margin: 0; }
dialog.ds-invpaid .ds-tboxes { display: grid; grid-template-columns: 1.3fr .7fr 1fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-invpaid .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-invpaid .ds-tbox:last-child { border-right: 0; }
dialog.ds-invpaid .ds-k { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-invpaid .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-invpaid .ds-xcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
dialog.ds-invpaid .table-wrap { max-height: 55vh; overflow-y: auto; border: 0 !important; margin: 0; border-radius: 0 !important; }
dialog.ds-invpaid table { margin: 0; }
dialog.ds-invpaid :is(th, td):first-child { padding-left: 14px; }
dialog.ds-invpaid :is(th, td):last-child { padding-right: 14px; }
dialog.ds-invpaid tbody > tr > td, dialog.ds-invpaid tfoot td { background: var(--surface) !important; }
dialog.ds-invpaid thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
dialog.ds-invpaid .dlg-tools { display: none !important; }
dialog.ds-invpaid .ds-xbar { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
dialog.ds-invpaid .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid var(--accent); }
@media (max-width: 700px) { dialog.ds-invpaid .ds-tboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Businesses: the list as a table */
.biz-table { padding: 0; overflow: hidden; }
.biz-table .table-wrap { border: 0; margin: 0; }
.biz-table table { margin: 0; }
.biz-table :is(th, td):first-child { padding-left: 14px; }
.biz-table :is(th, td):last-child { padding-right: 14px; }
.biz-table .biz-links-cell { text-align: right; }
.biz-table .biz-links-cell .btn + .btn { margin-left: 4px; }

/* Lease (Detail look): room for the dates - a wider pop-up, the date boxes never squeezed below a full date */
dialog.ds-lease { width: min(1120px, calc(100vw - 32px)); }
dialog.ds-lease input[type="date"] { min-width: 132px; }

/* Rent reviews: the Change the rent pop-up, and a lease's rent catch-up under its reviews */
dialog.ds-rr { width: min(560px, calc(100vw - 32px)); background: var(--surface) !important; }
dialog.ds-rr form { display: flex; flex-direction: column; gap: 10px; }
dialog.ds-rr .ds-rr-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
dialog.ds-rr .ds-rr-top h2 { margin: 0; }
dialog.ds-rr .ds-tboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-rr .ds-tbox { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-rr .ds-tbox:last-child { border-right: 0; }
dialog.ds-rr .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-rr .ds-tv { font-size: 1.05rem; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-rr .field { margin: 0; max-width: 220px; }
dialog.ds-rr p { margin: 0; font-size: .85rem; }
dialog.ds-rr .ds-xbar { display: flex; gap: 8px; align-items: center; }
.rent-cu-note { margin: 8px 12px 10px; padding: 8px 10px; border: 1px solid #f3d19e; background: #fff7e6; border-radius: 8px; font-size: .9rem; }
.rent-cu-note.hidden { display: none; }

/* Lease reviews, renewals and reminders: Edit and ✕ on each row, done ones greyed; the entry's pop-up */
#eventRows td.ev-btns { width: 1%; white-space: nowrap; text-align: right; }
#eventRows td.ev-btns .btn + .btn { margin-left: 2px; }
#eventRows tr.ev-done > td:not(.ev-btns) { color: var(--muted); }
#eventRows tr.ev-row { cursor: default; }
dialog.ds-evedit .ds-evgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; align-items: end; }
dialog.ds-evedit .ds-evgrid .field { margin: 0; max-width: none; }
dialog.ds-evedit .ds-evgrid .field.wide { grid-column: 1 / -1; }
dialog.ds-evedit .ds-evdone { margin: 0 0 8px; }
dialog.ds-evedit .ds-evrent { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
dialog.ds-evedit .ds-evrent.hidden { display: none; }
dialog.ds-evedit .ds-evrent .field { max-width: 220px; }
dialog.ds-evedit .form-error:empty { display: none; }

/* Lease (Detail look): the dates down the left, the rent and money on the right */
dialog.ds-lease .ds-lsplit { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
dialog.ds-lease .ds-lcol { display: flex; flex-direction: column; gap: 12px; }
dialog.ds-lease .ds-lcol .field { margin: 0; }
@media (max-width: 760px) { dialog.ds-lease .ds-lsplit { grid-template-columns: 1fr; } }

/* Lease (Detail look): the dates and money in two lines of narrower fields; Terms and Notes labels at the bottom left */
dialog.ds-lease .ds-lr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 28px; align-items: center; }
dialog.ds-lease .ds-lhalf { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-width: 0; }
dialog.ds-lease .ds-lhalf > .field { display: flex !important; align-items: center; gap: 8px; margin: 0; flex: 0 0 auto; }
dialog.ds-lease .ds-lhalf > .field > span:first-child { width: auto !important; max-width: 92px; white-space: normal; line-height: 1.2; }
dialog.ds-lease .ds-lhalf > .field > :is(input, select) { flex: 0 0 auto; }
dialog.ds-lease .ds-lhalf input[type="date"] { width: 138px !important; min-width: 0; }
dialog.ds-lease .ds-lhalf :is([name="rentAnnual"], [name="outgoingsAnnual"]) { width: 112px !important; }
dialog.ds-lease .ds-lhalf [name="rentFrequency"] { width: 116px !important; }
dialog.ds-lease .ds-lhalf [name="bond"] { width: 96px !important; }
dialog.ds-lease .ds-lhalf [name="rightsOfRenewal"] { width: 130px !important; }
dialog.ds-lease .ds-ltext > .field { align-items: end !important; }
dialog.ds-lease .ds-ltext > .field > span:first-child { align-self: end; padding-bottom: 4px; }
@media (max-width: 900px) { dialog.ds-lease .ds-lr { grid-template-columns: 1fr; } }
dialog.ds-lease .ds-lhalf > .field { flex-direction: row !important; justify-content: flex-start; text-align: left; }
dialog.ds-lease .ds-lhalf > .field > span:first-child { text-align: left !important; margin: 0; }
/* (the two lines' fields line up: fixed label widths, one line each half; the dates half as wide as it needs) */
dialog.ds-lease { width: min(1180px, calc(100vw - 32px)); }
dialog.ds-lease .ds-lr { grid-template-columns: max-content minmax(0, 1fr); gap: 12px 24px; }
dialog.ds-lease .ds-lhalf { flex-wrap: nowrap; gap: 12px; }
dialog.ds-lease .ds-lhalf > .field > span:first-child { flex: 0 0 auto; }
dialog.ds-lease .ds-lhalf:first-child > .field > span:first-child { width: 84px !important; max-width: none; }
dialog.ds-lease .ds-lhalf input[type="date"] { width: 132px !important; }
dialog.ds-lease .ds-lhalf:last-child > .field:nth-child(1) > span:first-child { width: 80px !important; max-width: none; }
dialog.ds-lease .ds-lhalf:last-child > .field:nth-child(2) > span:first-child { width: 36px !important; max-width: none; }
dialog.ds-lease .ds-lhalf:last-child > .field:nth-child(3) > span:first-child { width: 66px !important; max-width: none; }
dialog.ds-lease .ds-lhalf [name="bond"] { width: 116px !important; }
dialog.ds-lease .ds-lhalf [name="rightsOfRenewal"] { width: 120px !important; }
@media (max-width: 1100px) { dialog.ds-lease .ds-lr { grid-template-columns: 1fr; } dialog.ds-lease .ds-lhalf { flex-wrap: wrap; } }

/* Lease (Detail look): the two lines on the Name / Space grid - the same halves, the first label the same width */
dialog.ds-lease .ds-lr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 12px 14px !important; }
dialog.ds-lease .ds-lhalf > .field > span:first-child { width: 36px !important; }
dialog.ds-lease .ds-lhalf > .field:first-child > span:first-child { width: 118px !important; }
dialog.ds-lease .ds-lhalf:first-child > .field:nth-child(2) > span:first-child { width: 84px !important; }
dialog.ds-lease .ds-lhalf:last-child > .field:nth-child(3) > span:first-child { width: 56px !important; }
dialog.ds-lease .ds-lhalf :is([name="rentAnnual"], [name="outgoingsAnnual"]) { width: 100px !important; }
dialog.ds-lease .ds-lhalf :is([name="rentFrequency"], [name="bond"]) { width: 96px !important; }
dialog.ds-lease .ds-lhalf [name="rightsOfRenewal"] { width: 96px !important; }
/* Reviews: the add row - narrower date, kind and rent; the ticks by their words */
.event-add [name="evDate"] { flex: 0 0 140px; }
.event-add [name="evKind"] { flex: 0 0 190px; }   /* (fits "Market review reminder") */
.event-add [name="evRent"] { flex: 0 0 130px; }
.event-add .check { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; margin: 0; white-space: nowrap; }
.event-add .check input { flex: 0 0 auto; min-width: 0; width: auto; padding: 0; margin: 0; }
.event-add { align-items: center; }
dialog.ds-evedit .ds-evticks { display: flex; gap: 16px; align-items: center; margin: 0 0 8px; }
dialog.ds-evedit .ds-evticks .check { margin: 0; }
dialog.ds-lease .ds-lhalf:is(:first-child, :last-child) > .field:nth-child(1) > span:first-child { width: 118px !important; }
dialog.ds-lease .ds-lhalf:last-child > .field:nth-child(2) > span:first-child { width: 36px !important; }

/* Reviews: New rent / incl GST / Auto change rent only for a CPI, Market or Fixed review */
.event-add .ev-off { display: none !important; }
/* Lease (Detail look): Tenant, Where and Status on one line - each label beside its value */
dialog.ds-lease .ds-tfacts { grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 8px 28px; align-items: center; }
dialog.ds-lease .ds-tfacts > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
dialog.ds-lease .ds-tfacts > div > .ds-k { flex: 0 0 auto; }
dialog.ds-lease .ds-tfacts [data-lf] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Lease (Detail look): Final expiry / Expiry date of current term ending in line with Name; Bond and Bond location */
dialog.ds-lease .ds-lr .ds-lhalf:first-child > .field:nth-child(2) { margin-left: auto; }
dialog.ds-lease .ds-lr .ds-lhalf [name="bond"] { width: 100px !important; }
dialog.ds-lease .ds-lr .ds-lhalf:last-child > .field:has([name="bondLocation"]) { flex: 1 1 auto; min-width: 0; }
dialog.ds-lease .ds-lr .ds-lhalf:last-child > .field:has([name="bondLocation"]) > span:first-child { width: 56px !important; }
dialog.ds-lease .ds-lr .ds-lhalf [name="bondLocation"] { flex: 1 1 auto; width: auto !important; min-width: 0; }

/* Lease reviews: the add line above the entries */
#eventsBox.ev-addtop > .panel-foot { border-top: 0; border-bottom: 1px solid var(--border); }
/* (Paid's box starts with Bond location's; Rights of renewal ends with it) */
dialog.ds-lease .ds-lr .ds-lhalf:last-child > .field:nth-child(2) > span:first-child { width: 56px !important; }
dialog.ds-lease .ds-lr .ds-lhalf [name="rentFrequency"] { width: 90px !important; }
dialog.ds-lease .ds-lr .ds-lhalf [name="rightsOfRenewal"] { width: 84px !important; }
dialog.ds-lease .ds-lr .ds-lhalf:last-child > .field:has([name="rightsOfRenewal"]) { margin-left: auto; }

/* Lease: Terms bigger; Terms and Notes labels at the top left */
dialog.ds-lease .ds-ltext > .field { align-items: start !important; }
dialog.ds-lease .ds-ltext > .field > span:first-child { align-self: start !important; padding: 6px 0 0 !important; }
dialog.ds-lease .ds-ltext [name="terms"] { min-height: 120px; }
dialog.ds-lease .ds-ltext [name="notes"] { min-height: 120px; }

/* Lease: Date of Assignment (DOA) under Lease Original Start */
dialog.ds-lease .ds-lr .ds-lhalf:first-child > .field:has([name="assignmentDate"]) { margin-left: 0; }

/* Lease: Assign to new tenant */
dialog.ds-assign { width: min(600px, calc(100vw - 32px)); }
dialog.ds-assign .ds-asg-note { font-size: .85rem; margin: 0; }
dialog.ds-assign .ds-evgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; align-items: end; }
dialog.ds-assign .ds-evgrid .field { margin: 0; max-width: none; display: flex !important; flex-direction: column; align-items: stretch; gap: 4px; }
dialog.ds-assign .ds-evgrid .field > span:first-child { width: auto !important; text-align: left !important; }
dialog.ds-assign .ds-evgrid .field > :is(input, select) { width: 100% !important; box-sizing: border-box; }
dialog.ds-assign .ds-evgrid .field.wide { grid-column: 1 / -1; }
dialog.ds-assign .form-error:empty { display: none; }

/* Register: a credit card's Processed date (when the bank feed first had it) */
table.register .col-proc { width: 1%; white-space: nowrap; }
table.register td.col-proc { color: var(--muted); }

/* Change several: Processed - how, and the date */
dialog.ds-cm .ds-cmpair { display: flex; gap: 8px; }
dialog.ds-cm .ds-cmpair > * { flex: 1 1 0; min-width: 0; }

/* Bank feeds: a Rule in the Detail look - Name, Then and On along the top; When down the left, Bills & deposits above Then
   on the right (the two sides end level: Then takes up what's left); the buttons along the bottom */
dialog.ds-rule { width: min(1100px, calc(100vw - 32px)); background: var(--bg) !important; }
dialog.ds-rule .dlg-tools > .btn:not(.dlg-x) { display: none !important; }
dialog.ds-rule form { display: flex; flex-direction: column; gap: 12px; }
dialog.ds-rule .field { margin: 0; }
dialog.ds-rule .ds-rtop { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
dialog.ds-rule .ds-rtop .field { display: flex; flex-direction: column; gap: 4px; }
dialog.ds-rule .ds-rtop .field > span { text-align: left !important; align-self: flex-start; font-size: .85rem; color: var(--muted); }
dialog.ds-rule .form-error:empty { display: none; }
dialog.ds-rule .ds-rname { flex: 2 1 220px; }
dialog.ds-rule .ds-rthen { flex: 3 1 260px; }
dialog.ds-rule .ds-ron { margin: 0 0 8px; font-weight: 600; white-space: nowrap; }
dialog.ds-rule .ds-rcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
dialog.ds-rule .ds-rstack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
dialog.ds-rule .ds-rstack > .ds-rthencard { flex: 1; }
dialog.ds-rule .ds-rcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
dialog.ds-rule .ds-rcard > h3 { margin: 0; font-size: 1rem; font-weight: 700; }
dialog.ds-rule .ds-rcard > .field { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 10px; }
dialog.ds-rule .ds-rcard > .field > span:first-child { font-size: .85rem; color: var(--muted); font-weight: 500; }
dialog.ds-rule .ds-rcard > .field > .line-tag-sum { grid-column: 2; }
dialog.ds-rule .ds-rpair { display: flex; gap: 8px; align-items: center; min-width: 0; }
dialog.ds-rule .ds-rpair > select, dialog.ds-rule .ds-rpair > input { flex: 1 1 0; min-width: 0; }
dialog.ds-rule .ds-rsep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
dialog.ds-rule .ds-rsep::before, dialog.ds-rule .ds-rsep::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
dialog.ds-rule .feed-when { margin: 0; }
dialog.ds-rule #condRows { grid-template-columns: 1fr; }
dialog.ds-rule .bill-fill { margin: 0; }
dialog.ds-rule .ds-xbar { align-items: center; }
dialog.ds-rule .ds-xbar .btn { padding: 9px 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); border: 1px solid #b9c1cc; }
dialog.ds-rule .ds-xbar .btn.primary { border-color: var(--accent); }
dialog.ds-rule .ds-xbar .btn.danger { color: var(--negative); }
dialog.ds-rule .ds-rhelp { position: relative; }
dialog.ds-rule .ds-rtip { position: absolute; right: 0; top: calc(100% + 6px); width: min(340px, 80vw); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: .82rem; line-height: 1.45; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); z-index: 10; font-weight: 400; }
dialog.ds-rtest { width: min(1000px, calc(100vw - 32px)); height: min(580px, calc(100vh - 32px)); min-width: 420px; min-height: 300px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px);
  resize: both; overflow: hidden; display: none; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--surface) !important; }
dialog.ds-rtest[open] { display: flex; }
dialog.ds-rtest .ds-rtest-top { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
dialog.ds-rtest .ds-rtest-top h2 { margin: 0; padding: 0; border: 0; flex: 1; font-size: 1.2rem; }
dialog.ds-rtest .ds-rtest-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-rtest .ds-rtest-boxes:empty { display: none; }
dialog.ds-rtest .ds-rtest-box { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-rtest .ds-rtest-box:last-child { border-right: 0; }
dialog.ds-rtest .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-rtest .ds-tv { font-size: 1.1rem; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-rtest > p { margin: 0; font-size: .85rem; }
dialog.ds-rtest .ds-rtest-list { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-rtest .ds-rtest-list:empty { display: none; }
dialog.ds-rtest .ds-rtest-list table { width: 100%; margin: 0; font-size: .88rem; }
dialog.ds-rtest .ds-rtest-list th { position: sticky; top: 0; z-index: 1; background: var(--surface-2, var(--surface)); text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
dialog.ds-rtest .ds-rtest-list th.num { text-align: right; }
dialog.ds-rtest .ds-rtest-list td { padding: 7px 10px; }
dialog.ds-rtest .ds-rtest-st { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--surface-2, #f0f2f5); color: var(--muted); white-space: nowrap; }
dialog.ds-rtest .ds-rtest-st.new { background: var(--accent-soft, #e3f3f1); color: var(--accent); }
dialog.ds-rtest .ds-xbar { margin: 0; padding-top: 10px; border-top: 1px solid var(--border); align-items: center; }
dialog.ds-rtest .ds-rtest-tip { font-size: .78rem; }
@media (max-width: 760px) { dialog.ds-rtest { min-width: 0; resize: none; } dialog.ds-rtest .ds-rtest-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } dialog.ds-rtest .ds-rtest-tip { display: none; } }
@media (max-width: 760px) {
  dialog.ds-rule .ds-rcols { grid-template-columns: 1fr; }
  dialog.ds-rule .ds-rcard > .field { grid-template-columns: 1fr; gap: 4px; }
}

/* Appearance -> Font: the site's font (data-font on <html>; none = System). The web fonts are kept on the site (fonts/,
   Latin letters, SIL Open Font License, from Fontsource) - only the one in use is downloaded. Also on an Appearance picture. */
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto Var"; src: url("/fonts/roboto-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Open Sans Var"; src: url("/fonts/open-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 300 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3 Var"; src: url("/fonts/source-sans-3-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans Var"; src: url("/fonts/noto-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato Web"; src: url("/fonts/lato-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lato Web"; src: url("/fonts/lato-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito Sans Var"; src: url("/fonts/nunito-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "Work Sans Var"; src: url("/fonts/work-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Var"; src: url("/fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Manrope Var"; src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat Var"; src: url("/fonts/montserrat-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins Web"; src: url("/fonts/poppins-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins Web"; src: url("/fonts/poppins-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins Web"; src: url("/fonts/poppins-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins Web"; src: url("/fonts/poppins-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
:root[data-font="inter"], [data-font-pick="inter"] { --font-ui: "Inter", "Segoe UI", system-ui, sans-serif; }
:root[data-font="system"], [data-font-pick="system"] { --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
:root[data-font="segoe"], [data-font-pick="segoe"] { --font-ui: "Segoe UI", "Segoe UI Variable", system-ui, sans-serif; }
:root[data-font="roboto"], [data-font-pick="roboto"] { --font-ui: "Roboto Var", Roboto, system-ui, sans-serif; }
:root[data-font="opensans"], [data-font-pick="opensans"] { --font-ui: "Open Sans Var", "Open Sans", system-ui, sans-serif; }
:root[data-font="sourcesans"], [data-font-pick="sourcesans"] { --font-ui: "Source Sans 3 Var", system-ui, sans-serif; }
:root[data-font="notosans"], [data-font-pick="notosans"] { --font-ui: "Noto Sans Var", system-ui, sans-serif; }
:root[data-font="lato"], [data-font-pick="lato"] { --font-ui: "Lato Web", Lato, system-ui, sans-serif; }
:root[data-font="nunitosans"], [data-font-pick="nunitosans"] { --font-ui: "Nunito Sans Var", system-ui, sans-serif; }
:root[data-font="worksans"], [data-font-pick="worksans"] { --font-ui: "Work Sans Var", system-ui, sans-serif; }
:root[data-font="ibmplex"], [data-font-pick="ibmplex"] { --font-ui: "IBM Plex Sans Var", system-ui, sans-serif; }
:root[data-font="manrope"], [data-font-pick="manrope"] { --font-ui: "Manrope Var", system-ui, sans-serif; }
:root[data-font="montserrat"], [data-font-pick="montserrat"] { --font-ui: "Montserrat Var", system-ui, sans-serif; }
:root[data-font="poppins"], [data-font-pick="poppins"] { --font-ui: "Poppins Web", system-ui, sans-serif; }
:root[data-font="arial"], [data-font-pick="arial"] { --font-ui: Arial, "Helvetica Neue", Helvetica, sans-serif; }
:root[data-font="calibri"], [data-font-pick="calibri"] { --font-ui: Calibri, Carlito, "Segoe UI", sans-serif; }
:root[data-font="verdana"], [data-font-pick="verdana"] { --font-ui: Verdana, Geneva, sans-serif; }
:root[data-font="tahoma"], [data-font-pick="tahoma"] { --font-ui: Tahoma, Verdana, sans-serif; }
:root[data-font="trebuchet"], [data-font-pick="trebuchet"] { --font-ui: "Trebuchet MS", "Lucida Grande", sans-serif; }
:root[data-font="georgia"], [data-font-pick="georgia"] { --font-ui: Georgia, "Times New Roman", serif; }
.lk-pic .lk-fontpic { font-family: var(--font-ui); font-size: 14px; line-height: 1.35; }
.lk-pic .lk-fontpic .lk-fsub { color: #5f6b7a; font-size: 12px; }

/* Bank feeds: Change the connection in the Detail look - the connection, then its Akahu tokens, each a white card */
dialog.ds-tok { width: min(620px, calc(100vw - 32px)); background: var(--bg) !important; }
dialog.ds-tok form { display: flex; flex-direction: column; gap: 12px; background: var(--bg) !important; }
dialog.ds-tok .dlg-top { background: transparent !important; }
dialog.ds-tok .ds-tokcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.ds-tok .ds-tokcard > h3 { margin: 0; font-size: 1rem; font-weight: 700; }
dialog.ds-tok .ds-tokcard > .field { display: grid !important; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; }
dialog.ds-tok .ds-tokcard > .field > span:first-child { font-size: .85rem; color: var(--muted); font-weight: 500; width: auto !important; text-align: left !important; }
dialog.ds-tok .ds-tokcard .secret-input { display: flex; gap: 6px; min-width: 0; }
dialog.ds-tok .ds-tokcard .secret-input > input { flex: 1; min-width: 0; }
dialog.ds-tok .ds-toksync { margin: 0 0 0 150px; }
dialog.ds-tok .ds-toknote { margin: 0; font-size: .82rem; }
dialog.ds-tok .form-error:empty { display: none; }
dialog.ds-tok .ds-xbar { align-items: center; margin: 0; }
dialog.ds-tok .ds-xbar .btn { padding: 9px 16px; font-weight: 600; }
@media (max-width: 760px) {
  dialog.ds-tok .ds-tokcard > .field { grid-template-columns: 1fr; gap: 4px; }
  dialog.ds-tok .ds-toksync { margin: 0; }
}

/* Bank feeds: Bank transactions (an account's, the last month) in the Detail look - summary boxes, the list in a white card
   (headings stay as it scrolls), Close along the bottom; the same size whatever's in it */
dialog.ds-btx { width: min(1100px, calc(100vw - 32px)); height: min(680px, calc(100vh - 32px)); min-width: 420px; min-height: 300px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px);
  resize: both; overflow: hidden; display: none; flex-direction: column; gap: 12px; padding: 16px 18px; background: var(--surface) !important; }
dialog.ds-btx[open] { display: flex; }
dialog.ds-btx .ds-btx-top { display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
dialog.ds-btx .ds-btx-head { flex: 1; min-width: 0; }
dialog.ds-btx .ds-btx-head h2 { margin: 0; padding: 0; border: 0; font-size: 1.2rem; }
dialog.ds-btx .ds-btx-head .muted { font-size: .85rem; margin-top: 2px; }
dialog.ds-btx .ds-btx-boxes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-btx .ds-btx-boxes:empty { display: none; }
dialog.ds-btx .ds-btx-box { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
dialog.ds-btx .ds-btx-box:last-child { border-right: 0; }
dialog.ds-btx .ds-k { font-size: .78rem; color: var(--muted); }
dialog.ds-btx .ds-tv { font-size: 1.1rem; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.ds-btx .ds-tv.negative { color: var(--negative); }
dialog.ds-btx .ds-btx-list { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
dialog.ds-btx .ds-btx-list .table-wrap { overflow: visible; border: 0; margin: 0; }
dialog.ds-btx .ds-btx-list table { width: 100%; margin: 0; }
dialog.ds-btx .ds-btx-list th { position: sticky; top: 0; z-index: 1; background: var(--surface-2, var(--surface)); border-bottom: 1px solid var(--border); }
dialog.ds-btx .ds-btx-msg { margin: 14px 16px; }
dialog.ds-btx .ds-xbar { margin: 0; padding-top: 10px; border-top: 1px solid var(--border); align-items: center; }
dialog.ds-btx .ds-xbar .btn { padding: 9px 16px; font-weight: 600; }
@media (max-width: 760px) { dialog.ds-btx { min-width: 0; resize: none; } dialog.ds-btx .ds-btx-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Lease: an entry's pop-up wide enough for its Kind ("Market review reminder") */
dialog.ds-evedit { width: min(680px, calc(100vw - 32px)); }
dialog.ds-evedit [name="kind"] { min-width: 190px; }

/* Bank feeds: Balances - the Bank transactions look (ds-btx); the accounts not the same as the bank tinted */
dialog.ds-bal tr.ds-baloff > td { background: color-mix(in srgb, var(--negative) 7%, transparent); }
/* (the ticks lined up with the boxes above - after the labels, in the classic layout) */
dialog.ds-evedit .ds-evticks { grid-column: 1 / -1; }
:root[data-layout="classic"] dialog.ds-evedit .ds-evticks { padding-left: calc(var(--label-w, 118px) + 8px); }
/* Lease: Reviews, renewals and reminders - Show all / Show fewer under the first 5 */
#eventRows tr.ev-toggle > td { text-align: center; padding: 4px; }
#eventRows tr.ev-toggle .btn { color: var(--accent); font-weight: 600; }
