/* ============================================================
   心理諮商所｜晤談室預約與自動白板系統 樣式表
   色調：溫潤米白底 + 沉穩鼠尾草綠主色，降低長時間盯螢幕疲勞
   ============================================================ */
:root {
  --bg-page: #f6f5f0;
  --bg-card: #ffffff;
  --bg-subtle: #efede6;
  --border-color: #dcd9cf;
  --border-strong: #bdb8aa;
  --text-main: #2c302e;
  --text-muted: #666c68;
  --primary: #2f5d50;
  --primary-hover: #244a40;
  --primary-soft: #e6f0ec;
  --danger: #b8443a;
  --danger-soft: #fdecea;
  --warn-bg: #fff6e0;
  --warn-border: #e5b84b;
  --warn-text: #7a5700;
  --outreach-bg: #fff8eb;
  --outreach-border: #d99b38;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(30, 35, 32, 0.06);
  --shadow-md: 0 6px 20px rgba(30, 35, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* ---------- 頂部導覽列 ---------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.app-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sync-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 99px;
  background: #fff6e0;
  color: #7a5700;
  border: 1px solid #e5c675;
}
.sync-badge.is-cloud {
  background: #e6f5ee;
  color: #1f6b49;
  border-color: #a8dcc3;
}

/* ---------- 按鈕與表單元件 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #c2dad2;
}
.btn-secondary:hover {
  background: #d5e6df;
}

.btn-outline {
  background: #fff;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background: var(--bg-subtle);
}

.btn-subtle {
  background: var(--bg-subtle);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 12px;
}
.btn-subtle:hover {
  background: #e3e0d6;
}

.btn-icon {
  background: #fff;
  border: 1px solid var(--border-color);
  padding: 5px 9px;
}
.btn-icon:hover {
  background: var(--bg-subtle);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f3c4be;
}
.btn-danger:hover {
  background: #fad6d2;
}

.select-input,
.text-input {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text-main);
}
.select-input:focus,
.text-input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

/* 下拉選單 */
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 170px;
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropdown-menu button {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-main);
}
.dropdown-menu button:hover {
  background: var(--bg-subtle);
}
.dropdown-menu .danger-text {
  color: var(--danger);
}

/* ---------- 工具列 ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg-page);
}

.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.tab-btn .tab-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 99px;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tab-btn.active .tab-hint {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.period-label {
  font-weight: 700;
  font-size: 14px;
  min-width: 190px;
  text-align: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

/* ---------- 圖例列 ---------- */
.legend-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 10px;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-tip {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- 主容器 ---------- */
.main-container {
  padding: 0 24px 36px;
}

/* ============================================================
   視圖 1：週登記表（對應原紙本登記表）
   ============================================================ */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.weekly-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  font-size: 13px;
}

.weekly-table th,
.weekly-table td {
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  vertical-align: top;
}

.weekly-table thead th {
  background: #f0eee7;
  font-weight: 700;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 5;
}

.weekly-table thead th .day-date {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.weekly-table thead th.is-today {
  background: var(--primary-soft);
  color: var(--primary);
}

.room-col {
  width: 66px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  background: #f7f5ef;
  vertical-align: middle !important;
  color: var(--primary);
}

.room-col.room-out {
  background: var(--outreach-bg);
  color: #9e650a;
}

.time-col {
  width: 96px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: #fbfaf7;
  white-space: nowrap;
  vertical-align: middle !important;
}

.room-separator td {
  border-top: 2.5px solid var(--border-strong);
}

.slot-cell {
  min-height: 52px;
  height: 52px;
  padding: 0 !important;
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
  overflow: visible;
}

.slot-cell:hover {
  background: #f4f8f6;
}

.slot-cell.drag-over {
  background: #d8efe5 !important;
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}

.slot-cell.outreach-cell {
  background: #fffdf8;
  min-height: 82px;
  height: 82px;
  padding: 6px !important;
}
.slot-cell.outreach-cell:hover {
  background: #fff6e3;
}

/* 精準比例跨時段塗色色塊（例如 13:15~14:15 => 1300格下3/4 + 1400格上1/4） */
.prop-block {
  position: absolute;
  left: 3px;
  right: 3px;
  border-left: 3.5px solid #333;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11.5px;
  line-height: 1.25;
  overflow: hidden;
  cursor: grab;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.12s ease, opacity 0.12s ease;
}
.prop-block:hover {
  z-index: 6;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  overflow: visible;
  min-height: fit-content;
}
.prop-block.is-locked {
  cursor: pointer;
}
.prop-block.dragging {
  opacity: 0.45;
}
.prop-block.continues-down {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.prop-block.continues-up {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 1px dashed rgba(0, 0, 0, 0.18);
}
.prop-block .chip-head {
  font-weight: 700;
}
.prop-block .chip-time {
  font-size: 10px;
  opacity: 0.85;
  margin-right: 3px;
}

.booking-chip {
  display: block;
  border-radius: 6px;
  padding: 4px 7px;
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 1.35;
  border-left: 3.5px solid #333;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.booking-chip:last-child {
  margin-bottom: 0;
}
.booking-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.booking-chip .chip-head {
  font-weight: 700;
}
.booking-chip .chip-note {
  display: inline-block;
  font-size: 11px;
  opacity: 0.9;
}
.booking-chip.continuation {
  opacity: 0.72;
  border-style: dashed;
  border-left-style: solid;
}

/* ============================================================
   視圖 2：月白板檢視（對應原所上白板）
   ============================================================ */
.whiteboard-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.wb-badge {
  margin-left: 10px;
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 9px;
  border-radius: 99px;
  font-weight: 600;
}

.whiteboard-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--border-color);
  gap: 1px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.wb-weekday-head {
  background: #ece9e0;
  text-align: center;
  padding: 8px 4px;
  font-weight: 700;
  font-size: 13px;
}

.wb-day-cell {
  background: #fff;
  min-height: 155px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.wb-day-cell:hover {
  background: #fafaf7;
}
.wb-day-cell.other-month {
  background: #f5f4f0;
  color: #a5a59e;
}
.wb-day-cell.is-today {
  background: #f3faf7;
}

.wb-day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #e5e2d8;
  padding-bottom: 4px;
}
.wb-day-num {
  font-weight: 700;
  font-size: 13px;
}
.wb-day-add {
  font-size: 11px;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.12s;
}
.wb-day-cell:hover .wb-day-add {
  opacity: 1;
}

.wb-therapist-group {
  margin-bottom: 4px;
}
.wb-therapist-name {
  font-weight: 800;
  font-size: 12.5px;
  margin-bottom: 2px;
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
}
.wb-entry {
  font-size: 11.5px;
  line-height: 1.4;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  word-break: break-word;
}
.wb-entry:hover {
  background: var(--bg-subtle);
}
.wb-room-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  margin-right: 3px;
  background: #eceae2;
  color: #444;
}
.wb-room-tag.is-out {
  background: #fdecc8;
  color: #8f5800;
}

