/* StaffHQ styles. Values come from docs/StaffHQ design tokens.json. */

:root {
  /* color */
  --cream: #F8F4ED;
  --white: #FFFFFF;
  --champagne: #E6D5B8;
  --latte: #B8946B;
  --mocha: #6B4A36;
  --espresso: #2E1F16;
  --hairline: #DED0B9;
  --success: #3B6D11;
  --danger: #A32D2D;

  /* type */
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;

  /* spacing */
  --space-2: 8px;
  --space-4: 16px;
  --space-6: 24px;
  --space-10: 40px;

  /* radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--cream);
  color: var(--espresso);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--mocha); }
a:hover { color: var(--espresso); }

h1, h2, h3, p { margin: 0; }

/* ---------- type styles ---------- */
.wordmark { font-family: var(--font-display); font-size: 30px; font-weight: 500; line-height: 1; color: var(--espresso); text-decoration: none; }
.t-display { font-family: var(--font-display); font-size: 48px; line-height: 52px; font-weight: 500; }
.t-title { font-family: var(--font-display); font-size: 32px; line-height: 38px; font-weight: 500; }
.t-agent { font-family: var(--font-display); font-size: 22px; line-height: 26px; font-weight: 500; }
.t-heading { font-size: 18px; line-height: 26px; font-weight: 500; }
.t-small { font-size: 13px; line-height: 20px; }
.t-label { font-size: 12px; line-height: 16px; font-weight: 500; }
.muted { color: var(--mocha); }

/* ---------- cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 20px;
  border-radius: var(--radius-sm);
  font: 500 14px var(--font-sans);
  text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--espresso); color: var(--cream); border: none; }
.btn-primary:hover { color: var(--cream); background: #3d2a1e; }
.btn-outline { background: var(--white); color: var(--mocha); border: 1px solid var(--latte); }
.btn-outline:hover { color: var(--espresso); background: var(--cream); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-text {
  background: none; border: none; padding: 0; min-height: 44px;
  font: 500 14px var(--font-sans); color: var(--mocha); cursor: pointer; text-decoration: underline;
}
.btn-text:hover { color: var(--espresso); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--mocha); cursor: pointer;
}
.btn-icon:hover { border-color: var(--hairline); color: var(--espresso); }
.btn:focus-visible, .btn-text:focus-visible, .btn-icon:focus-visible, a:focus-visible {
  outline: 2px solid var(--espresso); outline-offset: 2px;
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--espresso); }
.field .hint { font-size: 13px; line-height: 20px; color: var(--mocha); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--espresso);
  font: 400 15px/22px var(--font-sans);
}
textarea.input { resize: vertical; min-height: 96px; }
.input::placeholder { color: #9a8170; }
.input:focus { outline: none; border-color: var(--latte); box-shadow: 0 0 0 3px rgba(230, 213, 184, .7); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mocha); pointer-events: none; }
.input-prefix .input { padding-left: 24px; }

.error {
  display: none;
  font-size: 13px; line-height: 20px; color: var(--danger);
}
.error.show { display: block; }

.form-stack { display: flex; flex-direction: column; gap: var(--space-6); }

/* ---------- auth pages (log in, sign up) ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
}
.auth-side {
  position: relative; overflow: hidden;
  padding: var(--space-10);
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-10);
  border-right: 1px solid var(--hairline);
}
.auth-side .pitch { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--space-4); max-width: 460px; }
.auth-side .staff-row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.auth-main {
  background: var(--white);
  padding: var(--space-10);
  display: flex; flex-direction: column; justify-content: center;
}
.auth-form { width: 100%; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-6); }
.auth-form header { display: flex; flex-direction: column; gap: 6px; }
.auth-mobile-brand { display: none; }

.mini-staff { display: flex; align-items: center; gap: 12px; }

/* ---------- avatars & staff ---------- */
.avatar {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--champagne);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--espresso);
}
.avatar-lg { width: 48px; height: 48px; font-size: 22px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--mocha); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--latte); }
.status.ok { color: var(--success); }
.status.ok::before { background: var(--success); }

