/* Site Man — 只放 BSI 頁面本身沒有的東西。⛔ 不要在這裡重做版面。 */

/* 配對卡：外觀完全借用 BSI 登入頁（dist/css/login-inline.min.css 的
   .login-container / .login-box / .btn-login），這裡只補 QR 的位置。 */
#pairing {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
}

#pairing.show {
    display: flex;
}

/* 用 app 本身的桌布漸變（glass.min.css 的 --glass-wallpaper-gradient），
   跟首頁同一個底色；BSI 登入頁預設是白色，但那是另一張頁。 */
#pairing.login-container {
    background: var(--glass-wallpaper-gradient, #f6f1eb);
}

#pairing .sm-pairing-box {
    max-width: 380px;
    text-align: center;
}

#pairing .login-box h1 {
    text-align: center;
    /* styles.min.css 把所有 h1 設成 display:flex（BSI 的標題帶圖示），
       純文字要自己置中。 */
    justify-content: center;
}

#pairing .sm-pairing-sub {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.5;
}

#pairing .sm-pairing-qr {
    width: 240px;
    height: 240px;
    margin: 12px auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

#pairing .sm-pairing-qr svg {
    width: 100%;
    height: 100%;
    display: block;
}

#pairing .sm-pairing-status {
    min-height: 1.4em;
    margin: 6px 0 4px;
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.4;
}

#pairing .sm-pairing-again {
    margin-top: 8px;
}

#pairing [hidden] {
    display: none !important;
}

/* ======================================================================
   首頁三欄的資料（home.js）

   版面全部是 BSI 的；這裡只有兩類東西：

   1. iOS 的顏色：提醒分類色（貼紙、今日卡、時間軸標籤卡）、行程型別色。
   2. 第三欄時間軸的尺寸：BSI 的標籤欄寬度是 `--home-layout-width`（桌機
      250px），在 420px 的欄位裡會把日期軸擠到看不見 ⇒ 這一欄自己收窄成
      168px；列標籤卡也換成 iOS 的玻璃卡，不再是 BSI 的白底膠囊。
   ====================================================================== */

/* ---- 分類色（一處定義，貼紙／今日卡／bar 共用） ---------------------- */

.sm-cat-personal {
    --sticker-base: #fde68a;
    --sticker-base-2: #fff6bf;
    --reminder-base: #fde68a;
    --reminder-base-2: #fff6bf;
    --sm-cat-soft: rgba(253, 230, 138, .66);
}

.sm-cat-work {
    --sticker-base: #93c5fd;
    --sticker-base-2: #bfdbfe;
    --reminder-base: #93c5fd;
    --reminder-base-2: #bfdbfe;
    --sm-cat-soft: rgba(147, 197, 253, .66);
}

.sm-cat-family {
    --sticker-base: #86efac;
    --sticker-base-2: #bbf7d0;
    --reminder-base: #86efac;
    --reminder-base-2: #bbf7d0;
    --sm-cat-soft: rgba(134, 239, 172, .66);
}

.sm-cat-shared {
    --sticker-base: #c4b5fd;
    --sticker-base-2: #ddd6fe;
    --reminder-base: #c4b5fd;
    --reminder-base-2: #ddd6fe;
    --sm-cat-soft: rgba(196, 181, 253, .66);
}

/* 行程型別色（與 app 的 `HomeScheduleEntry.Kind.tint` 相同）。 */
.sm-type-work { --schedule-type-color: #2563eb; }
.sm-type-meeting { --schedule-type-color: #ea580c; }
.sm-type-visit { --schedule-type-color: #16a34a; }
.sm-type-reminder { --schedule-type-color: #9333ea; }

/* ---- 第一欄：今日 ---------------------------------------------------- */

#taskToday .home-schedule-card-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 0;
}

#taskToday .home-schedule-card-wrap .home-schedule-card {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
}

#taskToday .reminder-sticker-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-bottom: 0;
}

/* ---- 第二欄：提醒貼紙 ------------------------------------------------ */

#reminderStickersCanvas {
    flex: 1 1 auto;
    align-self: stretch;
    padding: 6px 4px 10px;
    gap: 10px;
}

#reminderStickersCanvas .reminder-sticker-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-bottom: 0;
}

