/* Ledger - styled to match the CosmoLex screens the firm uses today. */
:root {
  --nav-bg: #2d2d2d;
  --nav-icon: #b9b9b9;
  --nav-active: #f0642c;
  --topbar-bg: #e6e6e6;
  --topbar-text: #4a4a4a;
  --grid-head: #3b3b3b;
  --row-alt: #ffffff;
  --row-hover: #e9e9e9;
  --row-border: #f0f0f0;
  --chip-bar: #e9e9e9;
  --chip: #d9d9d9;
  --tool-icon: #f4a52b;
  --tool-text: #555;
  --count: #f4a52b;
  --text: #333;
  --muted: #8a8a8a;
  --panel-border: #dcdcdc;
  --panel-head: #f2f2f2;
  --link: #1a5fd0;
  --red: #d9534f;
  --blue: #4a90d9;
  --green: #4caf7a;
  --purple: #8e5cc5;
  --yellow: #f2c037;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: #fff;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
a { color: var(--link); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: 66px 1fr; height: 100vh; }
.nav { grid-row: 1 / span 2; background: var(--nav-bg); display: flex; flex-direction: column; align-items: center; padding-top: 10px; }
.nav .brand { color: #fff; font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 18px; text-align: center; line-height: 1.1; }
.nav .brand b { display: block; width: 34px; height: 34px; margin: 0 auto 4px; border-radius: 50%; background: var(--nav-active); color: #fff; line-height: 34px; font-size: 18px; letter-spacing: 0; }
.nav a { width: 64px; height: 46px; display: flex; align-items: center; justify-content: center; color: var(--nav-icon); position: relative; }
.nav a:hover { color: #fff; background: #3a3a3a; }
.nav a.active { color: var(--nav-active); }
.nav a svg { width: 22px; height: 22px; }
.nav a .tip { display: none; position: absolute; left: 60px; background: #222; color: #fff; padding: 4px 9px; border-radius: 3px; font-size: 12px; white-space: nowrap; z-index: 20; }
.nav a:hover .tip { display: block; }

.topbar { background: var(--topbar-bg); display: flex; align-items: stretch; border-bottom: 1px solid #d4d4d4; }
.topbar .title { min-width: 230px; padding: 0 18px; display: flex; align-items: center; font-size: 20px; text-transform: uppercase; color: var(--topbar-text); letter-spacing: .01em; }
.firm { display: flex; align-items: center; padding: 0 16px; text-transform: uppercase; font-size: 14px; color: var(--topbar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.top-icons { display: flex; align-items: center; gap: 4px; padding: 0 10px; border-left: 1px solid #d0d0d0; }
.top-icons .ic { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: #8d8d8d; border-radius: 4px; background: none; border: 0; position: relative; }
.top-icons .ic:hover { background: #dadada; }
.top-icons .ic.green { color: #47a86b; }
.top-icons .ic svg { width: 22px; height: 22px; }
.user-menu { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--panel-border); box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 220px; z-index: 30; text-align: left; font-size: 14px; }
.user-menu div { padding: 10px 14px; border-bottom: 1px solid var(--row-border); }
.user-menu button { width: 100%; text-align: left; padding: 10px 14px; background: none; border: 0; color: var(--text); }
.user-menu button:hover { background: var(--row-hover); }

.main { display: flex; min-height: 0; min-width: 0; }
.subnav { width: 200px; flex: none; border-right: 1px solid #ececec; padding-top: 6px; background: #fff; }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: #8a8a8a; text-decoration: none; font-size: 15px; border-bottom: 1px solid #f1f1f1; }
.subnav a svg { width: 17px; height: 17px; color: #a3a3a3; }
.subnav a.active { color: #222; }
.subnav a.active svg { color: var(--blue); }
.subnav a.active::after { content: "\25B8"; margin-left: auto; font-size: 11px; color: #333; }
.subnav a.disabled { color: #c4c4c4; cursor: default; }
.subnav a.disabled svg { color: #d4d4d4; }
.subnav a .soon { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #bbb; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 8px 14px 10px 14px; overflow: auto; }
.rail { width: 52px; flex: none; margin: 96px 8px 10px 0; background: #2f2f2f; border-radius: 6px; display: flex; flex-direction: column; align-items: center; padding-top: 12px; gap: 12px; align-self: flex-start; padding-bottom: 12px; }
.rail span { color: #fff; display: flex; }
.rail span svg { width: 22px; height: 22px; }

/* ---------- Toolbar, chips, grid ---------- */
.toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 0 8px; flex-wrap: wrap; }
.toolbar button { display: flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--tool-text); padding: 6px 10px; font-size: 15px; border-radius: 3px; }
.toolbar button:hover:not(:disabled) { background: #f1f1f1; }
.toolbar button svg { width: 19px; height: 19px; color: var(--tool-icon); }
.toolbar button:disabled { color: #b5b5b5; cursor: default; }
.toolbar button:disabled svg { color: #d4c4a8; }
.toolbar .sep { width: 1px; height: 22px; background: #cfcfcf; margin: 0 6px; }
.dropdown { position: relative; }
.dropdown .menu { position: absolute; top: 34px; left: 0; background: #fff; border: 1px solid var(--panel-border); box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 230px; z-index: 25; }
.dropdown .menu button { width: 100%; justify-content: flex-start; padding: 9px 14px; border-radius: 0; }
.dropdown .menu button svg { display: none; }

.chips { background: var(--chip-bar); border-radius: 4px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: #555; margin-bottom: 8px; flex-wrap: wrap; }
.chips svg { width: 16px; height: 16px; }
.chip { background: var(--chip); border-radius: 12px; padding: 2px 10px; display: inline-flex; gap: 6px; align-items: center; }
.chip button { border: 0; background: none; padding: 0; font-weight: 700; color: #222; }
.chips input, .chips select { border: 1px solid #ccc; border-radius: 3px; padding: 3px 7px; font: inherit; font-size: 13px; background: #fff; }

.grid-wrap { border: 1px solid #e3e3e3; overflow: auto; flex: 1; min-height: 160px; background: #fff; }
table.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid thead th { position: sticky; top: 0; background: var(--grid-head); color: #fff; font-weight: 400; text-align: left; padding: 11px 10px; border-right: 1px solid #555; white-space: nowrap; cursor: pointer; user-select: none; }
.grid thead th.num, .grid td.num { text-align: right; }
.grid tbody td { padding: 14px 10px; border-bottom: 1px solid var(--row-border); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.grid tbody tr:hover td { background: var(--row-hover); }
.grid tbody tr.selected td { background: #dcdcdc; }
.grid tbody tr { cursor: default; }
.grid tbody tr.click { cursor: pointer; }
.grid .neg { color: #333; }
.grid .badge { display: inline-flex; width: 20px; height: 20px; border-radius: 4px; background: #8a8a8a; color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; }
.grid .void { color: #b0b0b0; text-decoration: line-through; }
.grid .sub td { background: #fafafa; font-size: 14px; padding: 8px 10px; color: #555; }
.gridfoot { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px 0; color: var(--count); font-size: 15px; }
.gridfoot .pages { color: #888; display: flex; gap: 10px; align-items: center; }
.gridfoot .pages button { background: none; border: 0; color: #888; font-size: 16px; padding: 0 4px; }
.gridfoot .pages button.cur { color: #333; }
.empty { padding: 50px; text-align: center; color: #b9b9b9; font-size: 22px; }

/* ---------- Page header (back button, title, balance box) ---------- */
.pagehead { display: flex; align-items: center; gap: 16px; padding: 4px 0 10px; flex-wrap: wrap; }
.backbtn { background: #6f6f6f; color: #fff; border: 0; border-radius: 4px; padding: 8px 16px 8px 10px; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.backbtn svg { width: 22px; height: 22px; }
.pagehead h2 { margin: 0; font-weight: 400; font-size: 24px; color: #444; }
.pagehead .namebox { flex: 1; min-width: 260px; border: 1px solid #ccc; border-radius: 3px; padding: 8px 10px; font-size: 19px; }
.balbox { border: 1px solid #ccc; border-radius: 3px; padding: 8px 14px; font-size: 14px; color: #555; background: #f5f5f5; display: flex; gap: 18px; flex-wrap: wrap; }
.select { border: 1px solid #b9b9b9; border-radius: 3px; padding: 8px 10px; font: inherit; font-size: 16px; min-width: 320px; background: #fff; }

/* ---------- Panels (dashboard, matter summary) ---------- */
.tabs { display: flex; gap: 12px; padding: 4px 0 0; flex: none; }
.tabs button { border: 1px solid #ddd; border-bottom: 0; background: #e3e3e3; color: #888; padding: 9px 16px; font-size: 16px; border-radius: 3px 3px 0 0; display: flex; gap: 8px; align-items: center; }
.tabs button svg { width: 17px; height: 17px; }
.tabs button.active { background: #fff; color: #333; }
.tabs button.active svg { color: var(--blue); }
.panels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; padding-top: 6px; }
.panel { border: 1px solid var(--panel-border); background: #fff; display: flex; flex-direction: column; min-height: 210px; }
.panel h3 { margin: 0; background: var(--panel-head); font-weight: 400; font-size: 17px; padding: 9px 14px; color: #444; display: flex; align-items: center; gap: 8px; }
.panel h3 .q { width: 16px; height: 16px; border-radius: 50%; background: #5bb5e8; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.panel .body { padding: 10px 14px; flex: 1; }
.snap { display: flex; justify-content: space-around; text-align: center; gap: 8px; padding-top: 6px; flex-wrap: wrap; }
.snap .n { font-size: 44px; line-height: 1.15; }
.snap .n.small { font-size: 22px; padding-top: 14px; }
.snap .l { color: #555; font-size: 16px; max-width: 120px; margin: 4px auto 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: #888; }
.kv dd { margin: 0; }
.bigstats { display: grid; grid-template-columns: 1fr 1fr; text-align: center; gap: 12px; padding: 12px 0; }
.bigstats .n { font-size: 42px; }
.bigstats .l { font-size: 17px; color: #555; }
.collapsible h4 { margin: 0 0 8px; font-weight: 400; font-size: 19px; color: #444; }
.notice { background: #fdf3e1; border: 1px solid #f0d9a8; color: #6a5426; padding: 8px 12px; border-radius: 3px; font-size: 14px; margin-bottom: 8px; display: flex; gap: 8px; align-items: flex-start; }
.notice svg { width: 16px; height: 16px; color: #e4a72b; flex: none; margin-top: 2px; }
.ok-tag { color: #2e8b57; font-weight: 600; }
.bad-tag { color: var(--red); font-weight: 600; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 110px; align-items: center; gap: 10px; margin: 10px 0; font-size: 14px; }
.bar-row .bar { height: 14px; background: #5fbf95; }
.bar-row .v { text-align: right; color: #555; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; z-index: 50; }
.modal { background: #fff; width: min(1040px, 94vw); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); border-radius: 3px; }
.modal header { background: var(--grid-head); color: #fff; padding: 12px 16px; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.modal header button { background: none; border: 0; color: #fff; font-size: 22px; line-height: 1; }
.modal .mbody { padding: 14px 16px; overflow: auto; }
.modal footer { padding: 12px 16px; border-top: 1px solid #e5e5e5; display: flex; justify-content: flex-end; gap: 10px; }
.btn { border: 1px solid #bdbdbd; background: #f5f5f5; color: #333; padding: 8px 18px; border-radius: 3px; font-size: 15px; }
.btn.primary { background: #4a90d9; border-color: #3d7fc4; color: #fff; }
.btn.danger { background: var(--red); border-color: #c4413d; color: #fff; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #666; }
label.f .req { color: var(--red); }
label.f input, label.f select, label.f textarea, .lines input, .lines select { border: 1px solid #c4c4c4; border-radius: 3px; padding: 7px 8px; font: inherit; font-size: 14px; color: #333; background: #fff; width: 100%; }
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines th { background: #efefef; font-weight: 600; text-align: left; padding: 7px 6px; color: #555; }
.lines td { padding: 4px 4px; border-bottom: 1px solid #f0f0f0; }
.lines .totals td { font-weight: 600; padding: 8px 6px; }
.err { background: #fdecea; border: 1px solid #f5c2bf; color: #8e2b26; padding: 9px 12px; border-radius: 3px; font-size: 14px; margin-bottom: 10px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 18px; border-radius: 4px; font-size: 14px; z-index: 60; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: #2d2d2d; padding: 20px; }
.login .card { background: #fff; width: min(460px, 100%); padding: 28px 28px 22px; border-radius: 4px; }
.login h1 { margin: 0 0 4px; font-weight: 600; font-size: 26px; }
.login p { margin: 0 0 18px; color: #777; font-size: 14px; }
.login .roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.login .roles button { text-align: left; padding: 10px 12px; border: 1px solid #d5d5d5; background: #fafafa; border-radius: 3px; font-size: 14px; }
.login .roles button:hover { background: #f0f0f0; }
.login .roles small { display: block; color: #888; font-size: 12px; margin-top: 2px; }
.login .devnote { margin-top: 16px; font-size: 12px; color: #999; border-top: 1px solid #eee; padding-top: 12px; }

.noaccess { display: grid; place-items: center; height: 100%; text-align: center; color: #777; padding: 40px; }
.noaccess h2 { font-weight: 400; color: #444; }

@media (max-width: 900px) {
  .subnav { width: 150px; }
  .rail { display: none; }
  .topbar .title { min-width: 140px; font-size: 17px; }
  .firm { display: none; }
}
@media (max-width: 640px) {
  .app { grid-template-columns: 52px minmax(0, 1fr); }
  .topbar { min-width: 0; overflow: hidden; }
  .topbar .title { min-width: 0; padding: 0 10px; font-size: 15px; flex: 1; }
    .tabs { overflow-x: auto; gap: 6px; }
  .tabs button { padding: 8px 10px; font-size: 14px; white-space: nowrap; }
  .content { padding: 8px; }
  .grid-wrap { overflow-x: auto; }
  table.grid.fit { min-width: 900px; }
  .pagehead .namebox { min-width: 0; width: 100%; font-size: 16px; }
  .modal { width: calc(100vw - 16px) !important; max-width: none; }
  .nav a { width: 52px; }
  .main { flex-direction: column; }
  .subnav { width: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid #eee; }
  .subnav a { white-space: nowrap; border-bottom: 0; }
    .top-icons .ic:not(.keep) { display: none; }
  .panels { grid-template-columns: 1fr; }
  .panels > .panel { grid-column: 1 / -1 !important; }
}

/* Fixed-width grids (registers): every column fits; long text trims with an ellipsis like CosmoLex. */
table.grid.fit { table-layout: fixed; }
.grid.fit th, .grid.fit td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Reports (CosmoLex layout) ---------- */
.rep-wrap { flex: 1; min-width: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; }
.rep-menu { border-right: 1px solid var(--panel-border); background: #fff; overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.rep-sec { border-bottom: 1px solid #e3e3e3; }
.rep-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 11px 14px; font-size: 19px; color: #444; text-align: left; }
.rep-head svg { width: 16px; height: 16px; color: #666; transition: transform .15s; flex: none; }
.rep-sec.open .rep-head svg { transform: rotate(90deg); }
.rep-items { display: none; }
.rep-sec.open .rep-items { display: block; }
.rep-items a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px 6px 38px; font-size: 15.5px; color: #444; text-decoration: none; border-top: 1px solid #efefef; background: #fff; }
.rep-items a:hover { background: #f4f4f4; }
.rep-items a.active { background: #e9e9e9; }
.rep-q { flex: none; width: 17px; height: 17px; border-radius: 50%; background: #5bb8e8; color: #fff; font: 700 11px/17px Arial, sans-serif; text-align: center; font-style: normal; }
.rep-sched { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 18px; color: #555; border-top: 1px solid #e3e3e3; background: #f7f7f7; font-size: 15px; }
.rep-sched svg { width: 17px; height: 17px; }
.rep-main { min-width: 0; overflow: auto; padding: 10px 16px 24px; }
.rep-bar { display: flex; align-items: center; gap: 14px; border: 1px solid var(--panel-border); padding: 8px 14px; flex-wrap: wrap; }
.rep-bar h2 { margin: 0 auto 0 0; font-weight: 400; font-size: 26px; color: #444; }
.rep-printas { display: flex; align-items: center; gap: 8px; font-size: 16px; color: #444; }
.rep-printas select { min-width: 86px; }
.rep-act { display: flex; align-items: center; gap: 6px; background: none; border: 0; font-size: 17px; color: #444; padding: 4px 6px; }
.rep-act svg { width: 20px; height: 20px; color: var(--tool-icon); }
.rep-act:disabled { color: #b5b5b5; cursor: default; } .rep-act:disabled svg { color: #d8c9ad; }
.rep-box { border: 1px solid var(--panel-border); margin-top: 12px; padding: 6px 20px; }
.rep-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 0; }
.rep-lab { width: 160px; flex: none; color: #444; font-size: 16px; }
.rep-lab2 { color: #444; font-size: 16px; }
.rep-row select, .rep-row input[type=date], .rep-printas select { height: 36px; border: 1px solid #d5d5d5; border-radius: 3px; padding: 0 10px; font: inherit; color: #555; background: #fff; }
.rep-row select { min-width: 190px; max-width: 100%; }
.rep-row select:disabled { background: #eee; }
.rep-chk { display: flex; align-items: center; gap: 8px; color: #444; font-size: 16px; }
.rep-chk input { width: 17px; height: 17px; }
.rep-sub { margin: 16px 0 0; font-size: 19px; color: #555; }
.rep-opts { display: flex; gap: 40px; flex-wrap: wrap; padding: 10px 20px; margin-top: 6px; }
.rep-soon, .rep-loading, .rep-err { margin-top: 16px; padding: 18px; border: 1px dashed #d5d5d5; color: #777; }
.rep-err { color: var(--red); border-color: #f0c2c0; }

/* The printout itself: plain white page, Arial, like the CosmoLex PDFs. */
.paper-scroll { margin-top: 16px; background: #e9e9e9; padding: 18px; overflow: auto; border: 1px solid var(--panel-border); }
.paper { background: #fff; color: #000; font: 11px/1.35 Arial, Helvetica, sans-serif; width: 794px; max-width: none; margin: 0 auto; padding: 36px 40px 26px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.paper.land { width: 1123px; }
.p-head { text-align: center; margin-bottom: 16px; }
.p-firm { font-size: 17px; font-weight: 700; }
.p-title { font-size: 15px; font-weight: 700; margin-top: 2px; }
.p-subt { font-size: 10.5px; font-weight: 700; }
.p-tab { width: 100%; border-collapse: collapse; margin: 4px 0 10px; }
.p-tab th { text-align: left; font-weight: 700; font-size: 10px; border-bottom: 1px solid #000; padding: 4px 6px; white-space: nowrap; }
.p-tab td { padding: 5px 6px; vertical-align: top; border-bottom: 1px solid #d9d9d9; }
.p-tab .num { text-align: right; white-space: nowrap; }
.p-nohead thead { display: none; }
.p-fin td { border-bottom: 0; padding: 4px 6px; }
.p-fin tr.p-sec td { border-top: 1px solid #000; border-bottom: 1px solid #000; padding-top: 6px; }
.p-fin tr.p-grp td { padding-top: 12px; }
.p-fin tr.p-sub td { padding-top: 12px; }
.p-fin tr.p-gap td { padding-top: 18px; }
.p-fin .ind1 { padding-left: 16px; } .p-fin .ind2 { padding-left: 28px; } .p-fin .ind3 { padding-left: 36px; }
.p-fin tr.p-tot td { border-bottom: 1px solid #000; }
.p-tab tr.p-grand td { border-top: 1px solid #000; border-bottom: 1px solid #000; font-weight: 700; }
.p-tab tr.p-tot td { font-weight: 700; }
.p-tb td { border-bottom: 1px solid #e3e3e3; }
.p-caps th { text-transform: uppercase; }
.p-acct { font-weight: 700; font-size: 12px; margin: 16px 0 2px; }
.p-dim { font-weight: 400; color: #444; }
.p-open td { font-style: normal; }
.p-kv { border-collapse: collapse; margin: 14px 0 4px; font-size: 11.5px; }
.p-kv td { padding: 2px 0; } .p-kv td:first-child { width: 200px; font-weight: 700; }
.p-banks { width: auto; min-width: 46%; margin-left: auto; }
.p-item + .p-item { margin-top: 18px; border-top: 1px solid #bbb; padding-top: 4px; }
.p-filters { width: 50%; margin-top: 22px; }
.p-none { color: #444; text-align: center; padding: 24px 0; }
.p-foot { display: flex; justify-content: space-between; border-top: 0; margin-top: 26px; font-size: 8.5px; }

@media (max-width: 900px) {
  .rep-wrap { grid-template-columns: 1fr; }
  .rep-menu { border-right: 0; border-bottom: 1px solid var(--panel-border); max-height: 46vh; }
  .rep-sched { display: none; }
  .rep-lab { width: 100%; }
  .rep-bar h2 { font-size: 21px; width: 100%; }
}

@media print {
  body.printing-report * { visibility: hidden; }
  body.printing-report .paper, body.printing-report .paper * { visibility: visible; }
  body.printing-report .app { display: block; height: auto; }
  body.printing-report .nav, body.printing-report .topbar, body.printing-report .rep-menu, body.printing-report .rep-bar, body.printing-report .rep-box, body.printing-report .rep-sub { display: none !important; }
  body.printing-report .rep-wrap, body.printing-report .main, body.printing-report .rep-main { display: block; overflow: visible; padding: 0; }
  body.printing-report .paper-scroll { background: none; border: 0; padding: 0; margin: 0; overflow: visible; }
  body.printing-report .paper { width: auto; zoom: 1 !important; box-shadow: none; padding: 0; position: absolute; left: 0; top: 0; }
  body.printing-report .p-foot { display: none; }
  body.printing-report .p-tab:not(.p-nohead) thead { display: table-header-group; }
  body.printing-report .p-tab tr { break-inside: avoid; }
  body.printing-report .p-pb + .p-pb { break-before: page; border-top: 0; margin-top: 0; }
}
.p-fixed { table-layout: fixed; }
.p-fixed td, .p-fixed th { overflow-wrap: anywhere; }
.p-fixed th.num { white-space: normal; }
.p-fixed tr.p-open td:first-child, .p-fixed tr.p-tot td:first-child, .p-fixed tr.p-grand td:first-child { white-space: nowrap; overflow-wrap: normal; overflow: visible; }

/* Report window (opened by View or Download) */
body.report-window { background: #e9e9e9; height: auto; }
.report-window #rw { padding: 0 0 30px; }
.report-window .rep-loading, .report-window .rep-err { margin: 40px auto; max-width: 520px; background: #fff; text-align: center; }
.report-window .rw-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #3b3b3b; color: #fff; padding: 8px 16px; font-size: 15px; }
.report-window .rw-bar button { background: #f4a52b; color: #fff; border: 0; border-radius: 3px; padding: 7px 14px; font-size: 14px; }
.report-window .paper-scroll { background: none; border: 0; margin: 0; padding: 18px; }
@media print {
  .report-window .rw-bar { display: none !important; }
  body.report-window { background: #fff; }
}
.report-window .rw-btns { display: flex; gap: 8px; }

/* ---------- Phase 2: Activities, timecard and expense forms ---------- */
.btn.orange { background: #f4a52b; border-color: #e0951f; color: #fff; }
.btn.plain { background: #fff; }
.grid .akind svg { width: 22px; height: 22px; color: #777; }
.grid .flag svg { width: 17px; height: 17px; fill: currentColor; }
.grid .hold svg { width: 15px; height: 15px; color: #999; margin-left: 2px; }
.grid .open-edit { background: none; border: 0; padding: 0; color: #f4a52b; }
.grid .open-edit svg { width: 19px; height: 19px; }
.act-total { padding: 6px 4px 0; color: #666; font-size: 14px; text-align: right; }
.modal.form-modal { width: min(1080px, 96vw); }
.form-modal .mbody { background: #fafafa; }
.fs { border: 1px solid #ddd; border-radius: 3px; background: #fff; padding: 10px 14px 12px; margin: 0 0 12px; }
.fs-h { font-weight: 400; font-size: 18px; color: #555; margin: 0 0 10px; }
.fs-h.toggle { cursor: pointer; user-select: none; }
.fs-h.toggle::before { content: "\25B8"; display: inline-block; width: 16px; color: #888; font-size: 13px; }
.fs-h.toggle.open::before { content: "\25BE"; }
.f.row { display: grid; grid-template-columns: 130px 1fr; align-items: start; gap: 10px; margin-bottom: 10px; }
.f.row > span:first-child { padding-top: 7px; color: #444; }
.f.row .grow { display: flex; flex-direction: column; }
.f input, .f select, .f textarea { font: inherit; font-size: 15px; border: 1px solid #ccc; border-radius: 3px; padding: 6px 8px; background: #fff; width: 100%; box-sizing: border-box; }
.f input:disabled, .f select:disabled, .f textarea:disabled { background: #f0f0f0; color: #666; }
.f textarea { resize: vertical; }
.f .count { color: #999; text-align: right; font-size: 13px; margin-top: 3px; }
.frow2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; }
.frow3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 26px; align-items: center; }
.f.inl { display: grid; grid-template-columns: 104px 1fr auto; align-items: center; gap: 8px; margin: 0; }
.f.inl > span:first-child { color: #444; }
.f input.t { text-align: right; }
.qm { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: #5bc0de; color: #fff; font-size: 12px; align-items: center; justify-content: center; cursor: help; }
.value { margin-top: 12px; font-size: 18px; color: #444; }
.value b { color: #5cb85c; font-size: 30px; font-weight: 400; margin-left: 6px; }
.value.inl { margin: 0; }
.chk { display: flex; align-items: center; gap: 6px; color: #444; }
.chk input { width: 17px; height: 17px; }
#flag-i svg { width: 18px; height: 18px; fill: currentColor; }
.tabs.small { padding: 0 0 10px; border-bottom: 1px solid #e3e3e3; margin-bottom: 12px; }
.tabs.small button { font-size: 15px; padding: 7px 16px; }
.hint { color: #888; font-size: 13px; margin: 10px 0 0; }
.req { color: #d9534f; margin-left: 2px; }
.cm-wrap { position: relative; }
.cm-list { position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid #ccc; box-shadow: 0 6px 16px rgba(0,0,0,.12); z-index: 5; max-height: 300px; overflow: auto; }
.cm-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; font-size: 14px; border-bottom: 1px solid #f2f2f2; }
.cm-list button:hover { background: #eef5fc; }
.cm-list button span { color: #999; margin-left: 6px; }
.cm-list .none { padding: 10px; color: #999; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-grid .f { display: flex; flex-direction: column; gap: 4px; }
.mtabs { margin-bottom: 0; }
.mtabs button:disabled { color: #c4c4c4; cursor: default; }
.mtab-body { border-top: 1px solid #ddd; padding-top: 6px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.settings-form { overflow: auto; padding-top: 12px; }
.settings-form .f.row { grid-template-columns: 170px 1fr; }
.form-actions { display: flex; justify-content: flex-end; padding: 4px 0 10px; }
.grid td:has(.akind), .grid td:has(.flag), .grid td:has(.open-edit) { text-overflow: clip; overflow: visible; }
.btn:disabled { opacity: .5; cursor: default; }

/* Phase 2 part 2: invoices */
.flt-row { display:flex; align-items:center; gap:8px; }
.flt-row .chips { margin:0; }
.linkbtn { background:none; border:0; color:#2a6ebb; cursor:pointer; display:inline-flex; align-items:center; gap:4px; font:inherit; padding:4px 6px; }
.linkbtn svg { width:15px; height:15px; }
.sent-i, .cmt-i { color:#f0a030; display:inline-flex; }
.cmt-i { color:#888; }
.sent-i svg, .cmt-i svg { width:17px; height:17px; }
.addinv { display:flex; flex-direction:column; min-height:0; }
.addinv-head { display:flex; align-items:center; justify-content:space-between; padding:8px 4px 12px; }
.addinv-head h1 { font-weight:400; font-size:34px; margin:0; color:#444; }
.addinv-head .btns { display:flex; gap:12px; }
.addinv-head .btn { min-width:120px; font-size:16px; padding:9px 18px; }
.addinv-body { display:flex; gap:16px; flex:1; min-height:0; }
.addinv-left { width:230px; flex:none; border:1px solid #ddd; border-radius:4px; padding:14px 18px; background:#fff; overflow:auto; }
.addinv-left .f { margin-bottom:14px; }
.addinv-right { flex:1; min-width:0; border:1px solid #ddd; border-radius:4px; padding:10px 16px 14px; margin:0; background:#fff; display:flex; flex-direction:column; }
.addinv-right legend { font-size:20px; color:#555; padding:0 6px; }
.addinv-right #chipbox .chips { display:flex; align-items:center; }
.grid.sel tr.picked td { background:#d9eef8; }
.mbadge { display:inline-block; background:#999; color:#fff; border-radius:3px; font-size:11px; font-weight:700; padding:1px 5px; }
.inv-edit .grid td { font-size:13px; }
.mtabs a { display:inline-flex; align-items:center; gap:6px; padding:8px 14px; color:#555; text-decoration:none; border-bottom:2px solid transparent; }
.mtabs a.active { color:#222; border-bottom-color:#f0a030; }
.mtabs a svg { width:16px; height:16px; }
.content.addinv { overflow:hidden; }
.addinv-right #cgrid { flex:1; min-height:0; display:flex; flex-direction:column; }
.addinv-right #cgrid .grid-wrap { flex:1; min-height:0; overflow:auto; }
.addinv-left .f > span:first-child { display:block; }
.grid.sel td a svg { width:20px; height:20px; color:#2a6ebb; }
/* Resizable grid columns */
.grid-wrap { overflow-x: auto; }
.grid thead th { position: relative; }
.grid .col-rs { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
.grid .col-rs:hover, body.col-resizing .grid .col-rs:active { background: rgba(240,160,48,.6); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none; }
