/* Owed · shared styles. A working tool, so the chrome is quiet and the numbers
   are the only thing with weight. */
:root {
  --ink: #15181d;
  --body: #3d434e;
  --muted: #5b6270;
  --faint: #8a919e;
  --line: #e3e6eb;
  --hair: #eef0f3;
  --page: #f5f6f8;
  --card: #ffffff;
  --accent: #3f5fd6;
  --accent-soft: #e6e9f9;
  --danger: #c2410c;
  --ok: #1f7a4d;
  --r: 10px;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--page);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 440px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.col { display: flex; flex-direction: column; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; } .gap24 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 24px;
}
.card + .card { margin-top: 20px; }
.card-title { font-size: 16px; font-weight: 600; }

label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=color], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  height: 44px;
}
textarea { height: auto; padding: 10px 12px; min-height: 88px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

button, .btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(0.94); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: default; filter: none; }
button.ghost, .btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.quiet { background: transparent; color: var(--accent); padding: 0; height: auto; font-size: 14px; }
button.quiet:hover { text-decoration: underline; filter: none; }
button.sm { height: 36px; font-size: 14px; padding: 0 14px; }
button.block { width: 100%; }
button.danger { background: var(--danger); }

.note { border-radius: 8px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.note.err { background: #fdecea; color: #8c1d16; }
.note.ok { background: #e8f4ee; color: #14532d; }
.note.warn { background: #fef6e7; color: #7c4a03; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  background: var(--hair); color: var(--muted);
}
.tag.ok { background: #e8f4ee; color: #14532d; }
.tag.due { background: #fef6e7; color: #7c4a03; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--hair); }
.item:first-child { border-top: 0; }

.empty { text-align: center; padding: 32px 20px; color: var(--muted); }
.empty.small { padding: 20px; font-size: 14px; }

.bar { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }

.dot { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; border: 1.5px solid #cfc8bc; background: #fff; }
.dot.done { border: 0; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.dot.done::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }

.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px 12px 12px 4px; background: #f3f0ea; font-size: 14px; line-height: 1.45; }
.msg.mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--accent); color: #fff; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } .field-row { grid-template-columns: minmax(0, 1fr); } }

.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  height: 62px; display: flex; align-items: center;
}
.brandmark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}
.brandmark img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; background: #fff; }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 0; }

/* --- tracker specifics --- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 600; line-height: 1; }
.stat .foot { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat.warn { border-color: #f3c9b6; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 0 10px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; padding-right: 20px; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td:last-child, th:last-child { padding-right: 0; }
th + th, td + td { padding-left: 4px; }
.scroll-x { overflow-x: auto; }
/* Crushing six columns into a phone makes a table unreadable, so a WIDE table keeps
   its shape and scrolls inside its own card instead. The PAGE must never scroll
   sideways. Only tables marked wide get the minimum: a four-column table in a 400px
   sidebar reads fine as it is, and forcing 600px on it hides its last two columns. */
.scroll-x.wide > table { min-width: 560px; }
/* Percentage column widths are only honoured under a fixed layout; with the default
   auto layout a long client name steals room from the last column and the button in
   it gets cut in half. */
.tbl-fixed { table-layout: fixed; }
/* Headers may not stay on one line once the columns are pinned: a two-line heading
   is fine, a heading cut off mid-word is not. */
.tbl-fixed th { white-space: normal; }
.sev { width: 6px; border-radius: 3px; align-self: stretch; flex: 0 0 6px; }
.sev.high { background: var(--danger); }
.sev.medium { background: #d9a441; }
.finding { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); }
.finding:first-child { border-top: 0; }
.pill { display:inline-flex; align-items:center; height:22px; padding:0 9px; border-radius:6px; font-size:12px; font-weight:600; background: var(--hair); color: var(--muted); white-space: nowrap; }
.pill.overdue { background:#fdece4; color:#9a3412; }
.pill.received { background:#e8f4ee; color:#14532d; }
.pill.pending { background:#e6e9f9; color:#2d47ad; }
.pill.cancelled, .pill.refunded { background: var(--hair); color: var(--faint); }
.pill.short { background:#fef3c7; color:#92400e; }

.stat .foot .up, .stat .foot .down { display: inline-flex; align-items: center; gap: 6px; }
