/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --b3sb-white:  #ffffff;
  --b3sb-black:  #111111;
  --b3sb-g1:     #f5f5f5;
  --b3sb-g2:     #e5e7eb;
  --b3sb-g3:     #9ca3af;
  --b3sb-g4:     #6b7280;
  --b3sb-r:      12px;
  --b3sb-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* ── App wrapper ────────────────────────────────────────────────────────── */
.b3sb-app {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 0 48px;
  color: var(--b3sb-black);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Member Auth ───────────────────────────────────────────────────────── */
.b3sb-member-auth {
  max-width: 520px;
  margin: 24px auto;
}
.b3sb-auth-card {
  border: 1px solid #b9c4d1;
  background: #fff;
  box-shadow: var(--b3sb-shadow);
}
.b3sb-auth-head {
  padding: 16px 18px;
  background: linear-gradient(#80afe4, #2f77c3);
  color: #fff;
}
.b3sb-auth-head strong {
  display: block;
  font-size: 18px;
}
.b3sb-auth-head span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: .9;
}
.b3sb-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #d8dee8;
}
.b3sb-auth-tab {
  min-height: 42px;
  border: 0;
  border-right: 1px solid #d8dee8;
  background: linear-gradient(#fff, #e7edf5);
  color: #334155;
  font-weight: 700;
  cursor: pointer;
}
.b3sb-auth-tab:last-child { border-right: 0; }
.b3sb-auth-tab.is-active {
  background: linear-gradient(#2d82da, #075aa9);
  color: #fff;
}
.b3sb-auth-form {
  padding: 18px;
}
.b3sb-auth-form label {
  display: flex;
  justify-content: space-between;
  margin: 0 0 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.b3sb-auth-form label span {
  color: #94a3b8;
  font-weight: 600;
}
.b3sb-auth-form .b3sb-input {
  margin-bottom: 12px;
}

/* ── Member Bar ────────────────────────────────────────────────────────── */
.b3sb-member-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #c8d2df;
  background: #f8fafc;
}
.b3sb-member-bar span {
  display: block;
  color: #64748b;
  font-size: 11px;
}
.b3sb-member-bar strong {
  color: #111827;
}

/* ── Public Salon Board ────────────────────────────────────────────────── */
.b3sb-salon-public-shell {
  border: 1px solid #d8dee8;
  border-top: 0;
  padding: 12px;
  background: #fff;
}
.b3sb-public-schedule-wrap {
  border: 1px solid #a8b0bc;
  border-top: 0;
  background: #fff;
}
.b3sb-public-schedule {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.b3sb-public-board {
  --b3sb-hour-width: 122px;
}
.b3sb-public-grid {
  display: grid;
  grid-template-columns: 154px calc(var(--b3sb-hours) * var(--b3sb-hour-width));
  min-width: calc(154px + var(--b3sb-hours) * var(--b3sb-hour-width));
  font-size: 13px;
}
.b3sb-public-corner,
.b3sb-public-room,
.b3sb-public-time-head,
.b3sb-public-lane {
  border-right: 1px solid #a8b0bc;
  border-bottom: 1px solid #a8b0bc;
}
.b3sb-public-corner {
  position: sticky;
  left: 0;
  z-index: 12;
  height: 38px;
  padding: 9px 10px;
  background: #f5f7fa;
  text-align: center;
  font-weight: 700;
}
.b3sb-public-time-head {
  display: grid;
  grid-template-columns: repeat(var(--b3sb-hours), var(--b3sb-hour-width));
  height: 38px;
}
.b3sb-public-time-head div {
  padding: 9px 6px;
  border-right: 1px solid #a8b0bc;
  background: #f5f7fa;
  color: #253042;
  text-align: center;
  font-weight: 700;
}
.b3sb-public-room {
  position: sticky;
  left: 0;
  z-index: 11;
  min-height: 78px;
  padding: 10px;
  background: #f8fafc;
}
.b3sb-public-room strong {
  display: block;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #a9b1bc;
  border-radius: 4px;
  background: linear-gradient(#fff, #e1e7ef);
  color: #1f2937;
}
.b3sb-public-room span {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 11px;
}
.b3sb-public-lane {
  position: relative;
  min-height: 78px;
  background-color: #fff;
  background-image:
    repeating-linear-gradient(to right, transparent 0, transparent 60px, rgba(111, 124, 145, .22) 60px, rgba(111, 124, 145, .22) 61px),
    repeating-linear-gradient(to right, transparent 0, transparent 121px, rgba(58, 67, 81, .38) 121px, rgba(58, 67, 81, .38) 122px);
}
.b3sb-public-slot {
  position: absolute;
  top: 10px;
  z-index: 1;
  height: 58px;
  min-width: 42px;
  border: 1px dashed #dbe3ed;
  background: rgba(248, 250, 252, .18);
  color: #c4cedb;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.b3sb-public-slot:hover,
.b3sb-public-slot.selected,
.b3sb-public-slot.selected-range,
.b3sb-public-slot.dragging-range {
  z-index: 3;
  border-color: #0f5ca8;
  background: #1f7ed0;
  color: #fff;
  font-weight: 700;
}
.b3sb-public-slot.dragging-range {
  background: #4a9ae1;
}
.b3sb-public-slot span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.b3sb-public-booked {
  position: absolute;
  top: 12px;
  z-index: 7;
  height: 54px;
  padding: 6px 8px;
  border: 1px solid #d1b24c;
  border-radius: 3px;
  background: #fff3c8;
  color: #334155;
  cursor: not-allowed;
  pointer-events: auto;
  overflow: hidden;
}
.b3sb-public-booked-confirmed {
  border-color: #8dbb58;
  background: #e9f7d8;
}
.b3sb-public-booked-own {
  border-color: #5c9bd8;
  background: #dceeff;
}
.b3sb-public-booked strong,
.b3sb-public-booked span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.b3sb-public-booked span {
  color: #64748b;
  font-size: 11px;
}
.b3sb-public-no-slot {
  position: absolute;
  top: 28px;
  left: 12px;
  color: #a7b0bd;
  font-size: 12px;
  font-weight: 700;
}
.b3sb-public-empty {
  grid-column: 1 / span 2;
  padding: 24px;
  color: #94a3b8;
  text-align: center;
}
.b3sb-selected-head {
  margin: 0 0 10px;
  color: #1f2937;
  font-weight: 700;
}
.b3sb-member-confirm {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.b3sb-member-confirm div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.b3sb-member-confirm span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

/* ── Admin bar (管理者のみ表示) ──────────────────────────────────────────── */
.b3sb-admin-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.b3sb-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--b3sb-g1);
  border: 1px solid var(--b3sb-g2);
  border-radius: 6px;
  font-size: 11px;
  color: var(--b3sb-g4);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.b3sb-admin-btn:hover {
  background: var(--b3sb-g2);
  color: var(--b3sb-black);
  text-decoration: none;
}

.b3sb-admin-btn--login {
  color: var(--b3sb-g3);
}

.b3sb-admin-btn--login:hover {
  color: var(--b3sb-g4);
}

/* ── Section card ───────────────────────────────────────────────────────── */
.b3sb-section {
  position: relative;
  background: var(--b3sb-white);
  border: 1px solid var(--b3sb-g2);
  border-radius: var(--b3sb-r);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--b3sb-shadow);
}

.b3sb-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--b3sb-g1);
  border-bottom: 1px solid var(--b3sb-g2);
}

.b3sb-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--b3sb-black);
  color: var(--b3sb-white);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.b3sb-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.b3sb-section-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--b3sb-g4);
}

