/* ============================================================
   Built Business OS — app styles
   Same look as builtbusinessos.com. Mobile first: bottom tab bar
   on phones, sidebar from 960px.
   ============================================================ */
:root {
  --bg: #120a10;
  --bg-2: #1b0f18;
  --surface: #241522;
  --surface-2: #2e1b2b;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f6eef3;
  --muted: #c8b6c2;
  --soft: #9d8896;
  --pink: #ff5c9d;
  --pink-2: #ff8fbd;
  --pink-ink: #2a0716;
  --gold: #f4c77a;
  --green: #4fd6a0;
  --red: #ff7a7a;
  --wa: #25d366;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--pink-2); }
h1, h2 { margin: 0 0 0.4em; line-height: 1.15; }
h1 { font-family: var(--display); font-weight: 600; font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 0.8em; }
.muted { color: var(--muted); }
.tiny { font-size: 0.8rem; }
.center { text-align: center; }
.right { text-align: right; }
.up { color: var(--green); }
.down { color: var(--red); }
:focus-visible { outline: 3px solid var(--pink-2); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.ico { width: 20px; height: 20px; flex: none; }

/* ---------- Layout ---------- */
.main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-left)) calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom));
}
.no-nav .main { padding-bottom: 40px; }

.sidebar { display: none; }
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(27, 15, 24, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--soft); text-decoration: none; font-size: 0.68rem; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a.active { color: var(--pink); }
.tabbar .ico { width: 22px; height: 22px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--pink), #ff9a7a); color: var(--pink-ink); font-weight: 800;
}
.brand-center { display: flex; justify-content: center; margin: 12px 0 20px; }