/* 白板大螢幕看板模式 */
body.kiosk-mode .app-header,
body.kiosk-mode .toolbar,
body.kiosk-mode .legend-bar {
  display: none;
}
body.kiosk-mode .main-container {
  padding: 12px;
}
body.kiosk-mode .wb-day-cell {
  min-height: 175px;
}

/* ============================================================
   視圖 3：空間平面圖（對齊附檔左下 A、右上 B、右下 C）
   ============================================================ */
.floorplan-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.fp-date-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
}

.fp-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 3px;
}
.status-dot.free {
  background: #3d9970;
}
.status-dot.busy {
  background: #d9534f;
}

.floorplan-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
}

@media (max-width: 960px) {
  .floorplan-layout {
    grid-template-columns: 1fr;
  }
}

.floorplan-canvas {
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.canvas-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* 精準對應附檔平面圖：2x2 空間配置（左上走廊、右上 B、左下 A、右下 C） */
.fp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(210px, auto) minmax(210px, auto);
  gap: 24px 36px;
}

@media (max-width: 680px) {
  .fp-grid {
    grid-template-columns: 1fr;
  }
}

.fp-common-area {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: #faf9f5;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
}
.common-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}
.common-desc {
  font-size: 12px;
  margin: 0;
  max-width: 240px;
}

.fp-room-card {
  border: 2.5px solid #2c302e;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.15s ease;
  cursor: pointer;
}
.fp-room-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.fp-room-card.state-free {
  background: #f5fbf8;
  border-color: #3d9970;
}
.fp-room-card.state-busy {
  background: #fff6f5;
  border-color: #c94c4c;
}

.fp-room-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.fp-room-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}
.fp-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}
.fp-status-pill.free {
  background: #dcf3e8;
  color: #1f6b49;
}
.fp-status-pill.busy {
  background: #fde4e2;
  color: #a6322b;
}

