/* Timed salon calendar — structure consumes the active product theme. */

.sxc-shell,
.sxc-hours,
.sxc-pop {
  --sxc-surface: var(--flow-card);
  --sxc-surface-2: var(--flow-elevated);
  --sxc-ink: var(--flow-w90);
  --sxc-muted: var(--flow-w55);
  --sxc-faint: var(--flow-w40);
  --sxc-line: var(--flow-border);
  --sxc-line-soft: var(--flow-w08);
  --sxc-seg-track: var(--flow-w06);
  --sxc-seg-on-bg: var(--flow-card);
  --sxc-seg-on-ink: var(--flow-accent);
  --sxc-accent: var(--flow-accent);
  --sxc-chip: var(--flow-card);
  --sxc-chip-live: color-mix(in srgb, var(--flow-accent) 10%, var(--flow-card));
  --sxc-chip-done: var(--flow-subtle-bg);
  --sxc-chip-block: var(--flow-subtle-bg);
  --sxc-closed-a: var(--flow-inset-bg);
  --sxc-closed-b: var(--flow-subtle-bg);
  --sxc-pop: var(--flow-elevated);
}

.sxc-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin: 0 0 8px;
}

.sxc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sxc-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--sxc-seg-track);
}

.sxc-seg button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font: 650 13px/1 var(--flow-font, 'Space Grotesk', system-ui, sans-serif);
  color: var(--sxc-muted);
  cursor: pointer;
}

.sxc-seg button:hover,
.sxc-seg button:focus-visible {
  color: var(--sxc-ink);
  outline: none;
}

.sxc-seg button.is-on {
  background: var(--sxc-seg-on-bg);
  color: var(--sxc-seg-on-ink);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sxc-accent) 40%, transparent);
}

.sxc-toolbar .sxc-hint { display: none; }

#salon-cal-sub[hidden],
#salon-cal-cols[hidden],
#salon-cal-mount[hidden] {
  display: none !important;
}

/* ── Day board: one flush card surface ── */
.sxc-day {
  position: relative;
  display: grid;
  grid-template-columns: 48px repeat(var(--sxc-cols, 1), minmax(148px, 1fr));
  border-radius: 14px;
  background: var(--sxc-surface);
  overflow: auto;
  max-height: min(72vh, 780px);
  box-shadow: 0 0 0 1px var(--sxc-line);
  --sxc-pxh: 72px;
}

.sxc-day.is-phone {
  max-height: 62vh;
  border-radius: 12px;
  grid-template-columns: 36px repeat(var(--sxc-cols, 1), minmax(132px, 1fr));
  --sxc-pxh: 60px;
}

.sxc-corner,
.sxc-colhead {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--sxc-surface);
  border-bottom: 1px solid var(--sxc-line);
  padding: 12px 12px 11px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sxc-ink);
}

.sxc-corner {
  z-index: 5;
  left: 0;
  border-right: 1px solid var(--sxc-line-soft);
}