@media (min-width: 960px) {
  .has-nav .main { margin-left: 260px; width: auto; max-width: 1080px; padding: 32px 40px 60px; }
  .tabbar, .fab { display: none !important; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px;
    position: fixed; top: 0; bottom: 0; left: 0; width: 240px;
    padding: 24px 16px; background: var(--bg-2); border-right: 1px solid var(--line);
  }
  .salon-name { color: var(--soft); font-size: 0.85rem; margin: 6px 0 18px 4px; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
    color: var(--muted); text-decoration: none; font-weight: 600;
  }
  .side-nav a:hover { background: var(--surface); color: var(--text); }
  .side-nav a.active { background: var(--surface-2); color: var(--pink); }
  .side-cta { margin-top: auto; }
  .hide-mobile { display: inline-flex !important; }
}
.hide-mobile { display: none !important; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }
.eyebrow { color: var(--pink-2); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; margin: 0 0 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 6px; }
.back .ico { width: 16px; height: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; border: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--pink), #ff7a8a); color: var(--pink-ink); box-shadow: 0 8px 24px rgba(255, 92, 157, 0.3); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--pink-2); }
.btn-wa { background: var(--wa); color: #06210f; }
.btn-block { width: 100%; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; background: var(--surface); color: var(--text); border: 1px solid var(--line);
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 36px; padding: 6px 13px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  font: inherit; font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip .ico { width: 16px; height: 16px; }
.chip:hover { border-color: rgba(255, 255, 255, 0.25); }
.chip-done { background: rgba(79, 214, 160, 0.16); color: var(--green); border-color: rgba(79, 214, 160, 0.35); }
.chip-wa { background: rgba(37, 211, 102, 0.14); color: var(--wa); border-color: rgba(37, 211, 102, 0.35); }
.link, .link-btn { color: var(--pink-2); font-size: 0.9rem; background: none; border: 0; cursor: pointer; font: inherit; }
.link-btn { font-size: 1.3rem; line-height: 1; padding: 0 4px; color: var(--soft); }

.fab {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  z-index: 21; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), #ff7a8a); color: var(--pink-ink);
  box-shadow: 0 12px 30px rgba(255, 92, 157, 0.45);
}
.fab .ico { width: 28px; height: 28px; stroke-width: 2.4; }

/* ---------- Cards & forms ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.form { display: flex; flex-direction: column; gap: 14px; }
.form-narrow { max-width: 560px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
label .muted { font-weight: 400; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 16px; font-weight: 400; /* 16px stops iOS zooming in */
  color-scheme: dark;
}
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 92, 157, 0.2); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { flex-direction: row; align-items: center; gap: 8px; margin-top: 8px; color: var(--text); }
.check input { width: 20px; min-height: 20px; }
.inline, .inline-form { display: inline; }
.inline-form label { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 14px; }
.inline-form select { width: auto; }
.danger-zone { margin-top: 28px; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; }
.flash-ok { background: rgba(79, 214, 160, 0.14); color: #b9f2db; border: 1px solid rgba(79, 214, 160, 0.3); }
.flash-error { background: rgba(255, 122, 122, 0.14); color: #ffd0d0; border: 1px solid rgba(255, 122, 122, 0.3); }
.flash-warn { background: rgba(244, 199, 122, 0.14); color: #fbe4bb; border: 1px solid rgba(244, 199, 122, 0.35); }

/* ---------- Auth ---------- */
.auth { max-width: 440px; margin: 0 auto; padding-top: 4vh; }
.auth-card h1 { font-size: 1.6rem; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat span { color: var(--soft); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.stat strong { font-size: 1.45rem; font-weight: 700; }
.stat small { color: var(--muted); font-size: 0.8rem; }
.stat-hero { background: linear-gradient(135deg, rgba(255, 92, 157, 0.22), rgba(255, 154, 122, 0.12)); border-color: rgba(255, 92, 157, 0.35); }

/* ---------- Setup checklist ---------- */
.setup { border-color: rgba(255, 92, 157, 0.35); }
.steps { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
.steps .ico { width: 22px; height: 22px; padding: 3px; border-radius: 50%; border: 1.5px solid var(--soft); color: transparent; }
.steps li.done .ico { background: var(--green); border-color: var(--green); color: #06210f; }
.steps li.done span { color: var(--text); }

/* ---------- Week strip & day ---------- */
.week { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day {
  display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px;
  border-radius: 14px; text-decoration: none; color: var(--muted); border: 1px solid transparent;
}
.day span { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.day strong { font-size: 1.1rem; color: var(--text); }
.day i { font-style: normal; font-size: 0.7rem; color: var(--pink-2); min-height: 1em; font-weight: 700; }
.day.today { border-color: rgba(255, 92, 157, 0.4); }
.day.selected { background: linear-gradient(135deg, var(--pink), #ff7a8a); color: var(--pink-ink); }
.day.selected strong, .day.selected i { color: var(--pink-ink); }
@media (max-width: 380px) { .week .icon-btn { width: 32px; height: 32px; } .week { gap: 4px; } }

.day-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.day-head h2 { font-family: var(--display); font-size: 1.35rem; font-weight: 600; margin: 0; }
.day-head input[type="date"] { width: auto; min-height: 38px; padding: 6px 10px; font-size: 0.9rem; }
.day-sum { font-size: 0.9rem; }

.appts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.appt {
  display: flex; gap: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--pink); border-radius: var(--radius);
}
.appt.status-done { border-left-color: var(--green); }
.appt.status-no_show { border-left-color: var(--red); opacity: 0.75; }
.appt.status-cancelled { border-left-color: var(--soft); opacity: 0.55; }
.appt-time { display: flex; flex-direction: column; min-width: 50px; }
.appt-time strong { font-size: 1.05rem; }
.appt-time span { color: var(--soft); font-size: 0.8rem; }
.appt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.appt-client { color: var(--text); font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.appt-service { color: var(--muted); font-size: 0.9rem; }
.appt-notes { color: var(--soft); font-size: 0.85rem; font-style: italic; }
.appt-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.appt-actions form { display: contents; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge-done { background: rgba(79, 214, 160, 0.16); color: var(--green); }
.badge-no_show { background: rgba(255, 122, 122, 0.16); color: var(--red); }
.badge-booked { background: rgba(255, 92, 157, 0.16); color: var(--pink-2); }

.empty { text-align: center; padding: 34px 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- Lists ---------- */
.search { margin-bottom: 14px; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.card .list-row { background: var(--bg-2); }
.list-row > .ico { color: var(--soft); }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { color: var(--muted); font-size: 0.82rem; }
.avatar {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--surface-2); color: var(--pink-2); font-weight: 700;
}

.history { list-style: none; padding: 0; margin: 0; }
.history li, .history li > a { display: flex; justify-content: space-between; gap: 12px; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history li > a { flex: 1; color: var(--text); text-decoration: none; }

.two-col { display: grid; gap: 16px; }
.two-col > * { margin-bottom: 0; }
.two-col + * { margin-top: 16px; }
.two-col > div > .card:last-child { margin-bottom: 0; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }
.two-col { margin-bottom: 16px; }

/* ---------- Services ---------- */
.svc-list { list-style: none; padding: 0; margin: 0; }
.svc-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.svc-list li:last-child { border-bottom: 0; }
.svc-list li.archived { opacity: 0.5; }
.svc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.svc-row > input { grid-column: 1 / -1; }
.mini { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.mini input { min-height: 40px; padding: 8px 10px; }
@media (min-width: 700px) {
  .svc-row { grid-template-columns: 1fr 110px 110px auto auto; }
  .svc-row > input { grid-column: auto; }
}

/* ---------- Finance ---------- */
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav strong { min-width: 130px; text-align: center; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, var(--pink), rgba(255, 92, 157, 0.45)); }
.bar.today i { background: var(--gold); }
.bar span { font-size: 0.65rem; color: var(--soft); height: 1em; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { color: var(--soft); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; text-align: left; padding: 0 0 8px; }
.table td { padding: 9px 0; border-top: 1px solid var(--line); }
.table .right { text-align: right; }
.expense-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.expense-form input[name="description"] { grid-column: 1 / -1; }

/* ---------- Welcome (first screen after sign-up) ---------- */
.welcome { max-width: 560px; margin: 0 auto; padding: 6vh 0 20px; text-align: center; }
.welcome-burst {
  width: 96px; height: 96px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 48px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255, 92, 157, 0.35), rgba(255, 92, 157, 0.05) 70%);
  animation: pop 0.6s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .welcome-burst { animation: none; } }
.welcome h1 { font-size: clamp(2rem, 7vw, 2.8rem); margin-bottom: 10px; }
.welcome-lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 26px; }
.welcome-steps { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; text-align: left; }
.welcome-steps li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.welcome-steps li > span {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), #ff7a8a); color: var(--pink-ink); font-weight: 800;
}
.welcome-steps strong { display: block; }
.welcome-steps small { color: var(--muted); }
.btn-xl { width: 100%; min-height: 60px; font-size: 1.15rem; margin-bottom: 16px; }

/* ---------- Satisfaction ---------- */
.feedback-ask h2 { font-family: var(--display); font-size: 1.3rem; font-weight: 600; }
.feedback { border-color: rgba(255, 92, 157, 0.35); }
.faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.face { position: relative; align-items: center; gap: 4px; padding: 14px 6px; border-radius: var(--radius); background: var(--bg-2); border: 2px solid var(--line); cursor: pointer; text-align: center; }
.face input { position: absolute; opacity: 0; pointer-events: none; }
.face-emoji { font-size: 2.1rem; line-height: 1; }
.face-label { font-size: 0.85rem; color: var(--text); }
.face:has(input:checked) { border-color: var(--pink); background: rgba(255, 92, 157, 0.14); }
.face:has(input:focus-visible) { outline: 3px solid var(--pink-2); outline-offset: 2px; }
.feedback-comment { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
.table-wrap .table { min-width: 640px; }
.table td { vertical-align: top; }

/* ---------- Campaigns ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 9px 15px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); text-decoration: none; font-size: 0.88rem; font-weight: 600;
}
.tabs a.active { background: var(--surface-2); color: var(--pink); border-color: rgba(255, 92, 157, 0.45); }
.tabs i { font-style: normal; display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--pink); color: var(--pink-ink); font-size: 0.72rem; text-align: center; }
[data-campaign] > label { margin-bottom: 14px; }
.post { padding: 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 10px; }
.post p { margin: 6px 0 10px; color: var(--muted); }