/* 唯讀（資料來自主機；網頁不寫入任何東西）。 */
#reminderStickersCanvas .reminder-sticker-title,
#reminderStickersCanvas .reminder-sticker-notes,
#taskToday .reminder-sticker-title,
#taskToday .reminder-sticker-notes {
    cursor: default;
}

#reminderStickersCanvas .reminder-sticker-check,
#taskToday .reminder-sticker-check {
    cursor: default;
    pointer-events: none;
}

#reminderAppBodyHint[hidden] {
    display: none !important;
}

.sm-empty {
    margin: 16px 8px;
    font-size: 12px;
    color: var(--home-contrast-text-muted, #999);
    text-align: center;
}

/* ---- 第三欄：時間軸（BSI 版面 ＋ iOS 卡面） -------------------------- */

#scheduleContent {
    /* 列標籤欄。BSI 的預設是 250px——在 420px 的欄位裡軸只剩 82px，一行
       一日都放不下。 */
    --home-layout-width: 168px;
    --day-px: 40px;
}

#scheduleContent .home-tl-header-spacer,
#scheduleContent .home-tl-labels-col {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
}

#scheduleContent .home-tl-header-spacer {
    border-radius: 15px 0 0 0;
}

/* 標籤與軌道同高：兩欄是各自排的，高度不同就會一路錯位。 */
#scheduleContent .home-tl-row-label,
#scheduleContent .home-tl-row-track {
    height: 48px;
    min-height: 48px;
    box-sizing: border-box;
}

/* BSI 的白底膠囊收掉——卡面由下面的 `.sm-sched-card` 畫。 */
#scheduleContent .home-tl-row-label {
    border: none;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    margin-bottom: 4px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
}

/* iOS `ScheduleLabelCard`：提醒＝分類色玻璃；行程／紀錄＝透明玻璃＋
   左邊 3px 型別色條（⛔ 不要把整張行程卡染成型別色）。 */
.sm-sched-card {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 253, 250, .46);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35),
        0 2px 8px rgba(15, 23, 42, .10);
}

.sm-sched-card.sm-sched-reminder {
    background: var(--sm-cat-soft, rgba(253, 230, 138, .66));
}

.sm-sched-card.is-completed {
    opacity: .72;
}