/* ---------- champagne bubbles motif ---------- */
.bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubbles span {
  position: absolute; bottom: -40px;
  border-radius: var(--radius-pill);
  animation: rise linear infinite;
}
@keyframes rise {
  from { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  to { transform: translateY(-110vh); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bubbles span { animation: none; bottom: auto; }
}

/* ---------- app shell (setup, home) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: 20px var(--space-10);
  background: var(--white);
  border-bottom: 1px solid var(--hairline);
}
.topbar .brand { display: flex; flex-direction: column; gap: 2px; }
.topbar .brand .t-label { font-weight: 400; color: var(--mocha); }

.page { max-width: 760px; margin: 0 auto; padding: var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); }
.page-wide { max-width: 1200px; }

/* wizard progress */
.progress { display: flex; flex-direction: column; gap: 12px; }
.progress-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.progress-bar span { height: 4px; border-radius: var(--radius-pill); background: var(--hairline); }
.progress-bar span.done { background: var(--latte); }
.progress-bar span.current { background: var(--espresso); }

.wizard-step { display: none; }
.wizard-step.active { display: flex; flex-direction: column; gap: var(--space-6); }
.wizard-head { display: flex; flex-direction: column; gap: 6px; }

.helper {
  display: flex; gap: 12px; align-items: flex-start;
  padding: var(--space-4);
  background: var(--cream);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
}
.helper .avatar { width: 36px; height: 36px; font-size: 17px; }

.wizard-actions {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--hairline);
}

/* repeating rows (services, FAQs) */
.rows { display: flex; flex-direction: column; gap: var(--space-4); }
.row-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: var(--space-4);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--cream);
}
.row-card .row-top { display: flex; gap: var(--space-2); align-items: flex-end; }
.row-card .row-top .field { flex: 1; }
.service-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; }

/* hours */
.hours { display: flex; flex-direction: column; }
.hours-row {
  display: grid; grid-template-columns: 140px 1fr; gap: var(--space-4); align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.hours-row:last-child { border-bottom: none; }
.hours-day { display: flex; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; min-height: 44px; }
.hours-times { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.hours-times .input { width: 140px; }
.hours-times .closed { color: var(--mocha); font-size: 13px; }

/* switch */
.switch { position: relative; width: 40px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: var(--radius-pill); background: var(--hairline); transition: background .15s; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: var(--radius-pill); background: var(--white); transition: transform .15s;
}
.switch input:checked + .track { background: var(--espresso); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--espresso); outline-offset: 2px; }

/* home */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.staff-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.staff-card .who { display: flex; align-items: center; gap: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.summary-item { display: flex; flex-direction: column; gap: 6px; padding: 20px var(--space-6); }
.band { background: var(--champagne); border-radius: var(--radius-md); padding: 20px var(--space-6); display: flex; flex-direction: column; gap: 6px; }

/* ---------- dashboard shell (side menu + main area, from the mockup) ---------- */
.app { min-height: 100vh; display: flex; }
.sidenav {
  flex: 0 0 248px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 32px 20px;
  background: var(--white);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; gap: 32px;
}
.sidenav .brand { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidenav .brand .biz { font-size: 12px; line-height: 16px; color: var(--mocha); }
.nav-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav-toggle { display: none; }
.nav-links { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  color: var(--mocha); text-decoration: none; font-size: 15px; line-height: 20px;
}
.nav-link:hover { color: var(--espresso); background: var(--cream); }
.nav-link[aria-current="page"] { background: var(--cream); color: var(--espresso); font-weight: 500; }
.nav-link svg { flex-shrink: 0; }
.nav-link .grow { flex: 1; }
.badge {
  font-size: 12px; line-height: 16px; font-weight: 500;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--espresso); color: var(--cream);
}
.nav-foot { padding: 0 12px; }
.main {
  flex: 1; min-width: 0; max-width: 1200px;
  padding: var(--space-10);
  display: flex; flex-direction: column; gap: 32px;
}
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-4); }
.page-head .text { display: flex; flex-direction: column; gap: 6px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link-sm { font-size: 13px; line-height: 20px; }

/* this week's numbers */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat.card, .stat.band { padding: 20px var(--space-6); }
.stat .value { font-family: var(--font-display); font-size: 40px; line-height: 1; font-weight: 500; }
.stat .note { font-size: 12px; line-height: 16px; color: var(--mocha); }
.stat .note.up { color: var(--success); }
.stat.band { border: none; }

.split { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: flex-start; }
.split > .wide { flex: 3 1 420px; min-width: 0; }
.split > .narrow { flex: 2 1 300px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }

/* approval rows */
.approval {
  display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--hairline); border-radius: var(--radius-md);
}
.approval.first { background: var(--cream); }
.approval .info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.approval .info .what { font-size: 15px; line-height: 22px; font-weight: 500; }
.approval .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.approval .more { flex-basis: 100%; display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13px; line-height: 20px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.approval .more dt { color: var(--mocha); }
.approval .more dd { margin: 0; overflow-wrap: anywhere; }

/* schedule rows */
.sched-row { display: flex; gap: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--hairline); }
.sched-row:last-child { padding-bottom: 0; border-bottom: none; }
.sched-row .time { font-size: 13px; line-height: 22px; font-weight: 500; width: 72px; flex-shrink: 0; }
.sched-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sched-row .side { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

.empty { font-size: 13px; line-height: 20px; color: var(--mocha); padding: var(--space-4); border: 1px dashed var(--hairline); border-radius: var(--radius-md); }

/* "Hire another staff member" card */
.hire-card {
  border: 1px dashed var(--latte); border-radius: var(--radius-md);
  padding: 20px; min-height: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  background: none; color: var(--mocha); font: inherit; text-align: center; cursor: pointer;
}
.hire-card:hover { background: var(--white); }
.hire-card .title { font-size: 15px; font-weight: 500; color: var(--espresso); }

/* status chips */
.chip { display: inline-flex; align-items: center; font-size: 12px; line-height: 16px; font-weight: 500; padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid var(--hairline); color: var(--mocha); background: var(--white); white-space: nowrap; }
.chip.new { background: var(--champagne); border-color: var(--champagne); color: var(--espresso); }
.chip.quoted, .chip.requested { border-color: var(--latte); }
.chip.booked, .chip.confirmed { color: var(--success); border-color: var(--success); }
.chip.lost, .chip.rejected { color: var(--mocha); background: var(--cream); }

/* tabs */
.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; border-bottom: 1px solid var(--hairline); }
.tab { min-height: 44px; padding: 0 var(--space-4); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font: 500 14px var(--font-sans); color: var(--mocha); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--espresso); border-bottom-color: var(--espresso); }