.fp-room-bookings {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.fp-empty-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.fp-room-footer {
  display: flex;
  justify-content: flex-end;
}

.fp-outreach-panel {
  background: var(--outreach-bg);
  border: 1.5px solid #e6c68b;
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.outreach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.outreach-header h3 {
  margin: 0;
  font-size: 15px;
  color: #825204;
}
.outreach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Modal 彈窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 30, 28, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-sm {
  max-width: 390px;
}
.modal-lg {
  max-width: 720px;
}

.alert-box.success {
  background: #e6f5ee;
  border: 1px solid #a8dcc3;
  color: #1f6b49;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #d9483b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- 事後補充註記區 ---------- */
.post-notes-box {
  background: #faf9f5;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.post-notes-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
}
.post-notes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}
.post-note-item {
  background: #fff;
  border: 1px solid #e5e2d8;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
}
.post-note-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.post-note-composer {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- 公開客戶端預約頁 ---------- */
.client-shell {
  min-height: 100vh;
  background: var(--bg-page);
}
.client-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border-color);
}
.client-main {
  max-width: 720px;
  margin: 24px auto;
  padding: 0 16px 40px;
}
.client-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.client-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
  color: var(--primary);
}
.client-hint {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.client-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.slot-builder-box {
  background: #f8f7f2;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}
.slot-builder-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.slot-builder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.time-tilde {
  font-weight: 700;
  color: var(--text-muted);
}
.selected-slots-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.slot-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #b5d6c9;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
}
.slot-tag button {
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
  padding: 0 2px;
}
.client-submit-row {
  display: flex;
  justify-content: flex-end;
}

/* ---------- 第 4 工作表：個案預約審核清單 ---------- */
.requests-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.requests-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.requests-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.request-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.request-card.is-confirmed {
  border-left: 5px solid #2f855a;
  background: #fafdfb;
}
.request-card.is-rejected {
  opacity: 0.65;
  border-left: 5px solid #a0aec0;
}
.req-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.req-client-title {
  font-size: 16px;
  font-weight: 800;
}
.req-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.req-status-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}
.req-status-pill.pending {
  background: #fff3d6;
  color: #8a5a00;
}
.req-status-pill.confirmed {
  background: #dcf3e8;
  color: #1f6b49;
}
.req-status-pill.rejected {
  background: #edf2f7;
  color: #4a5568;
}
.req-slots-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.req-slot-option {
  border: 1px solid #e2dfd5;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #fcfbf8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.req-slot-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.req-room-availability {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.avail-free {
  background: #e6f5ee;
  color: #1f6b49;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.avail-busy {
  background: #fdecea;
  color: #a6322b;
  padding: 2px 7px;
  border-radius: 4px;
}
.req-slot-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- 擁有者管理面板 ---------- */
.owner-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  background: #faf9f5;
}
.owner-section h3 {
  margin: 0;
  font-size: 14px;
}
.owner-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.small-muted {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e2dfd5;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
}
.contact-pill {
  background: #f5f4ef;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- 子分頁切換（個案預約未處理/已處理） ---------- */
.sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.sub-tab-btn {
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sub-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.sub-tab-count {
  background: rgba(0, 0, 0, 0.1);
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
}
.sub-tab-btn.active .sub-tab-count {
  background: rgba(255, 255, 255, 0.25);
}

/* ---------- 第 5 工作表：方案庫 ---------- */
.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.program-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.program-card-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}
.program-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- 客製時間選擇器（整條可點擊＋時欄超過 12 自動切換上午/下午） ---------- */
.time-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.time-bar-input {
  width: 100%;
  cursor: pointer;
  padding-right: 32px;
  font-variant-numeric: tabular-nums;
}
.time-bar-icon {
  position: absolute;
  right: 9px;
  pointer-events: none;
  font-size: 14px;
  opacity: 0.7;
}
.time-picker-popover {
  position: fixed;
  z-index: 300;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  padding: 10px;
  width: 248px;
  user-select: none;
}
.tp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 2px;
}
.tp-cols {
  display: grid;
  grid-template-columns: 64px 1fr 1fr;
  gap: 6px;
}
.tp-col-title {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.tp-col-list {
  height: 196px;
  overflow-y: auto;
  border: 1px solid #eceae2;
  border-radius: 8px;
  background: #faf9f5;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}
.tp-item {
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  color: var(--text-main);
  font-family: inherit;
}
.tp-item:hover {
  background: var(--primary-soft);
}
.tp-item.active {
  background: var(--primary);
  color: #fff;
}
.tp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eceae2;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- 公開客戶端方案必選框 ---------- */
.plan-radio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  cursor: pointer;
  background: #fff;
  font-weight: 600;
  font-size: 14px;
}
.plan-radio-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: #faf9f5;
  flex-shrink: 0;
}
.modal-header h2 {
  margin: 0;
  font-size: 16px;
}
.btn-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}
.btn-close:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
}

.form-row {
  display: grid;
  gap: 12px;
}
.two-col {
  grid-template-columns: 1fr 1fr;
}
.three-col {
  grid-template-columns: 1.2fr 1fr 1fr;
}
@media (max-width: 520px) {
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}
.req {
  color: var(--danger);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.note-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
}
.note-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.alert-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
}
.alert-box.error {
  background: var(--danger-soft);
  border: 1px solid #f0b2ac;
  color: #8f261e;
}
.alert-box.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}
.footer-right {
  display: flex;
  gap: 8px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #243630;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 200;
}

/* ---------- 手機版響應式優化（取消頂部橫槓置頂，釋放操作空間） ---------- */
@media (max-width: 768px) {
  .app-header {
    position: static;
    padding: 12px 14px;
  }
  .toolbar {
    padding: 10px 14px;
  }
  .legend-bar {
    padding: 0 14px 10px;
  }
  .main-container {
    padding: 0 12px 28px;
  }
  .weekly-table thead th {
    position: static;
  }
}

/* ---------- 列印樣式 ---------- */
@media print {
  .app-header,
  .toolbar,
  .legend-bar,
  .floorplan-controls,
  .wb-day-add,
  #btnExitKiosk {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .main-container {
    padding: 0;
  }
  .table-wrapper,
  .whiteboard-grid {
    box-shadow: none;
  }
}