.sm-sched-accent {
    flex: 0 0 3px;
    width: 3px;
    background: var(--schedule-type-color, #2563eb);
}

.sm-accent-work .sm-sched-accent { background: #2563eb; }
.sm-accent-meeting .sm-sched-accent { background: #ea580c; }
.sm-accent-visit .sm-sched-accent { background: #16a34a; }
.sm-accent-reminder .sm-sched-accent { background: #9333ea; }

.sm-sched-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 0 8px;
}

.sm-sched-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-sched-meta {
    font-size: 10px;
    line-height: 1.2;
    color: rgba(15, 23, 42, .66);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-record-icon {
    margin-right: 4px;
    font-size: 10px;
    opacity: .8;
}

/* bar：位置與寬度由 home.js 用 CSSOM 設定；顏色跟 iOS 的淺色系一致。 */
.sm-tl-bar {
    opacity: .92;
    border: none;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
}

.sm-tl-bar > span {
    color: #0f172a;
    font-weight: 600;
}

.sm-bar-work {
    background-color: #acc4f7;
    background-image: linear-gradient(180deg, #cfddfb 0%, #acc4f7 100%);
}

.sm-bar-meeting {
    background-color: #f7c0a3;
    background-image: linear-gradient(180deg, #fadaca 0%, #f7c0a3 100%);
}

.sm-bar-visit {
    background-color: #a6dcba;
    background-image: linear-gradient(180deg, #ccebd7 0%, #a6dcba 100%);
}

.sm-bar-reminder {
    background-color: #d6b1f7;
    background-image: linear-gradient(180deg, #e7d2fa 0%, #d6b1f7 100%);
}

/* 提醒的 bar 用 BSI 的 `.home-tl-bar--reminder`（分類色來自 `.sm-cat-*`
   的 `--reminder-base`／`--reminder-base-2`），所以這裡不用再上色。 */

.sm-now-line {
    z-index: 5;
}

.sm-empty-hint {
    font-size: 12px;
    opacity: .7;
}

/* ==========================================================================
 * 專案頁（2026-11-17）：左欄 Project 鈕 → 專案卡 → BSI 表格面板
 * ========================================================================== */

#projectScreen {
    display: none;
}

body.sm-project-open #turntableContainer {
    display: none;
}

body.sm-project-open #projectScreen {
    display: block;
}

/* `.project-close-btn` 本來只在 BSI 的 `body[data-page="project"]` 出現；
   我們的頁面沒有那個 body 屬性，且這一顆是「返回首頁」，永遠要見到。 */
#projectBackBtn {
    display: flex !important;
    flex: 0 0 auto;
}

.sm-project-title {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* 手機的標題列是 absolute，內容的 padding-top 固定 64px（BSI 的
   `mobile.min.css`）。名字一長 `h2` 會摺成兩三行、標題列撐高壓住內文，
   所以一律收成一行省略號。 */
.sm-project-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-project-view-switch {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

/* 卡片：BSI 的玻璃卡。顏色由 `--project-accent`（CSSOM 設）給。 */
#projectsContainer.gallery-view .project-card {
    border-radius: 30px;
}

#projectsContainer .project-card .gallery-bg-menu-btn {
    display: none;
}

.sm-project-open-btn {
    width: 35px;
    height: 35px;
    min-width: 35px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, .55);
    background: transparent;
    color: rgba(37, 99, 235, .95);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
}

.sm-project-open-btn:hover {
    background: rgba(37, 99, 235, .08);
}

.sm-project-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 64px 20px;
    color: #9ca3af;
    text-align: center;
}

.sm-project-empty i {
    font-size: 34px;
    opacity: .55;
}

.sm-project-empty p {
    margin: 0;
    font-size: 14px;
}

/* 表格面板內的排程格：BSI 的類型色（`.sm-type-*` 提供
   `--schedule-type-color`）。 */
.sm-sched-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 2px 4px 2px 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--schedule-type-color, #2563eb) 14%, #fff);
    color: var(--schedule-type-color, #2563eb);
    font-size: 11px;
    white-space: nowrap;
}

.sm-sched-chip strong {
    font-weight: 600;
}

.sm-cell-check {
    color: #16a34a;
    font-weight: 700;
}

/* 表格面板：BSI `js/table-view.js` 用 inline style 畫的每一格，
   在這裡逐條搬成 class。⛔ CSP `style-src 'self'` 會把 innerHTML 裡的
   `style="…"` 整段丟掉，所以 BSI 那批 inline style 一個都不能照抄；
   會變的（欄寬、選項顏色）插入 DOM 之後再用 CSSOM 設。 */
.sm-th-num {
    width: 75px;
    text-align: center;
}

.sm-th-num i {
    color: #999;
    font-size: .9rem;
}

#table-view-thead th .fas {
    margin-right: 6px;
    color: #666;
    font-size: .85rem;
}

.sm-row-num {
    text-align: center;
    color: #999;
    font-size: 12px;
    width: 75px;
}

.cell-display.sm-right {
    text-align: right;
}

.cell-display.sm-center {
    text-align: center;
}

.cell-display.sm-muted,
.sm-muted {
    color: #999;
}

.sm-cell-link {
    color: #3b82f6;
}

.sm-cell-link.sm-attachment {
    margin-right: 6px;
}

.sm-check-on {
    color: #3b82f6;
}

.sm-check-off {
    color: #ccc;
}

/* 單選／多選的 chip。顏色來自 `column_config.options[].option_color`，
   插入之後用 CSSOM 上色（`.sm-chip-colored` 才有白字）。 */
.sm-chip-select {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.sm-chip-multi {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
    background: #e5e7eb;
}

.sm-chip-colored {
    color: #fff;
}

.sm-chip-record,
.sm-chip-project {
    background: #e0e7ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
}

.sm-chip-tag {
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
}

.sm-chip-tag .fa-map-pin {
    margin-right: 2px;
}

.sm-logbook {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.sm-logbook i {
    font-size: 13px;
}

.sm-logbook span {
    font-size: 12px;
}

.sm-logbook.sm-has i {
    color: #6b7280;
}

.sm-logbook.sm-has span {
    color: #1f2937;
}

.sm-logbook.sm-none i,
.sm-logbook.sm-none span {
    color: #9ca3af;
}

.sm-table-empty {
    padding: 32px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

/* ==========================================================================
 * 設定面板：只顯示選單（個人資料那一列）；BSI 的子頁沒有對應 JS，
 * 全部疊在一起只會變成一張超長的表單。
 * ========================================================================== */

#settingsModal #settingsCategoriesView,
#settingsModal #settingsPageView,
#settingsModal #settingsAiView,
#settingsModal #settingsWeatherView,
#settingsModal #settingsBackBtn {
    display: none;
}

#settingsModal #settingsMenuView {
    display: block;
}

#settingsUserProfile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}

#settingsUserProfile > div {
    flex: 1 1 auto;
    min-width: 0;
}

#settingsUserName {
    font-weight: 600;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#settingsUserEmail {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ==========================================================================
 * 專案表格：照 BSI 的「卡片拉開」版（2026-11-17 使用者要求）
 *
 * 這裡只補 BSI 編譯 CSS 裡**沒有**、或者被 `mobile.min.css` 的
 * `!important` 藏起來的部分。`.tt-*` 本身的樣式一律由
 * `dist/css/index-inline.min.css` 提供——⛔ 不要在 app.css 重新定義，
 * 兩份一有出入就不再是「100% 照 BSI」。
 * ========================================================================== */

/* 展開之後，卡片本身那顆「開表格」的圓鈕不需要。 */
.project-card.expanded .sm-project-open-btn {
    display: none;
}

/* 工具列：全部照畫，唯讀的部分變淡、不能按（使用者指定）。 */
.sm-readonly-toolbar button[disabled],
.sm-readonly-toolbar select[disabled],
.sm-readonly-toolbar .tt-col-dropdown-btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

.sm-readonly-toolbar button[disabled]:hover,
.sm-readonly-toolbar select[disabled]:hover {
    background: #fff;
    border-color: #d1d5db;
    color: #6b7280;
}

/* 返回、檢視分頁、表格清單仍然可以按。 */
.sm-readonly-toolbar .tt-back-btn {
    opacity: 1;
    cursor: pointer;
}

/* 欄頭名稱：BSI 的圖示帶 `margin-right:6px;opacity:.7`（寫在 inline style，
   CSP 不容許）⇒ 改寫在這裡。`.tt-col-name` 在 BSI 沒有獨立樣式。 */
.tt-grid thead th > i {
    margin-right: 6px;
    opacity: .7;
}

.tt-grid thead th .tt-col-name {
    vertical-align: middle;
}

.tt-grid thead th {
    white-space: nowrap;
}

/* 選取欄／新增欄的欄寬（BSI 是 `<col style="width:…">`，CSP 不容許）。 */
.tt-grid col.sm-col-selector {
    width: 106px;
}

.tt-grid col.sm-col-add {
    width: 100px;
}

/* 附件格：`_ttAttachmentSummaryHtml` 在沒有縮圖時是一個 28×28 的方塊
   （BSI 寫 inline `display:flex`，這裡補上）。 */
.tt-attachment-thumb > i {
    font-size: 12px;
    color: #666;
}

span.tt-attachment-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 日誌格：BSI 的 `renderLogBookCellHTML` 我們沒有，畫圖示＋數量。 */
.tt-cell-logbook {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 2px 0;
}

.tt-cell-logbook-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
    font-size: 12px;
}

/* Gallery 檢視：卡片一格一張（BSI 的 `.tt-gallery-body` 只有 JS 會
   建 class，CSS 沒有帶出來）。 */
.tt-gallery-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 16px;
    align-content: start;
}

