* { box-sizing: border-box; }
body {
  font-family: 'Noto Sans TC', -apple-system, sans-serif;
  background: #f5f7fa; margin: 0; color: #2c3e50;
}

.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #C4ECEB 0%, #5BB5B2 100%);
}
.login-box { background: #fff; padding: 40px; border-radius: 16px; min-width: 320px; box-shadow: 0 20px 60px rgba(42,127,124,0.25); }
.login-box h2 { margin-top: 0; color: #2A7F7C; }
.login-box input { width: 100%; padding: 12px; border: 2px solid #C4ECEB; border-radius: 8px; font-size: 16px; margin-bottom: 12px; transition: border-color 0.2s; }
.login-box input:focus { outline: none; border-color: #2A7F7C; }
.login-box button { width: 100%; padding: 12px; background: linear-gradient(135deg, #2A7F7C, #5BB5B2); color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 0.1s; }
.login-box button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(42,127,124,0.3); }

header { background: #fff; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
header h1 { margin: 0; font-size: 22px; color: #2A7F7C; }
.actions { display: flex; gap: 8px; align-items: center; }

section { padding: 24px; max-width: 1200px; margin: 0 auto; }
section h2 { margin-top: 0; font-size: 18px; color: #555; }

.session-list { }
.session-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.session-card {
  background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative; border-left: 4px solid #2A7F7C;
}
.session-card.closed { opacity: 0.6; border-left-color: #999; }
.session-card .name { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.session-card .stats { font-size: 13px; color: #666; line-height: 1.8; }
.session-card .badges-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.session-card .assistant-badge {
  display: inline-block;
  background: #ede9fe; color: #6d28d9;
  padding: 4px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
  border: 1px solid #c4b5fd;
}
.session-card .assistant-badge.assistant-empty {
  background: #f5f5f5; color: #999; border-color: #e0e0e0;
}
.session-card .badges-row .discount-badge { margin: 0; }
.session-card .stats b { color: #2c3e50; }
.session-card .discount-badge {
  display: inline-block; background: #ff9500; color: #fff; padding: 3px 8px;
  border-radius: 10px; font-size: 11px; margin-left: 6px;
}
.session-card .discount-closed { background: #ccc; }
.session-card .actions { display: flex; gap: 6px; margin-top: 12px; }
.session-card .actions button { flex: 1; padding: 6px; font-size: 12px; border: 1px solid #ddd; background: #fff; border-radius: 6px; cursor: pointer; }
.session-card .actions button:hover { background: #f0f0f0; }
.session-card .actions .danger { color: #e74c3c; border-color: #e74c3c; }

.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; }
.filter-bar select { padding: 8px 12px; border: 1.5px solid #e0e0e0; border-radius: 6px; font-size: 14px; }

.booking-list { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td {
  padding: 8px 6px; text-align: left; font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
th { background: #fafafa; font-weight: 600; color: #555; font-size: 12px; }
tr:hover { background: #fafafa; }
/* 各欄寬度,加總 100% */
table th:nth-child(1),  table td:nth-child(1)  { width: 9%; }   /* 送出時間 */
table th:nth-child(2),  table td:nth-child(2)  { width: 8%; }   /* 場次 */
table th:nth-child(3),  table td:nth-child(3)  { width: 7%; }   /* 姓名 */
table th:nth-child(4),  table td:nth-child(4)  { width: 9%; }   /* 電話 */
table th:nth-child(5),  table td:nth-child(5)  { width: 11%; }  /* 寶寶 */
table th:nth-child(6),  table td:nth-child(6)  { width: 5%; text-align:center; }  /* 抓周 */
table th:nth-child(7),  table td:nth-child(7)  { width: 5%; text-align:center; }  /* 折扣 */
table th:nth-child(8),  table td:nth-child(8)  { width: 6%; text-align:right; }   /* 總金額 */
table th:nth-child(9),  table td:nth-child(9)  { width: 7%; }   /* 匯款日 */
table th:nth-child(10), table td:nth-child(10) { width: 6%; }   /* 末5碼 */
table th:nth-child(11), table td:nth-child(11) { width: 6%; text-align:center; }  /* 狀態 */
table th:nth-child(12), table td:nth-child(12) { width: 19%; text-align:center; } /* 操作 (確認/換團/取消) */
/* 滑鼠 hover 時顯示完整內容 (寶寶資料/場次名容易被截) */
td[title] { cursor: help; }

.status-badge { padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-paid { background: #dbeafe; color: #1e40af; }
.status-confirmed { background: #d1fae5; color: #065f46; }
.status-expired { background: #fee2e2; color: #991b1b; }
.status-superseded { background: #f3f4f6; color: #6b7280; }
.status-cancelled { background: #f3f4f6; color: #6b7280; }

.btn-primary { background: #2A7F7C; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-primary:hover { background: #1F6562; }
.btn-link {
  display: inline-block; background: #fff; color: #2A7F7C; text-decoration: none;
  padding: 8px 14px; border-radius: 6px; font-weight: 600;
  border: 1.5px solid #5BB5B2; transition: all 0.15s; font-size: 14px;
}
.btn-link:hover { background: #E8F7F6; border-color: #2A7F7C; }
.btn-text { background: none; border: none; color: #888; cursor: pointer; padding: 8px; }
.btn-confirm { background: #10b981; color: #fff; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-transfer { background: #f59e0b; color: #fff; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; margin-left: 3px; }
.btn-cancel { background: #ef4444; color: #fff; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; margin-left: 3px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { background: #fff; padding: 24px; border-radius: 12px; min-width: 400px; max-width: 500px; }
.modal-content h3 { margin-top: 0; }
.modal-content label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.modal-content input, .modal-content select { width: 100%; padding: 10px; border: 1.5px solid #e0e0e0; border-radius: 6px; font-size: 14px; background: #fff; }
.modal-content .checkbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.modal-content .checkbox input { width: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-actions button { padding: 10px 20px; border-radius: 6px; cursor: pointer; border: 1px solid #ddd; background: #fff; color: #555; font-weight: 600; transition: all 0.15s; }
.modal-actions button:hover { background: #f5f5f5; border-color: #999; }
.modal-actions button.btn-primary { background: #2A7F7C; color: #fff; border-color: #2A7F7C; }
.modal-actions button.btn-primary:hover { background: #1F6562; border-color: #1F6562; }

/* ── 手機版 ────────────────────────────────────── */
@media (max-width: 768px) {
  /* 登入框 */
  .login-box { min-width: auto; width: 90vw; padding: 24px; }

  /* Header 改垂直排列 */
  header { flex-direction: column; align-items: stretch; gap: 12px; padding: 12px 16px; }
  header h1 { font-size: 18px; text-align: center; }
  .actions { flex-wrap: wrap; gap: 6px; justify-content: center; }
  .actions button { flex: 1 1 calc(50% - 4px); padding: 10px 8px; font-size: 13px; }
  .actions .btn-text { flex: 1 1 100%; }

  /* section 收緊 padding */
  section { padding: 12px; }
  section h2 { font-size: 16px; margin-bottom: 12px; }

  /* 場次卡片改一欄 */
  .session-cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .session-card { padding: 14px; }
  .session-card .name { font-size: 14px; }
  .session-card .stats { font-size: 12px; }
  .session-card .actions { flex-direction: row; gap: 4px; }
  .session-card .actions button { padding: 8px 4px; font-size: 11px; }

  /* 篩選列垂直 */
  .filter-bar { flex-direction: column; gap: 8px; }
  .filter-bar select { width: 100%; padding: 10px; }

  /* 報名清單表格改卡片式 */
  .booking-list { background: transparent; box-shadow: none; }
  .booking-list table thead { display: none; }
  .booking-list table, .booking-list table tbody, .booking-list table tr, .booking-list table td {
    display: block; width: 100%;
  }
  .booking-list table tr {
    background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  }
  .booking-list table td {
    border-bottom: 1px dashed #f0f0f0; padding: 6px 0; white-space: normal;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px;
  }
  .booking-list table td:last-child { border-bottom: none; padding-top: 10px; }
  .booking-list table td:before {
    content: attr(data-label); color: #888; font-size: 12px; font-weight: 600;
    margin-right: 8px; flex-shrink: 0;
  }

  /* Modal 適應手機 */
  .modal-content { min-width: auto; width: 92vw; max-width: 92vw; padding: 18px; max-height: 85vh; overflow-y: auto; }
  .modal-content h3 { font-size: 17px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; padding: 12px; }
}