/* lead list */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; gap: var(--space-4); align-items: center;
  padding: var(--space-4) 0; border-bottom: 1px solid var(--hairline);
  color: inherit; text-decoration: none;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover .name { text-decoration: underline; }
.list-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row .name { font-size: 15px; line-height: 22px; font-weight: 500; }
.list-row .line { font-size: 13px; line-height: 20px; color: var(--mocha); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; font-size: 12px; color: var(--mocha); }

/* details list */
.details { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; line-height: 22px; }
.details dt { color: var(--mocha); }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* chat transcript */
.transcript { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; display: flex; flex-direction: column; gap: 4px; }
.msg .who { font-size: 12px; line-height: 16px; color: var(--mocha); }
.msg .body { padding: 10px 14px; border-radius: var(--radius-md); font-size: 14px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.lead { align-self: flex-start; }
.msg.lead .body { background: var(--cream); border: 1px solid var(--hairline); }
.msg.staff, .msg.owner { align-self: flex-end; align-items: flex-end; }
.msg.staff .body { background: var(--champagne); }
.msg.owner .body { background: var(--white); border: 1px solid var(--latte); }

/* pop-up windows */
dialog.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: var(--space-6); border: 1px solid var(--hairline); border-radius: var(--radius-md);
  background: var(--white); color: var(--espresso);
}
dialog.modal::backdrop { background: rgba(46, 31, 22, .35); }
dialog.modal form { display: flex; flex-direction: column; gap: var(--space-4); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; padding-top: var(--space-2); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* little confirmation message */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--espresso); color: var(--cream); font-size: 14px; line-height: 20px;
  z-index: 50;
}
.toast[hidden], .auth-form[hidden] { display: none; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { padding: var(--space-10) var(--space-4); justify-content: flex-start; background: var(--cream); }
  .auth-mobile-brand { display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
  .auth-form { background: var(--white); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: var(--space-6); }

  .app { flex-direction: column; }
  .sidenav { position: static; height: auto; flex: none; padding: 12px var(--space-4); gap: 12px; border-right: none; border-bottom: 1px solid var(--hairline); }
  .sidenav .brand { padding: 0; }
  .nav-toggle { display: inline-flex; }
  .sidenav:not(.open) .nav-links, .sidenav:not(.open) .nav-foot { display: none; }
  .nav-foot { padding: 0; }
  .main { padding: var(--space-6) var(--space-4); gap: var(--space-6); }
}
@media (max-width: 640px) {
  .topbar { padding: var(--space-4); }
  .page { padding: var(--space-6) var(--space-4); }
  .t-display { font-size: 36px; line-height: 40px; }
  .t-title { font-size: 28px; line-height: 34px; }
  .card { padding: 20px var(--space-4); }
  .service-grid { grid-template-columns: 1fr 1fr; }
  .service-grid .field-notes { grid-column: 1 / -1; }
  .hours-row { grid-template-columns: 1fr; gap: var(--space-2); }
  .hours-times .input { width: auto; flex: 1; min-width: 0; }
  .details, .approval .more { grid-template-columns: 1fr; gap: 0 12px; }
  .details dd, .approval .more dd { margin-bottom: 8px; }
  .msg { max-width: 92%; }
  .two-col { grid-template-columns: 1fr; }
  .list-row .side { display: none; }
  .approval .actions { width: 100%; }
}