.tt-gallery-container {
    overflow: auto;
}

/* 表格清單（`.tt-sidebar` 60px 的窄條）：文字要 truncate，hover 拉開
   到 250px 才看全文，與 BSI 一樣。 */
.tt-table-item-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tt-tables-empty {
    padding: 12px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* Timeline（唯讀簡化版）：左邊釘住紀錄名，右邊一天一欄。 */
.sm-timeline-table {
    width: max-content;
    min-width: 100%;
}

.sm-col-timeline-label,
.sm-col-timeline-day {
    width: 120px;
}

.sm-timeline-table .sm-timeline-label {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    vertical-align: middle;
    padding: 8px 10px;
}

.sm-timeline-table thead .tt-select-all-header {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
}

.sm-timeline-table tbody td {
    padding: 6px;
    vertical-align: top;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f3f4f6;
}

.sm-timeline-table .tt-schedule-entry-button {
    width: 100%;
    margin: 2px 0;
    height: auto;
    min-height: 34px;
}

/* 手機：BSI 的 `mobile.min.css` 把工具列、左邊表格條、檢視分頁整組
   藏起來（`!important`），因為 BSI 手機版另有選單。SiteMan 網頁沒有
   那組選單——表格與檢視分頁是唯一的入口，所以要在 app.css（載入在
   `mobile.min.css` 之後）把它們放回來，並改成直向排列。 */
@media (max-width: 767px) {
    .project-card.expanded {
        /* 卡片本身鋪滿 `.project-container`；給捲動區一點呼吸位。 */
        overflow: hidden;
    }

    .project-card.expanded .tt-toolbar {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        max-height: none;
        overflow: visible;
        padding: 4px 8px;
        gap: 4px;
        border-bottom: 1px solid #e5e7eb;
    }

    .project-card.expanded .tt-toolbar .tt-toolbar-left {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 3px;
        flex: 1 1 100%;
        min-width: 0;
        padding-bottom: 2px;
    }

    .project-card.expanded .tt-toolbar .tt-back-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        flex-shrink: 0;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        background: #fff;
        color: #374151;
    }

    .project-card.expanded .tt-toolbar .tt-archive-btn {
        display: flex !important;
        flex-shrink: 0;
    }

    .project-card.expanded .tt-toolbar .tt-hidden-items-wrap {
        display: block !important;
        flex-shrink: 0;
    }

    .project-card.expanded .tt-toolbar .tt-toolbar-right {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;
        flex: 1 1 100%;
        min-width: 0;
        margin-left: 0;
        overflow-x: auto;
    }

    .project-card.expanded .tt-toolbar .tt-view-btn {
        display: inline-flex !important;
        flex-shrink: 0;
    }

    /* 左邊的表格條：直向窄條改成橫向的一排。 */
    .project-card.expanded .tt-app .tt-sidebar {
        display: flex !important;
        position: static;
        width: 100%;
        height: auto;
        min-height: 0;
        border-right: 0;
        border-bottom: 1px solid rgba(17, 24, 39, .1);
        box-shadow: none;
        transition: none;
    }

    .project-card.expanded .tt-app .tt-sidebar .tt-sidebar-inner {
        width: 100%;
        min-width: 0;
        height: auto;
        flex-direction: row;
        align-items: center;
    }

    .project-card.expanded .tt-app .tt-sidebar .tt-sidebar-header {
        display: none !important;
    }

    .project-card.expanded .tt-app .tt-sidebar .tt-tables-list {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px 8px;
        gap: 4px;
    }

    .project-card.expanded .tt-app .tt-sidebar .tt-table-item {
        width: auto;
        flex: 0 0 auto;
        margin-bottom: 0;
        padding: 8px 12px;
        border-radius: 999px;
        white-space: nowrap;
    }

    .project-card.expanded .tt-app .tt-sidebar .tt-table-item-title-wrap {
        white-space: nowrap;
    }

    /* 工具列與表格條都在上面 ⇒ 內容不需要再讓開 60px。 */
    .project-card.expanded .tt-main {
        margin-left: 0;
        padding-left: 0;
    }

    .project-card.expanded .tt-grid-container:not(.tt-gallery-container) {
        margin-left: 0;
        padding-left: 0;
    }

    .sm-timeline-table .sm-timeline-label {
        width: 140px;
        min-width: 140px;
        max-width: 140px;
    }

    .tt-gallery-body {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 10px;
    }
}