.sxc-colhead {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 1px solid var(--sxc-line-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
}

.sxc-colhead small {
  display: block;
  font-weight: 500;
  color: var(--sxc-muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: capitalize;
}

/* + column — same flush cell as staff headers */
.sxc-colhead.is-add {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.sxc-add {
  appearance: none;
  border: 0;
  background: color-mix(in srgb, var(--sxc-accent) 14%, transparent);
  color: var(--sxc-ink);
  width: 100%;
  height: 100%;
  min-height: 52px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 0;
}

.sxc-add:hover,
.sxc-add:focus-visible {
  background: color-mix(in srgb, var(--sxc-accent) 24%, transparent);
  outline: none;
}

.sxc-add svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
}

.sxc-rail {
  position: relative;
  border-right: 1px solid var(--sxc-line-soft);
  background: var(--sxc-surface);
}

.sxc-tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid transparent;
  font: 600 10.5px/1 'JetBrains Mono', ui-monospace, monospace;
  color: var(--sxc-faint);
  padding-left: 4px;
  transform: translateY(-50%);
  pointer-events: none;
}

.sxc-tick.is-hour { border-top-color: var(--sxc-line-soft); }

.sxc-col {
  position: relative;
  border-left: 1px solid var(--sxc-line-soft);
  min-height: calc(var(--sxc-span) * var(--sxc-pxh));
  background:
    repeating-linear-gradient(
      to bottom,
      var(--sxc-surface) 0,
      var(--sxc-surface) calc(var(--sxc-pxh) - 1px),
      var(--sxc-line-soft) calc(var(--sxc-pxh) - 1px),
      var(--sxc-line-soft) var(--sxc-pxh)
    );
}

.sxc-col.is-add-col {
  background: color-mix(in srgb, var(--sxc-accent) 5%, transparent);
}

.sxc-col.is-closed {
  background: repeating-linear-gradient(
    -45deg,
    var(--sxc-closed-a),
    var(--sxc-closed-a) 8px,
    var(--sxc-closed-b) 8px,
    var(--sxc-closed-b) 16px
  );
}

.sxc-slot {
  position: absolute;
  inset-inline: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  z-index: 1;
}

.sxc-slot:hover,
.sxc-slot:focus-visible {
  background: color-mix(in srgb, var(--sxc-accent) 12%, transparent);
  outline: none;
}

/* Flush booking cards — retail product language */
.sxc-chip {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  border-radius: 0;
  padding: 10px 12px 12px;
  background: var(--sxc-chip);
  border: 0;
  border-top: 1px solid var(--sxc-line);
  border-bottom: 1px solid var(--sxc-line);
  box-shadow: inset 3px 0 0 var(--sxc-accent);
  color: var(--sxc-ink);
  cursor: grab;
  overflow: hidden;
  font: 650 13px/1.25 var(--flow-font, 'Space Grotesk', system-ui, sans-serif);
  touch-action: none;
  user-select: none;
}

.sxc-chip.is-block {
  background: var(--sxc-chip-block);
  box-shadow: inset 3px 0 0 #6b7280;
  color: var(--sxc-muted);
}

.sxc-chip.is-live {
  background: var(--sxc-chip-live);
  box-shadow: inset 3px 0 0 var(--sxc-accent);
}

.sxc-chip.is-done {
  background: var(--sxc-chip-done);
  box-shadow: inset 3px 0 0 #5b6170;
  color: var(--sxc-muted);
}

.sxc-chip.is-dragging {
  opacity: 0.95;
  box-shadow: inset 3px 0 0 var(--sxc-accent), 0 10px 28px rgba(0, 0, 0, 0.35);
  cursor: grabbing;
  z-index: 6;
}

.sxc-chip .sxc-chip-t {
  font: 600 11px/1 'JetBrains Mono', ui-monospace, monospace;
  color: var(--sxc-accent);
  margin-bottom: 4px;
}

.sxc-chip.is-block .sxc-chip-t,
.sxc-chip.is-done .sxc-chip-t { color: var(--sxc-faint); }

.sxc-chip .sxc-chip-n {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sxc-ink);
}

.sxc-chip.is-done .sxc-chip-n { color: var(--sxc-muted); }

.sxc-chip .sxc-chip-s {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--sxc-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.sxc-chip.is-compact {
  padding: 6px 10px;
  display: flex;
  align-items: center;
}
.sxc-chip.is-compact .sxc-chip-n {
  font-size: 13px;
  line-height: 1.15;
}
.sxc-chip.is-compact .sxc-chip-t,
.sxc-chip.is-compact .sxc-chip-s { display: none; }

.sxc-seg-primary {
  padding: 4px;
  background: var(--sxc-seg-track);
}
.sxc-seg-primary button {
  padding: 9px 18px;
  font-size: 14px;
}

.sxc-resize {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  cursor: ns-resize;
}

.sxc-resize::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 2px;
  background: var(--sxc-faint);
}

.sxc-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  z-index: 3;
  border-top: 2px solid #e11d48;
  pointer-events: none;
}

.sxc-now::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e11d48;
}

