/* Herbal ERP — admin styling for the Herbal Hair & Spa screens. */
:root {
  --hb-green: #1F4A38;
  --hb-green-dark: #163528;
  --hb-gold: #8A6D24;
  --hb-cream: #F6F4EF;
  --hb-border: #e4ded1;
  --hb-muted: #7a7466;
}

.hb-wrap { max-width: 1100px; }
.hb-hero {
  background: linear-gradient(135deg, var(--hb-green), var(--hb-green-dark));
  color: #fff; border-radius: 16px; padding: 22px 26px; margin: 14px 0 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.hb-hero h1 { color: #fff; margin: 0 0 4px; font-size: 24px; }
.hb-hero p { margin: 0; opacity: .85; }
.hb-hero .hb-actions .button { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; }
.hb-hero .hb-actions .button:hover { background: rgba(255,255,255,.24); color: #fff; }

.hb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0 0 24px; }
.hb-kpi {
  background: #fff; border: 1px solid var(--hb-border); border-radius: 14px; padding: 18px 20px;
  position: relative; overflow: hidden;
}
.hb-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--hb-gold); }
.hb-kpi__value { font-size: 30px; font-weight: 800; color: var(--hb-green); line-height: 1.1; }
.hb-kpi__label { color: var(--hb-muted); margin-top: 4px; font-size: 13px; }
.hb-kpi--green .hb-kpi__value { color: var(--hb-green); }

.hb-card { background: #fff; border: 1px solid var(--hb-border); border-radius: 14px; padding: 20px 22px; margin-bottom: 18px; }
.hb-card h2 { margin-top: 0; color: var(--hb-green); font-size: 16px; }
.hb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 782px) { .hb-grid2 { grid-template-columns: 1fr; } }

.hb-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1ece0; }
.hb-row:last-child { border-bottom: 0; }
.hb-row b { color: var(--hb-green); }