.b3sb-section-body {
  padding: 12px;
}

/* ── Room grid ──────────────────────────────────────────────────────────── */
.b3sb-room-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px;
}

@media (min-width: 480px) {
  .b3sb-room-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.b3sb-room-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1.5px solid var(--b3sb-g2);
  border-radius: 8px;
  cursor: pointer;
  background: var(--b3sb-white);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  gap: 2px;
  text-align: left;
}

.b3sb-room-option:hover {
  border-color: var(--b3sb-black);
}

.b3sb-room-option.selected {
  border-color: var(--b3sb-black);
  background: var(--b3sb-black);
  color: var(--b3sb-white);
}

.b3sb-room-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.b3sb-room-rate {
  font-size: 11px;
  opacity: 0.65;
}

/* ── Calendar lock overlay ──────────────────────────────────────────────── */
.b3sb-cal-lock {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.b3sb-cal-lock.hidden {
  display: none;
}

.b3sb-cal-lock span {
  font-size: 12px;
  color: var(--b3sb-g4);
  padding: 8px 18px;
  background: var(--b3sb-white);
  border: 1px solid var(--b3sb-g2);
  border-radius: 20px;
  box-shadow: var(--b3sb-shadow);
}

/* ── Calendar ───────────────────────────────────────────────────────────── */
.b3sb-calendar {
  padding: 12px;
}

.b3sb-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.b3sb-cal-month {
  font-size: 14px;
  font-weight: 600;
}

.b3sb-cal-prev,
.b3sb-cal-next {
  background: none;
  border: 1px solid var(--b3sb-g2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--b3sb-black);
  transition: background 0.12s;
}

.b3sb-cal-prev:hover,
.b3sb-cal-next:hover {
  background: var(--b3sb-g1);
}

.b3sb-cal-prev:disabled,
.b3sb-cal-next:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Calendar grid */
.b3sb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.b3sb-cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--b3sb-g3);
  padding: 4px 0;
  letter-spacing: 0.02em;
}

