/* 來源：Suiyuecare/Platform packages/ui/module-shell.css（commit 1692c17，Platform PR #34）。
   這是原樣複製；要改請改 Platform 的共用檔再同步。EDOC 的對應寫在 edoc-jellycat.css。 */

/* 歲悅模組外框：照電子公文（EDOC）的樣子。左邊側欄（品牌、選單、帳號）＋上方列（頁名、狀態、通知、操作）＋內容；
   手機（≤ 760px）側欄變成從左邊滑出的抽屜，底部有分頁列。疊在 jellycat.css 上面，只用 --jc-* 變數。
   內容裡的表格、表單、按鈕、狀態、空白頁、進度條直接用 jellycat.css 的 jc-*；這裡只補外框、頁首與面板。
   示範與完整 HTML：module-shell.html。

   <body class="jc" data-module="hr">
     <div class="jc-shell">            手機打開選單時加 jc-shell--drawer-open；嵌在島嶼視窗裡加 jc-shell--embedded
       <aside class="jc-shell-sidebar">  jc-shell-brand ＋ jc-shell-nav ＋ jc-shell-profile ＋ jc-shell-drawer-actions（手機才顯示）
       <button class="jc-shell-backdrop" hidden>   手機選單的遮罩，點了關閉
       <div class="jc-shell-main">       jc-shell-topbar ＋ <main class="jc-shell-content">
       <nav class="jc-shell-tabbar">     手機底部分頁列，最多 4 個常用頁
   目前所在頁：選單與分頁列的項目加 aria-current="page"。上方列子元素照順序放：jc-shell-heading、jc-shell-status、通知鈕、jc-shell-menu、jc-shell-actions。 */

/* ── 外框：整頁不捲，側欄與內容各自捲動 ── */
body:has(> .jc-shell) { margin: 0; }
.jc-shell { display: flex; flex-direction: row; height: 100dvh; overflow: hidden; background: var(--jc-bg); color: var(--jc-ink); }
.jc-shell .jc-shell-sidebar {
  display: flex; flex-direction: column; flex: 0 0 240px; width: 240px; min-height: 0; overflow-y: auto;
  background: var(--jc-paper); border-right: 1.5px dashed var(--jc-stitch);
}
.jc-shell .jc-shell-main { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; background: var(--jc-bg); }
.jc-shell .jc-shell-content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 42px 42px; }

/* 品牌區與上方列拼成同一條：64px 高、上緣一條代表色、下緣縫線 */
.jc-shell .jc-shell-brand, .jc-shell .jc-shell-topbar {
  background: var(--jc-paper); border-bottom: 1.5px dashed var(--jc-stitch); box-shadow: inset 0 5px 0 var(--jc-mod);
}

/* ── 品牌區：標章（或吉祥物）＋模組名稱＋集團名稱 ── */
.jc-shell .jc-shell-brand { display: flex; align-items: center; gap: 10px; flex: none; height: 64px; min-height: 64px; padding: 10px 16px; }
.jc-shell .jc-shell-brand-mark {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 3px; overflow: hidden; border: 0; border-radius: 50%;
  background: var(--jc-mod); box-shadow: var(--jc-puff); outline: 1.5px dashed rgb(255 255 255 / 0.7); outline-offset: -5px;
}
.jc-shell .jc-shell-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
/* 吉祥物：品牌區最前面直接放 jellycat.css 的 jc-mascot jc-mascot--sm（<picture>），不加圓形底 */
.jc-shell .jc-shell-brand > picture { display: contents; }
.jc-shell .jc-shell-brand-text { display: flex; flex-direction: column; min-width: 0; }
.jc-shell .jc-shell-brand-name { margin: 0; color: var(--jc-ink); font-size: 17px; line-height: 1.55; letter-spacing: 0; }
.jc-shell .jc-shell-brand-org { margin: 0; color: var(--jc-muted); font-size: 12.5px; line-height: 1.3; }

