:root {
  --paper: #f8f4ee;
  --card: #fffdfa;
  --ink: #2b2025;
  --muted: #75686d;
  --line: #e6ded4;
  --accent: #7a2e4d;
  --accent-ink: #ffffff;
  --ok: #2e6b4a;
  --ok-bg: #e5f2ea;
  --warn: #92560b;
  --warn-bg: #fbf0dc;
  --err: #a12c2c;
  --err-bg: #fbe9e7;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin-top: 1.2em; }
.card > h2:first-child, .card h2:first-child { margin-top: 0; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
code { background: #f0eae2; padding: .35em .5em; border-radius: 6px; font-size: .82rem; word-break: break-all; display: inline-block; }

/* top navigation */
nav.top { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding: 8px 16px; background: var(--ink); color: #f6efe7; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font: 600 1.05rem var(--serif); }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font: italic 600 15px var(--serif); }
.mark.large { width: 56px; height: 56px; font-size: 30px; margin-bottom: 12px; }
.links { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.links a, .links .link { color: #e2d8cf; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .92rem; }
.links a:hover, .links .link:hover { background: #41333a; color: #fff; }
.links a.on { background: #fff; color: var(--ink); }
.links form { margin: 0; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 9px; background: #d9822b; color: #fff; font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
main.wide { max-width: none; padding: 10px 16px 0; }
.hero { text-align: center; padding: 72px 16px; }
.hero h1 { font-size: 2.6rem; margin-bottom: .2em; }
.hero p { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.4em; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card.empty { text-align: center; color: var(--muted); padding: 32px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* buttons and forms */
.btn { display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font: 600 .92rem var(--sans); cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { background: #f1eadf; filter: none; }
.btn.danger { color: var(--err); }
.btn.big { padding: 12px 18px; font-size: 1rem; }
.btn.small { padding: 4px 10px; font-size: .84rem; }
.btn.full { width: 100%; }
.btn.icon { padding: 6px 13px; font-size: 1.15rem; line-height: 1.1; }
.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; }
.links .link { text-decoration: none; }
label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 10px; }
input, select, textarea { display: block; width: 100%; margin-top: 3px; padding: 8px 10px; border: 1px solid #cfc5b9; border-radius: 7px; background: #fff; color: var(--ink); font: 400 15px var(--sans); }
input[type=color] { padding: 2px; height: 36px; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 6px 0 0; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .appt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; font-weight: 500; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 16px; align-items: end; }
.grid-form .span { grid-column: 1 / -1; }
.grid-form > .btn { justify-self: start; }
.row-form { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: end; }
.row-form label { flex: 1 1 120px; }
.row-form .btn { margin-bottom: 10px; }
.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spaced { margin-top: 10px; }
.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input { margin: 0; }
.short { width: 90px; }
.nowrap { white-space: nowrap; }
.hours-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.hours-row .check { width: 130px; margin: 0; }
.hours-row input[type=time] { width: 125px; margin: 0; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px; border-bottom: 1px solid #f0e9df; vertical-align: middle; }
.table input { margin: 0; }
.table tr:last-child td { border-bottom: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); color: #1f4f35; }
.flash.err { background: var(--err-bg); color: var(--err); }
.block-link { display: block; text-decoration: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .75rem; font-weight: 600; background: #efe8de; color: #5d5157; margin: 0 4px 2px 0; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn, .tag.pending, .tag.awaiting_deposit, .tag.no_show { background: var(--warn-bg); color: var(--warn); }
.tags { margin-bottom: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.note { background: #f6efe3; border-radius: 6px; padding: 6px 10px; margin: 6px 0 0; font-size: .9rem; white-space: pre-wrap; }
.client-note { background: #eef0f6; }
.request header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.request h3 { margin: 0 0 4px; }
.outbox-row { border-bottom: 1px solid #f0e9df; padding: 8px 0; }
.outbox-row summary { cursor: pointer; }
.outbox-row pre { white-space: pre-wrap; font: 14px/1.5 var(--sans); background: #faf6ef; padding: 10px; border-radius: 6px; margin: 8px 0 0; }

/* day calendar */
.calendar { display: flex; flex-direction: column; height: calc(100dvh - 62px); min-height: 480px; }
.cal-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.cal-bar h1 { margin: 0; font-size: 1.4rem; }
.cal-nav { display: flex; gap: 4px; }
.cal-bar input[type=date] { width: auto; margin: 0; padding: 5px 8px; }
.legend { display: flex; gap: 12px; margin-left: auto; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border-left: 3px solid #7a2e4d; }
.swatch.confirmed { background: #d9b7c5; }
.swatch.waiting { background: #fff; outline: 1px solid #d9b7c5; outline-offset: -1px; }
.swatch.pending { background: repeating-linear-gradient(135deg, #fbe3b6 0 3px, #fff7e8 3px 6px); border-left-color: #b8791a; }
.week { display: flex; gap: 3px; margin: 8px 0; }
.week button { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 2px 0; cursor: pointer; color: var(--ink); font: 600 .95rem var(--sans); }
.week button small { display: block; font-weight: 400; font-size: .7rem; color: var(--muted); }
.week button:hover { background: #efe7db; }
.week .week-arrow { flex: 0 0 34px; color: var(--muted); }
.week-day.today { border-color: var(--accent); }
.week-day.on { background: var(--accent) !important; color: #fff; }
.week-day.on small { color: #f1dde5; }
.rebook { margin-bottom: 8px; padding: 6px 12px; }

.cal-scroll { flex: 1; min-height: 0; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px 12px 0 0; overscroll-behavior: contain; }
#grid { min-width: min-content; }
.cal-head { position: sticky; top: 0; z-index: 6; display: grid; background: var(--card); border-bottom: 1px solid var(--line); }
.corner { position: sticky; left: 0; z-index: 7; background: var(--card); }
.col-head { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 6px; font-weight: 600; border-left: 1px solid var(--line); border-top: 3px solid var(--c, var(--line)); min-width: 0; }
.cal-body { display: grid; }
.axis { position: sticky; left: 0; z-index: 5; background: var(--card); }
.axis-hour { position: absolute; right: 8px; font-size: .74rem; color: var(--muted); transform: translateY(-1px); padding-top: 2px; white-space: nowrap; }
.col { position: relative; border-left: 1px solid var(--line); cursor: copy; touch-action: pan-x pan-y;
  background-image: repeating-linear-gradient(to bottom, #e9e2d8 0 1px, transparent 1px calc(var(--hour) / 2), #f3eee6 calc(var(--hour) / 2) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px) var(--hour)); }
.off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #efe9df 0 6px, #f6f1e9 6px 12px); pointer-events: none; display: grid; place-items: start center; color: var(--muted); font-size: .8rem; padding-top: 12px; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: #d2452c; z-index: 3; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #d2452c; }

.appt { position: absolute; z-index: 2; overflow: hidden; padding: 3px 7px; border-radius: 6px; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y;
  background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 40%, #fff); border-left: 4px solid var(--c); font-size: .82rem; line-height: 1.25; transition: box-shadow .1s; }
.appt:hover { box-shadow: 0 2px 8px rgb(43 32 37 / .18); z-index: 3; }
.appt.is-confirmed { background: color-mix(in srgb, var(--c) 30%, #fff); }
.appt.is-waiting { background: #fff; }
.appt.k-block { background: repeating-linear-gradient(135deg, #e7e1d8 0 6px, #f0ebe3 6px 12px); border-color: #cfc7bb; color: #5d5157; }
.appt.s-pending, .appt.s-awaiting_deposit, .appt.is-requested { background: repeating-linear-gradient(135deg, #fbe3b6 0 6px, #fff7e8 6px 12px); border: 1px dashed #b8791a; border-left: 4px solid #b8791a; }
.appt.is-cant { outline: 2px solid #d9822b; outline-offset: -2px; }
.appt.s-completed, .appt.s-no_show { opacity: .55; cursor: pointer; }
.appt.s-no_show .appt-who { text-decoration: line-through; }
.appt.dragging { opacity: .9; box-shadow: 0 6px 18px rgb(43 32 37 / .32); z-index: 5; cursor: grabbing; }
.appt.lifted { box-shadow: 0 6px 18px rgb(43 32 37 / .32); transform: scale(1.02); z-index: 5; touch-action: none; }
.appt-time { display: flex; gap: 5px; font-size: .72rem; color: color-mix(in srgb, var(--ink) 75%, transparent); white-space: nowrap; }
.tick { font-weight: 800; color: var(--ok); }
.appt-who { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-job { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-flag { font-size: .7rem; font-weight: 700; color: var(--warn); }
.appt.short { padding-top: 0; padding-bottom: 0; display: flex; gap: 6px; align-items: center; }
.appt.short .appt-job, .appt.short .appt-flag { display: none; }
.appt-add { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--c); background: #fff; color: var(--ink); font: 700 14px/1 var(--sans); cursor: pointer; opacity: 0; }
.appt:hover .appt-add, .appt:focus-within .appt-add { opacity: 1; }
@media (hover: none) { .appt-add { opacity: .85; } }
.appt-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; cursor: ns-resize; touch-action: none; }
.appt-resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: rgb(43 32 37 / .25); opacity: 0; }
.appt:hover .appt-resize::after { opacity: 1; }
@media (hover: none) { .appt-resize { height: 14px; } .appt-resize::after { opacity: 1; } }

.drawer { position: fixed; z-index: 20; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); padding: 16px; overflow-y: auto; background: var(--card); box-shadow: -8px 0 28px rgb(43 32 37 / .2); }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.drawer-head h2 { margin: 0 0 6px; font-size: 1.35rem; }
.icon-close { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.drawer-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.drawer-actions:empty { display: none; }
.field-row { display: flex; gap: 10px; }
.field-row > label { flex: 1; min-width: 0; }
.seg { display: flex; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { flex: 1; margin: 0; cursor: pointer; font-weight: 500; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 6px; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.results { border: 1px solid var(--line); border-radius: 8px; margin: -6px 0 10px; overflow: hidden; }
.results button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-bottom: 1px solid #f0e9df; background: #fff; cursor: pointer; font: inherit; }
.results button:hover { background: #f6efe3; }
.results .add-new { color: var(--accent); font-weight: 600; }
.client-chip { display: flex; justify-content: space-between; align-items: center; background: #f6efe3; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgb(0 0 0 / .3); }
.toast.err { background: var(--err); }
.toast button { background: none; border: 0; color: #f4c98f; font: 700 .92rem var(--sans); cursor: pointer; white-space: nowrap; padding: 0; }
.modal { border: 0; border-radius: 14px; padding: 20px; max-width: min(440px, calc(100vw - 32px)); }
.modal::backdrop { background: rgb(43 32 37 / .45); }
.modal h2 { margin-top: 0; }
.modal ul { padding-left: 18px; }

/* stylist's day */
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; text-align: center; }
.day-head h1 { margin: 0; }
.day-head p { margin: 0; }
.day-head .btn { font-size: 1.3rem; padding: 6px 16px; }
.agenda { list-style: none; margin: 0 0 16px; padding: 0; }
.agenda-item { display: grid; grid-template-columns: 76px 1fr; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.agenda-item time { font-weight: 700; font-family: var(--serif); }
.agenda-item.block { background: #f3eee6; color: var(--muted); }
.agenda-item.completed, .agenda-item.no_show { opacity: .6; }

/* messages */
.messenger { display: grid; gap: 14px; }
.messenger.with-list { grid-template-columns: 240px 1fr; }
.threads { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; align-self: start; }
.thread { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 8px; text-decoration: none; color: inherit; }
.thread:hover { background: #f4ede2; }
.thread.on { background: #efe5d8; }
.thread-text { flex: 1; min-width: 0; }
.thread small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; height: calc(100dvh - 190px); min-height: 360px; }
.conversation h2 { margin: 0 0 8px; }
.bubbles { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px; background: #f1eadf; align-self: flex-start; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble small { display: block; margin-top: 2px; font-size: .7rem; color: var(--muted); }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; }
.bubble.mine small { color: #f1dde5; }
.bubble.auto { align-self: center; background: transparent; border: 1px dashed var(--line); text-align: center; color: var(--muted); font-size: .88rem; }
.send { display: flex; gap: 8px; align-items: end; margin-top: 8px; }
.send textarea { margin: 0; }

/* client-facing pages */
.public { background: #fbf8f4; }
.public .btn { background: var(--accent); border-color: var(--accent); }
.public .btn.secondary, .public .btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.public .btn.ghost { color: var(--ink); border-color: var(--line); }
.public-head { text-align: center; padding: 26px 16px 4px; }
.public-head h1 { margin: 0; color: var(--accent); }
.public-head p { color: var(--muted); margin: 4px 0 0; }
.public-main { max-width: 620px; margin: 0 auto; padding: 14px 16px 16px; }
.public-foot { text-align: center; font-size: .76rem; color: var(--muted); padding: 8px 0 20px; }
.embed { background: transparent; }
.intro { text-align: center; color: var(--muted); }
.step { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 14px; margin: 0 0 12px; min-width: 0; }
.step legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font: 600 1.1rem var(--serif); }
.step legend span { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 6px; border-radius: 50%; background: var(--accent); color: #fff; font: 700 .8rem var(--sans); }
.step legend + * { clear: both; }
.choices { display: grid; gap: 6px; }
.choices.compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.choice { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; font: inherit; text-align: left; }
.choice span { color: var(--muted); font-size: .86rem; white-space: nowrap; }
.choice:hover { border-color: var(--accent); }
.choice.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice.on span { color: inherit; }
.month-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; transition: opacity .1s; }
.month-grid.loading { opacity: .4; }
.dow { text-align: center; font-size: .72rem; color: var(--muted); padding: 2px 0; }
.day { aspect-ratio: 1.2; max-height: 52px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: 600 .95rem var(--sans); cursor: pointer; }
.day:hover:not(:disabled) { border-color: var(--accent); }
.day:disabled { border-color: transparent; background: transparent; color: #c4b9ae; font-weight: 400; cursor: default; }
.day.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.times { margin-top: 12px; }
.time-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.choice.time { justify-content: center; padding: 8px 4px; }
.summary { font-weight: 600; background: #f8f2e9; border-radius: 8px; padding: 8px 12px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.deposit-box { border: 1px solid #e3c98f; background: var(--warn-bg); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.deposit-box p { margin: 6px 0; font-size: .9rem; }
.deposit-box .check { margin: 0; font-weight: 600; }
.big-money { font: 600 2rem var(--serif); margin: .2em 0; }
.big-confirm { font-size: 1.15rem; }
.appointment-card { text-align: center; margin-top: 12px; }
.appointment-card .tag { font-size: .85rem; }
.appointment-card form:first-of-type { margin-top: 12px; }

@media (max-width: 720px) {
  main { padding-top: 12px; }
  main.wide { padding: 8px 8px 0; }
  .legend { display: none; }
  .cal-bar h1 { font-size: 1.1rem; flex: 1 1 100%; order: -1; }
  .cal-bar input[type=date] { flex: 1; }
  .messenger.with-list { grid-template-columns: 1fr; }
  .threads { display: flex; overflow-x: auto; gap: 4px; }
  .thread { flex: none; }
  .thread small { display: none; }
  .bubble { max-width: 90%; }
  .links { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .links a, .links .link { white-space: nowrap; }
}
