/* Report Maker - app styling. Mirrors the old Horizon layout (structure + colours), our own CSS. */
/* Light (Horizon's own look) is the default; the header's "Dark mode" button adds html.dark (saved in this browser). */
:root {
  --page-bg:      #ffffff;
  --frame-bg:     #ffffff;
  --panel-bg:     #f2f2f2;
  --panel-border: #d3d3d3;
  --text:         #000000;
  --text-dim:     #666666;
  --header-bg:    #ffffff;
  --nav-text:     #9a9a9a;
  --nav-active:   #c8202f;
  --badge-bg:     #283a6b;
  --btn-bg:       #1f4fa8;
  --btn-hover:    #2a62c9;
  --btn-text:     #ffffff;
  --chip-on:      #1f4fa8;
  --required-bg:  #ffe9cc;
  --today-row:    #dcefd9;
  --tag-warn:     #f3ec3a;
  --tag-ok:       #57b65a;
  --tag-bad:      #d9534f;
  --heading:      #418b9d;
  --footer-bg:    #d9d9d9;
  --link:         #1a5fb4;
  --font: Verdana, Tahoma, Arial, sans-serif;
  --fs: 11px;
}
html.dark {
  --page-bg:      #161819;
  --frame-bg:     #2b2f31;
  --panel-bg:     #222628;
  --panel-border: #4a4f52;
  --text:         #d6d6d6;
  --text-dim:     #9a9a9a;
  --header-bg:    #ffffff;
  --nav-text:     #9a9a9a;
  --nav-active:   #c8202f;
  --badge-bg:     #283a6b;
  --btn-bg:       #1f4fa8;
  --btn-hover:    #2a62c9;
  --btn-text:     #ffffff;
  --chip-on:      #1f4fa8;
  --required-bg:  #5a3410;
  --today-row:    #3c4a40;
  --tag-warn:     #e5e04a;
  --tag-ok:       #57b65a;
  --tag-bad:      #d9534f;
  --heading:      #8fb8e8;
  --footer-bg:    #d9d9d9;
  --link:         #8fb8e8;
  --font: Verdana, Tahoma, Arial, sans-serif;
  --fs: 11px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page-bg); color: var(--text); font: var(--fs)/1.45 var(--font); }
a { color: var(--link); }
.frame { max-width: 860px; margin: 8px auto; }