/* Day cell */
.b3sb-cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 2px;
  min-height: 58px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  gap: 1px;
}

.b3sb-cal-day:hover:not(.disabled):not(.other-month) {
  background: var(--b3sb-g1);
}

.b3sb-cal-day.other-month {
  visibility: hidden;
  pointer-events: none;
}

.b3sb-cal-day.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.b3sb-cal-day.selected {
  background: var(--b3sb-black);
}

.b3sb-cal-day.selected .b3sb-cal-num,
.b3sb-cal-day.selected .b3sb-avail-symbol,
.b3sb-cal-day.selected .b3sb-holiday-label {
  color: var(--b3sb-white) !important;
}

.b3sb-cal-day.today .b3sb-cal-num {
  background: var(--b3sb-black);
  color: var(--b3sb-white);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.b3sb-cal-day.sunday   .b3sb-cal-num { color: #ef4444; }
.b3sb-cal-day.saturday .b3sb-cal-num { color: #3b82f6; }
.b3sb-cal-day.holiday  .b3sb-cal-num { color: #ef4444; }

.b3sb-cal-num {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.b3sb-holiday-label {
  font-size: 8px;
  color: #ef4444;
  line-height: 1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 1px;
}

/* ── Availability symbols (larger) ───────────────────────────────────────── */
.b3sb-avail-symbol {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.b3sb-avail-empty  { color: #16a34a; }
.b3sb-avail-some   { color: #2563eb; }
.b3sb-avail-busy   { color: #d97706; }
.b3sb-avail-full   { color: #94a3b8; }
.b3sb-avail-closed { color: #d1d5db; }

/* ── Legend ─────────────────────────────────────────────────────────────── */
.b3sb-cal-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--b3sb-g2);
}

.b3sb-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--b3sb-g4);
}

/* ── Time panel ─────────────────────────────────────────────────────────── */
.b3sb-times-placeholder {
  text-align: center;
  color: var(--b3sb-g3);
  font-size: 13px;
  padding: 20px 0;
  margin: 0;
}

.b3sb-times-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--b3sb-g4);
  text-transform: uppercase;
  margin: 0 0 8px;
}

/* ── Time select (プルダウン) ────────────────────────────────────────── */
.b3sb-select-wrap {
  position: relative;
  margin-bottom: 14px;
}

.b3sb-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 14px;
  color: var(--b3sb-g4);
}

.b3sb-select {
  display: block;
  width: 100%;
  padding: 11px 36px 11px 12px;
  border: 1.5px solid var(--b3sb-g2);
  border-radius: 8px;
  background: var(--b3sb-white);
  font-size: 15px;
  font-family: inherit;
  color: var(--b3sb-black);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}

.b3sb-select:focus {
  outline: none;
  border-color: var(--b3sb-black);
}

.b3sb-select option:disabled {
  color: var(--b3sb-g3);
}

/* Price summary */
.b3sb-price-summary {
  background: var(--b3sb-g1);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.7;
}

.b3sb-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.b3sb-price-room {
  font-weight: 600;
}

.b3sb-price-dur {
  color: var(--b3sb-g4);
  font-size: 12px;
}

.b3sb-price-total-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--b3sb-g2);
  font-weight: 600;
}

.b3sb-price-total {
  font-size: 20px;
  font-weight: 700;
}

.b3sb-btn-proceed {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--b3sb-black);
  color: var(--b3sb-white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  font-family: inherit;
  transition: opacity 0.15s;
}

.b3sb-btn-proceed:hover {
  opacity: 0.82;
}

/* ── Detail view ────────────────────────────────────────────────────────── */
.b3sb-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.b3sb-btn-back-detail {
  background: none;
  border: 1px solid var(--b3sb-g2);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.12s;
}

.b3sb-btn-back-detail:hover {
  background: var(--b3sb-g1);
}

.b3sb-detail-summary {
  font-size: 12px;
  color: var(--b3sb-g4);
  line-height: 1.4;
}

.b3sb-step-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
}

/* Confirm card */
.b3sb-confirm-card {
  background: var(--b3sb-g1);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.b3sb-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--b3sb-g2);
  gap: 12px;
}

