/* Maplekey CRM — dark workspace, bright green text.

   Two colour systems, deliberately kept apart:

   * The MAIN panel is a fixed dark theme. Its text is bright green, so it
     must not depend on the tenant's accent: a customer who picks a dark
     navy accent would otherwise get unreadable body text.
   * The SIDEBAR is painted with the tenant's accent. Its text colour is
     not hardcoded — `accent_text` / `accent_veil` are computed per tenant
     in configuration/context_processors.py by WCAG contrast, and injected
     as CSS variables in base.html. That is what keeps navigation readable
     whether the customer chooses lemon yellow or midnight blue.

   So: use var(--ink) for emphasis inside main, and var(--accent) only
   where var(--accent-text) is also in play. */
:root {
  --accent: #B4552D;            /* overridden per tenant */
  --accent-text: #ffffff;       /* computed per tenant */
  --accent-veil: rgba(255,255,255,.16);

  --ink: #7CFFA5;               /* bright green: the main panel's text */
  --link: #A8FFC8;
  --paper: #0b0f0d;             /* main panel background */
  --card: #131916;
  --field: #0d1411;
  --line: #24302a;
  --muted: #6f9c84;
  --danger: #ff7a7a;
  --ok: #56e08b;
}
* { 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; }
main a { color: var(--link); }
main a:hover { text-decoration: none; }

/* --- sidebar: the tenant's accent, with contrast-picked text --- */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--accent); color: var(--accent-text);
  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 var(--accent-veil); }
.brand img { max-height: 34px; max-width: 34px; border-radius: 6px; }
.brand small { display: block; opacity: .75; font-size: .72rem; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; padding: .6rem 0; overflow-y: auto; }
.sidebar nav a {
  color: var(--accent-text); text-decoration: none; padding: .42rem 1rem;
  border-left: 3px solid transparent; opacity: .88;
}
.sidebar nav a:hover { background: var(--accent-veil); border-left-color: var(--accent-text);
  opacity: 1; }
.nav-label { padding: .9rem 1rem .2rem; font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-text); opacity: .6; }
.logout { padding: .8rem 1rem 0; border-top: 1px solid var(--accent-veil);
  display: flex; justify-content: space-between; font-size: .82rem;
  color: var(--accent-text); }
.logout .link { background: none; border: none; color: var(--accent-text);
  cursor: pointer; font-size: .82rem; text-decoration: underline; }
.logout .muted { color: var(--accent-text); opacity: .7; }

/* --- 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: var(--accent-text); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: none; }
.btn:hover { filter: brightness(1.25); }
.check { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
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: var(--field); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
input[type="checkbox"] { width: auto; accent-color: var(--ink); }
input[type="color"] { padding: .1rem; height: 2.2rem; max-width: 80px; }
input[type="file"] { color: var(--muted); }
.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(--ink); border-color: var(--ink); }
.muted { color: var(--muted); }
.flash { padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  background: rgba(86, 224, 139, .12); border: 1px solid var(--ok); color: var(--ok); }
.flash.error { background: rgba(255, 122, 122, .12); 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; color: var(--muted); }
.pill.paid, .pill.accepted { background: rgba(86, 224, 139, .12); color: var(--ok);
  border-color: var(--ok); }
.pill.overdue, .pill.declined { background: rgba(255, 122, 122, .12); color: var(--danger);
  border-color: var(--danger); }
.pill.sent { color: var(--ink); border-color: var(--ink); }
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(--ink); font-size: 1.05rem; }
.pagination { display: flex; gap: 1rem; align-items: center; color: var(--muted); }

/* Settings tabs, catalog filters, and small inline bits */
.settings-tabs { flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { max-width: 260px; }
.small { font-size: .75rem; }
.thumb { width: 56px; }
form.inline { display: inline; }
.error { color: var(--danger); font-size: .78rem; }

/* Photos and logos on people and companies */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); }
.avatar.placeholder { display: inline-grid; place-items: center; background: var(--field);
  color: var(--muted); font-size: .85rem; font-weight: 600; }
.avatar.lg { width: 52px; height: 52px; vertical-align: middle; margin-right: .5rem; }
.logo-sm { max-width: 40px; max-height: 36px; object-fit: contain; border-radius: 4px; }
.logo-lg { max-height: 46px; max-width: 130px; object-fit: contain;
  vertical-align: middle; margin-right: .6rem; }

/* Point of sale */
.pos-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .pos-grid { grid-template-columns: 1fr; } }
.pos-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem; margin-top: .8rem; }
.pos-item { display: flex; flex-direction: column; gap: .25rem; align-items: flex-start;
  padding: .6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--field);
  cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.pos-item:hover { border-color: var(--ink); }
.pos-item img, .pos-noimg { width: 100%; height: 72px; object-fit: cover; border-radius: 6px; }
.pos-noimg { background: var(--line); display: block; }
.pos-name { font-weight: 600; font-size: .82rem; }
.pos-price { color: var(--muted); font-size: .78rem; }
.pos-qty { display: inline-block; min-width: 2ch; text-align: center; }
.pos-collect { text-align: center; }
/* White plate behind the QR: scanners need the quiet zone to stay light. */
.pos-qr { width: 260px; max-width: 80vw; image-rendering: pixelated;
  background: #fff; padding: 10px; border-radius: 8px; }
.pos-paid-mark { color: var(--ok); font-size: 2rem; }

/* Platform branding — the "made by / running on" credit.
   Both logos are black-on-white JPEGs with no alpha, so each gets a real
   white plate rather than floating on the dark background. */
.platform-footer { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  margin: 2.4rem 0 .5rem; padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: .95rem; color: var(--muted); }
.pf-brand { display: inline-flex; align-items: center; gap: .55rem;
  color: var(--muted); text-decoration: none; }
.pf-brand:hover { color: var(--ink); }
.pf-brand strong { font-weight: 600; font-size: 1rem; }
.pf-plate { display: inline-flex; background: #fff; border-radius: 5px;
  padding: 4px 7px; line-height: 0; }
.pf-plate img { display: block; width: auto; }
.pf-pccool { height: 34px; }
.pf-lockup { height: 26px; }   /* wide lockup: match optical weight, not height */
.pf-sep { opacity: .7; }
.login-logo { max-height: 54px; max-width: 180px; object-fit: contain;
  display: block; margin-bottom: .6rem; }
.login-card .platform-footer { margin-top: 1.6rem; }

.error-page { margin-top: 2rem; }
.error-page h1 { margin-top: 0; }