/* Week */
.sxc-week {
  display: grid;
  grid-template-columns: 40px repeat(7, minmax(72px, 1fr));
  border-radius: 14px;
  overflow: auto;
  background: var(--sxc-surface);
  max-height: min(70vh, 720px);
  box-shadow: 0 0 0 1px var(--sxc-line);
  --sxc-pxh: 30px;
}

.sxc-week .sxc-corner,
.sxc-week .sxc-colhead {
  font-size: 12.5px;
  padding: 10px 6px;
  text-align: center;
  min-height: 44px;
}

.sxc-week .sxc-colhead { border-left: 1px solid var(--sxc-line-soft); }
.sxc-week .sxc-col {
  min-height: calc(var(--sxc-span) * var(--sxc-pxh));
  cursor: pointer;
  border-left: 1px solid var(--sxc-line-soft);
}

.sxc-week .sxc-chip {
  font-size: 11px;
  padding: 4px 6px;
  left: 0;
  right: 0;
  cursor: pointer;
}

.sxc-week .sxc-chip .sxc-chip-t,
.sxc-week .sxc-chip .sxc-chip-s,
.sxc-week .sxc-resize { display: none; }

.sxc-week .sxc-chip .sxc-chip-n { font-size: 11px; }

/* Popover — lives outside .sxc-shell sometimes, so redeclare tokens */
.sxc-pop {
  --sxc-surface: #161922;
  --sxc-ink: rgba(255, 255, 255, 0.92);
  --sxc-muted: rgba(255, 255, 255, 0.48);
  --sxc-line: rgba(255, 255, 255, 0.1);
  --sxc-pop: #1c2130;
  position: fixed;
  z-index: 80;
  min-width: 240px;
  max-width: 300px;
  background: var(--sxc-pop);
  color: var(--sxc-ink);
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--sxc-line), 0 18px 44px rgba(0, 0, 0, 0.4);
  padding: 14px;
  font: 500 14px/1.4 var(--flow-font, 'Space Grotesk', system-ui, sans-serif);
}

html[data-theme="light"] .sxc-pop {
  --sxc-ink: #0d0f14;
  --sxc-muted: rgba(12, 12, 24, 0.5);
  --sxc-line: rgba(12, 12, 24, 0.1);
  --sxc-pop: #fff;
}

.sxc-pop h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sxc-ink);
}

.sxc-pop p {
  margin: 0 0 12px;
  color: var(--sxc-muted);
  font-size: 13px;
}

.sxc-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sxc-pop-actions button {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  font: 650 13px/1 inherit;
  cursor: pointer;
  color: var(--sxc-ink);
}

html[data-theme="light"] .sxc-pop-actions button {
  background: rgba(12, 12, 24, 0.06);
}

.sxc-pop-actions button.pri { background: var(--sxc-accent); color: var(--salon-on-accent, #fff); }
.sxc-pop-actions button.danger {
  background: rgba(225, 29, 72, 0.14);
  color: #fb7185;
}
html[data-theme="light"] .sxc-pop-actions button.danger {
  color: #be123c;
}

/* Hours */
.sxc-hours { display: flex; flex-direction: column; gap: 10px; }
.sxc-hours-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
}
.sxc-hours-row b { font-weight: 700; text-transform: capitalize; }
.sxc-hours-ctrls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sxc-hours-ctrls input[type="time"] {
  border: 1px solid var(--sxc-line, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  padding: 8px 10px;
  font: 500 13px/1 'JetBrains Mono', ui-monospace, monospace;
  background: var(--sxc-surface-2, #1c2130);
  color: var(--sxc-ink, inherit);
}
.sxc-hours-ctrls label.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--sxc-muted, rgba(255, 255, 255, 0.55));
}

body.flow-phone-app .sxc-day.is-phone {
  background: var(--sxc-surface);
  box-shadow: 0 0 0 1px var(--sxc-line);
}
body.flow-phone-app .sxc-chip { background: var(--sxc-chip); }

@media (max-width: 720px) {
  .sxc-day:not(.is-phone) {
    grid-template-columns: 40px repeat(var(--sxc-cols, 1), minmax(120px, 1fr));
  }
}