/* ==========================================================================
 * Drawing／Record 兩個 app（2026-11-18）
 *
 * 兩個畫面與專案頁同一個外殼（`.turntable-container` ＋
 * `.project-container`），所以高度、滾動、標題列全部沿用 BSI 的 CSS；
 * 這裡只補「哪一個畫面要顯示」與卡片的樣子。
 * ========================================================================== */

#drawingScreen,
#recordScreen {
    display: none;
}

body.sm-drawing-open #turntableContainer,
body.sm-record-open #turntableContainer,
body.sm-drawing-open #projectScreen,
body.sm-record-open #projectScreen {
    display: none;
}

body.sm-drawing-open #drawingScreen,
body.sm-record-open #recordScreen {
    display: block;
}

/* 兩個畫面的返回鈕：`#projectBackBtn` 那一條同一條理由（BSI 只在
   `body[data-page="project"]` 顯示）。 */
#drawingBackBtn,
#recordBackBtn {
    display: flex !important;
    flex: 0 0 auto;
}

.sm-screen-count {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
    margin-left: auto;
    padding-right: 6px;
}

/* ------------------------------------------------------------------ Drawing */

.sm-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
    padding: 8px 10px 30px;
}

.sm-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 8px 10px 30px;
}

.sm-tile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px solid var(--glass-edge, #e5e7eb);
    border-radius: 22px;
    box-shadow: 0 10px 30px #4e3b231f, 0 1px 2px #4e3b230f;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .18s ease, transform .18s ease;
}

