/* =====================================================================
   Treatment Plan App — shared design system
   Ported from the client + provider clickable prototypes.
   Tokens, base type, and reusable components used by BOTH surfaces.
   ===================================================================== */

:root {
  --sand:      #EFE4D8;   /* page backdrop */
  --cream:     #FBF6F0;   /* surface bg */
  --card:      #FFFFFF;
  --espresso:  #2E2620;   /* primary text */
  --cocoa:     #5C4F44;   /* secondary text */
  --taupe:     #968779;   /* tertiary text */
  --clay:      #B5683F;   /* primary accent / CTA */
  --clay-deep: #9E552F;
  --clay-soft: #F3E4D8;   /* soft accent fill */
  --gold:      #C9A86A;
  --sage:      #7E8A6E;   /* success / done */
  --sage-soft: #EAEFE2;
  --line:      #E9DBCC;
  --shadow:    0 12px 30px -12px rgba(70, 50, 35, 0.28);
  --shadow-sm: 0 4px 14px -6px rgba(70, 50, 35, 0.22);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --maxw: 460px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: radial-gradient(120% 80% at 50% -10%, #F7EFE5 0%, var(--sand) 55%, #E5D7C7 100%);
  background-attachment: fixed;
  color: var(--espresso);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); }

/* ---------- App shell: a centered, responsive "device-less" column ---------- */
.app {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
}
@media (min-width: 520px) {
  .app {
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
    border-radius: 28px;
    overflow: hidden;
  }
}

/* ---------- Top app bar ---------- */
.appbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--cream);
  position: sticky; top: 0; z-index: 20;
}
.appbar .back {
  width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--cocoa); flex: 0 0 36px; transition: all .15s ease;
}
.appbar .back:hover { border-color: var(--gold); color: var(--espresso); }
.appbar .back[hidden] { display: none; }
.appbar .titles { flex: 1; min-width: 0; }
.appbar .kicker { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--taupe); font-weight: 600; }
.appbar .title { font-family: var(--serif); font-size: 19px; font-weight: 500; color: var(--espresso); line-height: 1.1; margin-top: 1px; }
.appbar .step { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--clay); background: var(--clay-soft); padding: 5px 10px; border-radius: 999px; }

/* progress dots for the builder flow */
.progress { display: flex; gap: 6px; padding: 10px 16px 0; }
.progress .pdot { flex: 1; height: 3px; border-radius: 999px; background: var(--line); }
.progress .pdot.on { background: var(--clay); }

/* ---------- Scroll body + sticky action bar ---------- */
.body { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.body::-webkit-scrollbar { width: 0; }
.pad { padding-left: 16px; padding-right: 16px; }

.actionbar {
  flex: 0 0 auto; padding: 12px 16px 18px; border-top: 1px solid var(--line);
  background: var(--cream); display: flex; flex-direction: column; gap: 9px;
  position: sticky; bottom: 0; z-index: 15;
}
.actionbar .hint { font-size: 11.5px; color: var(--taupe); text-align: center; }

/* ---------- Section heads ---------- */
.section-h {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--taupe); font-weight: 600; margin: 22px 16px 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-h.tight { margin-top: 16px; }

/* ---------- Buttons ---------- */
.btn {
  width: 100%; border: none; cursor: pointer;
  background: var(--clay); color: #fff; font-weight: 600; font-size: 15.5px;
  padding: 15px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 10px 22px -8px rgba(181,104,63,0.7);
  transition: transform .12s ease, background .18s ease;
}
.btn:hover { background: var(--clay-deep); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { background: #D9C6B6; cursor: not-allowed; box-shadow: none; transform: none; }
.btn svg { display: block; }
.btn-ghost {
  width: 100%; border: 1px solid var(--line); cursor: pointer; background: #fff; color: var(--cocoa);
  font-weight: 600; font-size: 14px; padding: 13px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .15s ease;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--espresso); }

/* ---------- Avatar ---------- */
.avatar {
  border-radius: 50%; background: linear-gradient(135deg, #C98A63, #9E552F);
  color: #fff; font-family: var(--serif); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Status pills ---------- */
.status-pill { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.status-pill.opened { background: var(--sage-soft); color: #59663F; }
.status-pill.booked { background: var(--clay-soft); color: var(--clay-deep); }
.status-pill.sent   { background: #EDE6DC; color: var(--cocoa); }

/* ---------- Generic card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }

/* ---------- Toggle ---------- */
.toggle { flex: 0 0 46px; width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s ease; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s ease; }
.toggle.on { background: var(--sage); }
.toggle.on::after { transform: translateX(20px); }

/* ---------- Bottom sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(40,30,22,0.45); opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 50; }
.overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(110%); bottom: 0;
  width: 100%; max-width: var(--maxw); z-index: 51;
  background: var(--cream); border-radius: 26px 26px 0 0;
  padding: 8px 18px 26px; transition: transform .3s cubic-bezier(.2,.8,.2,1);
  max-height: 82%; overflow-y: auto;
}
.sheet.show { transform: translateX(-50%) translateY(0); }
.sheet::-webkit-scrollbar { width: 0; }
.grab-bar { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 8px auto 14px; }
.sheet h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; }
.sheet .sub { font-size: 12.5px; color: var(--cocoa); margin-top: 3px; margin-bottom: 16px; }

/* slots (rebook) */
.slot { display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; transition: all .15s ease; background: #fff; }
.slot:hover { border-color: var(--gold); }
.slot.sel { border-color: var(--clay); background: var(--clay-soft); }
.slot .sd { font-size: 14.5px; font-weight: 600; color: var(--espresso); }
.slot .ss { font-size: 12.5px; color: var(--taupe); margin-top: 2px; }
.slot .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 20px; display: flex; align-items: center; justify-content: center; }
.slot.sel .radio { border-color: var(--clay); }
.slot.sel .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--clay); }

/* catalog items (product picker) */
.cat-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; margin-bottom: 9px; cursor: pointer; transition: all .15s ease; background: #fff; }
.cat-item:hover { border-color: var(--clay); }
.cat-item .swatch { flex: 0 0 40px; width: 40px; height: 48px; border-radius: 8px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; font-family: var(--serif); font-size: 9px; color: #fff; font-weight: 600; }
.cat-item .cinf { flex: 1; }
.cat-item .cnm { font-size: 13.5px; font-weight: 600; color: var(--espresso); }
.cat-item .cct { font-size: 11.5px; color: var(--taupe); margin-top: 1px; }
.cat-item .add { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--clay-soft); color: var(--clay-deep); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: var(--espresso); color: #F3E9DE; font-size: 13px; font-weight: 500;
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); z-index: 60;
  opacity: 0; pointer-events: none; transition: all .28s ease; display: flex; gap: 8px; align-items: center;
  max-width: 84%; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Small utilities ---------- */
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.center-col { display: flex; flex-direction: column; align-items: center; }
.muted { color: var(--taupe); }
