/* TekSwipe Accounting — ledger-green identity, server-rendered UI. */
:root {
  --paper: #F5F7F4;
  --surface: #FFFFFF;
  --ink: #1B2723;
  --muted: #5D6B64;
  --accent: #0E7A5F;
  --accent-dark: #0B6650;
  --accent-soft: #E3EFE9;
  --line: #D8DFD8;
  --line-soft: #E9EEE9;
  --warn: #9A6B15;
  --warn-soft: #F5EDDD;
  --bad: #A33A2A;
  --bad-soft: #F6E4E0;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: "Palatino Linotype", Palatino, Georgia, serif; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 17px; margin-bottom: 10px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  height: 54px;
}
.brand { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: 700;
  font-size: 19px; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.brand em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 4px; }
.brand.big { font-size: 34px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 11px; border-radius: 7px;
}
.topbar nav a:hover { background: var(--paper); color: var(--ink); }
.topbar nav a.on { background: var(--accent-soft); color: var(--accent-dark); }
.logout-form { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 13px; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0; text-decoration: underline; }

/* Page scaffold */
.page { max-width: 1060px; margin: 0 auto; padding: 26px 22px 60px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .actions { display: flex; gap: 8px; align-items: center; }
.pageintro { color: var(--muted); max-width: 70ch; margin: -8px 0 18px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(27,39,35,.06);
}
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .cols2 { grid-template-columns: 1fr; } }

/* Flash + callouts */
.flash { border-radius: 9px; padding: 10px 14px; margin-bottom: 16px; font-size: 14.5px; }
.flash.ok { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--accent); }
.flash.err { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); }
.callout { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--warn);
  border-radius: 9px; padding: 10px 14px; font-size: 14px; }

/* Stats */
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 800px) { .statrow { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px 16px; }
.stat .lab { display: block; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.warn .val { color: var(--bad); }

/* Getting-started steps */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.steps li a { color: var(--ink); text-decoration: none; }
.steps li.done a { color: var(--muted); text-decoration: line-through; }
.steps .tick { color: var(--accent); font-weight: 700; }
.steps .dot { width: 9px; height: 9px; border: 2px solid var(--line); border-radius: 50%; display: inline-block; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.list th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 7px 10px; border-bottom: 2px solid var(--line); }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
table.list tr.dim td { color: var(--muted); }
.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.totals td { border-bottom: 0; font-weight: 600; }
tr.totals.grand td { font-size: 16px; border-top: 2px solid var(--accent); }
.empty { color: var(--muted); }

/* Badges */
.badge { display: inline-block; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  border-radius: 5px; padding: 2px 8px; font-weight: 600; background: var(--line-soft); color: var(--muted);
  vertical-align: 2px; }
.badge.s-draft { background: var(--line-soft); color: var(--muted); }
.badge.s-approved, .badge.s-sent, .badge.s-accepted { background: var(--accent-soft); color: var(--accent-dark); }
.badge.s-paid { background: var(--accent); color: #fff; }
.badge.s-overdue, .badge.s-declined { background: var(--bad-soft); color: var(--bad); }
.badge.s-voided, .badge.s-expired { background: var(--line-soft); color: var(--muted); text-decoration: line-through; }
.badge.s-invoiced { background: var(--accent-soft); color: var(--accent-dark); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tabs a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; }
.tabs a.on { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* Forms */
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
.formgrid .span2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .formgrid { grid-template-columns: 1fr; } }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.checks { display: flex; gap: 22px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink); font-weight: 400; }
label.check input { width: auto; }
.fieldhelp { font-weight: 400; font-size: 12px; color: var(--muted); }
.rowend { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: inline; }
.btnrow { display: flex; gap: 10px; }
.hint { color: var(--muted); font-size: 13px; }
.notes { color: var(--muted); white-space: pre-line; }

/* Buttons */
.btn {
  display: inline-block; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 16px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.subtle { border-color: transparent; color: var(--muted); background: transparent; }
.btn.subtle:hover { color: var(--bad); }
.btn.wide { width: 100%; text-align: center; }
.danger-zone { margin-top: 8px; text-align: right; }

/* Auth pages */
.authbox { max-width: 380px; margin: 9vh auto 0; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 14px; padding: 34px 32px;
  box-shadow: 0 6px 24px rgba(27,39,35,.08); text-align: center; }
.authbox .sub { color: var(--muted); margin: 2px 0 22px; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.authbox form { text-align: left; }
.or { color: var(--muted); font-size: 12px; margin: 14px 0 10px; }

/* Document editor */
table.lines { width: 100%; border-collapse: collapse; font-size: 14px; margin: 18px 0 6px; }
table.lines th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 6px 6px; border-bottom: 2px solid var(--line); }
table.lines td { padding: 6px 4px; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
table.lines .grow { width: 38%; }
table.lines textarea { resize: vertical; min-height: 36px; }
table.lines .qty { width: 64px; }
table.lines .price { width: 100px; }
table.lines .amount { padding-top: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lines .itempick { margin-bottom: 4px; font-size: 12px; color: var(--muted); }
table.lines .rm { background: none; border: 0; color: var(--muted); font-size: 17px; cursor: pointer; padding: 8px 4px; }
table.lines .rm:hover { color: var(--bad); }
table.lines tfoot td { border-bottom: 0; }
table.lines tr.totals td { font-weight: 600; }
table.lines tr.grand td { font-size: 16px; }

/* Doc view */
.docmeta { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 14px; font-size: 14.5px; }
.docmeta .lab { display: block; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* Integrations */
.integ-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.integ-head h2 { margin: 0; }