.b3sb-confirm-row:last-child {
  border-bottom: none;
}

.b3sb-confirm-label {
  color: var(--b3sb-g4);
  flex-shrink: 0;
  font-size: 12px;
}

.b3sb-confirm-value {
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.b3sb-confirm-price {
  font-size: 18px;
  font-weight: 700;
}

/* ── Form ───────────────────────────────────────────────────────────────── */
.b3sb-form-group {
  margin-bottom: 14px;
}

.b3sb-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  color: var(--b3sb-g4);
}

.b3sb-required {
  color: #ef4444;
  font-size: 10px;
  margin-left: 4px;
}

.b3sb-optional {
  color: var(--b3sb-g3);
  font-size: 10px;
  margin-left: 4px;
}

.b3sb-input,
.b3sb-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--b3sb-g2);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--b3sb-white);
  box-sizing: border-box;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.b3sb-input:focus,
.b3sb-textarea:focus {
  outline: none;
  border-color: var(--b3sb-black);
}

.b3sb-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.b3sb-btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--b3sb-black);
  color: var(--b3sb-white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  font-family: inherit;
  margin-bottom: 10px;
  transition: opacity 0.15s;
}

.b3sb-btn-primary:hover {
  opacity: 0.82;
}

.b3sb-back-row {
  text-align: center;
}

.b3sb-btn-back {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--b3sb-g4);
  cursor: pointer;
  padding: 6px 8px;
  font-family: inherit;
  transition: color 0.12s;
}

.b3sb-btn-back:hover {
  color: var(--b3sb-black);
}

.b3sb-btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ── Complete ───────────────────────────────────────────────────────────── */
.b3sb-complete {
  text-align: center;
  padding: 40px 20px;
}

.b3sb-complete-icon {
  font-size: 44px;
  margin-bottom: 16px;
  color: #16a34a;
  font-weight: 700;
}

.b3sb-complete-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.b3sb-complete-text {
  font-size: 13px;
  color: var(--b3sb-g4);
  line-height: 1.8;
}

/* ── Loading ────────────────────────────────────────────────────────────── */
.b3sb-loading {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.b3sb-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--b3sb-g2);
  border-top-color: var(--b3sb-black);
  border-radius: 50%;
  animation: b3sb-spin 0.7s linear infinite;
}

@keyframes b3sb-spin {
  to { transform: rotate(360deg); }
}

/* ── Error ──────────────────────────────────────────────────────────────── */
.b3sb-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: #dc2626;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .b3sb-app {
    max-width: none;
    padding-bottom: 28px;
  }
  .b3sb-member-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .b3sb-public-board {
    --b3sb-hour-width: 104px;
  }
  .b3sb-public-grid {
    grid-template-columns: 128px calc(var(--b3sb-hours) * var(--b3sb-hour-width));
    min-width: calc(128px + var(--b3sb-hours) * var(--b3sb-hour-width));
  }
  .b3sb-public-room {
    padding: 8px;
  }
  .b3sb-public-room strong {
    font-size: 13px;
  }
  .b3sb-public-slot {
    min-width: 36px;
  }
  .b3sb-auth-card {
    border-left: 0;
    border-right: 0;
  }
  .b3sb-member-confirm div {
    flex-direction: column;
    gap: 2px;
  }
}