.sm-tile:hover {
    box-shadow: 0 14px 36px #4e3b2333;
    transform: translateY(-1px);
}

.sm-tile-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: #eef2f7;
    overflow: hidden;
}

.sm-tile-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.sm-tile-cover-icon {
    color: #9ca3af;
    font-size: 34px;
}

.sm-tile-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px 14px;
}

.sm-tile-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-tile-caption {
    font-size: 12px;
    color: #4b5563;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sm-tile-meta {
    font-size: 12px;
    color: #6b7280;
}

/* ------------------------------------------------------------------ Record */

.sm-dr-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    padding: 8px 10px 30px;
}

.sm-dr-project-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 128px;
    padding: 18px 18px 18px 20px;
    text-align: left;
    font: inherit;
    color: #1f2937;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px solid var(--glass-edge, #e5e7eb);
    border-radius: 24px;
    box-shadow: 0 10px 30px #4e3b231f, 0 1px 2px #4e3b230f;
    cursor: pointer;
    transition: box-shadow .18s ease, transform .18s ease;
}

.sm-dr-project-card:hover {
    box-shadow: 0 14px 36px #4e3b2333;
    transform: translateY(-1px);
}

.sm-dr-project-card--tinted {
    color: #fff;
    background: var(--sm-card-accent, #455461);
    border-color: transparent;
}

.sm-dr-project-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.sm-dr-project-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sm-dr-project-period,
.sm-dr-project-place,
.sm-dr-project-count {
    font-size: 12.5px;
    opacity: .82;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-dr-project-count {
    font-weight: 600;
    opacity: .95;
}

.sm-dr-project-go {
    flex: 0 0 auto;
    opacity: .55;
    font-size: 14px;
}

.sm-dr-records {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 8px 30px;
}

.sm-dr-record {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 12px;
    text-align: left;
    font: inherit;
    color: inherit;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px solid var(--glass-edge, #e5e7eb);
    border-radius: 22px;
    box-shadow: 0 10px 30px #4e3b231a, 0 1px 2px #4e3b230f;
    cursor: pointer;
    transition: box-shadow .18s ease, transform .18s ease;
}

.sm-dr-record:hover {
    box-shadow: 0 14px 36px #4e3b2333;
    transform: translateY(-1px);
}

.sm-dr-record-thumb {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
    border-radius: 16px;
    background: #eef2f7;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-dr-record-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sm-dr-record-icon {
    color: #9ca3af;
    font-size: 28px;
}

.sm-dr-record-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.sm-dr-record-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15.5px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.sm-dr-record-date {
    font-size: 12.5px;
    color: #4b5563;
}

.sm-dr-record-sub,
.sm-dr-record-meta {
    font-size: 12.5px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-dr-record-meta {
    font-weight: 600;
    color: #4b5563;
}

.sm-dr-record-go {
    flex: 0 0 auto;
    align-self: center;
    color: #9ca3af;
    font-size: 13px;
    padding-right: 4px;
}

.sm-dr-badge-master {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* ------------------------------------------------------------------ 展開頁 */

.sm-dr-detail {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 10px 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

.sm-dr-h1 {
    grid-column: 1 / -1;
    margin: 4px 0 0;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.sm-dr-detail-main,
.sm-dr-detail-side {
    min-width: 0;
}

.sm-dr-info {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px solid var(--glass-edge, #e5e7eb);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 24px #4e3b2317;
}

.sm-dr-info th,
.sm-dr-info td {
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    text-align: left;
    vertical-align: top;
}

.sm-dr-info tr:last-child th,
.sm-dr-info tr:last-child td {
    border-bottom: none;
}

.sm-dr-info th {
    width: 168px;
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
}

.sm-dr-info td {
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
}

.sm-dr-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: #374151;
}

.sm-dr-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

.sm-dr-table-wrap {
    overflow-x: auto;
    border-radius: 18px;
}

.sm-dr-worker {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px solid var(--glass-edge, #e5e7eb);
    border-radius: 18px;
    overflow: hidden;
    font-size: 13.5px;
}

.sm-dr-worker th,
.sm-dr-worker td {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    text-align: center;
    color: #1f2937;
}

.sm-dr-worker thead th {
    background: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
}

.sm-dr-worker .sm-dr-worker-category {
    text-align: left;
    white-space: nowrap;
    font-weight: 600;
}

.sm-dr-worker tfoot th,
.sm-dr-worker tfoot td {
    background: #f9fafb;
    font-weight: 700;
}

.sm-dr-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.sm-dr-photo {
    margin: 0;
    cursor: zoom-in;
    border-radius: 16px;
    overflow: hidden;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px solid var(--glass-edge, #e5e7eb);
    box-shadow: 0 8px 24px #4e3b2317;
}

.sm-dr-photo-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: #eef2f7;
    overflow: hidden;
}

.sm-dr-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sm-dr-photo-icon {
    color: #9ca3af;
    font-size: 30px;
}

.sm-dr-photo-label {
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .82);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sm-dr-photo-caption {
    padding: 8px 10px 10px;
    font-size: 12.5px;
    color: #374151;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.sm-dr-photos-empty {
    padding: 36px 16px;
    border-radius: 18px;
    background: var(--glass-surface, rgba(255, 253, 250, .62));
    border: 1px dashed var(--glass-edge, #d1d5db);
}

@media (max-width: 900px) {
    .sm-dr-detail {
        grid-template-columns: minmax(0, 1fr);
    }

    .sm-dr-info th {
        width: 128px;
    }
}

@media (max-width: 640px) {
    .sm-tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .sm-file-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .sm-dr-project-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .sm-dr-photos {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .sm-dr-h1 {
        font-size: 20px;
    }
}

/* ------------------------------------------------------------------ 看圖疊層 */

.sm-viewer {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    background: rgba(9, 12, 17, .94);
    overscroll-behavior: contain;
}

.sm-viewer[hidden] {
    display: none;
}

.sm-viewer-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(9, 12, 17, .8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sm-viewer-title {
    flex: 1;
    min-width: 0;
    color: #f9fafb;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.sm-viewer-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    color: #f9fafb;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.sm-viewer-btn:hover {
    background: rgba(255, 255, 255, .22);
}

.sm-viewer-btn[hidden] {
    display: none;
}

.sm-viewer-page {
    color: #d1d5db;
    font-size: 13px;
    white-space: nowrap;
    padding: 0 2px;
}

.sm-viewer-page[hidden] {
    display: none;
}

.sm-viewer-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.sm-viewer-canvas {
    display: block;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
    flex: 0 0 auto;
}

.sm-viewer-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 96px);
    object-fit: contain;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
}

.sm-viewer-msg {
    color: #e5e7eb;
    font-size: 15px;
    padding: 40px 20px;
    text-align: center;
}

/* `hidden` 屬性敵不過作者樣式的 `display:grid`（Drawing 的兩個容器就是
   `display:grid`）⇒ 資料夾那一格要在檔案清單開啟時真的收起來。 */
#drawingFolders[hidden],
#drawingFiles[hidden] {
    display: none !important;
}

.sm-dr-project-place {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.sm-dr-project-place > i {
    flex: 0 0 auto;
    font-size: 12px;
}

.sm-dr-project-place > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
