/* Inbox: the swatch card. Every chat carries one chip; its colour is its state.
   Lacquer red means "needs you" and nothing else. */
:root {
  --ground: #FBFAF8;
  --surface: #FFFFFF;
  --hover: #F5F0EC;
  --selected: #EFE7E1;
  --ink: #1F1A1C;
  --ink-2: #554C50;
  --ink-3: #6E6569;
  --rule: #E6E0DB;
  --rule-soft: #EFEAE6;

  --needs: #C8102E;
  --needs-text: #A80D27;
  --needs-wash: #FBEEF0;
  --you: #6B2D5C;
  --you-wash: #F3EAF0;
  --assistant: #E4CDBE;
  --assistant-wash: #F4EAE3;
  --booked: #B9C9B2;
  --booked-text: #3F5A38;
  --closed: #BFC4CB;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body {
  background: var(--ground); color: var(--ink);
  font: 14.5px/1.45 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  caret-color: var(--you);
}
::selection { background: var(--assistant); color: var(--ink); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--closed) transparent; }
.num { font-variant-numeric: tabular-nums; }
.code { font: 500 11px/1 var(--mono); letter-spacing: .04em; color: var(--ink-3); text-transform: uppercase; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- swatch chips ---------- */
.chip { display: inline-block; width: 12px; height: 18px; border-radius: 3px; flex: none; background: var(--c); }
.s-needs { --c: var(--needs); }
.s-you { --c: var(--you); }
.s-assistant { --c: var(--assistant); }
.s-booked { --c: var(--booked); }
.s-closed { --c: var(--closed); }
.repaint { animation: repaint 520ms var(--ease) both; }
@keyframes repaint { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 8px;
  font-weight: 600; font-size: 14px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  transition: background 160ms, border-color 160ms; white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: #D8D0CA; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #3A3236; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- sign in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.signin form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.signin .swatches { display: flex; gap: 6px; margin-bottom: 18px; }
.signin .swatches .chip { width: 18px; height: 30px; }
.signin h1 { font-size: 28px; font-weight: 650; letter-spacing: -.02em; }
.signin p { color: var(--ink-2); margin: -6px 0 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input {
  height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface);
  font-size: 15px; font-weight: 400; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--ink); }
.signin .btn { height: 44px; justify-content: center; margin-top: 6px; }
.error { color: var(--needs-text); font-size: 14px; }

/* ---------- shell ---------- */
.app { --rail: 216px; height: 100vh; height: 100dvh; display: grid; grid-template-columns: var(--rail) minmax(320px, 380px) minmax(0, 1fr); }
.app.info { grid-template-columns: var(--rail) minmax(320px, 380px) minmax(0, 1fr) 300px; }
.app.rail-min { --rail: 64px; }
.rail { border-right: 1px solid var(--rule); padding: 24px 14px 18px; display: flex; flex-direction: column; min-height: 0; }
.rail .who { padding: 0 6px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 36px; height: 36px; border-radius: 9px; flex: none; object-fit: cover; }
.rail .who-text { min-width: 0; }
.rail .salon { font-size: 16px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .mode { font-size: 12px; color: var(--ink-3); }
.legend { list-style: none; display: flex; flex-direction: column; gap: 2px; margin-top: 28px; }
.legend button {
  width: 100%; display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: center;
  padding: 8px; border-radius: 8px; font-size: 14px; text-align: left; color: var(--ink);
}
.legend button:hover { background: var(--hover); }
.legend button[aria-pressed="true"] { background: var(--selected); font-weight: 600; }
.legend .all { width: 12px; height: 18px; border-radius: 3px; border: 1.5px solid var(--ink-3); }
.legend .count { font: 500 12px/1 var(--mono); color: var(--ink-3); }
.legend .needs .count { color: var(--needs-text); font-weight: 700; }
.rail .foot { margin-top: auto; padding: 0 2px 0 8px; display: flex; align-items: center; gap: 2px; color: var(--ink-3); font-size: 13px; }
.rail .foot .me { margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn[aria-current="true"] { background: var(--selected); color: var(--ink); }
/* collapsed: swatches and counts only */
.rail-min .rail { padding: 20px 8px 14px; align-items: center; }
.rail-min .rail .who { padding: 0; }
.rail-min .who-text, .rail-min .legend .name, .rail-min .foot .me { display: none; }
.rail-min .legend { width: 100%; }
.rail-min .legend button { grid-template-columns: 1fr; justify-items: center; gap: 4px; padding: 8px 0; }
.rail-min .legend .count { font-size: 11px; }
.rail-min .rail .foot { flex-direction: column; padding: 0; gap: 4px; }

/* ---------- list ---------- */
.list { border-right: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; background: var(--ground); }
.list-head { padding: 24px 20px 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.list-head h2 { font-size: 21px; font-weight: 650; letter-spacing: -.015em; }
.list-head .side-tools { display: flex; align-items: center; gap: 4px; }
.list-head .compact { display: none; }
.list-head .heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-head .logo { width: 32px; height: 32px; border-radius: 8px; }
.chips-row { display: none; }
.salon-small { display: none; }
.rows { overflow-y: auto; flex: 1; list-style: none; }
a.row { color: inherit; text-decoration: none; }
.row {
  --row: var(--ground);
  width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; text-align: left;
  padding: 13px 20px; background: var(--row); transition: background 120ms; position: relative;
}
.rows li + li .row::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; border-top: 1px solid var(--rule-soft); }
.row:hover { --row: var(--hover); }
.row[aria-current="true"] { --row: var(--selected); }
.row .body { min-width: 0; }
.row .top { display: flex; align-items: center; gap: 8px; }
.row .top .chip { width: 8px; height: 12px; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.needs .name { color: var(--ink); font-weight: 650; }

/* initials with the channel's mark on the corner */
.avatar {
  position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--assistant-wash); color: var(--ink-2); font-size: 14px; font-weight: 600; letter-spacing: .01em;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl .badge { width: 24px; height: 24px; }
.avatar.xl .badge svg.i { width: 15px; height: 15px; }
.avatar .badge {
  position: absolute; right: -3px; bottom: -3px; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); box-shadow: 0 0 0 2px var(--row, var(--surface));
}
.avatar .badge svg.i { width: 13px; height: 13px; stroke-width: 2.1; }
.via { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); flex: none; align-self: center; }
.via svg.i { width: 15px; height: 15px; stroke-width: 1.9; }
.ch-whatsapp svg { color: #1FA855; }
.ch-instagram svg { color: #D62976; }
.ch-telegram svg { color: #229ED9; }
.row .time { margin-left: auto; font-size: 12px; color: var(--ink-3); flex: none; }
.row.needs .time { color: var(--needs-text); font-weight: 600; }
.row .snippet { color: var(--ink-3); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.state-line { font-size: 12.5px; margin-top: 3px; color: var(--ink-3); font-weight: 500; }
.state-line.needs { color: var(--needs-text); font-weight: 600; }
.state-line.you { color: var(--you); }
.state-line.booked { color: var(--booked-text); }
.empty { padding: 48px 24px; color: var(--ink-2); text-align: left; }
.empty h3 { font-size: 17px; color: var(--ink); margin-bottom: 4px; font-weight: 600; }

/* ---------- thread ---------- */
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ground); }
.thread-head { padding: 12px 20px 12px 24px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 12px; background: var(--surface); }
.thread-head .back { display: none; }
.settings .thread-head .title { flex: 1; }
.who-btn { flex: 0 1 auto; min-width: 0; margin-right: auto; display: flex; align-items: center; gap: 12px; text-align: left; padding: 4px 10px 4px 4px; margin-left: -4px; border-radius: 12px; transition: background 120ms; }
.who-btn:hover, .who-btn[aria-expanded="true"] { background: var(--hover); }
.thread-head .title { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.thread-head h1, .thread-head .t { font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .meta { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .actions { display: flex; gap: 6px; align-items: center; }
.btn svg.i { width: 18px; height: 18px; margin-left: -2px; }
.notice { margin: 16px 24px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--needs-wash); color: var(--needs-text); font-size: 14px; }
.notice b { font-weight: 650; }
.notice.you { background: var(--you-wash); color: var(--you); }
.notice span { color: var(--ink-2); }
.list .notice.down { margin: 0 16px 12px; }
.list .notice.off { margin: 0 16px 12px; background: var(--hover); color: var(--ink); }
.switches { display: grid; gap: 4px; margin-top: 12px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0;
  border-top: 1px solid var(--rule-soft); cursor: pointer; }
.switch span { display: grid; gap: 2px; font-weight: 550; }
.switch small { font-weight: 400; color: var(--ink-2); font-size: 13px; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--rule); position: relative;
  flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch input:disabled { opacity: .5; }
.list .notice.push { margin: 0 16px 12px; background: var(--hover); color: var(--ink); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice.push > div:first-child { flex: 1 1 200px; }
.notice-actions { display: flex; gap: 8px; }
.icon-btn[aria-pressed="true"] { color: var(--ink); }
.scroll { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.timeline { display: grid; grid-template-columns: 6px minmax(0, 1fr); column-gap: 22px; }
.timeline .strip { background: var(--c); border-radius: 0; }
.timeline .strip.first { border-top-right-radius: 3px; }
.timeline .strip.last { border-bottom-right-radius: 3px; }
.item { padding: 6px 24px 6px 0; display: flex; flex-direction: column; align-items: flex-start; }
.day { padding: 18px 24px 4px 0; text-align: center; }
.day span { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--hover); font-size: 12px; font-weight: 500; color: var(--ink-3); }
.label { font-size: 12px; color: var(--ink-3); margin: 10px 2px 4px; }
.item.out { align-items: flex-end; }
.bubble { max-width: min(560px, 70%); padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.bubble.client { background: var(--surface); box-shadow: 0 1px 2px rgba(31, 26, 28, .06); border-top-left-radius: 4px; }
.bubble.bot { background: var(--assistant-wash); border-top-right-radius: 4px; }
.bubble.owner { background: var(--you); color: #fff; border-top-right-radius: 4px; }
.bubble.owner::selection { background: #fff; color: var(--you); }
.event { align-self: center; display: inline-flex; align-items: center; gap: 8px; margin: 12px 0; padding: 6px 12px; border-radius: 10px; background: var(--surface); font-size: 12.5px; color: var(--ink-2); text-align: center; }
.event .chip { width: 8px; height: 14px; }
.event.needs { color: var(--needs-text); font-weight: 600; }
.event.booked { color: var(--booked-text); font-weight: 600; }
.event .detail { color: var(--ink-3); font-weight: 400; }

.composer { border-top: 1px solid var(--rule); padding: 12px 24px 14px; background: var(--surface); }
.composer form { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 180px; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--ground); font-size: 15px; line-height: 1.4;
}
.composer textarea:focus { outline: none; border-color: var(--ink-3); background: var(--surface); }
.composer textarea::placeholder { color: var(--ink-3); }
.composer .send { height: 44px; width: 44px; justify-content: center; padding: 0; }
.composer .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.composer .error { margin-top: 8px; }
.placeholder { flex: 1; display: grid; place-items: center; padding: 32px; }
.placeholder .key { display: flex; flex-direction: column; gap: 10px; max-width: 300px; }
.placeholder h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.placeholder .k { display: flex; gap: 12px; align-items: center; color: var(--ink-2); font-size: 14px; }

/* ---------- client panel ---------- */
.side { border-left: 1px solid var(--rule); padding: 18px 22px 24px; overflow-y: auto; background: var(--surface); }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; margin-right: -10px; }
.side-name { font-size: 17px; font-weight: 650; margin: 12px 0 6px; overflow-wrap: anywhere; }
.side h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin: 26px 0 6px; }
.side h3:first-child { margin-top: 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); font-size: 14px; }
.kv span:first-child { color: var(--ink-3); }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; }
.booking { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); font-size: 14px; display: grid; grid-template-columns: 8px 1fr; gap: 12px; }
.booking .chip { width: 8px; height: 100%; }
.booking b { font-weight: 600; display: block; }
.booking span { color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 14px; }

/* ---------- the colours guide (a popover: light dismiss, no modal) ---------- */
.legend .guide-link { color: var(--ink-3); font-size: 13px; margin-top: 10px; grid-template-columns: 12px 1fr; }
.legend .guide-link svg.i { width: 16px; height: 16px; margin-left: -2px; }
.legend .guide-link:hover { color: var(--ink); }
.rail-min .legend .guide-link { grid-template-columns: 1fr; }
.chips-row .guide-chip { width: 34px; padding: 0; justify-content: center; color: var(--ink-3); }
.chips-row .guide-chip svg.i { width: 18px; height: 18px; }
.guide {
  margin: auto; width: min(440px, calc(100% - 32px)); padding: 18px 20px 20px; border: 1px solid var(--rule);
  border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 48px rgba(31, 26, 28, .16);
}
.guide::backdrop { background: rgba(31, 26, 28, .18); }
.guide-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -8px 8px 0; }
.guide h2 { font-size: 16px; font-weight: 650; }
.guide dl > div { padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.guide dt { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.guide dt .chip { width: 10px; height: 15px; }
.guide dd { color: var(--ink-2); font-size: 14px; margin: 3px 0 0 20px; }

/* ---------- settings ---------- */
.settings-body { max-width: 620px; padding: 8px 24px 32px; }
.settings-body section { padding: 22px 0; border-bottom: 1px solid var(--rule-soft); }
.settings-body section:last-child { border-bottom: 0; }
.settings-body h2 { font-size: 15px; font-weight: 650; margin-bottom: 8px; }
.settings-body p { color: var(--ink-2); max-width: 60ch; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.settings .scroll { background: var(--surface); }
.settings-body .kv:last-of-type { border-bottom: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1360px) {
  .app, .app.info { grid-template-columns: var(--rail) minmax(300px, 360px) minmax(0, 1fr); }
  .side { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 100%); z-index: 5; box-shadow: -8px 0 28px rgba(31, 26, 28, .12); }
}
@media (max-width: 1080px) {
  .app, .app.info, .app.rail-min { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
  .rail { display: none; }
  .list-head .compact { display: grid; }
  .list-head .count-all { display: none; }
  .list-head .salon-small { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
  .list-head { padding: 18px 16px 6px; }
  .chips-row { display: flex; gap: 6px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
  .chips-row button {
    flex: none; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px;
    border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); font-size: 13.5px; font-weight: 500;
  }
  .chips-row button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
  .chips-row button[aria-pressed="true"] .code { color: #E9E3DF; }
  .chips-row .chip { width: 8px; height: 14px; }
  .row { padding: 12px 16px; }
  .rows li + li .row::before { left: 68px; }
}
@media (max-width: 760px) {
  .app, .app.info, .app.rail-min { grid-template-columns: minmax(0, 1fr); }
  .app.open .list { display: none; }
  .app:not(.open) .thread { display: none; }
  .list { border-right: 0; }
  .thread-head { padding: 10px 12px 10px 6px; }
  .thread-head .back { display: grid; }
  .settings .thread-head .close { display: none; }
  .thread-head .actions .btn { padding: 0; width: 40px; justify-content: center; }
  .thread-head .actions .btn svg.i { margin: 0; }
  .thread-head .actions .btn svg.chev { display: none; }
  .thread-head .actions .btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .who-btn { padding-right: 4px; }
  .notice { margin: 12px 16px 0; }
  .item, .day { padding-right: 16px; }
  .timeline { column-gap: 14px; }
  .composer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
  .bubble { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  .repaint { animation: none; }
  * { transition: none !important; }
}

.confirm-phone { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0 4px; border-top: 1px solid var(--rule-soft); }
.confirm-phone label { color: var(--ink-3); font-size: 13px; }
.confirm-phone .cp-row { display: flex; gap: 8px; }
.confirm-phone input { flex: 1; min-width: 0; width: 100%; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.confirm-phone input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.confirm-phone p { font-size: 12.5px; }
.confirm-phone .error { color: var(--needs-text); }

.menu-wrap { position: relative; }
.btn svg.chev { width: 14px; height: 14px; margin-left: -4px; color: var(--ink-3); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; padding: 6px; display: grid;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 14px 36px rgba(31, 26, 28, .14); }
.menu button { display: grid; gap: 1px; text-align: left; padding: 9px 10px; border-radius: 8px; }
.menu button:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu b { font-weight: 600; font-size: 14px; }
.menu span { font-size: 12.5px; color: var(--ink-3); }

.booking .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.booking .tags em { font-style: normal; font-size: 12px; color: var(--booked-text); background: var(--assistant-wash); border-radius: 6px; padding: 1px 6px; }
.muted.small { font-size: 12.5px; margin-top: 8px; }