/* ── 選單：分區標題＋項目（圖示、名稱、可選的 jc-count） ── */
.jc-shell .jc-shell-nav { display: grid; align-content: start; flex: 1; padding: 8px 12px; }
.jc-shell .jc-shell-nav-label { margin: 0; padding: 16px 12px 6px; color: var(--jc-muted); font-size: 13px; letter-spacing: 0.06em; }
.jc-shell .jc-shell-nav-item {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 44px;
  margin: 0 0 4px; padding: 0 12px; border: 0; border-radius: 14px; background: transparent; color: var(--jc-ink);
  font-size: 15px; text-align: left; text-decoration: none; transform: none; cursor: pointer;
}
.jc-shell .jc-shell-nav-item:hover { background: var(--jc-soft); }
.jc-shell .jc-shell-nav-item[aria-current="page"] { background: var(--jc-mod); color: var(--jc-on-pastel); box-shadow: var(--jc-puff); }
.jc-shell .jc-shell-nav-item > .jc-i { width: 18px; height: 18px; justify-self: center; }
.jc-shell .jc-shell-nav-item .jc-count { min-width: 28px; height: 28px; margin: 0; }
.jc-shell .jc-shell-nav-item[aria-current="page"] .jc-count { background: var(--jc-paper); }

/* ── 帳號卡：側欄最下面 ── */
.jc-shell .jc-shell-profile {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; align-items: center; gap: 12px; margin: auto 12px 16px;
  padding: 10px 10px 10px 12px; border: 1.5px solid var(--jc-line); border-radius: 18px; background: var(--jc-paper); box-shadow: var(--jc-puff);
}
.jc-shell .jc-shell-avatar {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--jc-mod); color: var(--jc-on-pastel);
  font-size: 16px; box-shadow: var(--jc-puff); outline: 1.5px dashed rgb(255 255 255 / 0.7); outline-offset: -5px;
}
.jc-shell .jc-shell-profile-text { display: grid; gap: 3px; min-width: 0; }
.jc-shell .jc-shell-profile-name, .jc-shell .jc-shell-profile-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-shell .jc-shell-profile-name { font-size: 14px; }
.jc-shell .jc-shell-profile-role { color: var(--jc-muted); font-size: 12px; }
.jc-shell .jc-shell-profile > button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--jc-muted); cursor: pointer;
}
.jc-shell .jc-shell-profile > button:hover { background: var(--jc-soft); }

