/*
  AI 旅宿管家共用樣式（純 CSS，無建置鏈）。色彩 token 沿用雛型站台 docs/雛型站台/index.php 的 :root。
  --muted 用於內文時對比不足 4.5:1，內文改用 --muted-text（SD 3.5.19）。
  各 Area 的頁面樣式放在 wwwroot/css/<area>.css（Gate 2b 由各 Area 開發者擁有），避免平行開發互相覆蓋。
*/
:root {
  --navy: #2d4a37;
  --blue: #4f7a5d;
  --teal: #395c45;
  --ink: #253d2d;
  --muted: #609471;
  --muted-text: #4a6f56;
  --line: #dfe8e2;
  --bg: #f9f7f3;
  --red: #b44343;
  --red-soft: #fbeaea;
  --amber: #805f2b;
  --white: #ffffff;
  --focus: #c9aa5b;
  --radius: 8px;
}

* { box-sizing: border-box; }
/* 全站 hidden 保護（issue #21）：帶 display 宣告的 class 會讓 hidden 屬性失效——
   UA stylesheet 的 [hidden] { display: none } 與 class 選擇器同為 0-1-0 specificity，author 宣告在 cascade 中永遠勝出。
   旅客端曾因此讓感謝訊息與「其他建議」輸入框在送出／展開前就顯示（.g-alert-success、.g-field 皆 display:flex）。
   本檔是六個頁面情境（旅客端／管理端／管理端獨立頁／員工端／平台端／銷售頁）唯一都會載入的樣式表，
   規則放這裡才能一次覆蓋全部；staff.css 另有一條同樣的規則（2026-10-23 加入），保留為備援。
   例外需求（刻意以 CSS 顯示 hidden 元素）請改用 class 切換，不要移除本條。 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.65 "Microsoft JhengHei", "Noto Sans TC", "Hiragino Sans", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; }
code { font-family: Consolas, monospace; background: var(--line); padding: 0 .3em; border-radius: 4px; }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd8cf;
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
}
label { display: block; margin: .9rem 0 .3rem; font-weight: 600; }

.aih-muted { color: var(--muted-text); }
.aih-inline { display: inline; }
.aih-container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* 按鈕 */
.aih-button {
  display: inline-block;
  cursor: pointer;
  border: 1px solid #cbd8cf;
  border-radius: 7px;
  background: var(--white);
  padding: 9px 14px;
  color: var(--ink);
  text-decoration: none;
}
.aih-button:hover { border-color: var(--blue); background: #f9f8f4; }
.aih-button:disabled { opacity: .45; cursor: not-allowed; }
.aih-button-primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.aih-button-primary:hover { background: var(--teal); border-color: var(--teal); }
.aih-button-danger { color: var(--red); border-color: #d9b6b6; }
.aih-button-small { padding: 5px 10px; font-size: 13px; }

/* 提示 */
.aih-alert { padding: 10px 12px; border-radius: 7px; margin: .5rem 0; }
.aih-alert:empty, .aih-alert.validation-summary-valid { display: none; }
.aih-alert-error { background: #f8e9e9; color: var(--red); border: 1px solid #e6c4c4; }
.aih-alert-error ul { margin: 0; padding-left: 1.2em; }
.aih-field-error { color: var(--red); font-size: 13px; }

/* 卡片與獨立頁（登入、錯誤、入口） */
.aih-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.aih-standalone { justify-content: center; align-items: center; padding: 16px; }
.aih-center { width: 100%; max-width: 420px; margin: auto; }
.aih-standalone .aih-button { margin-top: 1.2rem; width: 100%; }

/* 頂欄 */
.aih-appbar {
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.aih-brand { color: var(--white); text-decoration: none; font-size: 19px; font-weight: 700; }
.aih-brand small { display: block; font-size: 12px; font-weight: 400; opacity: .8; }
.aih-appbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 員工端左上角方形圖示（GitLab issue #6 批 6，Tang 2026-10-30 裁決：與管理端一致新增）。
   兩色與 hotel.css 的 --h-honey／--h-forest 同值——aih.css 單獨載入時沒有那套 token，
   做法比照上面 .ht-avatar 的註解：直接寫同值色碼，不是忘了用 var()。 */
.aih-brand-mark { width: 32px; height: 32px; border-radius: 10px; background: #e3ac3e; color: #23402f; display: grid; place-items: center; flex: none; }
.aih-brand-mark svg { width: 20px; height: 20px; }
.aih-brand-mark img { width: 100%; height: 100%; border-radius: 10px; object-fit: cover; }
.aih-appbar a { color: #e4ebe6; }
.aih-appbar-links, .aih-appbar-user { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.aih-appbar-user { gap: 10px; }

/* 上方列右上角四件組（切換鈕 → 圓框 → 姓名 → 登出）：標記在 _TopbarUser.cshtml，骨架在這裡。
   管理端與員工端都載 aih.css、只有管理端載 hotel.css，所以元件本身放共用檔，hotel.css 只留淺底配色。
   圓框的兩色與 hotel.css 的 --h-sage／--h-forest 同值——白底與深綠底上都讀得清楚，故兩端共用一份。 */
.ht-avatar { width: 34px; height: 34px; border-radius: 50%; background: #dfe6dc; color: #23402f; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.ht-user-name { max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 員工端頂欄的登出：尺寸與管理端那顆（來自 .ht-shell .aih-button）相同的膠囊。
   選擇器限定在 .aih-appbar 內（只有 _StaffLayout 用），員工端其他頁的按鈕維持原樣。 */
.aih-appbar .aih-button-small {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 4px 14px; border-radius: 999px; border: 1.5px solid #c3cbbd;
  background: var(--white); color: #23402f; font-weight: 700; font-size: 13.5px; line-height: 1.3;
}
.aih-appbar .aih-button-small:hover { border-color: #23402f; background: #f6f7f1; }
/* 員工端頁首的新單提示音開關（issue #20）：位置與管理端 _DispatchBar 在上方列的那顆對稱——
   貼在右上角四件組的左側。.aih-appbar 是 space-between 的 flex，加 margin-left: auto 才會把
   「開關＋四件組」一起靠右、館名留在左邊。按鈕本身沿用上面 .aih-appbar .aih-button-small 的膠囊樣式，
   與同一列的「登出」尺寸一致。 */
.aih-appbar #staff-alert-bar { margin-left: auto; }
/* 手機寬度只留喇叭圖示（提出人 2026-11-05 裁決，推翻 11-04 的「一樣顯示完整文字」）：
   最長狀態「音效已啟用（點擊關閉）」10 個字，在 390px 寬會靠 flex-wrap 把「登出」擠到第二行。
   三個狀態的 SVG 都在標記裡（_StaffAlertBar.cshtml），這裡只決定「哪一個顯示」——
   桌機全部隱藏、純文字，與管理端那顆一致；手機只顯示對應 data-sound-state 的那一個。
   class 前綴用 st-（員工端），放在 aih.css 是因為它只在 .aih-appbar 這個頁首裡成立，
   與上面 #staff-alert-bar、.ht-avatar 同一個理由。 */
.st-sound { gap: 0; }
.st-sound-note { display: inline-flex; align-items: center; }
.st-sound-icon { display: none; }
.st-sound-icon svg { display: block; width: 19px; height: 19px; }
.st-sound-note .st-sound-icon svg { width: 17px; height: 17px; }
/* 旅宿關閉音效時取代按鈕的說明文字。深綠底上不能用 .aih-muted（淺灰 var(--muted-text) 對比不足），
   改用與 .aih-switch-item 同一組的淺色，對比約 5.9:1。 */
.aih-appbar-note { color: rgba(238, 242, 234, .78); }

/* 員工端手機（< 720px）：圓框與姓名一起收起來，只留切換器與登出，頂欄才不會擠成兩行。
   管理端的收合在 hotel.css，斷點不同（姓名 < 1024px 就收，因為它還有選單鈕與麵包屑要擠）。 */
@media (max-width: 719.98px) {
  .aih-appbar-user .ht-avatar, .aih-appbar-user .ht-user-name { display: none; }
  /* 提示音的狀態文字改成視覺隱藏而不是 display: none——按鈕只剩圖示（圖示是 aria-hidden），
     文字是它唯一的可讀名稱，display: none 會讓螢幕閱讀器只念到「按鈕」。
     寫法同 public.css 的 .pub-sr-only（aih.css 單獨載入時沒有那支 class，故重寫一份）。 */
  #staff-sound .st-sound-text, .st-sound-note .st-sound-text {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  #staff-sound[data-sound-state="on"] .st-sound-icon-on,
  #staff-sound[data-sound-state="blocked"] .st-sound-icon-blocked,
  #staff-sound[data-sound-state="off"] .st-sound-icon-off,
  .st-sound-note .st-sound-icon-off { display: block; }
  /* 只剩圖示時要收成正方形，否則膠囊的左右 14px padding 會讓它看起來像一顆空按鈕 */
  #staff-sound { width: 34px; padding: 4px; }
}

/* 端別切換器（管理端 ⇄ 員工端）：骨架共用，深／淺底各自上色。
   目前所在端由伺服器輸出 aria-current="page" 決定，不靠 JS。深底＝員工端頂欄，淺底在 hotel.css。 */
.aih-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; }
.aih-switch-item { padding: 6px 15px; border-radius: 999px; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.aih-appbar .aih-switch { background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .22); }
.aih-appbar .aih-switch-item { color: rgba(238, 242, 234, .78); }
.aih-appbar .aih-switch-item:hover { color: var(--white); background: rgba(255, 255, 255, .08); }
.aih-appbar .aih-switch-item[aria-current="page"] { background: var(--white); color: var(--navy); }

/* 管理端版面：側欄＋內容 */
.aih-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); flex: 1; }
.aih-sidebar { background: var(--white); border-right: 1px solid var(--line); padding: 12px 0; }
.aih-main { padding: 20px; flex: 1; }
.aih-nav-group { margin-bottom: 10px; }
.aih-nav-title { font-size: 12px; color: var(--muted-text); padding: 4px 18px; }
.aih-nav-link { display: block; padding: 7px 18px; color: var(--ink); text-decoration: none; }
.aih-nav-link:hover { background: #f1f5f2; }
.aih-nav-badge { display: inline-block; min-width: 1.5em; margin-left: .4em; padding: 0 .4em; border-radius: 999px; background: var(--red); color: var(--white); font-size: 12px; text-align: center; }
.aih-nav-badge[hidden] { display: none; }
.aih-nav-link[aria-current="page"] { background: #e7efe9; font-weight: 700; border-left: 3px solid var(--blue); }
@media (max-width: 760px) {
  .aih-layout { grid-template-columns: 1fr; }
  .aih-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* 員工端：上方分頁 */
.aih-tabs { background: var(--white); border-bottom: 1px solid var(--line); overflow-x: auto; }
.aih-tabs .aih-nav { display: flex; }
.aih-tabs .aih-nav-group { display: flex; margin: 0; }
.aih-tabs .aih-nav-title { display: none; }
.aih-tabs .aih-nav-link { white-space: nowrap; }

/* 旅客端：480px 置中、底部固定導覽 */
.aih-guest { background: var(--bg); }
.aih-guest-frame { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--white); padding-bottom: 64px; }
.aih-guest-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--navy); color: var(--white); gap: 8px; }
.aih-guest-hotel { font-weight: 700; }
.aih-guest-room { font-size: 13px; opacity: .85; }
.aih-guest-lang { display: flex; gap: 8px; font-size: 13px; }
.aih-guest-lang a { color: #e4ebe6; }
.aih-guest-main { flex: 1; padding: 16px; }
.aih-guest-bottom {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--white); border-top: 1px solid var(--line); z-index: 10;
}
.aih-guest-bottom a { text-align: center; padding: 12px 4px; color: var(--ink); text-decoration: none; font-size: 13px; }

/* 銷售頁 */
.aih-hero { padding: 48px 0; }
.aih-hero h1 { font-size: 2rem; }

/* Footer（FR-001） */
.aih-footer { text-align: center; font-size: 12px; color: var(--muted-text); padding: 14px 16px; border-top: 1px solid var(--line); background: var(--bg); }

/* 危急事件全螢幕強制告警（issue #13 §C1，aih-emg- 前綴避免與既有 class 衝突；R3 圈 3 加兩段式解除，見 D1）。
   _EmergencyAlert.cshtml 共用於管理端與員工端，故放在兩端都會載入的 aih.css。
   展開狀態（預設，無 .aih-emg-collapsed）刻意沒有任何「背景可點擊關閉」樣式：overlay 鋪滿全螢幕、下面的內容不可互動，
   唯一解除途徑是「我已到場處理」或「知道了」。
   收合狀態（按過「知道了」、加 .aih-emg-collapsed）改成頁面頂端的常駐橫幅：外層改 pointer-events:none 讓點擊穿透
   到下面的頁面（只有橫幅本身的範圍恢復 pointer-events:auto），調度操作才不會被鎖住（解 R2-verify-2 Q5）。 */
.aih-emg-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(40, 10, 10, .78); }
.aih-emg-overlay[hidden] { display: none; }
.aih-emg-box { background: var(--white); border-radius: 14px; max-width: 420px; width: 100%; padding: 26px 22px; text-align: center; box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .55); border: 3px solid var(--red); animation: aih-emg-pulse 1.1s ease-in-out infinite; }
@keyframes aih-emg-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(180, 67, 67, .55); } 50% { box-shadow: 0 0 0 14px rgba(180, 67, 67, 0); } }
@media (prefers-reduced-motion: reduce) { .aih-emg-box { animation: none; } }
.aih-emg-badge { display: inline-block; background: var(--red); color: var(--white); border-radius: 999px; padding: 4px 16px; font-size: 13px; font-weight: 700; letter-spacing: .08em; margin: 0 0 12px; }
.aih-emg-title { margin: 0 0 8px; font-size: 20px; color: var(--red); }
.aih-emg-body { margin: 0 0 18px; font-size: 15px; color: var(--ink); }
.aih-emg-more { margin: 0 0 14px; font-size: 13px; color: var(--ink); }
.aih-emg-error { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 14px; }
.aih-emg-actions { display: flex; flex-direction: column; gap: 10px; }
.aih-emg-ack { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 700; font-size: 16px; padding: 13px; }
.aih-emg-ack:hover { background: #963636; border-color: #963636; }

/* 收合成橫幅（R3 D1 起；圈 4 改成流程內元素）：按過「知道了」後不再是覆蓋層，而是
   **佔流程空間、把後面的內容往下推**的常駐橫幅——圈 3 的做法仍繼承 `.aih-emg-overlay` 的
   `position: fixed; inset: 0`，橫幅因此蓋在頁首之上攔截點擊（R3 質疑 Q2-09）。
   兩端的 overlay 都已經在對的流程位置，所以只要改掉定位就夠，不需要 JS 量高度：
   - 員工端 `_StaffLayout.cshtml:49`：`<body>`（flex column）的直接子元素，在 .aih-tabs 之後、<main> 之前。
     員工端的 .aih-appbar 與 .aih-tabs 都**不**黏頂，所以橫幅靠自己的 `position: sticky` 黏在視窗頂端。
   - 管理端（CR-025 起）：`_HotelLayout.cshtml` 的 `.ht-stickytop` 容器內、`</header>` 之後，
     與 .ht-topbar 是同層的兩列。黏頂由容器負責（hotel.css `.ht-stickytop`），橫幅自己的 sticky
     在已黏住的容器內不產生額外偏移，留著是為了讓兩端共用同一條規則。
     **橫幅不可放回 `<header class="ht-topbar">` 內**：topbar 是 flex-wrap 的 row，width:100% 的橫幅
     會自成一列並把它後面的 .ht-user（切換鈕／姓名／登出）整組擠到第三列（Tang 2026-11-05 測出）。
   `width: 100%`（不可寫成 flex-basis）：flex-basis 指主軸，在員工端的 column 下會變成「高度 100%」
   把橫幅撐成整頁高；width 在 column 下是交叉軸全寬，在管理端的 block 容器內則是容器全寬，兩端都對。
   高度刻意不寫死：橫幅文字會換行，改成流程元素後高度自動正確。
   pointer-events:none 保留（overlay 比 box 寬時讓點擊穿透），橫幅本身在下一條規則恢復 auto。 */
.aih-emg-overlay.aih-emg-collapsed {
  position: sticky; inset: auto; top: 0; width: 100%;
  align-items: flex-start; justify-content: flex-start; padding: 0; background: transparent; pointer-events: none;
}
.aih-emg-overlay.aih-emg-collapsed .aih-emg-box {
  pointer-events: auto; max-width: none; width: 100%; border-radius: 0; border-width: 0 0 3px;
  text-align: left; animation: none; box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .45);
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding: 10px 20px;
}
.aih-emg-overlay.aih-emg-collapsed .aih-emg-badge,
.aih-emg-overlay.aih-emg-collapsed .aih-emg-title,
.aih-emg-overlay.aih-emg-collapsed .aih-emg-body,
.aih-emg-overlay.aih-emg-collapsed .aih-emg-more,
.aih-emg-overlay.aih-emg-collapsed .aih-emg-error { margin: 0; }
.aih-emg-overlay.aih-emg-collapsed .aih-emg-title { font-size: 15px; }
.aih-emg-overlay.aih-emg-collapsed .aih-emg-body,
.aih-emg-overlay.aih-emg-collapsed .aih-emg-more { font-size: 13px; }
.aih-emg-overlay.aih-emg-collapsed .aih-emg-actions { flex-direction: row; gap: 8px; margin-left: auto; }
.aih-emg-overlay.aih-emg-collapsed .aih-emg-ack { padding: 7px 14px; font-size: 14px; }
/* 「開啟提示音」強制對話框（issue #12，共用模組 wwwroot/js/shared/sound-alert.js 動態建立 DOM）。
   管理端與員工端共用，放在本檔而非各 Area 專屬 css。 */
.aih-sound-modal-backdrop { position: fixed; inset: 0; background: rgba(13, 26, 18, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 200; }
.aih-sound-modal { background: var(--white); border-radius: var(--radius); padding: 22px 24px; max-width: 360px; width: 100%; box-shadow: 0 20px 48px -16px rgba(0, 0, 0, .4); }
.aih-sound-modal h2 { margin: 0 0 10px; font-size: 1.15rem; color: var(--ink); }
.aih-sound-modal p { margin: 0 0 18px; color: var(--muted-text); font-size: 14px; line-height: 1.5; }
.aih-sound-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* 稽核日誌的「變更內容」展開（issue #24，共用 partial Views/Shared/_AuditChanges.cshtml）。
   旅宿管理端與平台端共用，放在本檔而非各 Area 專屬 css。 */
.aih-audit-diff { margin-top: 4px; }
.aih-audit-diff > summary { cursor: pointer; color: var(--muted-text); font-size: 13px; }
.aih-audit-diff-table { border-collapse: collapse; margin: 6px 0 0; font-size: 12px; max-width: 520px; }
.aih-audit-diff-table th, .aih-audit-diff-table td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; vertical-align: top; word-break: break-all; }
.aih-audit-raw { white-space: pre-wrap; word-break: break-all; font-size: 12px; margin: 6px 0 0; max-width: 520px; }

/* 匯入結果的三段清單（CR-037，共用 partial Views/Shared/_ImportOutcomes.cshtml）。
   旅宿管理端與平台端共用，而兩邊的表格樣式類別不同（.hotel-table／.pf-table），
   所以這個 partial 自帶一套基礎樣式放在本檔——沒有這幾條，它在兩個端都是沒有框線的裸表格。 */
.aih-table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14.5px; margin: 0 0 16px; }
.aih-table th, .aih-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.aih-table thead th { background: var(--bg); color: var(--muted-text); font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.aih-table tbody tr:last-child > * { border-bottom: 0; }
.aih-table ul { margin: 0; padding-left: 1.2em; }
/* 列號＋欄位名＋兩欄值在手機上一定放不下，讓表格自己橫向捲動（同 .hotel-table 的做法）。 */
@media (max-width: 760px) { .aih-table { display: block; overflow-x: auto; } }

/* 各 Area 專屬樣式放在 wwwroot/css/{public,platform,hotel,staff,guest}.css（由各 Layout 載入），本檔只放共用 token 與元件。 */
