/* Apex CRM: phone-first, same palette as the website. */
:root {
  --night: #15161b; --panel: #1f2027; --line-dark: #33353d; --gold: #c9a24f; --gold-hover: #e2c27a;
  --gold-text: #7e6220; --sand: #f5f3ee; --line: #e2ded5; --ink: #16171d; --muted: #4a4d55; --error: #b3261e;
  --ok: #2f7a4a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--sand); color: var(--ink); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--gold-text); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--night); color: #fff; }
.bar__brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 20px; }
.bar__brand span { color: var(--gold); }
.bar__nav { display: flex; gap: 8px; }
.app { max-width: 980px; margin: 0 auto; padding: 16px 16px 64px; outline: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 8px; border: 2px solid transparent; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn--small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.btn--gold { background: var(--gold); color: var(--night); }
.btn--gold:hover { background: var(--gold-hover); }
.btn--dark { background: var(--night); color: #fff; }
.btn--ghost { background: transparent; border-color: #5a5d66; color: #fff; }
.btn--line { background: #fff; border-color: #cfc9bd; color: var(--ink); }
.btn--danger { background: #fff; border-color: var(--error); color: var(--error); }
.btn:disabled { opacity: 0.6; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 19px; margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 14px; color: var(--muted); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.tab { flex: none; border: 1px solid #cfc9bd; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 15px; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--night); color: #fff; border-color: var(--night); }
.search { width: 100%; min-height: 46px; border: 2px solid #cfc9bd; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.item:hover { border-color: var(--gold); }
.item__top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item__name { font-weight: 700; }
.item__meta { font-size: 14px; color: var(--muted); margin-top: 2px; }
.item__msg { font-size: 15px; color: #34363d; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; background: #ece8df; color: #3f3a2f; white-space: nowrap; }
.badge--new { background: #fbe7b5; color: #5c4710; }
.badge--quoted { background: #dde8f6; color: #1f3c63; }
.badge--scheduled { background: #e3dcf5; color: #3b2a6b; }
.badge--done, .badge--paid { background: #d9efe0; color: #1f5133; }
.badge--lost, .badge--referred, .badge--spam { background: #eee; color: #555; }

.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 700; font-size: 14px; }
.field input, .field select, .field textarea { min-height: 46px; border: 2px solid #cfc9bd; border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.span2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 22px; height: 22px; }

.notes { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notes li { background: var(--sand); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
.notes time { display: block; font-size: 13px; color: var(--muted); }

.photos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 12px; }
.photo { position: relative; background: var(--sand); border-radius: 8px; overflow: hidden; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; font-size: 13px; }
.photo button { border: 0; background: none; color: var(--error); cursor: pointer; font-size: 13px; padding: 6px; }

.signin { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.signin h1 { margin-bottom: 8px; }
.signin p { margin-bottom: 20px; }
.signin__buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.btn--block { width: 100%; }
.error { color: var(--error); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 90vw; z-index: 20; }
.toast--error { background: var(--error); }