/* ---------- header ---------- */
.hdr { background: var(--header-bg); }
.hdr-top { display: flex; align-items: flex-end; gap: 18px; padding: 10px 0 6px 14px; position: relative; min-height: 50px; }
.wordmark { font: 900 24px/1 Georgia, 'Times New Roman', serif; color: var(--nav-active); text-decoration: none; letter-spacing: 1px; text-transform: uppercase; padding-right: 14px; }
.mainnav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; padding-bottom: 2px; }
.mainnav a { color: var(--nav-text); text-decoration: none; font-weight: bold; }
.mainnav a:hover { color: #555; }
.mainnav a.on { color: var(--nav-active); }
.mainnav .sep { color: #333; }
.badge { position: absolute; top: 0; right: 0; background: var(--badge-bg); color: #fff; font-size: 10px; font-weight: bold; padding: 2px 8px; }

/* ---------- body / footer ---------- */
.body { background: var(--frame-bg); padding: 10px 12px 14px; border: 6px solid #1f2224; border-top: 0; min-height: 300px; }
.ftr { background: var(--footer-bg); color: #444; display: flex; justify-content: space-between; padding: 4px 10px; font-size: 10px; }
.ftr-links { color: #777; }
.pagetitle { font: normal 18px/1.2 var(--font); color: var(--heading); border-bottom: 1px solid var(--panel-border); padding: 6px 4px 6px; margin: 4px 0 10px; }
h2 { color: var(--heading); font-size: 13px; margin: 2px 0 10px; }
h3 { font-size: 11px; margin: 12px 0 4px; color: var(--text); border-bottom: 1px solid var(--panel-border); }
.dim { color: var(--text-dim); }
.red { color: var(--nav-active); font-weight: bold; }
.pad { padding: 10px; }
.flash { background: #2f4a2f; border: 1px solid #4f7a4f; color: #e8ffe8; padding: 5px 8px; margin-bottom: 8px; }
.flash-err, .errors { background: #4a2626; border: 1px solid #8a3b3b; color: #ffe5e5; padding: 5px 8px; margin-bottom: 8px; }

/* ---------- buttons / forms ---------- */
.btn { display: inline-block; background: var(--btn-bg); color: var(--btn-text); border: 0; border-radius: 2px; font: bold 10px/1.4 var(--font); padding: 4px 9px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--btn-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 2px 7px; }
.btn-ghost { background: #2c3550; }
.btn-warn { background: #9a5a14; }
.linkbtn { background: none; border: 0; color: #5fc1ff; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
form.inline { display: inline; }
input, select, textarea { font: 11px var(--font); color: #111; background: #fff; border: 1px solid #888; padding: 2px 3px; max-width: 100%; }
input[type=checkbox], input[type=radio] { vertical-align: -2px; margin: 0 3px 0 0; }
textarea { width: 100%; }
textarea.wide { width: 100%; }
.mono { font-family: Consolas, 'Courier New', monospace; font-size: 11px; }
label { font-weight: bold; font-size: 10px; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
label.block { display: block; width: 100%; }
label.block textarea, label.block input { display: block; width: 100%; margin-top: 2px; font-weight: normal; }
label.chk { font-weight: normal; }
.row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 5px 0; }
.lbl { font-weight: bold; font-size: 10px; }
.box, fieldset.box { background: var(--panel-bg); border: 1px solid var(--panel-border); border-width: 1px 0; padding: 6px 8px; margin: 0 0 8px; }
.foot-note { font-style: italic; font-size: 10px; }
.radios { gap: 4px 12px; }

/* ---------- home ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 0 10px; border-bottom: 1px solid var(--panel-border); margin-bottom: 6px; }
.gridwrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 10px; padding: 4px 5px; white-space: nowrap; }
.grid th a { color: #6aa8ff; }
.grid td { padding: 4px 5px; border-top: 1px solid #3a3f42; vertical-align: top; }
.grid tr.today td { background: var(--today-row); }
.grid.small td, .grid.small th { font-size: 10px; }
.gridfoot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: var(--text-dim); }
.todaykey { background: var(--today-row); color: #fff; padding: 1px 6px; }
.nowrap { white-space: nowrap; }
.imported { background: #3a4150; color: #cfd8ea; border: 1px solid #5a6680; padding: 0 5px; font-size: 9.5px; }
.gridpager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gridpager a { color: #6aa8ff; }
.gridpager .off { color: var(--text-dim); }
.gridpager input { width: 34px; text-align: center; }
.homebtns { margin-top: 14px; display: flex; gap: 6px; }
.tag { display: inline-block; font-size: 9px; padding: 0 4px; color: #111; }
.tag-pending { background: var(--tag-warn); }
.tag-accepted { background: var(--tag-ok); }
.tag-rejected { background: var(--tag-bad); color: #fff; }

/* ---------- work order ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 2px 0 6px; }
.subnav a { color: #c9c9c9; text-decoration: none; font-size: 10px; }
.subnav a:hover { color: #fff; text-decoration: underline; }
.statusline { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; border-top: 1px solid var(--panel-border); border-bottom: 1px solid var(--panel-border); padding: 5px 2px; margin-bottom: 8px; }
.statusline .right { margin-left: auto; }
.wo { display: grid; grid-template-columns: 190px 1fr; gap: 10px; }
.wo-cards { display: flex; flex-direction: column; gap: 3px; }
.card { position: relative; display: block; background: var(--panel-bg); border: 1px solid #3a3f42; padding: 5px 26px 6px 6px; color: var(--text); text-decoration: none; min-height: 30px; }
.card:hover { border-color: #6a7074; }
.card.on { background: #30363a; border-color: #7a8084; }
.card-title { display: block; font-weight: bold; }
.card-sum { display: block; color: var(--text-dim); font-size: 9.5px; }
.card .tag { margin-top: 2px; }
.card .arrow { position: absolute; right: 5px; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: #e6b422; color: #222; font-size: 10px; line-height: 16px; text-align: center; }
.card.on .arrow { background: #3eae49; color: #fff; }
.wo-panel { min-width: 0; }
.dnc { margin-left: auto; border: 1px solid var(--panel-border); padding: 2px 6px; }
.emailform .erow { display: grid; grid-template-columns: 70px 1fr; gap: 6px; align-items: start; margin: 4px 0; }
.emailform .erow > span { text-align: right; font-weight: bold; font-size: 10px; padding-top: 3px; color: #6aa8ff; }
.emailform input:not([type=checkbox]):not([type=radio]), .emailform select { width: 100%; }
.emailform .btn { justify-self: start; }
.incl label.chk { display: flex; flex-wrap: nowrap; align-items: center; }
.incl { display: flex; flex-direction: column; gap: 2px; }

/* ---------- report writing ---------- */
.rw-head { text-align: right; font-weight: bold; margin-bottom: 4px; }
.toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.toolbar > div { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs { display: flex; flex-wrap: wrap; background: #3a3f42; border-top: 1px solid #555; }
.tab { flex: 1 1 auto; text-align: center; padding: 4px 8px; color: #cfcfcf; text-decoration: none; font-size: 9.5px; font-weight: bold; border-right: 1px solid #2b2f31; white-space: nowrap; }
.tab:hover { background: #474d50; }
.tab.on { background: #5b6266; color: #fff; }
.tab .dot { color: #7fd17f; margin-left: 3px; }
.pager { display: flex; align-items: center; gap: 4px; padding: 0 8px; }
.pager a { color: #ddd; text-decoration: none; font-weight: bold; padding: 0 3px; }
.pager a.on { background: #ddd; color: #222; }
.subtabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #2f3437; margin-bottom: 8px; }
.subtabs a { text-align: center; padding: 3px; color: #bbb; text-decoration: none; font-size: 9.5px; border-right: 1px solid #222; }
.subtabs a.on { background: #1b1e20; color: #fff; font-weight: bold; }
.groups { position: relative; }
.group { background: var(--panel-bg); border: 1px solid var(--panel-border); margin-bottom: 8px; }
.group.required-missing { background: var(--required-bg); }
.group-title { display: flex; justify-content: space-between; gap: 8px; background: rgba(255,255,255,.04); padding: 3px 5px; font-weight: bold; border-bottom: 1px solid var(--panel-border); }
.group-links a { color: #eee; font-size: 9.5px; }
.reqmark { color: #ffb15a; font-weight: normal; font-size: 9.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px 6px; padding: 7px 7px 8px; }
.chip { background: transparent; color: var(--text); border: 1px solid #8a8f92; font: 10.5px/1.3 var(--font); padding: 3px 7px; cursor: pointer; text-align: left; }
.chip:hover { border-color: #fff; color: #fff; }
.chip.on { background: var(--chip-on); border-color: #6c95e6; color: #fff; }
.chip.on.always { background: #2f6b3a; border-color: #5aa96a; }
.chip.blank { font-size: 9.5px; border-style: dotted; color: var(--text-dim); }
.chipwrap { display: inline-flex; align-items: stretch; gap: 1px; }
.ico { background: #e9e9e9; color: #111; border: 0; font-size: 10px; width: 20px; cursor: pointer; padding: 0; }
.ico:hover { background: #fff; }
.cam, .note { font-size: 9px; opacity: .85; }
.missingbox ul { margin: 4px 0 0 18px; padding: 0; }

/* item dialog: an in-page panel (not a browser popup) */
.dialog { position: fixed; z-index: 50; left: 50%; top: 40px; transform: translateX(-50%); width: min(820px, calc(100vw - 16px)); max-height: calc(100vh - 60px); overflow: auto; background: #1d2022; border: 1px solid #777; box-shadow: 0 10px 40px rgba(0,0,0,.7); }
.dialog-title { display: flex; justify-content: space-between; align-items: center; background: #5b6266; color: #fff; font-weight: bold; padding: 4px 6px; position: sticky; top: 0; }
.dialog-photos-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; }
.photogrid { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 6px; padding: 6px; border: 1px solid var(--panel-border); background: #151718; min-height: 120px; }
.ptile { width: 132px; display: flex; flex-direction: column; gap: 2px; padding: 3px; border: 1px solid #3a3f42; }
.ptile img { width: 124px; height: 93px; object-fit: cover; cursor: pointer; border: 2px solid transparent; }
.ptile.sel { border-color: #6c95e6; background: #1f2a40; }
.ptile.sel img { border-color: #c8202f; }
.ptile .cap { width: 100%; font-size: 10px; }
.ptile .del { font-size: 9.5px; color: #ddd; }
.dialog-fields { padding: 6px; }
.rec-fields { border-top: 1px solid var(--panel-border); margin-top: 6px; padding-top: 2px; }
.rec-fields select { max-width: 100%; }

/* ---------- scheduler / outbox / help ---------- */
.dayhead { font-size: 12px; color: var(--heading); margin-top: 14px; }
.dayhead.today { color: #9fe39f; }
.schedrow { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 4px 2px; border-bottom: 1px solid #3a3f42; }
.schedrow .t { font-weight: bold; min-width: 60px; }
.kv { border-collapse: collapse; margin-bottom: 10px; }
.kv th { text-align: left; padding: 2px 10px 2px 0; color: var(--text-dim); font-weight: normal; vertical-align: top; }
.mailbody { white-space: pre-wrap; background: #fff; color: #111; padding: 12px; font: 12px/1.5 Arial, sans-serif; margin-bottom: 10px; }
.help li { margin-bottom: 8px; }

/* ---------- phone ---------- */
@media (max-width: 700px) {
  .frame { margin: 0; }
  .body { border-width: 0; padding: 8px; }
  .hdr-top { flex-wrap: wrap; padding-top: 22px; }
  .wo { grid-template-columns: 1fr; }
  .wo-cards { flex-direction: row; overflow-x: auto; }
  .card { min-width: 150px; }
  .emailform .erow { grid-template-columns: 1fr; }
  .emailform .erow > span { text-align: left; }
  .chip { font-size: 12px; padding: 6px 9px; }
  .ico { width: 30px; font-size: 13px; }
  .tab { font-size: 10px; padding: 7px 6px; }
}

/* === Invoices (worker 3) === */
.inv-top { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-top .box { margin: 0 0 8px; }
.grid .num, .kv .num, .grid th.num { text-align: right; white-space: nowrap; }
.inv-lines input.wide { width: 100%; min-width: 180px; }
.inv-sums { display: flex; justify-content: flex-end; }
.inv-sums .kv th { text-align: right; }
.inv-sums .kv td { min-width: 80px; }
.kv tr.strong th, .kv tr.strong td, .grid tr.strong td { font-weight: bold; color: #fff; border-top: 1px solid var(--panel-border); }
.inv-status { display: inline-block; white-space: nowrap; padding: 0 5px; font-weight: bold; font-size: 9.5px; border: 1px solid #777; }
.inv-draft { color: #ccc; }
.inv-sent { color: #9cc8ff; border-color: #4f7fc0; }
.inv-partial { color: #222; background: var(--tag-warn); border-color: var(--tag-warn); }
.inv-paid { color: #fff; background: #2f6b3a; border-color: #5aa96a; }
.inv-void { color: #fff; background: var(--nav-active); border-color: var(--nav-active); }
.ar-aging { margin-bottom: 6px; }
.ar-aging th a { color: #6aa8ff; }
.ar-aging td.ar-on { background: #283a6b; }
.grid tr.ar-late td { background: #3d2a2a; }
.ar-pay { display: flex; gap: 3px; align-items: center; white-space: nowrap; }
.ar-pay select { max-width: 90px; }
@media (max-width: 700px) { .inv-top { grid-template-columns: 1fr; } }

/* === Email (worker 2) === */
.mailbanner { padding: 5px 8px; margin: 0 0 8px; border: 1px solid; font-size: var(--fs); }
.mailbanner.mb-log { background: #2a3140; border-color: #4a5874; color: #cfd9ec; }
.mailbanner.mb-live { background: #4a2626; border-color: #a33a3a; color: #ffe5e5; }
.mailbanner.mb-redirect { background: #4a4214; border-color: var(--tag-warn); color: #fff7c0; }
.mailbanner a { color: inherit; text-decoration: underline; }
.mailstatus { display: inline-block; padding: 0 5px; font-size: 10px; font-weight: bold; border-radius: 2px; background: #3a3f42; color: #ddd; }
.mailstatus.ms-sent { background: #2f6a35; color: #fff; }
.mailstatus.ms-failed { background: var(--nav-active); color: #fff; }
.mailstatus.ms-sending { background: #6a5a1a; color: #fff; }
.mailerr { color: #ff9c9c; }
.mailhtml { width: 100%; height: 460px; border: 1px solid var(--panel-border); background: #fff; margin-bottom: 8px; }
.tplbox { border-top: 1px solid var(--panel-border); padding: 6px 0; }
.emailform .erow > span.attach { font-weight: normal; color: var(--text); text-align: left; }

/* Work order Log pop-up (like Horizon's LogView window) */
body.popup { padding: 8px 10px; }
body.popup .pagetitle { font-size: 13px; margin: 0 0 8px; }
.logview td.nowrap, .logview .nowrap { white-space: nowrap; }
.logview .prel { white-space: pre-line; }
.logview details summary { cursor: pointer; }

/* Report Publishing (like Horizon's page) */
.pub-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.pub-where { font-size: 12px; }
.pub-tools { gap: 6px; }
.pub-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin: 4px 0 8px; }
.pub-versions td { vertical-align: middle; }

/* Report Writing dialog step 1: Location, Task, Time and Cost columns (like Horizon) */
.lttc { display: grid; grid-template-columns: repeat(7, minmax(90px, 1fr)); gap: 4px; padding: 4px; }
.lttc[hidden] { display: none; }
.lttc-col { display: flex; flex-direction: column; min-width: 0; }
.lttc-h { font-weight: bold; font-size: 11px; padding: 2px 4px; }
.lttc-list { display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow-y: auto; padding: 2px; border: 1px solid #3a3f42; }
.lttc-opt { text-align: left; font-size: 11px; padding: 3px 6px; background: #1f2224; color: #e8e8e8; border: 1px solid #6b7173; border-radius: 4px; cursor: pointer; }
.lttc-opt:hover { border-color: #aaa; }
.lttc-opt.on { background: #1f5fae; border-color: #6aa8ff; color: #fff; }
.dlg-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.dlg-checks { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; }
.lttc-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.lttc-fields label { flex: 1 1 160px; display: flex; flex-direction: column; }
@media (max-width: 760px) { .lttc { grid-template-columns: repeat(2, 1fr); } .lttc-list { max-height: 160px; } }

/* Illustrations (our own) */
.illus-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid #3a3f42; margin: 4px 0; max-height: 260px; overflow-y: auto; }
.illus-pick[hidden] { display: none; }
.illus-opt { display: flex; flex-direction: column; width: 120px; font-size: 10px; border: 1px solid #555; padding: 3px; cursor: pointer; }
.illus-opt.on { border-color: #6aa8ff; background: #1f3550; }
.illus-opt img { width: 100%; height: 80px; object-fit: contain; background: #fff; }
.illus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.illus-tile { border: 1px solid #444; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.illus-tile img { width: 100%; height: 130px; object-fit: contain; background: #fff; }

/* Photo editor */
.ped-body { display: flex; gap: 12px; padding: 8px; flex-wrap: wrap; }
.ped-body img { max-width: min(560px, 100%); max-height: 60vh; object-fit: contain; background: #000; }
.ped-side { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; }

/* Customize mode */
.cz-bar { background: #2b4a6b; }
.chip.cz.changed { text-decoration: underline; }
.chip.cz.always { border-color: #c9a227; }
.chip.cz.hiddenitem { opacity: .55; }
.sortlist { margin: 0; padding-left: 22px; max-height: 50vh; overflow-y: auto; }
.sortlist li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid #333; }
.pager a { padding: 2px 6px; border: 1px solid #777; border-radius: 3px; }

/* Inspection Type and Fee panel (like Horizon): price list left, invoice right */
.feepanel { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr); gap: 10px; }
.fee-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; border: 1px solid #555; padding: 2px; background: #1d2022; }
.fee-pick { text-align: left; background: none; border: 0; color: #e8e8e8; font-size: 11px; padding: 2px 4px; cursor: pointer; }
.fee-pick:hover { background: #2f5d91; }
.fee-inv { border: 1px solid #555; padding: 6px 8px; }
.feelines { width: 100%; border-collapse: collapse; }
.feelines td { padding: 2px 3px; }
.fee-desc { width: 100%; }
.fee-totals { margin-left: auto; border-collapse: collapse; }
.fee-totals th { text-align: right; font-weight: normal; padding: 1px 8px; }
.paidbox { font-size: 12px; }
@media (max-width: 760px) { .feepanel { grid-template-columns: 1fr; } .fee-list { max-height: 180px; } }

.green { color: #5fd35f; }
.feelines td.num { white-space: nowrap; width: 1%; }
.feelines td:first-child { width: 99%; }
.estack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.estack > * { width: 100%; box-sizing: border-box; }

/* Photo editor (same layout as Horizon's) */
.ped { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.75); display: flex; align-items: flex-start; justify-content: center; padding: 20px 10px; overflow-y: auto; }
.ped[hidden] { display: none; }
.ped > div { background: #222628; }
.ped-left { width: 220px; flex: 0 0 220px; padding: 10px; display: flex; flex-direction: column; gap: 8px; border: 1px solid #555; border-right: 0; }
.ped-right { flex: 0 1 820px; padding: 10px; border: 1px solid #555; min-width: 0; }
.ped-h { font-size: 11px; color: #ddd; margin-bottom: 6px; }
.ped-shapes { display: flex; flex-direction: column; align-items: center; gap: 30px; padding: 20px 0; }
.ped-shapes canvas { cursor: pointer; border-radius: 6px; }
.ped-shapes canvas:hover { background: #333a3e; }
.ped-hide { align-self: flex-end; font-size: 10px; color: #bbb; }
.ped-options { border: 1px dashed #555; padding: 6px; display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.ped-options[hidden] { display: none; }
.ped-options input[type=range] { width: 100%; }
.ped-r { accent-color: #d22; } .ped-g { accent-color: #3a3; } .ped-b { accent-color: #36c; }
.ped-text { display: flex; gap: 4px; }
.ped-text input { flex: 1; min-width: 0; background: #3b3b10; color: #fff; border: 1px solid #777; }
.ped-btns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.ped-btns span { display: flex; gap: 6px; justify-content: center; }
#pedCanvas { display: block; background: #000; touch-action: none; cursor: move; border: 1px solid #555; }
.ptile .cap { width: 100%; box-sizing: border-box; font-size: 10px; }
@media (max-width: 760px) {
  .ped { flex-direction: column; align-items: stretch; }
  .ped-left { width: auto; flex: none; border-right: 1px solid #555; border-bottom: 0; }
  .ped-shapes { flex-direction: row; justify-content: center; padding: 6px 0; }
}
.ped-right { flex: 1 1 820px; max-width: 900px; }
.ped-btns .btn { white-space: normal; }
.pub-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; align-items: end; }
.pub-sum label { display: flex; flex-direction: column; font-size: 11px; }

/* ---- login ---- */
.login-wrap { display: flex; justify-content: center; padding: 40px 0 60px; }
.login-box { width: 340px; max-width: 100%; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form label { display: flex; flex-direction: column; gap: 3px; }
.login-form input { padding: 5px 6px; }
.login-form .btn { align-self: flex-start; }
.mainnav form.logoff { display: inline; margin: 0; }
.mainnav form.logoff button { background: none; border: 0; padding: 0; font: inherit; font-weight: bold; color: var(--nav-text); cursor: pointer; }
.mainnav form.logoff button:hover { color: #555; }

/* ---------- Profile > Title Page ---------- */
.tp-wrap { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.tp-left { flex: 1 1 520px; min-width: 0; }
.tp-right { flex: 0 0 420px; position: sticky; top: 8px; }
.tp-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.tp-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 4px; border: 1px solid transparent; }
.tp-choice.on { border-color: #3fa34d; }
.tp-choice.on .tp-name { text-decoration: underline; font-weight: bold; }
.tp-mini { display: block; width: 122px; height: 158px; overflow: hidden; border: 1px solid #444; background: #fff; position: relative; }
.tp-mini iframe { position: absolute; left: 0; top: 0; width: 816px; height: 1056px; border: 0; transform: scale(.15); transform-origin: 0 0; pointer-events: none; }
.tp-big { width: 408px; height: 528px; overflow: hidden; border: 1px solid #444; background: #fff; position: relative; }
.tp-big iframe { position: absolute; left: 0; top: 0; width: 816px; height: 1056px; border: 0; transform: scale(.5); transform-origin: 0 0; }
.tp-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tp-slot { border: 1px solid #444; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.tp-slot-h { font-weight: bold; }
.tp-slot-img { height: 110px; display: flex; align-items: center; justify-content: center; background: #fff; }
.tp-slot-img img { max-width: 100%; max-height: 110px; }
.tp-slot input[type=file] { max-width: 100%; }

/* ---------- Profile > Cover Letters ---------- */
.cl-wrap { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.cl-list { flex: 0 1 380px; }
.cl-edit { flex: 1 1 480px; }
.cl-list tr.sel td { background: rgba(80, 140, 255, .18); }
form.inline { display: inline; }
.nowrap { white-space: nowrap; }
.pub-letter textarea { margin: 4px 0; }
hr.sep { border: 0; border-top: 1px solid #444; margin: 10px 0; }

/* ---------- light theme: colours written straight into the rules above, for the default (light) look ---------- */
html:not(.dark) .body { border-color: #d9d9d9; }
html:not(.dark) .btn-ghost { background: #4b5a7d; }
html:not(.dark) .linkbtn { color: var(--link); }
html:not(.dark) input, html:not(.dark) select, html:not(.dark) textarea { border-color: #a9a9a9; }
html:not(.dark) .grid th a, html:not(.dark) .gridpager a, html:not(.dark) .ar-aging th a, html:not(.dark) .emailform .erow > span { color: var(--link); }
html:not(.dark) .grid td { border-top-color: #dddddd; }
html:not(.dark) .todaykey { color: #000; }
html:not(.dark) .imported { background: #e8edf7; color: #2a3a5a; border-color: #b5c2dd; }
html:not(.dark) .subnav a { color: #333; }
html:not(.dark) .subnav a:hover { color: #000; }
html:not(.dark) .card { background: #ffffff; border-color: #d3d3d3; }
html:not(.dark) .card:hover { border-color: #9a9a9a; }
html:not(.dark) .card.on { background: #f4f4f4; border-color: #b5b5b5; }
html:not(.dark) .card .arrow { background: radial-gradient(circle at 35% 30%, #ffe680, #f2b705 70%); color: #fff; box-shadow: 0 0 0 1px #d49b00; font-weight: bold; }
html:not(.dark) .card.on .arrow { background: radial-gradient(circle at 35% 30%, #7ee07e, #2c9c35 70%); box-shadow: 0 0 0 1px #217a29; }
html:not(.dark) .tabs { background: #e6e6e6; border-top-color: #cccccc; }
html:not(.dark) .tab { color: #333; border-right-color: #cccccc; }
html:not(.dark) .tab:hover { background: #d6d6d6; }
html:not(.dark) .tab.on { background: #ffffff; color: #000; }
html:not(.dark) .tab .dot { color: #2e8b2e; }
html:not(.dark) .pager a { color: #333; border-color: #aaaaaa; }
html:not(.dark) .pager a.on { background: #333; color: #fff; }
html:not(.dark) .subtabs { background: #eeeeee; }
html:not(.dark) .subtabs a { color: #555; border-right-color: #cccccc; }
html:not(.dark) .subtabs a.on { background: #ffffff; color: #000; }
html:not(.dark) .group-title { background: #f4f4f4; }
html:not(.dark) .group-links a { color: var(--link); }
html:not(.dark) .reqmark { color: #c46a00; }
html:not(.dark) .chip { color: #222; border-color: #9a9a9a; }
html:not(.dark) .chip:hover { border-color: #333; color: #000; }
html:not(.dark) .chip.on, html:not(.dark) .chip.on:hover { color: #fff; border-color: #1f4fa8; }
html:not(.dark) .chip.on.always { background: #2f8a3f; border-color: #2f8a3f; }
html:not(.dark) .ico { background: #ececec; box-shadow: inset 0 0 0 1px #c8c8c8; }
html:not(.dark) .ico:hover { background: #dcdcdc; }
html:not(.dark) .dialog { background: #ffffff; border-color: #999; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
html:not(.dark) .photogrid { background: #fafafa; }
html:not(.dark) .ptile { border-color: #cccccc; }
html:not(.dark) .ptile.sel { background: #e6efff; }
html:not(.dark) .ptile .del { color: #333; }
html:not(.dark) .dayhead.today { color: #2e8b2e; }
html:not(.dark) .schedrow { border-bottom-color: #dddddd; }
html:not(.dark) .kv tr.strong th, html:not(.dark) .kv tr.strong td, html:not(.dark) .grid tr.strong td { color: #000; }
html:not(.dark) .inv-draft { color: #555; }
html:not(.dark) .inv-sent { color: var(--link); }
html:not(.dark) .ar-aging td.ar-on { background: #dbe5ff; }
html:not(.dark) .grid tr.ar-late td { background: #fde8e8; }
html:not(.dark) .flash { background: #e6f4e6; border-color: #99cc99; color: #1e3a1e; }
html:not(.dark) .flash-err, html:not(.dark) .errors { background: #fde8e8; border-color: #e0a0a0; color: #660000; }
html:not(.dark) .mailbanner.mb-log { background: #eef2fa; border-color: #b5c2dd; color: #223; }
html:not(.dark) .mailbanner.mb-live { background: #fde8e8; border-color: #e0a0a0; color: #600; }
html:not(.dark) .mailbanner.mb-redirect { background: #fff8cc; border-color: #e5d44a; color: #5a4a00; }
html:not(.dark) .mailstatus { background: #e6e6e6; color: #333; }
html:not(.dark) .mailerr { color: #c00; }
html:not(.dark) .lttc-list, html:not(.dark) .illus-pick, html:not(.dark) .illus-opt, html:not(.dark) .illus-tile, html:not(.dark) .tp-mini, html:not(.dark) .tp-big, html:not(.dark) .tp-slot, html:not(.dark) .fee-inv { border-color: #cccccc; }
html:not(.dark) .lttc-opt { background: #ffffff; color: #222; border-color: #aaaaaa; }
html:not(.dark) .lttc-opt.on { background: #1f5fae; color: #fff; }
html:not(.dark) .illus-opt.on { background: #e6efff; }
html:not(.dark) .cz-bar { background: #dbe7f5; }
html:not(.dark) .sortlist li { border-bottom-color: #dddddd; }
html:not(.dark) .fee-list { background: #ffffff; border-color: #cccccc; }
html:not(.dark) .fee-pick { color: #222; }
html:not(.dark) .fee-pick:hover { background: #dbe7f5; }
html:not(.dark) .green { color: #2e8b2e; }
html:not(.dark) .mainnav .sep { color: #999; }
html:not(.dark) hr.sep { border-top-color: #dddddd; }
html:not(.dark) .cl-list tr.sel td { background: #e3ecff; }

/* Report Writing: added to the Summary = red border (blue = ticked, green = in every report). */
.chip.on.insum, html:not(.dark) .chip.on.insum { border-color: #e0201b; box-shadow: 0 0 0 2px #e0201b; }
.chip.on.insum:hover { border-color: #ff4a45; }

/* Dark mode switch in the header */
.themebtn { background: none; border: 1px solid #bbb; color: #666; font: bold 9.5px var(--font); padding: 1px 6px; cursor: pointer; border-radius: 2px; margin-left: auto; align-self: flex-start; margin-top: 18px; margin-right: 8px; }
.themebtn:hover { color: #000; border-color: #666; }

/* ---------- Business at a Glance ---------- */
.bag { border-bottom: 2px solid var(--panel-border); padding: 8px 0 4px; margin-bottom: 6px; }
.bag-title { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.bag-bars { display: grid; grid-template-columns: 120px 1fr; gap: 3px 8px; align-items: center; }
.bag-lbl { text-align: right; font-weight: bold; font-size: 10px; white-space: nowrap; }
.bag-track { display: flex; align-items: center; gap: 5px; min-height: 16px; background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px), rgba(128,128,128,.18) calc(12.5% - 1px) 12.5%); }
.bag-bar { background: #2f5fb3; height: 14px; min-width: 2px; position: relative; }
.bag-bar span { position: absolute; right: 3px; top: 0; font-size: 10px; line-height: 14px; color: #fff; white-space: nowrap; }
.bag-zero { font-size: 10px; color: var(--text-dim); }
.bag-stack { display: flex; height: 16px; min-width: 2px; }
.bag-stack i { display: block; height: 100%; border-right: 1px solid rgba(255,255,255,.5); }
.bag-total { font-size: 10px; color: #2e9a2e; white-space: nowrap; }
.bag-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0 0 6px 128px; font-size: 10px; }
.bag-legend i { display: inline-block; width: 18px; height: 10px; margin-right: 4px; vertical-align: -1px; }
.bag-scroll { overflow-x: auto; }
.bag-chart { border-collapse: collapse; font-size: 10px; }
.bag-chart th, .bag-chart td { padding: 2px 5px; text-align: right; white-space: nowrap; }
.bag-chart tbody th { text-align: left; }
.bag-chart th.rot { vertical-align: bottom; height: 190px; padding: 0 2px; }
.bag-chart th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: normal; }
.bag-chart tr.tot td, .bag-chart tr.tot th, .bag-fiscal tr.tot td { font-weight: bold; border-top: 1px solid var(--panel-border); }
.bag-fiscal { border-collapse: collapse; font-size: 10.5px; }
.bag-fiscal th, .bag-fiscal td { padding: 3px 10px; text-align: right; }
.bag-fiscal tbody th { text-align: left; font-weight: normal; }
.bag-fiscal td.neg { color: #e0201b; }
.bag-btns { margin-top: 6px; }
.bag-list td { vertical-align: middle; }

/* ---------- compact email templates / text options ---------- */
.tpl-list { border: 1px solid var(--panel-border); }
.tpl { border-bottom: 1px solid var(--panel-border); }
.tpl:last-child { border-bottom: 0; }
.tpl > summary { cursor: pointer; padding: 4px 6px; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl > summary::-webkit-details-marker { display: none; }
.tpl > summary::before { content: "▸"; display: inline-block; width: 12px; color: var(--text-dim); }
.tpl[open] > summary::before { content: "▾"; }
.tpl > summary:hover { background: rgba(128,128,128,.12); }
.tpl-edit { padding: 2px 8px 8px 18px; }
.row label.grow { flex: 1 1 260px; display: flex; gap: 4px; align-items: center; }
details.txo > summary { cursor: pointer; }
.txo-grid td { vertical-align: top; }
.txo-text { width: 55%; }
.txo-text input + input { margin-top: 3px; }
.txo-new td { background: rgba(128,128,128,.08); }
