:root {
  --green: #115d6e;
  --green-soft: #e3eef0;
  --cream: #f7f2e9;
  --card: #ffffff;
  --ink: #17323a;
  --muted: #5f7379;
  --line: rgba(17, 93, 110, 0.14);
  --warn: #b5532a;
  --warn-soft: #f8e6dc;
  --amber: #a7741b;
  --amber-soft: #f6ecd6;
  --ok: #2f7a4f;
  --ok-soft: #e1f0e6;
  --web: #115d6e;
  --takealot: #4f9fb0;
  --shops: #c98a4b;
  --other: #a9b6b9;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.5 "League Spartan", system-ui, sans-serif;
}
h1, h2 { font-family: "Caprasimo", Georgia, serif; font-weight: 400; color: var(--green); letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; }
h2 { font-size: 21px; margin: 0 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
a { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--cream); border-bottom: 1px solid var(--line); padding: 10px 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand span { font-family: "Caprasimo", serif; color: var(--green); font-size: 18px; }
nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 6px -16px 0; padding: 0 16px; }
nav::-webkit-scrollbar { display: none; }
nav a { white-space: nowrap; text-decoration: none; padding: 8px 12px 10px; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; }
nav a.on { color: var(--green); border-bottom-color: var(--green); }

main { max-width: 1040px; margin: 0 auto; padding: 22px 16px 40px; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 70ch; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.tile .v { font-family: "Caprasimo", serif; font-size: 28px; color: var(--green); line-height: 1.1; }
.tile .k { color: var(--muted); font-size: 14px; margin-top: 4px; }
.tile.warn .v { color: var(--warn); }
a.tile { text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--green); }

.actions { list-style: none; margin: 0; padding: 0; }
.actions li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.actions li:first-child { border-top: 0; padding-top: 0; }
.actions .dot { flex: 0 0 auto; margin-top: 3px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; height: fit-content; }
.actions .t { font-weight: 500; }
.actions .d { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.k-chase, .k-stock, .s-gap, .s-out, .s-due, .s-overdue { background: var(--warn-soft); color: var(--warn); }
.k-send, .k-invoice, .s-order, .s-soon, .s-draft, .s-quiet { background: var(--amber-soft); color: var(--amber); }
.k-shop, .s-ok, .s-sent, .s-viewed, .s-unpaid, .s-partially_paid { background: var(--green-soft); color: var(--green); }

.tablewrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
td.l, th.l { text-align: left; }
th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
tr.total td { font-weight: 600; border-bottom: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--muted); margin: 6px 0 10px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
svg text { font-family: "League Spartan", sans-serif; fill: var(--muted); font-size: 12px; }
.bars { display: grid; gap: 14px; }
.bar .row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.bar .track { height: 12px; background: var(--green-soft); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--green); border-radius: 99px; }

.notice { background: var(--green-soft); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.notice.warn { background: var(--warn-soft); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }

form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); margin-top: 3px; }
button { font: inherit; }
.btn { background: var(--green); color: #fff; border: 0; border-radius: 99px; padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.link { background: none; border: 0; color: var(--green); cursor: pointer; text-decoration: underline; padding: 0; }
.incoming { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }

.foot { max-width: 1040px; margin: 0 auto; padding: 0 16px 30px; color: var(--muted); font-size: 14px; }
@media (max-width: 600px) {
  h1 { font-size: 25px; }
  .tile .v { font-size: 24px; }
  table { font-size: 14px; }
}

.btn.sm { padding: 6px 12px; font-size: 14px; min-height: 0; }
textarea { width: 100%; font: inherit; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
tr.preview td { background: var(--green-soft); white-space: normal; }
.mailbox { max-width: 640px; padding: 6px 0; }
.mailtext { white-space: pre-wrap; font: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 10px 0; }
.warntext { color: var(--warn); }

body.out nav, body.out .foot { display: none; }
.login { max-width: 420px; margin: 6vh auto 0; }
.login label { margin-bottom: 12px; }
.login .lead { margin-bottom: 16px; }

.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cardhead h2 { margin: 0; }
label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
label.inline select { width: auto; margin: 0; }
tr.sub td { color: var(--muted, #5b6b70); font-size: 14px; }
tr.grp td { background: rgba(0,0,0,.025); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.chip { border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.chips input[type=search] { width: auto; flex: 1 1 200px; margin: 0; }
.cardhead h1 { margin: 0; }
.cardhead h1 .tag { vertical-align: middle; font-family: "League Spartan", sans-serif; }
.cardhead + .lead { margin-top: 6px; }
.invgrid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; align-items: start; }
@media (max-width: 860px) { .invgrid { grid-template-columns: 1fr; } }
table.lines input { margin: 0; }
input.num { width: 92px; text-align: right; }
table.lines td:first-child { white-space: normal; min-width: 180px; }
table.lines .xname { min-width: 160px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.v2 { font-family: "Caprasimo", serif; font-size: 24px; color: var(--green); line-height: 1.2; }
.mailcard { background: var(--green-soft); }
[hidden] { display: none !important; }
td.wrap { white-space: normal; min-width: 150px; }
