/* FTF brand: red #E41F26 (accents only), black #000001, white, light gray #F2F2F2, charcoal #282829, medium gray #939597 */
:root { --red: #E41F26; --black: #000001; --white: #fff; --lg: #F2F2F2; --char: #282829; --mg: #939597; --line: #dcdcdc; --ok: #1d7a3a; --warn: #9a6700; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Poppins, system-ui, sans-serif; font-size: 13px; color: var(--black); background: var(--white); display: flex; }
h1, h2, h3, .brandfont { font-family: Oswald, 'Arial Narrow', sans-serif; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; margin: 0; }
h1 { font-size: 22px; } h2 { font-size: 16px; margin: 18px 0 8px; } h3 { font-size: 13px; margin: 12px 0 6px; }
a { color: var(--black); }
nav { width: 220px; background: var(--char); color: var(--white); flex: none; display: flex; flex-direction: column; overflow-y: auto; }
nav .logo { padding: 18px 16px 10px; } nav .logo img { width: 150px; display: block; }
nav .role { padding: 8px 16px 12px; border-bottom: 1px solid #3a3a3b; }
nav .role label { color: var(--mg); font-size: 11px; display: block; margin-bottom: 4px; }
nav .role select { width: 100%; margin-bottom: 6px; }
nav .grp { font-family: Oswald, sans-serif; text-transform: uppercase; font-size: 11px; color: var(--mg); padding: 14px 16px 4px; letter-spacing: .08em; }
nav a { color: #e9e9e9; text-decoration: none; display: block; padding: 6px 16px 6px 20px; border-left: 3px solid transparent; }
nav a:hover { background: #333334; }
nav a.active { border-left-color: var(--red); background: #333334; color: var(--white); font-weight: 600; }
main { flex: 1; overflow: auto; padding: 20px 26px 60px; min-width: 0; }
.demo { background: var(--lg); border-left: 3px solid var(--red); padding: 6px 10px; margin-bottom: 14px; font-size: 12px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0; }
.bar label { font-size: 11px; color: #555; display: flex; flex-direction: column; gap: 2px; }
input, select, textarea, button { font-family: inherit; font-size: 13px; }
input, select, textarea { border: 1px solid #bbb; border-radius: 4px; padding: 5px 7px; background: #fff; }
button { border: 1px solid var(--black); background: var(--white); color: var(--black); border-radius: 4px; padding: 6px 12px; cursor: pointer; }
button:hover { background: var(--lg); }
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(.93); }
button.dark { background: var(--char); color: #fff; border-color: var(--char); }
button.sm { padding: 2px 8px; font-size: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--char); color: #fff; font-weight: 500; font-size: 12px; position: sticky; top: 0; z-index: 1; }
th small { display: block; color: #bdbdbd; font-weight: 400; font-size: 10px; }
tbody tr:nth-child(even) td { background: #fafafa; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.wrap { overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--line); }
.wrap table td:first-child, .wrap table th:first-child { position: sticky; left: 0; z-index: 2; }
.wrap table td:first-child { background: #fff; }
.wrap table th:first-child { z-index: 3; }
tr.header td { font-family: Oswald, sans-serif; text-transform: uppercase; background: var(--lg) !important; font-weight: 700; }
tr.subtotal td { font-weight: 600; border-top: 1px solid var(--mg); }
tr.total td { font-weight: 700; background: var(--lg) !important; border-top: 1px solid var(--black); }
tr.metric td { font-style: italic; color: #444; }
tr.grand td { font-weight: 700; border-top: 2px solid var(--black); border-bottom: 3px double var(--black); }
tr.check td { color: var(--mg); font-size: 11px; }
td.tot { background: #f6f6f6 !important; } td.cons { background: #efefef !important; font-weight: 600; }
td.ic { color: var(--mg); }
td.click { cursor: pointer; } td.click:hover { text-decoration: underline; }
.neg { color: var(--red); }
.pct { color: var(--mg); font-size: 11px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.card .k { font-size: 11px; color: var(--mg); text-transform: uppercase; }
.card .v { font-family: Oswald, sans-serif; font-size: 24px; margin-top: 4px; }
.card .s { font-size: 11px; color: #555; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; border: 1px solid var(--mg); }
.pill.ok { border-color: var(--ok); color: var(--ok); } .pill.bad { border-color: var(--red); color: var(--red); } .pill.warn { border-color: var(--warn); color: var(--warn); }
.flag { color: var(--red); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.muted { color: var(--mg); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--char); color: #fff; padding: 10px 16px; border-radius: 6px; max-width: 480px; z-index: 99; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.err { border-left: 4px solid var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; z-index: 50; }
.modal { background: #fff; border-radius: 8px; padding: 18px 22px; width: min(1000px, 94vw); max-height: 86vh; overflow: auto; }
.modal .close { float: right; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin: 8px 0 12px; }
.tabs a { padding: 7px 14px; text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a.on { border-bottom-color: var(--red); font-weight: 600; }
input.qty { width: 70px; text-align: right; }
.sheet { border: 1px solid var(--black); padding: 14px 18px; margin-bottom: 18px; }
.sheet .hdr { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--black); padding-bottom: 8px; margin-bottom: 10px; }
.sheet .hdr img { height: 34px; }
.sign { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-top: 18px; font-size: 11px; }
.sign div { border-top: 1px solid var(--black); padding-top: 4px; }
.print-only { display: none; }
@media print {
  nav, .bar, .demo, .noprint, .tabs { display: none !important; }
  main { padding: 0; overflow: visible; }
  body { display: block; font-size: 11px; }
  .wrap { max-height: none; overflow: visible; border: 0; }
  th { position: static; background: #fff !important; color: #000; border-bottom: 2px solid #000; }
  .sheet { page-break-after: always; border: 0; }
  .print-only { display: block; }
}

/* Documents to Process: side-by-side on wide screens, stacked on tablets/phones */
.docgrid { display: grid; grid-template-columns: minmax(320px, 46%) 1fr; gap: 18px; align-items: start; }
.docview { position: sticky; top: 0; }
#viewer { border: 1px solid var(--line); height: calc(100vh - 170px); overflow: auto; background: #fafafa; }
@media (max-width: 1100px) { .docgrid { grid-template-columns: 1fr; } .docview { position: static; } #viewer { height: 55vh; } }
#form .wrap { max-height: none; }
#form input, #form select { max-width: 100%; }

/* signed-in user box */
nav .role a { display: inline; padding: 0; border: 0; background: none; }
nav .role a:hover { text-decoration: underline; background: none; }

/* ---------- Icon rail + pop-out menus (replaces the long sidebar) ---------- */
#rail { width: 84px; background: var(--char); flex: none; display: flex; flex-direction: column; overflow-y: auto; padding: 8px 0; }
#rail .rail-logo { display: block; text-align: center; padding: 6px 0 12px; border-left: 0; }
#rail .rail-logo img { width: 40px; height: 40px; }
#rail .rail-logo:hover { background: none; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 10px 4px; background: none; border: 0; border-left: 3px solid transparent; border-radius: 0; color: #cfcfcf; font-size: 11px; line-height: 1.2; text-align: center; cursor: pointer; font-family: Poppins, system-ui, sans-serif; }
.rail-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover, .rail-btn.open { background: #333334; color: #fff; }
.rail-btn.active { border-left-color: var(--red); color: #fff; }
.rail-bottom { margin-top: auto; padding-top: 8px; border-top: 1px solid #3a3a3b; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--char); font-family: Oswald, sans-serif; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
#flyout, .flyout-panel { position: fixed; left: 84px; top: 0; bottom: 0; width: 270px; background: #fff; box-shadow: 6px 0 24px rgba(0,0,0,.18); z-index: 60; padding: 18px 0; overflow-y: auto; }
#flyout[hidden], .flyout-panel[hidden] { display: none; }
#flyout h2 { padding: 0 22px; margin: 0 0 4px; font-size: 16px; }
#flyout .sub { color: var(--mg); font-size: 12px; padding: 0 22px 10px; }
#flyout a { display: block; padding: 10px 22px; color: var(--black); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
#flyout a:hover { background: var(--lg); }
#flyout a.active { border-left-color: var(--red); font-weight: 600; background: var(--lg); }
#userbox { top: auto; bottom: 0; padding: 18px 20px; width: 290px; }
#userbox .fly-links a { display: block; padding: 8px 0; color: var(--black); }
@media print { #rail, #flyout, #userbox { display: none !important; } }

/* side-by-side lists stack on narrower screens */
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- top-right shortcuts: Go to search, + New, gear (like QuickBooks / R365) ---- */
#topbar { position: fixed; top: 0; left: 84px; right: 0; height: 52px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 22px; z-index: 55; box-sizing: border-box; }
main#app { padding-top: 72px; }
.tb-search { position: relative; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 18px; padding: 0 12px; height: 34px; width: min(420px, 40vw); margin-right: auto; color: var(--mg); }
.tb-search input { border: 0; outline: 0; flex: 1; font: inherit; font-size: 13px; background: transparent; padding: 0; }
.tb-results { position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px 0; z-index: 70; }
.tb-results a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; text-decoration: none; color: var(--black); }
.tb-results a.on, .tb-results a:hover { background: var(--lg); }
.tb-new { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; border-radius: 18px; padding: 7px 18px; font-size: 14px; }
.tb-icon { background: none; border: 0; color: var(--char); padding: 6px; border-radius: 50%; cursor: pointer; display: flex; }
.tb-icon:hover { background: var(--lg); }
.tb-menu { position: fixed; top: 56px; right: 22px; background: #fff; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.22); padding: 18px 22px; z-index: 70; max-width: calc(100vw - 130px); max-height: calc(100vh - 80px); overflow: auto; }
.tb-cols { display: flex; gap: 34px; flex-wrap: wrap; }
.tb-col { display: flex; flex-direction: column; min-width: 150px; }
.tb-h { font-family: Oswald, sans-serif; text-transform: uppercase; font-size: 13px; letter-spacing: .03em; margin-bottom: 8px; border-bottom: 2px solid var(--red); padding-bottom: 4px; }
.tb-col a { padding: 6px 0; text-decoration: none; color: var(--black); font-size: 13px; }
.tb-col a:hover { color: var(--red); }
@media (max-width: 760px) { .tb-search { display: none; } #topbar { justify-content: flex-end; } }
@media print { #topbar { display: none !important; } main#app { padding-top: 0; } }

/* ---- home dashboard (QuickBooks-style cards) ---- */
.qa { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; }
.qa a { border: 1px solid var(--line); border-radius: 18px; padding: 6px 14px; text-decoration: none; color: var(--char); background: #fff; font-weight: 500; }
.qa a:hover { border-color: var(--red); color: var(--red); }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.hcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 12px; background: #fff; display: flex; flex-direction: column; min-height: 210px; }
.hc-t { display: flex; justify-content: space-between; gap: 8px; font-family: Oswald, sans-serif; text-transform: uppercase; font-size: 13px; letter-spacing: .03em; margin-bottom: 10px; }
.hc-t .muted { font-family: Poppins, sans-serif; text-transform: none; letter-spacing: 0; font-size: 11px; }
.hc-big { font-family: Oswald, sans-serif; font-size: 28px; line-height: 1.15; }
.hc-sub { font-size: 12px; color: #555; margin-top: 8px; }
.hc-f { margin-top: auto; padding-top: 10px; font-size: 12px; }
.hc-kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin-top: 10px; font-size: 12px; }
.hc-kv span { color: #555; }
.hc-bars { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.hc-bars > div { display: grid; grid-template-columns: 80px 1fr 56px; align-items: center; gap: 8px; }
.hc-bars > div > div { position: relative; height: 10px; background: var(--lg); border-radius: 5px; }
.hc-bars i { display: block; height: 10px; border-radius: 5px; }
.hc-bars em { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--char); }
.hc-bars b { text-align: right; }
.todo { margin: 0; padding-left: 18px; line-height: 1.9; }
.todo a { color: var(--black); }
.hc-t2 { width: 100%; font-size: 12px; } .hc-t2 th { background: none; color: var(--mg); font-weight: 500; padding: 4px 4px 2px; } .hc-t2 td { padding: 3px 4px; }
.n7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 11px; }
.n7b { height: 70px; display: flex; align-items: flex-end; justify-content: center; } .n7b i { display: block; width: 70%; background: var(--char); border-radius: 3px 3px 0 0; min-height: 2px; }
.n7w { height: 30px; line-height: 1.1; } .n7d { font-weight: 600; margin-top: 3px; } .n7v { color: #555; }

/* grouped pop-out menu (Accounting): collapsible groups like R365 */
.fly-g { border-top: 1px solid #eee; }
.fly-g summary { list-style: none; cursor: pointer; padding: 10px 20px; font-size: 14px; font-weight: 600; color: var(--char); display: flex; justify-content: space-between; }
.fly-g summary::-webkit-details-marker { display: none; }
.fly-g summary::after { content: '+'; color: var(--mg); font-size: 16px; line-height: 1; }
.fly-g[open] summary::after { content: '-'; }
.fly-g a { padding-left: 34px !important; }

/* ---- company switcher ---- */
.co-sw { position: relative; }
.co-btn { background: none; border: 1px solid var(--line); border-radius: 18px; padding: 6px 12px; display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; max-width: 260px; }
.co-btn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.co-menu { position: absolute !important; top: 40px !important; left: 0; right: auto !important; min-width: 260px; display: flex; flex-direction: column; }
.co-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 4px; text-decoration: none; color: var(--black); }
.co-menu a.cur { font-weight: 700; }
.co-menu a:hover { color: var(--red); }

/* ---- export to PDF: a clean branded print view of the page's tables ---- */
#printDoc { display: none; }
@media print {
  body.print-export { display: block !important; }
  body.print-export > *:not(#printDoc) { display: none !important; }
  body.print-export #printDoc { display: block; font-size: 10px; color: #000; }
  #printDoc .pd-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid var(--red); padding-bottom: 8px; margin-bottom: 12px; }
  #printDoc .pd-co { font-family: Oswald, sans-serif; font-size: 13px; text-transform: uppercase; color: #444; }
  #printDoc .pd-title { font-family: Oswald, sans-serif; font-size: 20px; }
  #printDoc .pd-sub { text-align: right; color: #555; font-size: 9px; }
  #printDoc table { width: 100%; border-collapse: collapse; page-break-inside: auto; }
  #printDoc tr { page-break-inside: avoid; }
  #printDoc thead { display: table-header-group; }
  #printDoc th { background: #eee !important; color: #000 !important; border-bottom: 1px solid #999; position: static; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printDoc td, #printDoc th { padding: 3px 5px; white-space: normal; }
  #printDoc h3 { margin: 14px 0 4px; }
}
.ex-menu { z-index: 80; min-width: 260px; display: flex; flex-direction: column; padding: 12px 16px; }
.ex-menu a { padding: 6px 0; text-decoration: none; color: var(--black); }
.ex-menu a:hover { color: var(--red); }

.co-menu[hidden], .tb-menu[hidden] { display: none !important; }
