/* ProBooks: original interface, own palette and layout */
:root {
  --bg: #f3f5f7; --card: #fff; --ink: #14202b; --muted: #64748b; --line: #e3e8ee;
  --side: #0f2a33; --side-ink: #b7c8cf; --side-hi: #16404b;
  --accent: #0f766e; --accent-d: #0b5c56; --accent-l: #e0f2f0;
  --green: #15803d; --green-l: #dcfce7; --red: #b91c1c; --red-l: #fee2e2;
  --amber: #b45309; --amber-l: #fef3c7; --blue: #1d4ed8; --blue-l: #dbeafe; --grey-l: #e5e7eb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 650; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.neg { color: var(--red); }
.hidden { display: none !important; }

/* layout */
.app { display: flex; min-height: 100vh; }
.side { width: 236px; background: var(--side); color: var(--side-ink); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.1rem; padding: 6px 10px 16px; }
.brand i { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #14b8a6, #0f766e); display: grid; place-items: center; font-style: normal; font-size: .95rem; }
.side .top-link { font-size: .88rem; font-weight: 600; }
.side .grp { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9fb4bc; margin: 14px 10px 2px; }
.side a { display: flex; align-items: center; min-height: 34px; color: var(--side-ink); padding: 6px 10px; border-radius: 7px; font-size: .88rem; line-height: 1.25; }
.side a:hover { background: var(--side-hi); color: #fff; text-decoration: none; }
.side a.on { background: var(--accent); color: #fff; font-weight: 600; }
.side details.grpbox { margin-bottom: 2px; }
.side details.grpbox + details.grpbox { border-top: 1px solid rgba(255,255,255,.06); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; gap: 14px; align-items: center; position: sticky; top: 0; z-index: 20; }
.top form.search { flex: 1; max-width: 420px; }
.top form.search input { width: 100%; background: var(--bg); border: 1px solid transparent; }
.top .sp { flex: 1; }
.content { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* dropdown via <details> */
details.dd { position: relative; }
details.dd > summary { list-style: none; cursor: pointer; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd .menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 42, 51, .15); min-width: 230px; padding: 6px; z-index: 40; max-height: 70vh; overflow: auto; }
details.dd .menu a, details.dd .menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--ink); font-size: .92rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
details.dd .menu a:hover, details.dd .menu button:hover { background: var(--accent-l); text-decoration: none; }
details.dd .menu .h { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px 2px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: .92rem; cursor: pointer; font-weight: 550; }
.btn:hover { background: #f8fafb; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { color: var(--red); border-color: #f3c1c1; }
.btn.danger:hover { background: var(--red-l); }
.btn.sm { padding: 4px 10px; font-size: .84rem; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
input, select, textarea { font: inherit; font-size: .93rem; padding: 8px 10px; border: 1px solid #cfd8e0; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-l); border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: .82rem; font-weight: 600; color: #3b4a58; margin-bottom: 4px; }
input[type=checkbox], input[type=radio] { width: auto; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .side { display: none; } .content { padding: 14px; } }
.err { color: var(--red); font-size: .84rem; margin-top: 3px; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; }
.alert.ok { background: var(--green-l); color: #14532d; }
.alert.bad { background: var(--red-l); color: #7f1d1d; }
.alert.info { background: var(--blue-l); color: #1e3a8a; }

/* cards & tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2:first-child { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 1.5rem; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .82rem; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; font-weight: 650; }
td { padding: 10px 14px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
th.num { text-align: right; }
tr.total td { font-weight: 700; background: #f6f8fa; border-top: 1px solid var(--line); }
tr.sub td { font-weight: 600; }
tr.head td { font-weight: 700; background: #f0f4f6; text-transform: uppercase; font-size: .78rem; letter-spacing: .05em; color: #435463; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 650; }
.badge.green { background: var(--green-l); color: var(--green); } .badge.red { background: var(--red-l); color: var(--red); }
.badge.amber { background: var(--amber-l); color: var(--amber); } .badge.blue { background: var(--blue-l); color: var(--blue); } .badge.grey { background: var(--grey-l); color: #4b5563; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters > div { min-width: 130px; }
.filters .grow { flex: 1; min-width: 200px; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 1.05rem; }
.pager { padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.pager nav { display: flex; gap: 4px; }
.pager a, .pager span.pg { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; }
.pager span.pg.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager span.pg.dis { color: #aab4be; }

/* forms with line items */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.doc-head { padding: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) { .doc-head { grid-template-columns: 1fr 1fr; } }
.lines input, .lines select { padding: 6px 8px; }
.lines td { padding: 6px 6px; border-bottom: 1px solid #eef1f4; }
.lines th { padding: 8px 6px; }
.lines .x { color: #94a3b8; cursor: pointer; background: none; border: 0; font-size: 1.1rem; }
.lines .x:hover { color: var(--red); }
.doc-foot { display: grid; grid-template-columns: 1fr 300px; gap: 24px; padding: 18px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .doc-foot { grid-template-columns: 1fr; } }
.totals { font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-size: 1.2rem; font-weight: 700; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; }
.stickybar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 10px; justify-content: flex-end; border-radius: 0 0 var(--radius) var(--radius); }
.balance-chip { padding: 4px 12px; border-radius: 99px; font-weight: 650; font-size: .88rem; }
.balance-chip.ok { background: var(--green-l); color: var(--green); } .balance-chip.bad { background: var(--red-l); color: var(--red); }

/* invoice paper */
.paper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 40px; }
.paper .ph { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.paper .title { font-size: 1.9rem; font-weight: 300; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.paper .meta td { padding: 2px 0 2px 16px; border: 0; }
.paper table.items th { background: var(--accent); color: #fff; }
.paper .stamp { display: inline-block; border: 3px solid; padding: 2px 14px; font-weight: 800; letter-spacing: .1em; transform: rotate(-6deg); border-radius: 6px; opacity: .8; }
.paper .stamp.paid { color: var(--green); } .paper .stamp.void { color: #6b7280; }

/* reports */
.report { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; }
.report .rh { text-align: center; margin-bottom: 20px; }
.report .rh .co { color: var(--muted); font-size: .9rem; }
.report .rh h2 { font-size: 1.35rem; margin: 2px 0; }
.report td, .report th { padding: 7px 12px; }
.report .ind1 { padding-left: 28px; } .report .ind2 { padding-left: 46px; }
.report-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.report-link { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink); }
.report-link:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 2px 10px rgba(15, 118, 110, .12); }
.report-link b { display: block; }
.range-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 11px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: .82rem; color: var(--ink); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:hover { text-decoration: none; }

/* dashboard charts */
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; } .two.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .two, .two.even { grid-template-columns: 1fr; } }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 10px 4px 0; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; width: 100%; justify-content: center; flex: 1; }
.bars .b { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b.inc { background: #14b8a6; } .bars .b.exp { background: #f59e0b; }
.bars .lb { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.hbar { height: 8px; border-radius: 4px; background: var(--grey-l); overflow: hidden; margin-top: 4px; }
.hbar div { height: 100%; background: #14b8a6; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .hero { background: linear-gradient(160deg, #0f2a33, #0f766e); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.auth .hero h1 { font-size: 2.2rem; margin-bottom: 10px; }
.auth .hero li { margin: 8px 0; color: #cde9e6; }
.auth .form { display: grid; place-items: center; padding: 30px; }
.auth .form .box { width: 100%; max-width: 380px; }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; } .auth .hero { display: none; } }

@media print {
  .side, .top, .actions, .no-print, .stickybar, .filters, .alert { display: none !important; }
  body { background: #fff; } .content { padding: 0; max-width: none; }
  .paper, .report, .card { border: 0; box-shadow: none; padding: 0; }
}

/* grouped navigation, bell, mobile menu */
.side details.grpbox > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.side details.grpbox > summary::-webkit-details-marker { display: none; }
.side details.grpbox > summary::after { content: '▸'; font-size: .7rem; opacity: .6; margin-right: 10px; transition: transform .15s; }
.side details.grpbox[open] > summary::after { transform: rotate(90deg); }
.side .grp { margin-top: 10px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 99px; font-size: .68rem; padding: 1px 6px; font-weight: 700; }
.menu-btn { display: none; }
@media (max-width: 900px) { .menu-btn { display: inline-flex; } .side { display: none; position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; } .side.open { display: block; } }
/* Select2 to match the form controls */
.select2-container { font-size: .93rem; max-width: 100%; }
.select2-container--default .select2-selection--single { height: auto; min-height: 38px; border: 1px solid #cfd8e0; border-radius: 8px; display: flex; align-items: center; }
.select2-container--default .select2-selection--single .select2-selection__rendered { padding: 6px 28px 6px 10px; line-height: 1.4; color: var(--ink); width: 100%; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 100%; }
.select2-container--default.select2-container--focus .select2-selection--single, .select2-container--open .select2-selection--single { border-color: var(--accent); outline: 2px solid var(--accent-l); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--accent); }
.select2-dropdown { border-color: #cfd8e0; border-radius: 8px; overflow: hidden; }
.select2-search--dropdown .select2-search__field { border-radius: 6px; padding: 6px 8px; }
.select2-dropdown { z-index: 2000; }
.lines .select2-container--default .select2-selection--single { min-height: 32px; }
.lines .select2-container--default .select2-selection--single .select2-selection__rendered { padding: 3px 26px 3px 8px; }

/* sidebar: sections, search, icons */
.side { padding: 0 0 24px; }
.side-head { position: sticky; top: 0; z-index: 2; background: var(--side); padding: 14px 10px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-head .brand { margin: 0 0 10px; }
.navsearch { position: relative; }
.navsearch input { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; padding: 7px 28px 7px 10px; font-size: .85rem; }
.navsearch input::placeholder { color: #8ea6ae; }
.navsearch input:focus { outline: none; border-color: #5eead4; background: rgba(255,255,255,.14); }
.navsearch button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #cfe0e5; font-size: 1.1rem; cursor: pointer; padding: 2px 8px; }
.navlist { padding: 4px 10px 0; }
.side .sec { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6f8b95; margin: 16px 10px 4px; }
.side .ic { width: 22px; flex: none; text-align: center; margin-right: 8px; font-size: .95rem; }
.side .top-link { min-height: 36px; }
.side details.grpbox { margin-bottom: 1px; border-top: 0; border-radius: 8px; }
.side details.grpbox[open] { background: rgba(255,255,255,.04); }
.side details.grpbox > summary.grp { margin: 0; padding: 8px 10px; border-radius: 8px; color: #d5e3e8; text-transform: none; letter-spacing: 0; font-size: .9rem; font-weight: 600; justify-content: flex-start; }
.side details.grpbox > summary.grp:hover { background: var(--side-hi); }
.side details.grpbox > summary.grp .gt { flex: 1; }
.side details.grpbox > summary.grp .cnt { font-size: .68rem; font-weight: 600; background: rgba(255,255,255,.1); color: #9fb4bc; border-radius: 10px; padding: 1px 7px; margin-right: 4px; }
.side details.grpbox > summary::after { margin-right: 2px; }
.side .items { margin: 2px 0 6px 19px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.12); }
.side .items a { min-height: 30px; padding: 4px 10px; font-size: .85rem; }
.side mark { background: #fde68a; color: #14202b; border-radius: 3px; padding: 0 1px; }
.navempty { color: #8ea6ae; font-size: .85rem; padding: 12px 10px; }
.side [hidden] { display: none !important; }

/* sidebar v2: left aligned, no icons, Shopify-style tree */
.side, .side a, .side summary { text-align: left; }
.side .top-link { justify-content: flex-start; padding-left: 12px; }
.side details.grpbox > summary.grp { display: flex; align-items: center; justify-content: flex-start; padding: 8px 12px; text-align: left; }
.side details.grpbox > summary.grp .gt { flex: 1 1 auto; text-align: left; }
.side details.grpbox > summary.grp .cnt { margin-left: auto; margin-right: 8px; text-align: right; }
.side details.grpbox > summary::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .7; margin: 0 4px 3px 6px; order: 3; flex: none; transform: rotate(-45deg); transition: transform .15s; }
.side details.grpbox[open] > summary::after { transform: rotate(45deg); margin-bottom: 5px; }
.side .items { position: relative; margin: 0 0 8px 18px; padding: 2px 0 0 0; border-left: 2px solid rgba(255,255,255,.14); }
.side .items a { position: relative; justify-content: flex-start; margin-left: 12px; padding: 5px 10px; min-height: 30px; }
.side .items a::before { content: ''; position: absolute; left: -12px; top: 50%; width: 10px; border-top: 2px solid rgba(255,255,255,.14); }
.side .items a.on { background: rgba(94,234,212,.16); color: #fff; }
.side .items a.on::before { border-top-color: #5eead4; }
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .btn.sm { padding: 3px 10px; font-size: .82rem; color: var(--ink); }
.crumbs .cur { color: var(--ink); font-weight: 600; }
.gs-box { position: absolute; left: 0; right: 0; top: calc(100% + 6px); min-width: 380px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); z-index: 60; padding: 6px; }
.gs-h { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.gs-i { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; }
.gs-i.on, .gs-i:hover { background: var(--bg); }
.gs-i mark { background: #fff3bf; color: inherit; border-radius: 2px; }
.gs-s { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.gs-t { overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 14px; color: var(--muted); }
.gs-all { display: block; padding: 9px 10px; border-top: 1px solid var(--line); margin-top: 4px; font-size: .88rem; }
@media (max-width: 700px) { .gs-box { min-width: 0; position: fixed; left: 8px; right: 8px; top: 56px; } }
