:root {
  --purple: #0e7490;          /* 主色深調：文字 / 邊框 / 強調（確保在淺底上可讀） */
  --purple-2: #22b8d4;        /* 主色副調：漸變淺端 */
  --purple-light: #c8f9fe;    /* 主色：淺青，用於背景與選中塊 */
  --purple-grad: linear-gradient(135deg, #0e7490, #22b8d4);
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e9e7f3;
  --bg: #f7f5fc;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
a { color: var(--purple); text-decoration: none; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ===== 導覽列 ===== */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: bold; font-size: 18px; color: var(--ink); }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; background: #fff; border: 1px solid #eee; }
.nav-links { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.nav-links a { color: #444; }
.nav-links a:hover { color: var(--purple); }
.nav-user { display: flex; align-items: center; gap: 10px; }

/* ===== 按鈕 ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; cursor: pointer; border-radius: 10px; font-size: 15px; font-family: inherit; padding: 10px 20px; transition: .15s; white-space: nowrap; }
.btn-primary { background: var(--purple-grad); color: #fff; font-weight: bold; }
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-outline { background: #fff; border: 1.5px solid var(--purple); color: var(--purple); }
.btn-outline:hover { background: var(--purple-light); }
.btn-ghost { background: #eee; color: #444; }
.btn-ghost:hover { background: #e2e2e2; }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ===== 卡片 ===== */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.page { padding: 34px 0 60px; }
.page-title { font-size: 26px; margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 26px; }

/* ===== 首頁 ===== */
.hero { background: linear-gradient(135deg, #e4fbff 0%, #c8f9fe 55%, #a5e9f8 100%); color: #0b4f5c; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; padding: 64px 20px; }
.hero h1 { font-size: 40px; line-height: 1.25; margin-bottom: 14px; }
.hero p { opacity: .92; font-size: 17px; margin-bottom: 26px; }
.hero-img { border-radius: 18px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.35); object-fit: cover; aspect-ratio: 3/2; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-badges span { background: rgba(255,255,255,.66); border: 1px solid rgba(255,255,255,.3); padding: 5px 14px; border-radius: 99px; font-size: 13px; }
.section { padding: 56px 0; }
.section h2 { font-size: 26px; text-align: center; margin-bottom: 8px; }
.section .sub { text-align: center; color: var(--muted); margin-bottom: 34px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.feature .icon { width: 46px; height: 46px; border-radius: 12px; background: var(--purple-light); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.feature h3 { font-size: 17px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 14px; }
.venue-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.venue-card { overflow: hidden; padding: 0; }
.venue-card .body { padding: 20px 22px; }
.steps { counter-reset: step; }
.step { display: flex; gap: 16px; padding: 14px 0; }
.step .num { counter-increment: step; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--purple-grad); color: #fff; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.step .num::before { content: counter(step); }
.cta-band { background: var(--purple-grad); border-radius: 18px; color: #fff; text-align: center; padding: 44px 24px; }
.footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: 14px; text-align: center; background: #fff; }

/* ===== 表單 ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 14px; font-weight: bold; }
label.f .req { color: var(--red); }
input.f, select.f, textarea.f { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; }
input.f:focus, select.f:focus, textarea.f:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(14,116,144,.14); }
.checks { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); padding: 8px 14px; border-radius: 10px; cursor: pointer; background: #fff; font-size: 14px; }
.checks label:has(input:checked) { border-color: var(--purple); background: var(--purple-light); }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.error-text { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 20px; }

/* ===== 日曆 ===== */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head .title { font-weight: bold; font-size: 16px; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 15px; }
.cal-nav button:hover { background: var(--purple-light); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-cell { position: relative; aspect-ratio: 1; border-radius: 10px; text-align: center; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; border: 1.5px solid transparent; }
.cal-cell:hover { background: var(--purple-light); }
.cal-cell.dim { color: #ccc; pointer-events: none; }
.cal-cell.today { border-color: var(--purple); }
.cal-cell.selected { background: var(--purple-grad); color: #fff; font-weight: bold; }
.cal-cell .dot { position: absolute; bottom: 5px; width: 6px; height: 6px; border-radius: 50%; }
.dot-full { background: var(--red); }
.dot-partial { background: var(--amber); }
.dot-free { background: #bbf7d0; }

/* ===== 時段格 ===== */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 9px; }
.slot { padding: 9px 6px; border-radius: 10px; text-align: center; font-size: 13.5px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; transition: .12s; font-family: inherit; }
.slot.available:hover { border-color: var(--purple); }
.slot.selected { background: var(--purple-grad); color: #fff; border-color: transparent; font-weight: bold; }
.slot.booked { background: #ececec; color: #aaa; cursor: not-allowed; text-decoration: line-through; }
.slot.past, .slot.tooSoon { background: #f6f6f6; color: #c2c2c2; cursor: not-allowed; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 12px 0; }
.legend i { display: inline-block; width: 13px; height: 13px; border-radius: 4px; margin-right: 5px; vertical-align: -2px; }
.summary-band { background: var(--purple-light); border-radius: 10px; padding: 12px 16px; font-size: 15px; margin: 14px 0; display: flex; justify-content: space-between; align-items: center; }
.summary-band b { color: var(--purple); font-size: 17px; }

/* ===== 表格 / 徽章 ===== */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.tb th, .tb td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tb th { background: #faf8ff; color: #555; font-weight: bold; }
.tb tr:hover td { background: #fbfaff; }
.badge { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: 12.5px; font-weight: bold; }
.badge.pending { background: #fef3c7; color: var(--amber); }
.badge.approved { background: #dcfce7; color: var(--green); }
.badge.rejected { background: #fee2e2; color: var(--red); }
.badge.cancelled { background: #e5e7eb; color: #6b7280; }

/* ===== 後台統計卡 ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .v { font-size: 28px; font-weight: bold; color: var(--purple); }
.stat .k { color: var(--muted); font-size: 13.5px; }

/* ===== 週/日檢視格 ===== */
.week-grid { display: grid; gap: 3px; font-size: 12px; min-width: 760px; }
.wg-cell { border-radius: 6px; min-height: 34px; padding: 3px 5px; background: #fafafa; border: 1px solid #f0f0f0; overflow: hidden; cursor: pointer; }
.wg-cell:hover { border-color: var(--purple); }
.wg-cell.busy { background: #c8f9fe; border-color: #a5e9f8; color: #0e7490; font-weight: bold; }
.wg-cell.busy.pending { background: #fef3c7; border-color: #fde68a; color: #92400e; }
/* 同一預約的接續格（起點在上一格）：同色但淡化，避免誤認可新增 */
.wg-cell.busy-cont { background: #c8f9fe; border-color: #c8f9fe; }
.wg-cell.busy-cont.pending { background: #fef3c7; border-color: #fef3c7; }
.wg-cell.head { background: none; border: none; text-align: center; color: var(--muted); font-weight: bold; min-height: 26px; cursor: default; }
.wg-cell.time { background: none; border: none; color: var(--muted); }

/* ===== Modal / Toast / Tabs ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(20,10,40,.45); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; }
.modal-mask.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; padding: 28px; position: relative; }
.modal h3 { margin-bottom: 18px; }
.modal .close { position: absolute; top: 14px; right: 18px; font-size: 22px; border: none; background: none; cursor: pointer; color: #999; }
#toastBox { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2430; color: #fff; padding: 11px 22px; border-radius: 10px; font-size: 14.5px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: fadein .2s; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } }
.tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 22px; }
.tabs button { border: none; background: none; font-family: inherit; font-size: 15.5px; padding: 11px 22px; cursor: pointer; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--purple); border-color: var(--purple); font-weight: bold; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .f { width: auto; }

@media (max-width: 860px) {
  .hero-inner, .grid-3, .grid-2, .form-grid, .stats { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .form-grid .full { grid-column: auto; }
  .nav-links { gap: 10px; font-size: 14px; }
}
@media (max-width: 520px) {
  .nav-links { gap: 8px; font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
  .nav-links .btn-sm { padding: 6px 10px; }
}
