/* Maplekey CRM — the accent color comes from each tenant's Business
   Profile via a CSS variable injected in base.html, so the whole UI
   rebrands itself per customer. */
:root {
  --accent: #B4552D;          /* overridden per tenant */
  --ink: #23211d;
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #e4dfd6;
  --muted: #8a8378;
  --danger: #a03030;
  --ok: #3f7a4b;
}
* { box-sizing: border-box; }
body {
  margin: 0; display: flex; min-height: 100vh;
  background: var(--paper); color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.5rem; } h2 { font-size: 1.05rem; margin-top: 0; }

/* --- sidebar --- */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--ink); color: #efece6;
  display: flex; flex-direction: column; padding: 1rem 0;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: .6rem; align-items: center; padding: 0 1rem 1rem;
  border-bottom: 1px solid #3c3931; }
.brand img { max-height: 34px; max-width: 34px; border-radius: 6px; }
.brand small { display: block; color: #a8a294; font-size: .72rem; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; padding: .6rem 0; overflow-y: auto; }
.sidebar nav a {
  color: #d9d4c9; text-decoration: none; padding: .42rem 1rem;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #322f29; border-left-color: var(--accent); color: #fff; }
.nav-label { padding: .9rem 1rem .2rem; font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: #7d776b; }
.logout { padding: .8rem 1rem 0; border-top: 1px solid #3c3931;
  display: flex; justify-content: space-between; font-size: .82rem; color: #a8a294; }
.logout .link { background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: .82rem; }

/* --- main --- */
main { flex: 1; padding: 1.6rem 2rem; max-width: 1100px; }
main.centered { display: grid; place-items: center; max-width: none; }
.page-head { display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 1.1rem 1.3rem; margin-bottom: 1.2rem; }
.card.narrow, .login-card { max-width: 620px; }
.login-card { min-width: 340px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; } }

/* --- tables, rows --- */
table.card { border-spacing: 0; width: 100%; padding: .4rem .6rem; }
table.card th { text-align: left; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); padding: .5rem .6rem;
  border-bottom: 2px solid var(--line); }
table.card td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
table.card tr:last-child td { border-bottom: none; }
tr.done td { opacity: .5; text-decoration: line-through; }
.row { display: flex; justify-content: space-between; gap: 1rem;
  padding: .4rem 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
dl { display: grid; grid-template-columns: 110px 1fr; row-gap: .3rem; margin: 0 0 1rem; }
dt { color: var(--muted); font-size: .82rem; } dd { margin: 0; }

/* --- stats --- */
.stat-row { display: flex; gap: 1.2rem; margin: 1rem 0 1.4rem; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .9rem 1.4rem; min-width: 140px; color: var(--muted); font-size: .85rem; }
.stat-n { display: block; font-size: 1.7rem; font-weight: 700; color: var(--ink); }
.stat.alert .stat-n { color: var(--danger); }

/* --- buttons, forms, misc --- */
.btn { display: inline-block; padding: .45rem .95rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none; font-size: .88rem; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: none; }
.btn:hover { filter: brightness(.95); }
.check { background: none; border: none; font-size: 1.1rem; cursor: pointer; }
form p { margin: .5rem 0; }
form label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
input, select, textarea {
  width: 100%; max-width: 460px; padding: .45rem .6rem; font: inherit;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: auto; }
.search { display: flex; gap: .5rem; margin: .8rem 0; }
.search input { max-width: 340px; }
.tabs { display: flex; gap: .3rem; margin: .8rem 0; }
.tabs a { padding: .3rem .8rem; border-radius: 999px; text-decoration: none;
  color: var(--muted); border: 1px solid transparent; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.muted { color: var(--muted); }
.flash { padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  background: #eef4ee; border: 1px solid var(--ok); color: var(--ok); }
.flash.error { background: #f8ecec; border-color: var(--danger); color: var(--danger); }
.note { border-top: 1px solid var(--line); padding: .6rem 0; }
.pill { font-size: .7rem; padding: .15rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--line);
  vertical-align: middle; }
.pill.paid, .pill.accepted { background: #eef4ee; color: var(--ok); border-color: var(--ok); }
.pill.overdue, .pill.declined { background: #f8ecec; color: var(--danger); border-color: var(--danger); }
.pill.sent { color: var(--accent); border-color: var(--accent); }
table.lines { width: 100%; border-collapse: collapse; margin: .8rem 0; }
table.lines th { text-align: left; font-size: .72rem; text-transform: uppercase;
  color: var(--muted); border-bottom: 2px solid var(--line); padding: .4rem; }
table.lines td { padding: .4rem; border-bottom: 1px solid var(--line); }
table.lines input { max-width: none; }
tr.totals td { border: none; text-align: right; font-weight: 600; }
tr.grand td { color: var(--accent); font-size: 1.05rem; }
.pagination { display: flex; gap: 1rem; align-items: center; color: var(--muted); }