.hb-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; text-transform: capitalize; }
.hb-pill--ok { background: #e6f4ea; color: #1a7f37; }
.hb-pill--warn { background: #fff4e5; color: #8a6d24; }
.hb-pill--bad { background: #fce8e6; color: #b3261e; }

/* CRM client list */
.hb-search { width: 320px; max-width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--hb-border); }
.hb-clients { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--hb-border); border-radius: 14px; overflow: hidden; }
.hb-clients th { text-align: left; background: var(--hb-cream); color: var(--hb-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px; }
.hb-clients td { padding: 12px 14px; border-top: 1px solid #f1ece0; }
.hb-clients tr:hover td { background: #faf8f3; }
.hb-clients a.hb-name { font-weight: 600; color: var(--hb-green); text-decoration: none; }

/* Sequences (automation) builder */
.hb-seq { border: 1px solid var(--hb-border); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; background: #fff; }
.hb-seq__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hb-seq__title { font-size: 15px; font-weight: 700; color: var(--hb-green); margin: 0; }
.hb-step { border: 1px dashed var(--hb-border); border-radius: 10px; padding: 12px; margin: 10px 0; background: var(--hb-cream); }
.hb-step__top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.hb-step textarea { width: 100%; }
.hb-step select, .hb-step input[type=number], .hb-step input[type=text] { vertical-align: middle; }
.hb-muted { color: var(--hb-muted); }
.hb-btn-add { color: var(--hb-green); font-weight: 600; text-decoration: none; }

/* ====================== Command Center ====================== */
.hb-dash { max-width: 1360px; }
.hb-dash .hb-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hb-dash .hb-kpi__value { font-size: 34px; margin-top: 6px; }
.hb-kpi__sub { color: var(--hb-muted); font-size: 12px; margin-top: 6px; }
.hb-kpi--link { display: block; text-decoration: none; transition: transform .08s ease, box-shadow .12s ease; }
.hb-kpi--link:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(31,74,56,.10); }
a.hb-att { text-decoration: none; color: inherit; margin: 0 -6px; padding-left: 6px; padding-right: 6px; border-radius: 8px; transition: background .12s ease; }
a.hb-att:hover { background: #faf6ec; }
.hb-card__view { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--hb-green); text-decoration: none; white-space: nowrap; }
.hb-card__view:hover { text-decoration: underline; }
.hb-delta { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.hb-delta--up   { background: #e6f4ea; color: #1a7f37; }
.hb-delta--down { background: #fce8e6; color: #b3261e; }
.hb-delta--flat { background: #eee; color: #666; }
.hb-delta--new  { background: #fff4e5; color: #8a6d24; }

.hb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.hb-grid .hb-card { margin-bottom: 0; }
.hb-col-2 { grid-column: span 2; }
.hb-col-3 { grid-column: span 3; }
@media (max-width: 1200px) {
  .hb-grid { grid-template-columns: 1fr; }
  .hb-col-2, .hb-col-3 { grid-column: span 1; }
}
.hb-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hb-card__head h2 { margin: 0; }
.hb-card__head .hb-muted { font-size: 12px; }
/* Charts need a fixed-height parent (Chart.js maintainAspectRatio:false),
   otherwise the canvas grows unbounded and the bars shoot off the top. */
.hb-chart { position: relative; height: 240px; width: 100%; }
.hb-chart canvas { position: absolute; inset: 0; }

/* Needs attention */
.hb-allgood { color: #1a7f37; font-weight: 600; margin: 6px 0; }
.hb-att { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1ece0; }
.hb-att:last-child { border-bottom: 0; }
.hb-att__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.hb-att--warn .hb-att__dot { background: #e0a106; }
.hb-att--bad .hb-att__dot { background: #d3352b; }
.hb-att__title { font-weight: 600; color: #2b2b2b; }
.hb-att__note { margin-left: auto; color: var(--hb-muted); font-size: 12px; }

/* Popular services bars */
.hb-bar-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1ece0; font-size: 13px; }
.hb-bar-row:last-child { border-bottom: 0; }
.hb-bar-row__name { font-weight: 600; color: #2b2b2b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-bar-row__val { color: var(--hb-muted); white-space: nowrap; }

/* Tables */
.hb-table { width: 100%; border-collapse: collapse; }
.hb-table th { text-align: left; color: var(--hb-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 8px; border-bottom: 2px solid #f1ece0; }
.hb-table td { padding: 10px 8px; border-bottom: 1px solid #f4efe4; font-size: 13px; }
.hb-table tr:last-child td { border-bottom: 0; }
.hb-util { display: inline-block; vertical-align: middle; width: 90px; height: 8px; background: #eee7d8; border-radius: 999px; overflow: hidden; margin-right: 8px; }
.hb-util span { display: block; height: 100%; background: var(--hb-green); border-radius: 999px; }
.hb-util__pct { font-size: 12px; color: var(--hb-muted); }

/* Client mini KPIs + lists */
.hb-mini-kpis { display: flex; gap: 10px; margin-bottom: 8px; }
.hb-mini-kpis > div { flex: 1; background: var(--hb-cream); border-radius: 10px; padding: 10px; text-align: center; }
.hb-mini-kpis b { display: block; font-size: 22px; color: var(--hb-green); }
.hb-mini-kpis span { font-size: 11px; color: var(--hb-muted); }
.hb-subhead { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--hb-muted); }
.hb-row--tight { padding: 6px 0; font-size: 13px; }

/* Financials + today */
.hb-fin { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hb-fin > div { background: var(--hb-cream); border-radius: 10px; padding: 12px 14px; }
.hb-fin span { display: block; color: var(--hb-muted); font-size: 12px; margin-bottom: 3px; }
.hb-fin b { font-size: 19px; color: var(--hb-green); }
.hb-today { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.hb-today__stat { background: var(--hb-cream); border-radius: 10px; padding: 12px; text-align: center; }
.hb-today__stat b { display: block; font-size: 22px; color: var(--hb-green); }
.hb-today__stat span { font-size: 11px; color: var(--hb-muted); }
.hb-appts { max-height: 260px; overflow: auto; }
@media (max-width: 782px) { .hb-today { grid-template-columns: repeat(2, 1fr); } }

/* Live salon floor / chair map */
.hb-floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.hb-chair { border: 1px solid var(--hb-border); border-radius: 12px; padding: 12px 14px; background: #fff; border-left: 4px solid #cfcabb; min-height: 96px; }
.hb-chair--busy { border-left-color: var(--hb-gold); background: #fbf7ec; }
.hb-chair--open { border-left-color: #1a7f37; background: #f2faf4; }
.hb-chair--off  { border-left-color: #cfcabb; background: #f7f6f2; opacity: .75; }
.hb-chair__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.hb-chair__name { font-weight: 700; color: var(--hb-green); font-size: 14px; border-bottom: 2px solid; padding-bottom: 1px; }
.hb-chair__station { font-size: 11px; color: var(--hb-muted); background: #efeadd; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.hb-chair__client { font-weight: 700; color: #2b2b2b; font-size: 15px; }
.hb-chair__svc { color: var(--hb-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-chair__meta { color: var(--hb-gold); font-size: 12px; font-weight: 700; margin-top: 4px; }
.hb-chair__status { font-weight: 700; font-size: 14px; color: #1a7f37; }
.hb-chair--off .hb-chair__status { color: var(--hb-muted); }
.hb-floor__bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hb-seg { display: inline-flex; border: 1px solid var(--hb-border); border-radius: 999px; overflow: hidden; background: #fff; }
.hb-seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 13px; font-weight: 700; color: var(--hb-muted); cursor: pointer; }
.hb-seg button:hover { background: #faf6ec; }
.hb-seg button.is-on { background: var(--hb-green); color: #fff; }
.hb-floor__dates { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hb-floor__dates input[type=date] { padding: 5px 8px; border: 1px solid var(--hb-border); border-radius: 8px; font-size: 13px; }
.hb-preset { border: 1px solid var(--hb-border); background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 700; color: var(--hb-green); cursor: pointer; }
.hb-preset:hover { background: #faf6ec; }
.hb-floor__total { font-weight: 800; color: var(--hb-green); margin-left: 4px; }
.hb-chair--ana { border-left-color: var(--hb-green); }
.hb-chair--ana .hb-chair__client { font-size: 18px; color: var(--hb-green); }
.hb-floor__legend { margin-right: 8px; }
.hb-floor__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.hb-floor__dot--busy { background: var(--hb-gold); }
.hb-floor__dot--open { background: #1a7f37; }

/* Messaging usage card */
.hb-usage__row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid #f4efe4; font-size: 13px; }
.hb-usage__row span:first-child { color: var(--hb-muted); }
.hb-usage__row b { color: var(--hb-green); }
.hb-usage__row em { color: var(--hb-muted); font-style: normal; font-weight: 500; font-size: 11px; }
.hb-usage__total b { font-size: 16px; }
.hb-usage__total { border-bottom: 0; }
.hb-usage__calc { margin-top: 10px; background: var(--hb-cream); border-radius: 10px; padding: 12px 14px; }
.hb-usage__calc label { font-size: 13px; color: #2b2b2b; }
.hb-usage__calc strong { color: var(--hb-green); margin-left: 6px; }

/* ====================== Schedule / Calendar ====================== */
.hb-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.hb-cal-col { background: #fff; border: 1px solid var(--hb-border); border-radius: 12px; overflow: hidden; }
.hb-cal-col__head { padding: 12px 14px; background: #fff; border-bottom: 1px solid #f1ece0; }
.hb-cal-col__name { font-weight: 700; color: var(--hb-green); display: flex; align-items: center; gap: 6px; }
.hb-cal-col__meta { color: var(--hb-muted); font-size: 12px; margin: 2px 0 8px; }
.hb-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #eee7d8; color: #8a6d24; padding: 1px 6px; border-radius: 999px; }
.hb-cal-col__body { padding: 8px 10px; max-height: 420px; overflow: auto; }
.hb-cal-appt { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid #f4efe4; }
.hb-cal-appt:last-child { border-bottom: 0; }
.hb-cal-appt__time { font-weight: 700; color: var(--hb-green); font-size: 12px; width: 64px; flex: none; }
.hb-cal-appt__body { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.hb-cal-appt__body strong { font-size: 13px; }
.hb-cal-appt__body .hb-muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spatial floor plan — editor (.hb-plan) + live map (.hb-map) */
.hb-plan, .hb-map {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border: 2px solid var(--hb-border); border-radius: 12px; overflow: hidden;
  background-color: #f7f5ef;
  background-image: linear-gradient(rgba(31,74,56,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(31,74,56,.05) 1px, transparent 1px);
  background-size: 5% 8.9%;
}
.hb-plan-stn, .hb-map-stn {
  position: absolute; border: 2px solid var(--hb-green); border-radius: 10px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px; overflow: hidden; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.hb-plan-stn { cursor: grab; touch-action: none; user-select: none; }
.hb-plan-stn.is-drag { cursor: grabbing; z-index: 5; box-shadow: 0 8px 20px rgba(0,0,0,.22); }
.hb-plan-stn__name, .hb-map-stn__name { font-weight: 800; font-size: 12px; color: var(--hb-green); line-height: 1.1; }
.hb-plan-stn__type { font-size: 10px; color: var(--hb-muted); }
.hb-map-stn--busy { border-color: var(--hb-gold); background: #fbf7ec; }
.hb-map-stn--open { border-color: #1a7f37; background: #f2faf4; }
.hb-map-stn--off  { border-color: #cfcabb; background: #f6f5f1; opacity: .82; }
.hb-map-stn--unassigned { border-color: #cfcabb; border-style: dashed; }
.hb-map-stn--t-wash { border-radius: 50%; }
.hb-map-stn--t-room, .hb-map-stn--t-desk { border-radius: 4px; }
.hb-map-stn__client { font-weight: 700; font-size: 12px; color: #2b2b2b; line-height: 1.1; }
.hb-map-stn__meta { font-size: 10px; color: var(--hb-muted); }
.hb-map-stn__staff { font-size: 10px; color: var(--hb-gold); font-weight: 700; }

/* Chair click → detail modal */
.hb-map-stn { cursor: pointer; }
.hb-map-stn:hover { box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 3; }
.hb-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.hb-modal__bg { position: absolute; inset: 0; background: rgba(0,0,0,.42); }
.hb-modal__card { position: relative; background: #fff; border-radius: 16px; padding: 20px 22px; width: 380px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.hb-modal__head { display: flex; align-items: center; justify-content: space-between; }
.hb-modal__head h3 { margin: 0; color: var(--hb-green); font-size: 18px; }
.hb-modal__x { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--hb-muted); }
.hb-modal__status { font-size: 14px; color: #2b2b2b; margin: 8px 0 14px; }
.hb-modal__stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.hb-modal__stats > div { background: var(--hb-cream); border-radius: 10px; padding: 12px; text-align: center; }
.hb-modal__stats b { display: block; font-size: 18px; color: var(--hb-green); }
.hb-modal__stats span { font-size: 11px; color: var(--hb-muted); }
.hb-modal__assign { display: block; font-weight: 700; color: var(--hb-muted); font-size: 13px; }
.hb-modal__assign select { display: block; width: 100%; margin-top: 6px; padding: 9px; border: 1px solid var(--hb-border); border-radius: 8px; font-size: 14px; }

/* ---- Schedule week view (time grid) ---- */
.hb-seg-group { display: inline-flex; border: 1px solid var(--hb-border); border-radius: 999px; overflow: hidden; background: #fff; }
.hb-seg-group .hb-seg { border: 0; border-radius: 0; padding: 7px 16px; font-size: 13px; font-weight: 700; color: var(--hb-muted); text-decoration: none; background: #fff; }
.hb-seg-group .hb-seg:hover { background: #faf6ec; }
.hb-seg-group .hb-seg.is-active { background: var(--hb-green); color: #fff; }

.hb-week-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 12px; }
.hb-week-legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #444; }
.hb-week-legend__item i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.hb-week { display: grid; grid-template-columns: 52px repeat(7, 1fr); gap: 0; background: #fff; border: 1px solid var(--hb-border); border-radius: 14px; overflow: hidden; }
.hb-week__gutter { position: relative; border-right: 1px solid var(--hb-border); }
.hb-week__hour { position: absolute; right: 6px; font-size: 11px; color: var(--hb-muted); transform: translateY(-6px); }
.hb-week__day { border-right: 1px solid #f0ece2; min-width: 0; }
.hb-week__day:last-child { border-right: 0; }
.hb-week__day.is-today { background: #fcfaf3; }
.hb-week__dayhead { text-align: center; padding: 8px 4px; border-bottom: 1px solid var(--hb-border); position: sticky; top: 32px; background: inherit; }
.hb-week__dow { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--hb-muted); }
.hb-week__dnum { display: block; font-size: 18px; font-weight: 700; color: #2b2b2b; }
.hb-week__day.is-today .hb-week__dnum { color: var(--hb-green); }
.hb-week__col { position: relative; }
.hb-week__line { position: absolute; left: 0; right: 0; height: 1px; background: #f2efe6; }
.hb-week__appt { position: absolute; left: 3px; right: 3px; border: 0; border-radius: 7px; color: #fff; text-align: left; padding: 3px 6px; cursor: pointer; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .08s; display: flex; flex-direction: column; line-height: 1.15; }
.hb-week__appt:hover { transform: scale(1.02); z-index: 5; box-shadow: 0 3px 10px rgba(0,0,0,.28); }
.hb-week__appt-t { font-size: 10px; opacity: .9; }
.hb-week__appt-c { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-week__appt-s { font-size: 10px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-week__appt.hb-status--completed { opacity: .78; }
.hb-week__appt.hb-status--no_show { background: #b32d2e !important; }
.hb-week__appt.hb-status--pending { outline: 2px dashed rgba(255,255,255,.6); outline-offset: -3px; }

/* Reschedule modal (reuses .hb-modal shell) */
.hb-modal[hidden] { display: none !important; }
#hbRes { background: rgba(0,0,0,.42); }
.hb-modal__box { position: relative; background: #fff; border-radius: 16px; padding: 20px 22px; width: 420px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.hb-modal__msg { font-size: 13px; min-height: 1.1em; margin: 4px 0; }
