:root {
  --ink: #14161a;
  --muted: #6b7280;
  --line: #e7e9ee;
  --bg: #f3f4f6;
  --card: #ffffff;
  --accent: #6c63ff;
  --accent-ink: #ffffff;
  --green: #2e9c7f;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; margin-left: 14px; }
.topnav a:last-child { color: var(--accent); }
.wrap { max-width: 560px; margin: 0 auto; padding: 18px; }
.err { background: #fdecec; color: #a12; border-radius: 10px; padding: 8px 12px; font-size: .9rem; }
.btn.small { padding: 7px 12px; font-size: .85rem; }

/* dashboard KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi-num { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.kpi-num .cur { font-size: .9rem; font-weight: 700; color: var(--muted); margin-left: 3px; }
.kpi-lab { color: var(--muted); font-size: .85rem; }

/* customizable chart */
.chart-controls { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-controls select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
                         background: #fff; font-family: inherit; font-size: .85rem; font-weight: 600; }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.chart-nav { display: flex; gap: 6px; }
.navbtn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
          border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; padding-top: 18px; min-height: 150px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1 0 auto; min-width: 26px; }
.bar { width: 60%; min-width: 14px; max-width: 34px; background: linear-gradient(var(--accent), #9a94ff);
       border-radius: 5px 5px 0 0; }
.bar-val { font-size: .62rem; font-weight: 700; color: var(--muted); height: 12px; }
.bar-lab { font-size: .62rem; color: var(--muted); white-space: nowrap; }

/* suggestions */
.tips { display: flex; flex-direction: column; gap: 10px; }
.tip { border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: .9rem;
       background: #f6f5ff; border: 1px solid #e5e2ff; }
.tip.saturated { background: #fff4ec; border-color: #ffd9bf; }
.tip.demand { background: #eefaf3; border-color: #cdeedd; }
.tip-title { font-weight: 800; }
.tip-text { color: var(--muted); }

/* week calendar grid */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calwrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.calgrid { display: grid; grid-template-columns: 34px repeat(7, minmax(74px, 1fr)); min-width: 560px; }
.cal-times { position: relative; }
.cal-corner { height: 26px; border-bottom: 1px solid var(--line); }
.cal-time { position: absolute; left: 0; right: 2px; font-size: .58rem; color: var(--muted);
            transform: translateY(26px); text-align: right; padding-right: 3px; }
.cal-col { border-left: 1px solid var(--line); }
.cal-colh { height: 26px; display: flex; align-items: center; justify-content: center;
            font-size: .68rem; font-weight: 700; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.cal-body { position: relative; height: var(--gh); cursor: pointer; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid #f1f2f6; }
.cal-ev { position: absolute; left: 3px; right: 3px; background: #e7e9ff; border-left: 3px solid var(--accent);
          border-radius: 5px; padding: 2px 4px; font-size: .6rem; overflow: hidden; z-index: 2; }
.cal-ev.s-confirmed { background: #e3f5ee; border-left-color: var(--green); }
.cal-ev.s-pending_group, .cal-ev.s-pending_confirmation, .cal-ev.s-pending_payment { background: #fff4e0; border-left-color: #d99a00; }
.cal-ev.s-expired { background: #f2f3f5; border-left-color: #b7bcc4; color: #98a0aa; text-decoration: line-through; }
.evtag { display: inline-block; font-size: .52rem; font-weight: 700; text-transform: uppercase;
         letter-spacing: .03em; background: #d99a00; color: #fff; border-radius: 4px; padding: 0 3px; margin-left: 2px; }
.cal-ev.s-expired .evtag { background: #b7bcc4; }
/* open availability blocks (blue, behind bookings) */
.cal-open { position: absolute; left: 3px; right: 3px; z-index: 1;
            background: repeating-linear-gradient(45deg, #e8f0ff, #e8f0ff 6px, #dbe7ff 6px, #dbe7ff 12px);
            border: 1px dashed #9db8ee; border-radius: 5px; overflow: hidden; }
.cal-open span { font-size: .55rem; color: #3763c4; font-weight: 700; padding: 1px 4px; display: inline-block; }
/* drag-to-resize handles on base slots */
.cal-open.resizable { touch-action: none; }
.cal-open .rz { position: absolute; left: 0; right: 0; height: 10px; cursor: ns-resize; z-index: 3; }
.cal-open .rz-top { top: -2px; }
.cal-open .rz-bottom { bottom: -2px; }
.cal-open .rz::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%);
   top: 3px; width: 22px; height: 3px; border-radius: 3px; background: #9db8ee; opacity: .7; }
.cal-open.dragging { outline: 2px solid #6c63ff; z-index: 5; }
.cal-del { position: absolute; top: 1px; right: 1px; z-index: 4; }
.cal-del button { border: none; background: rgba(255,255,255,.7); color: #b04141; font-weight: 800;
                  cursor: pointer; border-radius: 4px; line-height: 1; padding: 1px 4px; font-size: .7rem; }
.banner { background: #eef6ff; border: 1px solid #cfe2fb; color: #2a5aa5; border-radius: 12px;
          padding: 10px 12px; margin-bottom: 12px; font-size: .9rem; }
.editbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card);
           border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px;
           position: sticky; top: 8px; z-index: 6; }
.editbar form { margin: 0; }
.editbar .muted { margin-right: auto; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-head .section { margin-bottom: .4rem; }
/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; font-size: .78rem; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.confirmed { background: #e3f5ee; border-left: 3px solid var(--green); }
.sw.pending { background: #fff4e0; border-left: 3px solid #d99a00; }
.sw.expired { background: #f2f3f5; border-left: 3px solid #b7bcc4; }
.sw.open { background: repeating-linear-gradient(45deg, #e8f0ff, #e8f0ff 3px, #dbe7ff 3px, #dbe7ff 6px); border: 1px dashed #9db8ee; }
.small { font-size: .85rem; }

.page-title { font-size: 1.9rem; font-weight: 800; margin: .2rem 0 .1rem; letter-spacing: -.02em; }
.lede { color: var(--muted); margin: .1rem 0 1.2rem; }
.lede.small { font-size: .9rem; }
.ctx { color: var(--muted); margin-bottom: 1rem; }
.section { font-size: 1.15rem; font-weight: 800; margin: 1.6rem 0 .7rem; }
.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: .6rem; font-weight: 600; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); background: var(--card);
         border-radius: var(--radius); }

/* professional / coach cards */
.pro-list { display: flex; flex-direction: column; gap: 12px; }
.pro-card {
  display: flex; align-items: center; gap: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  text-decoration: none; color: inherit;
}
.pro-card:active { transform: scale(.99); }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
          font-weight: 800; font-size: 1.2rem; flex: 0 0 auto; }
.avatar-img { border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.pro-meta { flex: 1 1 auto; min-width: 0; }
.pro-name { font-weight: 700; }
.pro-name.big { font-size: 1.3rem; }
.handle { color: var(--muted); font-weight: 500; font-size: .85rem; }
.pro-role { color: var(--muted); font-size: .9rem; }
.pro-rating .stars, .stars { color: #f5a623; font-weight: 700; font-size: .9rem; }
.pro-bio { color: var(--muted); font-size: .9rem; margin-top: .3rem; }
.pro-head { display: flex; gap: 14px; align-items: flex-start; background: var(--card);
            border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: .5rem; }
.chev { color: var(--muted); font-size: 1.5rem; }
.pill { background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .85rem; }

/* service cards */
.svc-list { display: flex; flex-direction: column; gap: 12px; }
.svc-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: inherit;
}
.svc-card.shared { border-style: dashed; }
.svc-name { font-weight: 700; }
.svc-blurb { color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.svc-price { font-weight: 800; white-space: nowrap; }

/* date strip + time list */
.date-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.date-pill {
  flex: 0 0 auto; width: 64px; padding: 10px 0; border: 1px solid var(--line);
  background: var(--card); border-radius: 14px; cursor: pointer; display: flex;
  flex-direction: column; align-items: center; gap: 2px; font-family: inherit;
}
.date-pill .dow { font-size: .75rem; color: var(--muted); }
.date-pill .dnum { font-size: 1.2rem; font-weight: 800; }
.date-pill .mon { font-size: .72rem; color: var(--muted); }
.date-pill.active { background: var(--accent); border-color: var(--accent); }
.date-pill.active .dow, .date-pill.active .dnum, .date-pill.active .mon { color: #fff; }
.time-list { display: none; flex-direction: column; gap: 10px; margin-top: 8px; }
.time-list.active { display: flex; }
.time-row {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; text-decoration: none; color: inherit; font-weight: 600;
}
.time-row:active { background: #f0f0ff; }

/* summary / review */
.summary-card, .policy, .panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.summary-card { margin-bottom: 14px; }
.sc-coach { font-weight: 700; }
.sc-when { margin-top: .4rem; font-weight: 600; }
.sc-time { color: var(--muted); }
.summary-card hr, .panel hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.line { display: flex; justify-content: space-between; margin: 6px 0; }
.line.muted { color: var(--muted); font-size: .9rem; }
.line.total { font-weight: 800; font-size: 1.1rem; }
.note { background: #f6f5ff; border: 1px solid #e5e2ff; color: #4b46b3; padding: 10px 12px;
        border-radius: 12px; font-size: .88rem; }
.policy { margin-bottom: 14px; }
.policy strong { display: block; margin-bottom: .3rem; }
.policy p { color: var(--muted); margin: 0; font-size: .9rem; }

/* forms */
.details-form { display: flex; flex-direction: column; gap: 12px; }
.details-form.inline { display: grid; grid-template-columns: repeat(2, 1fr); align-items: end; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--muted); font-weight: 600; }
input, textarea { padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 1rem; font-family: inherit; background: #fff; }
textarea { resize: vertical; }

.btn { display: inline-block; padding: 12px 18px; border-radius: 12px; background: #eef0f4;
       color: var(--ink); text-decoration: none; font-weight: 700; border: none; cursor: pointer;
       font-size: 1rem; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.block { display: block; width: 100%; margin-top: 6px; }

/* panels / status */
.panel { max-width: 460px; margin: 10px auto; text-align: center; }
.panel.success .check { width: 56px; height: 56px; border-radius: 50%; background: var(--green);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; margin: 0 auto 12px; }
.panel .price { font-weight: 800; }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: .85rem; }
.tag { display: inline-block; background: #fff3cd; color: #7a5b00; padding: 4px 10px; border-radius: 8px;
       font-size: .78rem; font-weight: 700; margin-bottom: 10px; }
.invite input { width: 100%; }
.plist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.plist li { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.status { font-weight: 700; text-transform: capitalize; }
.s-confirmed { color: var(--green); }
.s-pending_group, .s-pending_confirmation, .s-pending_payment { color: #b8860b; }
.s-cancelled, .s-expired { color: #b04141; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.linkbtn { background: none; border: none; color: #b04141; cursor: pointer; font-size: .85rem; padding: 0; }
.inline-del { display: inline; }
code { background: #eef0f4; padding: 2px 6px; border-radius: 6px; }
