/* Colors and fonts come from config.js via CSS variables (see applyBrand). */
:root {
  --primary: #7a4b6b;
  --accent: #e8b4b8;
  --bg: #fbf6f4;
  --surface: #fff;
  --text: #2b1d26;
  --muted: color-mix(in srgb, var(--text) 55%, transparent);
  --line: color-mix(in srgb, var(--text) 10%, transparent);
  --late: #c2410c;
  --ok: #15803d;
  --font-heading: Georgia, serif;
  --font-body: system-ui, sans-serif;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 var(--font-body);
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--font-heading); font-weight: 600; margin: 0 0 12px; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 21px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 18px; }

.top {
  display: flex; align-items: baseline; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  background: var(--primary); color: #fff;
}
.logo { font-family: var(--font-heading); font-size: 26px; font-weight: 600; }
.biz { font-size: 13px; opacity: .8; letter-spacing: .04em; text-transform: uppercase; }

main { max-width: 640px; margin: 0 auto; padding: 22px 16px 80px; }

.card {
  background: var(--surface); border-radius: var(--radius); padding: 18px;
  margin: 0 0 16px; box-shadow: 0 1px 2px var(--line), 0 6px 20px -12px var(--line);
}
.card.empty { text-align: center; padding: 36px 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 50px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--primary); color: #fff; font: 600 17px var(--font-body); cursor: pointer;
}
.btn.small { min-height: 42px; padding: 0 18px; font-size: 15px; }
.btn.ghost { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.btn.danger { color: var(--late); }
.btn.danger.ghost { background: color-mix(in srgb, var(--late) 10%, transparent); }
.link { background: none; border: 0; color: var(--late); font: inherit; font-size: 12px; padding: 0; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }

.list { list-style: none; margin: 0; padding: 0; }
.list.card { padding: 6px 18px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.done { opacity: .6; }
.who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.who > div { min-width: 0; }
.who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { margin-top: 4px; }
.end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font: 600 19px var(--font-heading);
  background: var(--accent); color: var(--primary);
}
.avatar.big { width: 68px; height: 68px; font-size: 30px; }

.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.late { background: color-mix(in srgb, var(--late) 12%, transparent); color: var(--late); }
.pill.soon { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.pill.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }

.search {
  width: 100%; margin: 0 0 14px; padding: 14px 18px; font: inherit;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}

.back { display: inline-block; color: var(--primary); font-weight: 600; margin: 0 0 14px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin: 0 0 16px; }
.profile-head h1 { margin: 0 0 2px; }
.alert {
  background: color-mix(in srgb, var(--late) 10%, transparent); color: var(--late);
  border-radius: 14px; padding: 12px 16px; margin: 0 0 16px;
}
.status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.facts > div { display: flex; flex-direction: column; }
.facts .wide { grid-column: 1 / -1; }
.facts p { margin: 2px 0 0; }

.visits { list-style: none; padding: 0; margin: 0; }
.visit { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin: 0 0 10px; }
.visit-head { display: flex; justify-content: space-between; gap: 10px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.thumbs figure { margin: 0; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; display: block; }
.thumbs figcaption { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form input, .form select, .form textarea {
  font: 17px var(--font-body); padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.photo-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-pick label { flex-direction: row; font-size: 15px; }

.promo { display: block; }
.promo h2 { margin-bottom: 6px; }

.fab {
  position: fixed; right: 20px; bottom: calc(96px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 30px;
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--primary) 70%, transparent);
}

.alert.backup { display: block; font-size: 15px; }

.split { display: flex; gap: 12px; }
.split > div { flex: 1; display: flex; flex-direction: column; }
.split b { font-size: 19px; }
.totals .big, .brought .big { font: 600 44px/1.1 var(--font-heading); margin: 4px 0 14px; }
.totals .big.neg { color: var(--late); }
.brought { background: var(--primary); color: #fff; }
.brought .big { margin-bottom: 6px; }
.brought p { margin: 0; }
.segment { display: flex; gap: 6px; background: var(--line); border-radius: 999px; padding: 4px; margin: 0 0 16px; }
.segment a { flex: 1; text-align: center; padding: 9px 4px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); }
.segment a.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px var(--line); }
.bars { list-style: none; padding: 0; margin: 16px 0 6px; display: flex; flex-direction: column; gap: 12px; }
.bar-label { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 4px; }
.bar-track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar-track div { height: 100%; border-radius: 999px; background: var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-head h2 { margin: 0; }
.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.money-row input { width: 100%; }
.money-row.two { grid-template-columns: 1fr 1fr; }
.card .list + .btn { margin-top: 12px; }

.status-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; color: var(--muted); }
.tabs a span { font-size: 22px; line-height: 1; }
.tabs a.on { color: var(--primary); font-weight: 600; }

#oops {
  position: fixed; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 50;
  background: var(--late); color: #fff; border-radius: 14px; padding: 12px 16px; font-size: 15px;
}
#oops small { display: block; opacity: .8; margin-top: 4px; }

.logo img { height: 34px; width: auto; max-width: 140px; object-fit: contain; display: block; border-radius: 6px; background: #fff; }
.top:has(.logo img) { align-items: center; }
.card.setup { display: block; border: 2px dashed var(--accent); }
.card.setup h2 { margin-bottom: 6px; }
.look { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; margin: 0; }
.look legend { font-size: 15px; font-weight: 600; padding: 0 4px; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.form label.swatch { position: relative; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; }
.swatch input:checked + span { border-color: var(--text); }
.form label.inline { flex-direction: row; align-items: center; justify-content: space-between; font-size: 15px; }
.inline input[type=color] { width: 52px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
.copy { display: block; margin-top: 4px; word-break: break-all; user-select: all; -webkit-user-select: all; color: var(--text); }
.muted a, .small a:not(.btn) { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.btn.danger:not(.ghost) { background: var(--late); color: #fff; }
