/* Screen-only refinements: paper layouts retain their existing rules. */
@media screen {
  #view-work { padding: 24px; gap: 20px; }
  #view-work > .panel { min-width: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
  #view-work .panel-hd { padding: 0 0 20px; background: transparent; gap: 16px; border-bottom: 0; }
  #view-work .panel-hd h2 { font-size: 24px !important; font-weight: 700; line-height: 1.5; letter-spacing: 0 !important; color: var(--ink); }
  #view-work .panel-hd .mini { font-size: 12px; white-space: nowrap; }
  #view-work .panel-bd { padding: 0; overflow: visible; }
  #view-work .no-bar { padding: 10px 16px; margin-bottom: 16px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; gap: 12px 24px; }
  #view-work.two-col .no-bar > div:first-child { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
  #view-work .no-bar .k { color: var(--muted); font-size: 12px; letter-spacing: 0; }
  #view-work .no-bar .v { margin-top: 0; color: var(--brand); font-family: inherit; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; letter-spacing: .3px; line-height: 1.5; overflow-wrap: anywhere; }
  #view-work .no-bar .seq label, #view-work .no-hint { color: var(--muted); font-size: 12px; }
  #view-work .no-bar .seq input { background: #fff; color: var(--ink); border: 1px solid #bbcbd5; min-height: 36px; }
  #view-work.two-col #formBody > .sg-cols { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
  #view-work.two-col #formBody > .sg-cols > .sg-col { gap: 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  #view-work #formBody:is([data-kind=fh], [data-kind=cg]) > .sg-cols > .sg-col:first-child .fld:has(> :is(#f_customer, #f_supplier, #f_custAddr, #f_supAddr, #f_shipper, #f_buyer, #f_shipAddr, #f_buyAddr)) { grid-column: 1 / -1; }
  #view-work fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
  #view-work .sg-col > fieldset + fieldset, #view-work .entry-support { margin-top: 16px; padding-top: 12px; border-top: 1px solid #e6edf1; }
  #view-work .grp-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0; padding: 0; margin-bottom: 16px; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.5; letter-spacing: 0; }
  #view-work .entry-support { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  #view-work .entry-remark textarea { height: 68px; min-height: 68px; resize: vertical; }
  #view-work .entry-section-number { display: none; }
  #view-work .entry-items > .grp-title::after { content: attr(data-count); font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }
  #view-work .grid2 { gap: 12px; }
  #view-work .fld { gap: 6px; margin-bottom: 0; }
  #view-work .fld > label { margin-bottom: 0; font-size: 12px; line-height: 1.5; letter-spacing: 0; color: #526878; }
  #view-work .fld input { min-height: 34px; padding: 6px 10px; font-size: 13px; border: 1px solid #c7d4dd; border-radius: 6px; background: #fff; }
  #view-work textarea { padding: 6px 10px; min-height: 68px; font-size: 12.5px; border: 1px solid #c7d4dd; border-radius: 6px; line-height: 1.8; background: #fff; }
  #view-work input::placeholder, #view-work textarea::placeholder { color: #607585; }
  #view-work .entry-item-tools { gap: 8px; margin: 0 0 12px !important; align-items: center; }
  #view-work #btnAddItem { color: #fff; background: var(--brand); border-color: var(--brand); }
  #view-work #btnAddItem:hover { background: #163f51; }
  #view-work .entry-options { gap: 10px 16px; padding: 10px 12px; margin: 0 0 16px; background: #f5f8fa; border-radius: 6px; align-items: center; }
  #view-work .entry-options .pu-row { margin: 0; }
  #view-work .entry-options #priceUnitHint { color: var(--muted); }
  #view-work .entry-guide { margin-left: auto; font-size: 12px; color: var(--muted); }
  #view-work .entry-guide summary { cursor: pointer; padding: 4px 0; text-underline-offset: 3px; }
  #view-work .entry-guide summary:hover { color: var(--brand); text-decoration: underline; }
  #view-work .entry-guide[open] { flex-basis: 100%; margin-left: 0; }
  #view-work .entry-guide > .note { display: block; padding-top: 6px; line-height: 1.8; max-width: 72ch; }
  #view-work .entry-item-tools > .note { flex-basis: 100%; color: var(--muted); font-size: 12px; line-height: 1.7; }
  #view-work .toolbar .switch { font-size: 12px; min-height: 32px; }
  #view-work .toolbar .switch input { width: 16px; height: 16px; }
  #view-work .btn, #view-work .wb-btn { letter-spacing: 0; }
  #view-work .btn { min-height: 36px; padding: 8px 12px; font-size: 12.5px; border-radius: 6px; box-shadow: none; }
  #view-work .btn.primary { height: auto !important; }
  #view-work .paper-pick { gap: 8px; }
  #view-work .paper-pick select { min-height: 36px; font-size: 13px; }
  #view-work .items-ed { border-radius: 8px; scrollbar-width: thin; scrollbar-color: #a3b4bf #f5f8fa; }
  #view-work .items-ed .hd { padding: 8px; background: #edf3f6; color: #415868; font-size: 12px; font-weight: 500; line-height: 1.7; letter-spacing: 0; }
  #view-work .items-ed .row { padding: 6px 8px; }
  #view-work .items-ed .row:not(.dirty):nth-child(even) { background: #f7fafb; }
  #view-work .items-ed .row input { min-height: 34px; padding: 6px; border-radius: 5px; font-size: 13px; font-variant-numeric: tabular-nums; }
  #view-work .items-ed.dense .row input { font-size: 14px; }
  #view-work .items-ed.dense .hd { font-size: 12.5px; }
  #view-work .items-ed .row input:not([readonly]):not(.cell-dirty) { border-color: #c4d2dc; }
  #view-work .items-ed .row input[readonly] { background: #edf2f5; border-color: #dce5eb; color: #415868; }
  #view-work .items-ed .row .ckbox input[type=checkbox] { min-height: 0; padding: 0; }
  #view-work .items-ed .totrow { padding: 8px; background: #eaf2f6; }
  #view-work .items-ed .del { background: transparent; border-color: transparent; width: 26px; min-height: 32px; color: #a64a43; }
  #view-work .items-ed .del:hover { background: #fdeeee; }
  #view-work .pu-row { margin-top: 14px; gap: 8px 12px; }
  #view-work .pu-row .note { font-size: 12px; color: var(--muted); }
  #view-work .row-btns { gap: 10px; padding-top: 8px; }
  #view-work .entry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; padding: 14px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  #view-work .entry-actions .row-btns { width: 100%; padding-top: 0; }
  #view-work :is(.entry-actions,.entry-item-tools) #sgPrintBtn { margin-left: 0; background: #fff; color: var(--brand); border-color: #b9cad4; }
  #view-work .entry-actions .ship-print-row { margin-top: 0; }
  #view-work .foot-split { margin-top: 8px; }
  #view-work .foot-wb { min-width: 0; }
  #view-work .foot-wb .wb { border: 1px solid #cfddd5; box-shadow: none; overflow-x: auto; scrollbar-width: thin; }
  #view-work .foot-wb .wb-ws-state.off { color: #586d62; }
  #view-work .foot-wb .wb-state { color: #4d6661; }
  #view-work .foot-wb .wb-readout { box-shadow: none; border: 1px solid #cfddd5; }
  #view-work .foot-btns2 .btn, #view-work .wb-col .wb-btn { min-height: 36px; }
  #view-work .entry-row-actions .btn { width: 126px; }
  #view-work .entry-item-tools:not(:has(> button)) { margin: 0 !important; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.6fr); gap: 20px; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .no-bar { align-items: center; align-content: center; gap: 6px; margin: 0; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) .no-hint { margin: 0; text-align: left; font-size: 11px; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-basics { display: flex; align-items: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-basics > .grp-title { display: none; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-basics > .grid2 { width: 100%; grid-template-columns: minmax(150px, .6fr) minmax(0, 1fr); }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-items { grid-column: 1 / -1; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .foot-split { grid-column: 1 / -1; margin-top: 0; }
  #view-work #formBody > #headLists { display: none; }
  #view-work ::selection { background: #1d4e63; color: #fff; }
  #view-work input, #view-work textarea { caret-color: var(--brand); }
  #view-report { padding: 24px; min-width: 0; }
  #view-report .rep-page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
  #view-report .rep-page-head h2 { margin: 0; font-size: 24px; line-height: 1.5; color: var(--ink); letter-spacing: 0; }
  #view-report .rep-page-head p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
  #view-report .btn { min-height: 36px; padding: 8px 12px; border-radius: 6px; font-size: 12.5px; letter-spacing: 0; box-shadow: none; white-space: nowrap; }
  #view-report .btn.primary { height: auto !important; }
  #view-report .rep-bar { display: block; margin-bottom: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  #view-report .rep-filter-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 20px; }
  #view-report .rep-range { display: flex; align-items: flex-end; gap: 12px; padding: 0; background: transparent; border: 0; border-radius: 0; min-width: 0; }
  #view-report .rep-range > div { min-width: 0; }
  #view-report .rep-range label { display: block; margin: 0 0 6px; font-size: 12px; }
  #view-report .rep-range input[type=date] { width: 160px; min-width: 0; min-height: 38px; padding: 8px 10px; background: #fff; border: 1px solid #c7d4dd; border-radius: 6px; font-size: 13px; }
  #view-report .rep-range-separator { padding-bottom: 10px; color: var(--muted); font-size: 12px; }
  #view-report #repQuick { display: flex; gap: 4px; padding: 0; background: transparent; border: 0; box-shadow: none; border-radius: 0; }
  #view-report #repQuick button { min-height: 38px; padding: 8px 12px; background: #f3f7f9; border: 1px solid transparent; color: var(--muted); border-radius: 6px; font-size: 12.5px; box-shadow: none; letter-spacing: 0; }
  #view-report #repQuick button:hover { background: #eaf2f6; color: var(--brand); }
  #view-report #repQuick button.on { background: #eaf2f6; color: var(--brand); border-color: #c3d8e3; font-weight: 600; }
  #view-report #repGo { min-height: 38px; padding-left: 20px; padding-right: 20px; }
  #view-report .rep-filter-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; padding: 12px 20px; border-top: 1px solid #e5edf1; background: #f9fbfc; border-radius: 0 0 12px 12px; }
  #view-report #repSummary { flex: 1; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.8; overflow-wrap: anywhere; }
  #view-report .rep-export { display: flex; flex-shrink: 0; gap: 8px; }
  #view-report .rep-method { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
  #view-report .rep-method summary { cursor: pointer; width: fit-content; padding: 4px 0; text-underline-offset: 3px; }
  #view-report .rep-method summary:hover { color: var(--brand); text-decoration: underline; }
  #view-report .rep-note-line { margin: 8px 0 0; padding: 14px 16px; background: #f5f8fa; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.9; }
  #view-report .rep-status { margin: 0 0 16px; padding: 12px 16px; border-radius: 8px; color: var(--muted); background: #f5f8fa; font-size: 13px; }
  #view-report .rep-status.error { color: #a52f28; background: #fff0ee; }
  #view-report .rep-kpis { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: 1fr; gap: 16px; margin-bottom: 0; }
  #view-report .rep-kpi { min-width: 0; min-height: 138px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
  #view-report .rep-kpi::before { display: none; }
  #view-report .rep-kpi .k { color: var(--muted); font-size: 13px; line-height: 1.5; letter-spacing: 0; }
  #view-report .rep-kpi .v { margin-top: 10px; font-family: inherit; font-size: clamp(20px, 1.35vw, 24px); font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  #view-report .rep-kpi .v small { font-size: 12px; white-space: nowrap; }
  #view-report .rep-kpi .s { margin-top: 8px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }
  #view-report .rep-kpi.gold .v { color: #845f00; }
  #view-report .rep-kpi.warn .v { color: #9a5000; }
  #view-report .rep-main { border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
  #view-report .rep-head { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'title note' 'dims dims'; gap: 16px 24px; padding: 20px; background: #fff; }
  #view-report .rep-head h3 { grid-area: title; font-size: 16px; color: var(--ink); letter-spacing: 0; }
  #view-report .rep-head > .spacer { display: none; }
  #view-report .rep-head > .mini { grid-area: note; font-size: 12px; line-height: 1.7; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
  #view-report .rep-dims { grid-area: dims; gap: 8px; }
  #view-report .rep-dim { min-height: 34px; padding: 7px 12px; font-size: 12.5px; letter-spacing: 0; border-radius: 6px; background: #f8fafb; }
  #view-report .rep-dim.on { background: var(--brand); }
  #view-report .far-tblwrap { max-height: min(65vh, 720px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #a3b4bf #f5f8fa; }
  #view-report table.rep-tbl { min-width: 1280px; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
  #view-report table.rep-tbl.wide { min-width: 1720px; }
  #view-report .rep-tbl th { position: sticky; top: 0; z-index: 2; padding: 8px 12px; background: #edf3f6; border: 0; border-bottom: 1px solid var(--line); font-size: 12px; }
  #view-report .rep-tbl td { padding: 8px 12px; background: #fff; border: 0; border-bottom: 1px solid #e5edf1; line-height: 1.7; }
  #view-report .rep-tbl :is(th, td):first-child:not(:only-child) { position: sticky; left: 0; border-right: 1px solid #e1eaf0; }
  #view-report .rep-tbl th:first-child { z-index: 3; width: 160px; }
  #view-report .rep-tbl td:first-child { z-index: 1; }
  #view-report .rep-tbl .mono { font-family: inherit; font-variant-numeric: tabular-nums; }
  #view-report .rep-tbl td.num { white-space: nowrap; }
  #view-report .rep-tbl td.nm { font-weight: 500; overflow-wrap: anywhere; }
  #view-report .rep-tbl tbody tr:nth-child(even) td { background: #f7fafb; }
  #view-report .rep-tbl tbody tr:hover td { background: #edf5f8; }
  #view-report .rep-tbl tbody tr.rep-tot td { background: #eaf2f6; font-weight: 600; border-top: 1px solid #cddde6; }
  #view-report .rep-share i { background: #2b6b85; }
  #view-report .rep-scroll-hint { display: none; }
  #view-report .rep-chart-scroll-hint { display: none; }
  #view-report .rep-charts, #view-report .rep-row2 { gap: 20px; }
  #view-report .rep-card { padding: 20px; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
  #view-report .rep-card h4 { font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--ink); letter-spacing: 0; }
  #view-report .rep-card .sub { margin-top: 8px; font-size: 12px; line-height: 1.8; }
  #view-report #repTrendBox, #view-report #repPriceBox { margin-top: 16px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #a3b4bf #f5f8fa; }
  #view-report .rep-svg { min-width: 560px; margin-top: 0; }
  #view-report .rep-svg text[fill='#8a97a1'] { fill: #526878; }
  #view-report .rep-legend { margin-top: 16px; gap: 8px 20px; font-size: 12px; line-height: 1.8; }
  #view-report .rep-hbar { grid-template-columns: minmax(110px, 1fr) minmax(0, 1.5fr) 104px; gap: 12px; padding: 8px 0; font-size: 12.5px; }
  #view-report .rep-hbar .nm { white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip; line-height: 1.6; }
  #view-report .rep-hbar .tr { height: 10px; background: #edf3f6; }
  #view-report .rep-hbar .tr i { background: #2b6b85; }
  #view-report .rep-hbar.gold .tr i { background: #a9822b; }
  #view-report .rep-hbar b, #view-report .rep-tip b, #view-report .rep-kv .b b { font-family: inherit; font-variant-numeric: tabular-nums; }
  #view-report .rep-tip { gap: 16px; padding: 12px 0; border-bottom: 1px solid #e5edf1; font-size: 12.5px; }
  #view-report .rep-tip .tag { min-width: 88px; text-align: center; border-radius: 4px; }
  #view-report .rep-kv { gap: 16px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line); }
  #view-report .rep-kv .b { padding: 0; border: 0; border-radius: 0; background: transparent; }
  #view-report .rep-kv .b b { margin-top: 8px; font-size: 19px; }
  #view-report .rep-empty { padding: 40px 20px; line-height: 1.8; }
  #view-report ::selection { background: #1d4e63; color: #fff; }
  #view-report input { caret-color: var(--brand); }
  /* The header keeps brand, connection state and account controls in distinct groups. */
  .app-header { min-height: 72px; gap: 12px; padding: 12px 24px; background: #163d4c; box-shadow: 0 3px 12px rgba(16,34,44,.14); }
  .app-header .mark { width: 44px; height: 44px; border: 0; border-radius: 12px; padding: 6px; background: #fff; box-shadow: none; cursor: pointer; }
  .app-header .mark img { width: 32px; height: 32px; }
  .app-header .app-brand { max-width: min(560px,45vw); }
  .app-header h1 { display: flex; align-items: center; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: .6px; white-space: nowrap; }
  .app-header .brand-name { min-width: 0; white-space: normal; }
  .app-header .brand-name > span { display: inline-block; white-space: nowrap; }
  .app-header .brand-workspace { margin-left: 12px; padding-left: 12px; border-left: 1px solid #66838f; color: #d0e1e8; font-size: 12px; line-height: 16px; font-weight: 400; letter-spacing: 1px; }
  .app-header .sub { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bcd1db; font-size: 11px; line-height: 16px; letter-spacing: .3px; }
  .app-header .conn { min-height: 36px; gap: 8px; padding: 8px 12px; border: 1px solid #486976; border-radius: 8px; background: #214957; color: #d4e5ed; font-size: 12px; line-height: 18px; }
  .app-header .conn .dot { width: 6px; height: 6px; background: #c6d4dc; box-shadow: none; }
  .app-header .conn.ok .dot { background: #90d5b1; }
  .app-header .conn.err { border-color: #986c73; background: #563d42; color: #ffe6e2; }
  .app-header .conn.err .dot { background: #ffb3a4; }
  .app-header .user { flex-shrink: 0; }
  .app-header .user-chip { min-height: 48px; gap: 10px; padding: 6px 12px 6px 7px; border: 1px solid #486976; border-radius: 10px; background: #214957; color: #f3f7f9; transition: background .16s ease, border-color .16s ease; }
  .app-header .user-chip:hover, .app-header .user-chip[aria-expanded="true"] { border-color: #92acb8; background: #305969; }
  .app-header .user-chip .av { width: 32px; height: 32px; border-radius: 9px; background: #f0dfb8; color: #163d4c; font-size: 14px; }
  .app-header .user-identity { display: grid; justify-items: start; gap: 2px; min-width: 0; max-width: 140px; text-align: left; }
  .app-header .user-chip .nm { max-width: 140px; font-size: 13px; line-height: 18px; font-weight: 600; }
  .app-header .role-badge, .app-header .role-badge.op { max-width: 140px; overflow: hidden; text-overflow: ellipsis; padding: 0; border: 0; border-radius: 0; background: transparent; color: #edd9ac; font-size: 11px; line-height: 14px; letter-spacing: .3px; }
  .app-header .role-badge.op { color: #c4dbe5; }
  .app-header .user-chip > svg { width: 14px; height: 14px; margin-left: 2px; opacity: .9; transition: transform .16s ease; }
  .app-header .user-chip[aria-expanded="true"] > svg { transform: rotate(180deg); }
  .app-header :is(.mark,.user-chip,.mobile-nav-toggle):focus-visible { outline: 2px solid #f0dfb8; outline-offset: 3px; }
  .app-header .usermenu { top: calc(100% + 20px); width: 240px; max-width: calc(100vw - 24px); border: 0; border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(16,34,44,.2); }
  .app-header .usermenu .uhd { padding: 12px 12px 14px; }
  .app-header .usermenu .uhd b { margin-bottom: 4px; font-size: 14px; overflow-wrap: anywhere; }
  .app-header .usermenu .uhd span { display: block; color: #526878; line-height: 18px; overflow-wrap: anywhere; }
  .app-header .usermenu button { min-height: 44px; padding: 10px 12px; border-radius: 7px; }
  .app-header .usermenu button:focus-visible { outline: 2px solid #1d4e63; outline-offset: -2px; background: #edf4f7; }
  #mainNav { padding: 20px 12px; gap: 4px; scrollbar-width: thin; scrollbar-color: #bccbd3 transparent; }
  #mainNav .nav-caption { margin: 0 12px 12px; color: #607888; font-size: 11.5px; font-weight: 600; letter-spacing: .5px; }
  #mainNav > button:not(.nav-sub) { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 7px; color: #415a6b; background: transparent; box-shadow: none; font-size: 13px; font-weight: 500; letter-spacing: 0; }
  #mainNav button::before { display: none; }
  #mainNav button:hover { background: #f0f5f7; color: #173f50; }
  #mainNav > button.on:not(.nav-sub) { background: #eaf2f6; color: #173f50; font-weight: 600; }
  #mainNav .nav-icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  #mainNav .nav-parent > span:not(.nav-chevron) { flex: 1; }
  #mainNav .nav-chevron { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); margin-left: auto; flex-shrink: 0; opacity: .7; }
  #mainNav .nav-parent[aria-expanded=true] .nav-chevron { transform: rotate(45deg); }
  #mainNav .nav-divider { margin-top: 12px; }
  #mainNav .nav-sub { margin: 0 0 0 30px; width: calc(100% - 30px); min-height: 36px; padding: 8px 12px; align-items: center; border: 0; border-radius: 6px; font-size: 12.5px; color: #526878; box-shadow: none; letter-spacing: 0; }
  #mainNav .nav-sub.show { display: flex; }
  #mainNav .fin-nav-group { display:flex; align-items:center; gap:8px; flex:0 0 auto; margin:8px 0 0 30px; width:calc(100% - 30px); padding:6px 0 2px; color:#5b7788; font-size:12px; font-weight:600; line-height:20px; white-space:nowrap; }
  #mainNav .fin-nav-group[hidden] { display:none; }
  #mainNav .fin-nav-group::before, #mainNav .fin-nav-group::after { content:''; flex:1; min-width:0; border-top:1px dashed #9db6c5; }
  #mainNav .nav-sub-wrap { gap: 4px; }
  #mainNav button[aria-current=page] { background: #1d4e63; color: #fff; font-weight: 600; box-shadow: none; }
  #view-home { max-width: 1480px; height: calc(100vh - var(--hd, 72px)); height: calc(100dvh - var(--hd, 72px)); min-height: 0; padding: 32px 24px 24px; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 16px; justify-content: normal; }
  #view-home .home-grid { min-height: 0; grid-template-columns: minmax(0, 1fr) 440px; gap: 28px; align-items: stretch; }
  #view-home .home-main, #view-home .home-side { min-height: 0; display: flex; flex-direction: column; }
  #view-home .home-sec, #view-home .home-side h3, #view-home .home-side .side-tip { flex-shrink: 0; }
  #view-home .home-sec, #view-home .home-side h3 { margin: 0; color: var(--ink); font-size: 20px; line-height: 1.4; letter-spacing: 0; }
  #view-home .home-sec-tip { display: block; margin: 8px 0 20px; font-size: 12px; color: var(--muted); letter-spacing: 0; line-height: 1.6; }
  #view-home .cards { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; }
  #view-home .cards:not(:has(.home-first)) { display: none; }
  #view-home .card { display: grid; flex-shrink: 0; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-rows: auto auto auto; align-items: start; column-gap: 16px; row-gap: 8px; width: 100%; height: auto; min-height: 144px; padding: 24px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #fff; box-shadow: none; transition: background .15s; }
  #view-home .card.home-first { border-top: 0; }
  #view-home .card::before { display: none; }
  #view-home .card:hover { background: #f5f9fb; transform: none; box-shadow: none; }
  #view-home .card:focus-visible { outline-offset: -4px; }
  #view-home .card .ico { grid-column: 1; grid-row: 1 / 4; width: 28px; height: 28px; margin: 0; border-radius: 0; color: var(--brand); background: transparent; }
  #view-home .card .ico svg { width: 26px; height: 26px; }
  #view-home .card h3 { grid-column: 2; grid-row: 1; font-size: 16px; line-height: 1.6; letter-spacing: 0; font-weight: 600; }
  #view-home .card .desc { grid-column: 2; grid-row: 2; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.8; }
  #view-home .card .stat { grid-column: 2; grid-row: 3; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; border: 0; line-height: 1.6; }
  #view-home .card .stat b { font-size: 14px; font-family: inherit; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
  #view-home .card .stat span { color: var(--muted); font-size: 12px; }
  #view-home .card .go { grid-column: 3; grid-row: 1 / 4; position: static; align-self: center; display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 0; }
  #view-home .card .go::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
  #view-home .card .lock-tag { grid-column: 2; margin: 0; }
  #view-home .home-side { position: static; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  #view-home .home-side .side-tip { margin: 8px 0 20px; font-size: 12px; line-height: 1.6; letter-spacing: 0; }
  #view-home .changelog { flex: 1 1 auto; min-height: 0; padding: 8px 24px; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow-x: hidden; overflow-y: scroll; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
  #view-home .changelog > li:nth-child(n+6) { display: none; }
  #view-home :is(.cards,.changelog) { scrollbar-color: #6c8796 #eef3f6; }
  #view-home :is(.cards,.changelog)::-webkit-scrollbar { width: 10px; }
  #view-home :is(.cards,.changelog)::-webkit-scrollbar-track { background: #eef3f6; border-radius: 10px; }
  #view-home :is(.cards,.changelog)::-webkit-scrollbar-thumb { background: #6c8796; border: 2px solid #eef3f6; border-radius: 10px; }
  #view-home :is(.cards,.changelog):focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
  #view-home .changelog li { padding: 18px 0; border-top: 1px solid var(--line); }
  #view-home .changelog li:first-child { padding-top: 18px; border-top: 0; }
  #view-home .changelog .d { border: 0; padding: 0; background: transparent; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--brand); letter-spacing: 0; font-variant-numeric: tabular-nums; }
  #view-home .changelog p { margin-top: 8px; font-size: 12.5px; line-height: 1.85; color: var(--ink2); }
  #view-home .foot { padding-top: 12px; margin-top: 0; border-top: 1px solid var(--line); text-align: left; color: var(--muted); font-size: 11.5px; line-height: 1.9; }
  #view-home .home-help summary { width: fit-content; min-height: 32px; padding: 4px 0; cursor: pointer; color: var(--ink2); font-size: 12px; line-height: 24px; }
  #view-home .home-help summary:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
  #view-home .home-help summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
  #view-home .home-help-body { padding-top: 4px; }
  #view-home .home-empty { margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: 14px; line-height: 1.8; }
  #finPanePay .pay-page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 4px 0 20px; }
  #finPanePay .pay-page-head h2 { margin: 0; color: var(--ink); font-size: 24px; letter-spacing: 0; }
  #finPanePay .pay-page-head p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
  #finPanePay .btn { min-height: 36px; padding: 7px 12px; font-size: 12.5px; letter-spacing: 0; }
  #finPanePay .pay-overview { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.3fr); align-items: center; gap: 24px 40px; padding: 24px; margin-bottom: 20px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  #finSgBar { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 0; margin: 0; min-width: 0; }
  #finSgBar .fin-ym { flex: none; flex-direction: column; align-items: stretch; padding: 0; border: 0; gap: 10px; }
  #finSgBar label { font-size: 13px; font-weight: 600; color: var(--ink); }
  #finSgBar #finSgSel { min-width: 0 !important; max-width: 100% !important; width: 100%; min-height: 40px; padding: 8px 10px; font-size: 14px; border: 1px solid #b9cad4; border-radius: 6px; background: #f8fbfc; }
  #finSgInfo { flex: none; align-self: stretch; white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.85; font-size: 12px; color: var(--muted); }
  #finTotLine { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; margin: 0; padding: 0; min-width: 0; }
  #finTotLine .t { min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
  #finTotLine .t.empty { grid-column: 1 / -1; font-size: 12px; overflow-wrap: anywhere; }
  #finTotLine .t.empty b { white-space: normal; }
  #finTotLine .pay-amount { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
  #finTotLine .pay-amount span { font-size: 13px; }
  #finTotLine .pay-amount b { font-size: clamp(19px, 1.35vw, 26px); color: var(--ink); letter-spacing: -.3px; overflow-wrap: anywhere; }
  #finTotLine .warn b { color: #aa5100; }
  #finTotLine .t:not(.pay-amount) b { font-size: 13px; }
  #finPanePay .pay-workspace { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
  #finPanePay .pay-filter-bar { gap: 12px; margin: 0; padding: 20px; border-bottom: 1px solid var(--line); background: #fff; }
  #finPanePay .pay-filter-bar .fin-ym { min-height: 38px; padding: 6px 8px; border-radius: 6px; gap: 6px; }
  #finPanePay .pay-filter-bar .fin-ym select { font-size: 13px; max-width: 120px; min-width: 0; }
  #finPanePay .pay-filter-bar label { flex-shrink: 0; white-space: nowrap; }
  #finPanePay .pay-filter-controls { display: flex; gap: 8px; flex-shrink: 0; }
  #finPanePay #finYmBox { flex: 1 1 300px; }
  #finPanePay #finYmBox select { width: 60px; flex: 1; }
  #finPanePay #finInvBox, #finPanePay #finPayBox { flex: 1 1 130px; }
  #finPanePay .fin-search { padding: 6px 8px; border-radius: 6px; min-height: 38px; }
  #finPanePay .fin-search { flex: 1 1 150px; }
  #finPanePay .fin-search input { width: 100%; min-width: 0; font-size: 13px; }
  #finPanePay input::placeholder { color: var(--muted); }
  #finPanePay .pay-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
  #finPanePay .pay-actions-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
  #finPanePay .pay-write-actions { flex: 1 1 380px; justify-content: flex-end; }
  #finPanePay .pay-pick-info { margin-right: auto; font-size: 12px; color: var(--muted); }
  #finPanePay .far-main { border: 0; box-shadow: none; border-radius: 0; }
  #finPanePay .pay-table-head { align-items: center; padding: 16px 20px; gap: 8px; background: #f8fafb; }
  #finPanePay .pay-table-head > div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 8px 16px; width: 100%; }
  #finPanePay .pay-table-head > .spacer { display: none; }
  #finPanePay .pay-table-head h3 { display: inline; font-size: 15px; letter-spacing: 0; margin-right: 12px; }
  #finPanePay #finSummary { font-size: 12px; grid-column: 1 / -1; }
  #finPanePay #finSummary:empty { display: none; }
  #finPanePay .pay-help { margin: 0; max-width: 72ch; color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
  #finPanePay .pay-help summary { cursor: pointer; width: fit-content; text-underline-offset: 3px; }
  #finPanePay .pay-help summary:hover { color: var(--brand); text-decoration: underline; }
  #finPanePay #finSub { font-size: 12px; line-height: 1.8; padding-top: 6px; }
  #finPanePay .fin-lastsave { margin: 0; font-size: 11.5px; grid-column: 2; grid-row: 1; text-align: right; }
  #finPanePay #finPiiHint { grid-column: 1 / -1; }
  #finPanePay #finStatus:empty { display: none; }
  #finPanePay .fin-lastsave b { padding: 0; color: var(--muted); background: transparent; border: 0; font-weight: 500; }
  #finPanePay .far-tblwrap { max-height: min(58vh, 680px); overflow: auto; scrollbar-color: #a3b4bf var(--soft); scrollbar-width: thin; }
  #finPanePay .fin-tbl { min-width: 1420px; border-collapse: separate; border-spacing: 0; }
  #finPanePay .fin-tbl th { position: sticky; top: 0; z-index: 1; background: #edf3f6; font-size: 12px; padding: 12px 8px; border: 0; border-bottom: 1px solid var(--line); }
  #finPanePay .fin-tbl td { padding: 8px 6px; border: 0; border-bottom: 1px solid #e5edf1; font-size: 12.5px; }
  #finPanePay .fin-tbl th:last-child, #finPanePay .fin-tbl td:last-child:not(:first-child) { position: sticky; right: 0; width: 88px !important; box-shadow: -3px 0 6px rgba(20,40,60,.06); }
  #finPanePay .fin-tbl th:last-child { z-index: 2; }
  #finPanePay .fin-tbl tr:not(.fin-row-done):not(.fin-dirty) td:last-child:not(:first-child) { background: #fff; }
  #finPanePay .fin-tbl [data-fin-pick], #finPickAll { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
  #finPanePay .fin-tbl tr:has([data-fin-pick]:checked) td:first-child { box-shadow: inset 3px 0 var(--brand); }
  #finPanePay .fin-foot { gap: 10px 22px; padding: 16px 20px; background: #f8fafb; font-size: 12px; }
  #finPanePay .pay-scroll-hint { display: none; }
  :root { --muted: #526878; }
  input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
  .mobile-nav-toggle { display: none; }
  .app-brand, .fin-wrap, .fin-bar, .fin-ym { min-width: 0; }
  .dlg-bd { min-height: 0; overscroll-behavior: contain; }
  .mask .dlg { max-height: calc(100dvh - 44px); }
  .dlg-hd .x { min-width: 36px; min-height: 36px; }
  :is(#maskSgFlows,#maskCkFlows) .dlg-hd { padding: 16px 24px; flex-shrink: 0; }
  :is(#maskSgFlows,#maskCkFlows) .dlg-hd h3 { font-size: 16px; overflow-wrap: anywhere; }
  :is(#maskSgFlows,#maskCkFlows) .dlg-bd { padding: 20px 24px 24px; }
  :is(#sgfMeta,#ckfMeta) { display: flex; flex-wrap: wrap; gap: 12px 28px; padding-bottom: 18px; font-size: 13px; }
  :is(#sgfMeta,#ckfMeta) > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
  :is(#sgfMeta,#ckfMeta) span, .sgf-note, .sgf-section-hd > span { color: var(--muted); }
  :is(#sgfMeta,#ckfMeta) b { font-weight: 600; overflow-wrap: anywhere; }
  :is(#sgfMeta,#ckfMeta) .sgf-readonly { margin: 0; width: 100%; color: #825000; }
  :is(#sgfSum,#ckfSum) { padding: 18px 20px 0; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
  .sgf-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .sgf-money > div { display: flex; flex-direction: column; gap: 6px; }
  .sgf-money span { font-size: 13px; color: var(--ink2); }
  .sgf-money strong { font-size: 23px; line-height: 1.3; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
  .sgf-money .sgf-due strong { color: #aa5100; }
  .sgf-progress { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 14px 0; font-size: 12.5px; color: var(--ink2); }
  .sgf-reconcile { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; margin: 0 -20px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.7; }
  .sgf-match { color: #18603e; font-weight: 600; }
  .sgf-match::before { content: ''; display: inline-block; width: 6px; height: 10px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: 0 9px 0 2px; }
  .sgf-mismatch { color: #825000; }
  .sgf-section { margin-top: 24px; }
  .sgf-section-hd { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
  .sgf-section-hd h4, .sgf-empty h4 { margin: 0; font-size: 14px; font-weight: 600; }
  .sgf-section-hd > span { font-size: 12.5px; }
  .sgf-table-wrap { width: 100%; max-height: min(42vh, 440px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; overscroll-behavior: contain; scrollbar-color: #a3b4bf var(--soft); scrollbar-width: thin; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 690px; font-size: 13px; line-height: 1.6; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table th, :is(#maskSgFlows,#maskCkFlows) .sgf-table td { display: table-cell; padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid #e7edf1; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table th { position: sticky; top: 0; z-index: 1; background: #edf3f6; color: var(--ink2); font-weight: 600; font-size: 12px; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table td { background: #fff; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table tbody tr:nth-child(even) td { background: #f8fafb; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table tbody tr:hover td { background: #edf5f8; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-table tbody tr:last-child td { border-bottom: 0; }
  #maskCkFlows .sgf-table td.num, #ckfCars th:nth-child(n+4):nth-child(-n+6), #ckfFlows th:nth-child(3) { text-align: right; }
  :is(#maskSgFlows,#maskCkFlows) .num, .sgf-money, .sgf-reconcile { font-variant-numeric: tabular-nums; }
  .sgf-invoice { color: var(--muted); font-size: 12px; }
  .sgf-invoice.is-done { color: #18603e; font-weight: 600; }
  .sgf-note { margin: 0 0 12px; font-size: 12.5px; line-height: 1.7; }
  .sgf-scroll-hint { display: none; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-flow-table td:nth-child(6) { min-width: 160px; max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
  .sgf-empty { display: flex; align-items: center; gap: 14px; padding: 20px 0 0; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); }
  .sgf-empty svg { flex-shrink: 0; }
  .sgf-empty h4 { color: var(--ink2); font-size: 13px; }
  .sgf-empty p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.7; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-state { margin: 0; padding: 16px 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
  :is(#sgfFlows,#ckfFlows) > .sgf-state { margin-top: 16px; }
  :is(#maskSgFlows,#maskCkFlows) .sgf-error { color: #a52f28; }
}
@media screen and (min-width: 1101px) {
  #view-work.two-col #formBody:is([data-kind=fh], [data-kind=cg]) > .sg-cols { grid-template-columns: clamp(420px, 42%, 660px) minmax(0, 1fr); }
}
@media screen and (min-width: 1500px) {
  #view-report .rep-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  #view-report .rep-charts > :nth-child(n+3) { grid-column: 1 / -1; }
}
@media screen and (max-width: 1100px) {
  #view-home .home-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; }
  #finPanePay .pay-overview { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  #finTotLine { padding-top: 20px; border-top: 1px solid var(--line); }
  #finPanePay .pay-write-actions { justify-content: flex-start; flex-basis: 100%; }
}
@media screen and (max-width: 1100px) {
  #view-work.two-col #formBody > .sg-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #view-work .foot-wb .wb { overflow-x: auto; scrollbar-width: thin; }
}
@media screen and (max-width: 600px) {
  :is(#maskSgFlows,#maskCkFlows) .dlg-hd { padding: 12px 16px; }
  :is(#maskSgFlows,#maskCkFlows) .dlg-hd h3 { font-size: 14px; line-height: 1.6; }
  :is(#maskSgFlows,#maskCkFlows) .dlg-bd { padding: 16px; }
  :is(#sgfMeta,#ckfMeta) { gap: 10px 18px; font-size: 12px; }
  :is(#sgfMeta,#ckfMeta) > div:nth-child(2), :is(#sgfMeta,#ckfMeta) > div:last-of-type { width: 100%; }
  :is(#sgfSum,#ckfSum) { padding: 14px 14px 0; }
  .sgf-money { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .sgf-money strong { font-size: 20px; }
  .sgf-money > div:last-child { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 12px; }
  .sgf-reconcile { margin: 0 -14px; padding: 10px 14px; }
  .sgf-table-wrap { max-height: 360px; }
  .sgf-scroll-hint { display: block; margin: 0 0 10px; color: var(--muted); font-size: 12px; }
}
@media screen and (max-width: 760px) {
  #view-report { padding: 20px 12px; }
  #view-report .rep-page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; margin-bottom: 16px; }
  #view-report .rep-page-head > div { display: contents; }
  #view-report .rep-page-head h2 { font-size: 21px; }
  #view-report .rep-page-head h2 { grid-column: 1; grid-row: 1; }
  #view-report #repRefresh { grid-column: 2; grid-row: 1; }
  #view-report .rep-page-head p { grid-column: 1 / -1; grid-row: 2; max-width: none; margin: 0; font-size: 12px; }
  #view-report .btn { min-height: 40px; }
  #view-report .rep-filter-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; }
  #view-report .rep-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #view-report .rep-range-separator { display: none; }
  #view-report .rep-range input[type=date] { width: 100%; font-size: 16px; }
  #view-report #repQuick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #view-report #repQuick button { min-height: 40px; padding: 8px 4px; }
  #view-report .rep-filter-meta { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  #view-report #repSummary { flex-basis: 100%; }
  #view-report .rep-export { width: 100%; }
  #view-report .rep-export .btn { flex: 1; }
  #view-report .rep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #view-report .rep-kpi { min-height: 144px; padding: 16px 12px; }
  #view-report .rep-kpi .v { font-size: 20px; }
  #view-report .rep-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'title' 'note' 'dims'; padding: 16px; gap: 12px; }
  #view-report .rep-head > .mini { text-align: left; }
  #view-report .rep-dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #view-report .rep-dim { min-width: 0; min-height: 40px; padding: 6px 4px; }
  #view-report .rep-scroll-hint { display: block; margin: 0; padding: 0 16px 12px; color: var(--muted); font-size: 12px; }
  #view-report .rep-chart-scroll-hint { display: block; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
  #view-report .rep-card { padding: 16px; }
  #view-report .rep-charts, #view-report .rep-row2 { gap: 16px; }
  #view-report .rep-hbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 84px; gap: 8px; font-size: 12px; }
  #view-report .rep-tip { gap: 12px; }
  #view-report .rep-tip .tag { min-width: 72px; padding: 2px 6px; }
  #view-report .rep-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-work { padding: 16px 12px; }
  #view-work .panel-hd { padding: 0 0 16px; flex-wrap: wrap; gap: 4px 12px; }
  #view-work .panel-hd h2 { font-size: 21px !important; }
  #view-work .panel-bd { padding: 0; }
  #view-work .no-bar { padding: 10px 16px; margin-bottom: 16px; }
  #view-work.two-col .no-bar > div:first-child { display: block; }
  #view-work.two-col #formBody > .sg-cols { gap: 16px; }
  #view-work.two-col #formBody > .sg-cols > .sg-col { padding: 16px; }
  #view-work .entry-support { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #view-work .entry-guide { margin-left: 0; }
  #view-work .entry-options { gap: 8px 12px; }
  #view-work .entry-actions { padding: 14px 16px; margin-top: 16px; }
  #view-work .entry-actions #sgPrintBtn { margin-left: 0; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-basics, #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-items { padding: 16px; }
  #view-work #formBody:is([data-kind=rk], [data-kind=ck]) > .entry-basics > .grid2 { grid-template-columns: minmax(0, 1fr); }
  #view-work .no-bar .no-hint { flex-basis: 100%; text-align: left; margin-left: 0; }
  #view-work .grid2 { grid-template-columns: minmax(0, 1fr); }
  #view-work .fld input, #view-work textarea, #view-work .paper-pick select { font-size: 16px; min-height: 44px; }
  #view-work .items-ed .row input:not([type=checkbox]), #view-work .items-ed.dense .row input:not([type=checkbox]) { font-size: 16px; min-height: 44px; }
  #view-work .dtrange { flex-direction: column; align-items: stretch; }
  #view-work .dtrange input { flex: none; }
  #view-work .dtrange .dash { text-align: center; }
  #view-work .entry-item-tools { align-items: stretch; }
  #view-work .btn { min-height: 44px; }
  #view-work .row-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-work .entry-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  #view-work .entry-actions .ship-print-row .btn { width: 100% !important; }
  #view-work .foot-wb .wb { padding: 12px; }
  #view-work .foot-wb .wb-cols { flex-direction: column; align-items: stretch; }
  #view-work .foot-wb .wb-main { width: 100%; }
  #view-work .foot-wb .wb-body { display: grid; grid-template-columns: repeat(2, minmax(0, 126px)); gap: 12px; }
  #view-work .foot-wb .entry-row-actions { grid-column: 1 / -1; }
  #view-work .foot-wb .foot-btns2 { grid-column: 1 / -1; width: 100%; grid-template-columns: repeat(2, minmax(0, 126px)); }
  #view-work .foot-wb .wb-col { min-width: 0; }
  #view-work .foot-wb .foot-btns2 .btn, #view-work .foot-wb .wb-col .wb-btn { width: 100%; min-height: 40px; }
  #view-work .foot-wb .wb-rd { width: 100%; }
  #view-work .foot-wb .wb-readout { width: 100%; max-width: 430px; }
  #view-work .foot-wb .wb-tgt { white-space: normal; line-height: 1.7; }
  #mainNav { padding: 16px 12px; }
  #mainNav > button:not(.nav-sub) { min-height: 46px; font-size: 14px; }
  #mainNav .nav-sub { min-height: 42px; width: calc(100% - 30px); font-size: 13px; }
  #view-home { padding: 24px 16px; }
  #view-home .home-grid { gap: 28px; }
  #view-home .home-sec, #view-home .home-side h3 { font-size: 19px; }
  #view-home .card { padding: 20px 16px; column-gap: 12px; min-height: 140px; }
  #view-home .card .ico { width: 24px; height: 24px; }
  #view-home .card .desc { grid-column: 2 / -1; font-size: 13px; }
  #view-home .card .stat { grid-column: 2 / -1; }
  #view-home .card .go { grid-row: 1; align-self: center; }
  #view-home .changelog { padding: 4px 18px; }
  #finPanePay .pay-page-head { align-items: flex-start; margin: 4px 0 20px; }
  #finPanePay .pay-page-head h2 { font-size: 22px; }
  #finPanePay .pay-page-head p { font-size: 12.5px; }
  #finPanePay .pay-page-head > .btn { flex-shrink: 0; }
  #finPanePay .pay-overview { padding: 16px; margin-bottom: 16px; }
  #finTotLine { gap: 12px; padding: 16px 0 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #finTotLine .pay-amount:nth-last-child(3) { grid-column: 1 / -1; }
  #finTotLine .pay-amount b { font-size: 21px; }
  #finPanePay .pay-filter-bar, #finPanePay .pay-actions, #finPanePay .pay-table-head { padding: 16px; }
  #finPanePay .pay-filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #finPanePay .pay-filter-bar .fin-search, #finPanePay #finYmBox { grid-column: 1 / -1; }
  #finPanePay .pay-filter-controls { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  #finPanePay .fin-search input { width: 100%; min-width: 0; font-size: 16px; }
  #finPanePay .pay-filter-bar .fin-ym { width: auto; flex-wrap: nowrap; }
  #finPanePay .pay-filter-bar .fin-ym select { max-width: 100%; width: 100%; font-size: 14px; }
  #finPanePay .pay-filter-bar #finYmBox select { width: auto; flex: 1; }
  #finPanePay .pay-filter-bar datalist { display: none; }
  #finPanePay .btn { min-height: 40px; padding: 8px 10px; }
  #finPanePay .pay-actions-group { width: 100%; }
  #finPanePay .pay-pick-info { width: 100%; margin: 0; }
  #finPanePay .pay-table-head > div:first-child { width: 100%; }
  #finPanePay .fin-lastsave { grid-column: 1 / -1; grid-row: auto; text-align: left; }
  #finPanePay .pay-scroll-hint { display: block; margin: 0; padding: 10px 16px; background: #f8fafb; color: var(--muted); font-size: 12px; }
  #finPanePay .far-tblwrap { max-height: 480px; }
  #finPanePay .fin-foot { gap: 10px 18px; padding: 16px; }
  body { font-size: 16px; }
  .app-header { flex-wrap: nowrap; gap: 8px; }
  .app-brand { flex: 1; }
  .app-brand h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .app-header .mark { flex-shrink: 0; }
  .app-header .sub, .app-header .conn, .app-header .role-badge { display: none; }
  .mobile-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 10px; flex-shrink: 0;
    background: #fff; color: var(--brand-d); border: 1px solid var(--line);
    border-radius: 8px; font: inherit; font-size: 14px;
  }
  .app-header .nav {
    display: none; position: fixed; top: var(--hd, 62px); bottom: 0; left: 0;
    width: min(300px, calc(100vw - 48px)); margin: 0; padding: 12px;
    flex-direction: column; flex-wrap: nowrap; gap: 4px;
    overflow-y: auto; overscroll-behavior: contain; background: var(--panel);
    box-shadow: 6px 0 24px rgba(16, 34, 44, .18);
  }
  .mobile-nav-open .app-header .nav { display: flex; }
  .mobile-nav-open::before { content: ''; position: fixed; inset: var(--hd, 62px) 0 0; background: rgba(16,34,44,.4); z-index: 44; }
  .app-header .nav button { flex: 0 0 auto; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; font-size: 15px; }
  .app-header .nav .nav-sub { width: calc(100% - 14px); font-size: 14px; }
  input, select, textarea { font-size: 16px; }
  .fin-wrap { padding: 14px 12px 24px; }
  .fin-bar .fin-ym { width: 100%; flex-wrap: wrap; }
  #finSgSel, #salCkSel { min-width: 0 !important; max-width: 100% !important; width: 100%; }
  .fin-bar > .mini { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .mini { font-size: 13px; }
  .mask { padding: 12px; }
  .mask .dlg { max-height: calc(100dvh - 24px); max-width: 100%; }
  .dlg-hd, .dlg-bd, .dlg-ft { padding: 12px; }
  .dlg-hd .x { min-width: 44px; min-height: 44px; }
  .dlg-ft .btn { min-height: 44px; }
  .toast { max-width: calc(100vw - 24px); overflow-wrap: anywhere; }
}
@media screen and (max-width: 360px) {
  #view-report .rep-range { grid-template-columns: minmax(0, 1fr); }
  #view-report .rep-kpis { grid-template-columns: minmax(0, 1fr); }
  #view-report .rep-kpi { min-height: 120px; padding: 16px; }
  #view-report .rep-kpi .v { font-size: 22px; }
}

@media screen and (max-width: 760px) {
  .app-header { min-height: 68px; gap: 8px; padding: 10px 12px; }
  .app-header .app-brand { flex: 1; max-width: none; }
  .app-header h1 { font-size: 14px; line-height: 18px; letter-spacing: .3px; }
  .app-header .brand-workspace, .app-header .spacer, .app-header .user-identity { display: none; }
  .app-header .sub { display: block; font-size: 11px; line-height: 15px; letter-spacing: 0; }
  .app-header .mobile-nav-toggle { flex-shrink: 0; min-width: 52px; height: 44px; padding: 0 10px; border: 1px solid #66838f; border-radius: 9px; background: transparent; color: #edf5f8; font-size: 12px; letter-spacing: 0; }
  .app-header .mobile-nav-toggle:hover, .app-header .mobile-nav-toggle[aria-expanded="true"] { background: #305969; border-color: #92acb8; }
  .app-header .mobile-nav-toggle[aria-expanded="true"] { min-width: 76px; }
  .app-header .user-chip { width: 44px; min-height: 44px; padding: 5px; border-radius: 10px; }
  .app-header .user-chip > svg { display: none; }
  #view-home .home-help summary { min-height: 44px; padding: 10px 0; }
}
@media screen and (min-width: 761px) and (max-width: 1100px) and (max-height: 620px) {
  #view-home { padding: 20px 20px 16px; }
  #view-home .home-grid { grid-template-columns: minmax(0, 1fr) minmax(240px, .9fr); grid-template-rows: minmax(0, 1fr); gap: 20px; }
}
@media screen and (prefers-reduced-motion: reduce) {
  .app-header .user-chip, .app-header .user-chip > svg { transition: none; }
  .app-header .usermenu.on { animation: none; }
}