/* ── 上方列：頁名｜狀態（佔滿中間）｜通知｜操作（重新整理、回島嶼、深淺色開關、登出） ── */
.jc-shell .jc-shell-topbar { display: flex; align-items: center; gap: 10px; flex: none; height: 64px; min-height: 64px; padding: 0 16px 0 24px; }
.jc-shell .jc-shell-heading { display: flex; align-items: center; gap: 6px; min-width: 0; }
.jc-shell .jc-shell-title { margin: 0; overflow: hidden; color: var(--jc-ink); font-size: 20px; line-height: 1.15; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.jc-shell .jc-shell-status { flex: 1; min-width: 0; overflow: hidden; color: var(--jc-muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.jc-shell .jc-shell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; }
.jc-shell .jc-shell-action {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1.5px solid transparent; border-radius: var(--jc-radius-s);
  background: transparent; color: var(--jc-ink); font-size: 15px; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.jc-shell .jc-shell-action:hover { background: var(--jc-soft); }
/* 登出放最後，用有框的按鈕區隔 */
.jc-shell .jc-shell-action--outline { border-color: var(--jc-line); background: var(--jc-paper); box-shadow: var(--jc-puff); }
.jc-shell .jc-shell-action--outline:hover { border-color: var(--jc-accent); background: var(--jc-paper); }
/* 圓形圖示鈕（通知等）；有新通知時裡面放 jc-shell-dot */
.jc-shell .jc-shell-round {
  position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 1.5px solid var(--jc-line); border-radius: 50%; background: var(--jc-paper); color: var(--jc-ink); box-shadow: var(--jc-puff); cursor: pointer;
}
.jc-shell .jc-shell-round:hover { border-color: var(--jc-accent); }
.jc-shell .jc-shell-round > svg { width: 20px; height: 20px; }
.jc-shell .jc-shell-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border: 1.5px solid var(--jc-paper); border-radius: 999px; background: var(--jc-bad); }

/* ── 頁首與面板 ── */
.jc-shell .jc-shell-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.jc-shell .jc-shell-page-head h2 { font-size: 17px; line-height: 1.35; }
/* 面板：紙色＋細框；最外層的面板有一圈縫線，面板裡的面板不重複 */
.jc-shell .jc-shell-panel {
  margin: 0 0 16px; padding: 16px; background: var(--jc-paper); border: 1.5px solid var(--jc-line); border-radius: var(--jc-radius);
  outline: 1.5px dashed var(--jc-stitch); outline-offset: -8px;
}
.jc-shell .jc-shell-panel .jc-shell-panel { outline: 0; }
.jc-shell .jc-shell-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; }

/* ── 載入中（進入模組時的整頁卡片）：jc-shell-entry 裡放 jc-felt jc-shell-entry-card，進度用 jc-progress ── */
.jc-shell-entry { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; background: var(--jc-bg); color: var(--jc-ink); }
.jc-shell-entry-card { display: grid; gap: 6px; width: min(360px, 100%); padding: 28px 26px; text-align: center; }
.jc-shell-entry-card .jc-progress { height: 6px; margin-top: 18px; }

/* 只在手機出現的東西 */
.jc-shell .jc-shell-heading-logo, .jc-shell .jc-shell-heading-module, .jc-shell .jc-shell-heading-divider,
.jc-shell .jc-shell-menu, .jc-shell .jc-shell-close, .jc-shell .jc-shell-backdrop, .jc-shell .jc-shell-drawer-actions, .jc-shell .jc-shell-tabbar { display: none; }

/* ── 平板（761～1180px）：上方列放不下一行，狀態移到第二行；品牌區跟著一樣高 ── */
@media (min-width: 761px) and (max-width: 1180px) {
  .jc-shell .jc-shell-brand, .jc-shell .jc-shell-topbar { height: 96px; min-height: 96px; }
  /* 通知鈕沒指定位置，會自動排進空著的 bell 格 */
  .jc-shell .jc-shell-topbar {
    display: grid; grid-template-areas: "title bell actions" "status status status"; grid-template-columns: minmax(0, 1fr) max-content max-content;
    grid-template-rows: minmax(38px, 1fr) 18px; align-content: center; gap: 4px 10px; padding: 8px 18px;
  }
  .jc-shell .jc-shell-heading { grid-area: title; }
  .jc-shell .jc-shell-status { grid-area: status; font-size: 11px; line-height: 1.4; }
  .jc-shell .jc-shell-actions { grid-area: actions; }
}

/* ── 手機：上方列變成「標章 模組／頁名｜通知｜選單」，側欄變抽屜，底部分頁列 ── */
@media (max-width: 760px) {
  .jc-shell .jc-shell-topbar { position: sticky; top: 0; z-index: 90; gap: 5px; height: 56px; min-height: 56px; padding: 0 10px 0 12px; }
  .jc-shell .jc-shell-heading { flex: 1; }
  .jc-shell .jc-shell-heading-logo { display: block; flex: 0 0 28px; width: 28px; height: 28px; object-fit: contain; }
  .jc-shell .jc-shell-heading-module { display: block; color: var(--jc-muted); font-size: 13px; line-height: 1; white-space: nowrap; }
  .jc-shell .jc-shell-heading-divider { display: block; color: var(--jc-muted); }
  .jc-shell .jc-shell-title { line-height: 1.2; }
  .jc-shell .jc-shell-status, .jc-shell .jc-shell-actions { display: none; }
  .jc-shell .jc-shell-menu {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1.5px solid var(--jc-line);
    border-radius: 14px; background: var(--jc-paper); color: var(--jc-accent-strong); cursor: pointer;
  }
  .jc-shell .jc-shell-content { padding: 16px 14px calc(92px + env(safe-area-inset-bottom, 0px)); }

  /* 抽屜：關著時移出畫面並 visibility: hidden（讀屏、Tab 都不會進去） */
  .jc-shell .jc-shell-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 510; width: min(88vw, 360px); height: 100dvh; overflow: hidden;
    box-shadow: 18px 0 54px rgb(57 34 20 / 0.2); transform: translateX(-105%); visibility: hidden; transition: transform 0.18s ease, visibility 0s 0.18s;
  }
  .jc-shell--drawer-open .jc-shell-sidebar { transform: none; visibility: visible; transition: transform 0.18s ease; }
  .jc-shell--drawer-open .jc-shell-backdrop { display: block; position: fixed; inset: 0; z-index: 500; padding: 0; border: 0; background: var(--jc-scrim); }
  .jc-shell .jc-shell-brand { height: auto; min-height: 98px; padding: 20px 18px; }
  .jc-shell .jc-shell-close {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 1.5px solid var(--jc-line);
    border-radius: 50%; background: var(--jc-paper); color: var(--jc-ink); font-size: 24px; box-shadow: var(--jc-puff); cursor: pointer;
  }
  .jc-shell .jc-shell-nav { overflow-y: auto; padding: 12px 16px; }
  .jc-shell .jc-shell-profile { grid-template-columns: 42px minmax(0, 1fr) 44px; margin: auto 16px 10px; padding: 12px; }
  .jc-shell .jc-shell-drawer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .jc-shell .jc-shell-drawer-actions > :is(button, a):not(.jc-theme-switch) {
    display: grid; place-items: center; min-height: 44px; padding: 7px 8px; border: 1.5px solid var(--jc-line); border-radius: 14px;
    background: var(--jc-paper); color: var(--jc-accent-strong); font-size: 12px; font-weight: 900; text-decoration: none; cursor: pointer;
  }
  .jc-shell .jc-shell-drawer-actions > :is(button, a).jc-shell-danger { border-color: color-mix(in srgb, var(--jc-bad) 40%, var(--jc-line)); color: var(--jc-bad); }
  .jc-shell .jc-shell-drawer-actions > .jc-theme-switch { justify-self: center; align-self: center; }

  /* 底部分頁列 */
  .jc-shell .jc-shell-tabbar {
    position: fixed; inset: auto 0 0; z-index: 120; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; min-height: 68px;
    padding: 6px 12px calc(5px + env(safe-area-inset-bottom, 0px)); border-top: 1.5px dashed var(--jc-stitch); background: var(--jc-paper);
    box-shadow: 0 -12px 30px rgb(82 45 17 / 0.1);
  }
  .jc-shell .jc-shell-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; min-height: 54px; padding: 5px;
    border: 0; border-radius: 18px; background: transparent; color: var(--jc-muted); text-decoration: none; cursor: pointer;
  }
  .jc-shell .jc-shell-tab[aria-current="page"] { background: var(--jc-mod); color: var(--jc-on-pastel); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--jc-accent) 18%, transparent); }
  .jc-shell .jc-shell-tab > .jc-i { width: 25px; height: 25px; stroke-width: 1.9; }
  .jc-shell .jc-shell-tab > b { max-width: 100%; overflow: hidden; font-size: 10px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .jc-shell .jc-shell-sidebar { transition: none; }
}

/* ── 嵌在島嶼的模組視窗裡：視窗已有模組名稱與關閉鈕，品牌區與 jc-shell-standalone（回島嶼、登出）收起來。
   和 [hidden] 一樣是狀態，用 !important 蓋過上面各按鈕的 display ── */
.jc-shell--embedded .jc-shell-brand, .jc-shell--embedded .jc-shell-standalone { display: none !important; }
