﻿:root {
    /* --- 中醫配色系統 (TCM Palette) --- */
    --primary: #2F5935; /* 墨綠 (藥草) */
    --primary-dark: #1a3c22;
    --primary-light: #e8f0e8; /* 極淡綠 (背景用) */

    --accent: #8e3235; /* 硃砂紅 (印章/強調) */

    --paper-bg: #fcfaf2; /* 宣紙米色 (公告背景) */
    --paper-border: #e6e2d0; /* 米色邊框 */

    --bg-page: #f4f4f4; /* 頁面底色 (乾淨灰白) */
    --bg-card: #ffffff;
    --text-main: #2c3e50; /* 深灰藍 (比純黑柔和) */
    --text-sub: #607d8b; /* 鐵灰 */

    --radius: 12px;
    /* 懸浮陰影：讓 Header 更有立體感 */
    --shadow-float: 0 10px 25px -5px rgba(47, 89, 53, 0.1), 0 8px 10px -6px rgba(47, 89, 53, 0.1);
    /* 卡片陰影：比較紮實 */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

body {
    line-height: 1.5;
}

main {
    min-height: 59dvh;
}

.tcm-page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* =========================================
   2. 品牌 Header
   ========================================= */
.navbar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 20px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-float);
    border: 1px solid rgba(255,255,255,0.5);
    margin-bottom: 16px;
    position: relative;
    z-index: 10;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo-seal {
    width: 52px;
    height: 52px;
    background: var(--accent);
    color: white;
    font-size: 26px;
    font-family: "標楷體", serif;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 2px 2px 5px rgba(142, 50, 53, 0.3);
    border: 2px solid #fff;
    outline: 1px solid var(--accent);
}

.clinic-name {
    margin: 0;
    font-size: 1.6rem;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 1px;
}

.clinic-eng {
    color: var(--text-sub);
    font-weight: 500;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
    display: none;
}

@media (min-width: 768px) {
    .clinic-eng {
        display: block;
    }
}

/* =========================================
   3. 動態跑馬燈 (Ticker)
   ========================================= */
.ticker-bar {
    display: flex;
    background: var(--paper-bg);
    border: 1px solid var(--paper-border);
    border-radius: var(--radius);
    height: 48px;
    align-items: center;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.ticker-badge {
    background: #e8e4d2;
    color: #5d4037;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 0.95rem;
    flex-shrink: 0;
    border-right: 1px solid var(--paper-border);
}

.ticker-window {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    margin-left: 12px;
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: marquee 18s linear infinite;
    color: #4e342e;
    font-weight: 500;
    font-size: 1.05rem;
}

.ticker-bar:hover .ticker-content {
    animation-play-state: paused;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* =========================================
   4. 儀表板佈局 (RWD Grid)
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr; /* 手機預設單欄 */
    gap: 24px;
}

@media (min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1.8fr 1fr; /* 電腦版左右分欄 */
        align-items: start;
    }
}

/* =========================================
   5. 卡片通用風格 (TCM Card)
   ========================================= */
.tcm-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-left: 5px solid var(--primary); /* 左側綠色豎線 */
}

.head-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.card-head h2, .card-head h3 {
    margin: 0;
    font-size: 1.25rem;
    color: inherit;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* =========================================
   6. 左側：即時看診進度面板
   ========================================= */
.status-panel {
    /* [手機版] 高度自動，不佔用多餘版面 */
    min-height: auto;
}

/* [電腦版] 固定高度，維持版面平衡 */
@media (min-width: 992px) {
    .status-panel {
        min-height: auto;
    }
}

.update-time {
    font-size: 0.85rem;
    color: var(--text-sub);
}

/* =========================================
   7. 右側：Sidebar (按鈕、班表、聯絡)
   ========================================= */
.sidebar-column {
    display: flex;
    flex-direction: column;
}

/* 操作按鈕組 */
.action-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.btn-tcm {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: var(--shadow-card);
    border: none;
    text-align: left;
}

    .btn-tcm:active {
        transform: scale(0.98);
    }

    .btn-tcm.primary {
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        color: white;
    }

    .btn-tcm.secondary {
        background: #fff;
        color: var(--text-main);
        border: 1px solid #e0e0e0;
        border-bottom: 3px solid #dcdcdc;
    }

.btn-label {
    display: flex;
    flex-direction: column;
}

.main-text {
    font-size: 1.1rem;
    font-weight: bold;
}

.sub-text {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 班表 Widget */
.schedule-widget {
    margin-top: 24px;
}

.table-wrapper {
    overflow-x: auto;
}

.opd-mini-table .thead {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.opd-grid {
    border: none !important;
}

.opd-row {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    border-bottom: 1px solid #f5f5f5;
}

.cell {
    padding: 12px 2px;
    text-align: center;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

    .dot.on {
        background: #22c55e;
    }

    .dot.off {
        background: #e5e7eb;
    }

.opd-row.head {
    display: none;
}
/* 隱藏舊表頭 */

/* 聯絡資訊 Widget */
.contact-widget {
    padding: 0;
}

.card-body {
    padding: 24px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.info-data {
    display: flex;
    flex-direction: column;
}

.label {
    display: block;
    font-size: 0.85rem;
    color: #888;
}

.data-text, .data-link {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    line-height: 1.2;
}

.data-link {
    color: var(--primary);
    border-bottom: 1px dotted var(--primary);
    transition: all 0.2s;
}

    .data-link:hover {
        background-color: var(--primary-light);
        border-bottom: 1px solid var(--primary);
    }

.divider {
    height: 1px;
    background: #eee;
    margin: 16px 0 16px 58px;
}

.map-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px;
    background: #f8fafc;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 20px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

    .map-btn:hover {
        background: #f1f5f9;
        color: var(--primary);
        border-color: var(--primary);
    }

/* =========================================
   8. 純 CSS 繪製圖示 (CSS Shapes)
   ========================================= */
/* 基礎設定 */
.head-icon, .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: currentColor;
    flex-shrink: 0;
}

.info-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.btn-icon {
    width: 32px;
    height: 32px;
    margin-right: 12px;
}

/* 圖示繪製 */
.icon-bell {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: currentColor;
    border-radius: 50% 50% 0 0;
    position: relative;
    margin-right: 6px;
}

    .icon-bell::before {
        content: '';
        position: absolute;
        bottom: -2px;
        left: -2px;
        right: -2px;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
    }

    .icon-bell::after {
        content: '';
        position: absolute;
        bottom: -4px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 2px;
        background: currentColor;
        border-radius: 0 0 2px 2px;
    }

.icon-pin::before {
    content: '';
    width: 14px;
    height: 14px;
    background: currentColor;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    margin-top: -4px;
    box-shadow: inset 0 0 0 4px currentColor, inset 0 0 0 6px #fff;
}

/* 1. 圓形底座 */
.info-icon.icon-phone {
    width: 42px;
    height: 42px;
    background: var(--primary-light); 
    color: var(--primary);           
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(47, 89, 53, 0.15); /* 增加底層存在感 */
}

/* 2. 手機機身：用實心墨綠色做外殼 */
.info-icon.icon-phone::before {
    content: '';
    width: 16px;       /* 寬度稍微加寬，視覺比例更穩 */
    height: 26px;
    background: var(--primary); /* 實心機身 */
    border-radius: 4px;        /* 圓角稍微大一點點，更有現代手機感 */
    /* 核心關鍵：利用內陰影畫出「白色螢幕」，這會讓它一眼看去就是手機 */
    box-shadow: inset 0px -4px 0 0 var(--primary), /* 下巴 */
                inset 0px 4px 0 0 var(--primary),  /* 額頭 */
                inset 2px 0 0 0 var(--primary),    /* 左側 */
                inset -2px 0 0 0 var(--primary);   /* 右側 */
    background-color: #ffffff; /* 螢幕區塊為純白 */
}

/* 3. 聽筒與 Home 鍵：在實心區塊上用底色「挖孔」 */
.info-icon.icon-phone::after {
    content: '';
    position: absolute;
    /* 上方小聽筒 */
    width: 4px;
    height: 1.5px;
    background: var(--primary-light); /* 與背景同色，看起來像挖空 */
    top: 10px; /* 定位在機身的額頭處 */
    left: 50%;
    transform: translateX(-50%);
    border-radius: 1px;
    /* 下方 Home 鍵圓點 */
    /* y位移 20px 剛好落在機身的下巴處 */
    box-shadow: 0 20px 0 0 var(--primary-light); 
}

/* 4. 滑鼠移入效果：加深底色感 */
.info-row:hover .info-icon.icon-phone {
    background: #dbe7db; /* 稍微加深的綠色 */
    transform: translateY(-2px);
    border-color: var(--primary);
    transform: rotate(-15deg); /* 滑鼠移過或點擊時微動，增加互動感 */
    transition: transform 0.2s;
}

.icon-calendar::before {
    content: '';
    width: 16px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 2px;
    position: relative;
    border-top-width: 5px;
}

.icon-calendar::after {
    content: '';
    position: absolute;
    top: -7px;
    left: 3px;
    width: 2px;
    height: 4px;
    background: currentColor;
    box-shadow: 6px 0 0 currentColor;
}

.icon-chart::before {
    content: '';
    width: 4px;
    height: 12px;
    background: currentColor;
    position: relative;
    box-shadow: -6px 4px 0 currentColor, 6px -2px 0 currentColor;
    margin-top: 2px;
}

.icon-cal-check::before {
    content: '';
    width: 20px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 3px;
    position: relative;
    border-top-width: 5px;
}

.icon-cal-check::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 10px;
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(45deg);
    left: 6px;
    top: 0px;
}

.icon-search::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: relative;
    top: -2px;
    left: -2px;
}

.icon-search::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background: currentColor;
    transform: rotate(45deg);
    top: 18px;
    left: 18px;
}

/* Loading Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================
   9. Modal
   ========================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: #fff;
    width: 100%;
    max-width: 450px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-head {
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
}

    .modal-head h3 {
        margin: 0;
        color: var(--primary);
        font-size: 1.2rem;
    }

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: bold;
    }

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
}

/* =========================================
   重新整理按鈕與標題區配置
   ========================================= */

/* 1. 調整 Header 佈局，讓右側可以放多個元素 */
.card-head {
    /* 保持原本的 flex 設定 */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 2. 右側動作群組 (時間 + 按鈕) */
.head-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* 時間與按鈕的距離 */
}

/* 3. 重新整理按鈕樣式 */
.btn-refresh {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: var(--primary); /* 墨綠色 */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

    .btn-refresh svg {
        width: 14px;
        height: 14px;
    }

    .btn-refresh:hover {
        background-color: var(--primary-light);
        border-color: var(--primary);
        transform: scale(1.1);
    }

    .btn-refresh:active {
        transform: scale(0.95);
    }

    /* 4. 旋轉動畫 (點擊時觸發) */
    .btn-refresh.spinning {
        animation: rotate-btn 0.8s linear infinite;
        color: var(--accent); /* 轉動時變色，增加互動感 */
        border-color: var(--accent);
        cursor: wait;
    }

@keyframes rotate-btn {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 手機版微調：防止時間字太小 */
@media (max-width: 400px) {
    .update-time {
        font-size: 0.75rem;
    }
}

/* =========================================
   1. 品牌 Header (修正：英文名在下方，簡約質感)
   ========================================= */
.navbar-header {
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-float);
    border: 1px solid #fff;
    margin-bottom: 16px;
    position: relative;
    z-index: 10;
    /* 讓內容垂直置中 */
    display: flex;
    align-items: center;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo-seal {
    width: 56px;
    height: 56px;
    background: var(--accent); /* 硃砂紅 */
    color: white;
    font-size: 28px;
    font-family: "標楷體", serif;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 2px 2px 6px rgba(142, 50, 53, 0.25);
    border: 2px solid #fff;
    outline: 1px solid var(--accent);
    flex-shrink: 0;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.clinic-name {
    margin: 0;
    font-size: 1.5rem; /* 手機版字體 */
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.2;
}

.clinic-eng {
    margin: 4px 0 0 0;
    font-size: 0.8rem; /* 手機版小字 */
    color: var(--text-sub);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: system-ui, -apple-system, sans-serif;
    opacity: 0.9;
}

/* RWD: 電腦版字體加大 */
@media (min-width: 768px) {
    .clinic-name {
        font-size: 1.8rem;
    }

    .clinic-eng {
        font-size: 0.95rem;
    }
}

/* =========================================
   修正：即時看診進度 (Progress Cards) - 穩定版
   ========================================= */

/* 1. 列表容器：使用 Grid 自動排版 (RWD 核心) */
#progressContent.progress-cards-grid {
    display: grid;
    gap: 16px;
    padding: 20px;
    background-color: #fafafa;
    border-radius: 0 0 var(--radius) var(--radius);
    grid-template-columns: 1fr;
}

    /* 捲軸美化 */
    #progressContent.progress-cards-grid::-webkit-scrollbar {
        width: 8px;
    }

    #progressContent.progress-cards-grid::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

    #progressContent.progress-cards-grid::-webkit-scrollbar-track {
        background: transparent;
    }

/* 2. 單張卡片：資訊列風格 */
.doctor-hero-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 88px; /* 稍微增高，提升份量感 */
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

    /* Hover 浮動效果 */
    .doctor-hero-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(47, 89, 53, 0.12); /* 帶有品牌綠色的陰影 */
        border-color: var(--primary-light);
    }

    /* 狀態：看診中 (Active) */
    .doctor-hero-card.active {
        border: 1px solid var(--primary); /* 實線邊框更明顯 */
        background: #fff;
    }

        /* 左側綠色飾條：改為漸層光暈，更有質感 */
        .doctor-hero-card.active::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 6px;
            background: linear-gradient(180deg, var(--primary), var(--primary-dark));
        }

        /* 增加一個極淡的背景色讓 active 更突出 */
        .doctor-hero-card.active::after {
            content: "";
            position: absolute;
            inset: 0;
            background: var(--primary);
            opacity: 0.03;
            pointer-events: none;
        }

/* 3. 左側：醫師與診別資訊 */
.doc-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 6px; /* 增加間距 */
    flex: 1;
    min-width: 0;
}

    .doc-info h3 {
        margin: 0;
        font-size: 1.35rem; /* 字體加大 */
        font-weight: 800;
        color: var(--text-main);
        line-height: 1.2;
        letter-spacing: 0.5px;
    }

    .doc-info span {
        font-size: 0.9rem;
        color: var(--text-sub);
        background: #f1f5f9;
        padding: 3px 10px;
        border-radius: 6px; /* 圓角更圓潤 */
        font-weight: 500;
    }

/* 4. 右側：號碼顯示 */
.num-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
}

.big-num {
    font-family: 'Roboto Mono', monospace; /* 推薦改用 monospace 讓數字寬度穩定 */
    font-size: 2.4rem; /* 數字加大 */
    font-weight: 900;
    line-height: 1;
    color: #e2e8f0; /* 沒看診時更淡 */
    transition: color 0.3s;
}

/* 看診中數字變色 */
.doctor-hero-card.active .big-num {
    color: var(--accent); /* 硃砂紅 */
}

.unit {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    margin-left: 4px;
}

/* 候診人數標籤 (膠囊樣式優化) */
.wait-tag {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary); /* 改為實心背景，更顯眼 */
    padding: 3px 10px;
    border-radius: 20px;
    margin-top: 6px;
    box-shadow: 0 2px 4px rgba(47, 89, 53, 0.2);
    letter-spacing: 0.5px;
}

/* 5. 空狀態 / 休診狀態 */
.state-placeholder {
    grid-column: 1 / -1; /* 跨滿所有欄位 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    background-color: transparent;
    color: var(--text-sub);
}

/* RWD 手機版微調 */
@media (max-width: 576px) {
    #progressContent.progress-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .doctor-hero-card {
        padding: 10px 12px;
        min-height: 72px;
    }

    .doc-info h3 {
        font-size: 1.15rem;
    }

    .big-num {
        font-size: 2rem;
    }
}

/* =========================================
   條列式看診進度 - 和諧優化版 (Harmonious Row)
   ========================================= */

/* 1. 外層容器：給予最大寬度限制，避免在寬螢幕上左右拉太長 */
#progressContent.list-view-mode {
    display: flex;
    flex-direction: column;
    gap: 12px; /* 增加行距，讓每一行更獨立 */
    padding: 20px;
    /* [新增] 限制最大寬度並置中，避免在 27吋螢幕上資訊散太開 */
    max-width: 1000px;
}

/* =========================================
   內容文字樣式調整 (Typography)
   ========================================= */

/* 1. 醫師姓名：加強份量 */
.val-name {
    font-size: 1.35rem; /* 字體加大 */
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

/* 2. & 3. 診別與診間：弱化並置中 */
.tag-session, .val-room {
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
    background: #f8fafc; /* 給一個淡灰背景球 */
    padding: 6px 10px;
    border-radius: 20px;
    display: inline-block;
    min-width: 60px; /* 固定最小寬度，讓排版整齊 */
    text-align: center;
}

/* 4. 目前號碼：最大化 */
.val-num {
    font-family: 'Roboto Mono', monospace;
    font-size: 2.2rem; /* 再加大，成為視覺焦點 */
    font-weight: 800;
    color: #cbd5e1;
    line-height: 1;
    text-align: right; /* 數字靠右對齊 */
}

.doctor-row.active .val-num {
    color: var(--accent); /* 硃砂紅 */
}

/* 5. 候診人數 */
.val-wait {
    font-size: 0.95rem;
    color: #fff;
    background: #94a3b8; /* 預設灰底 (沒人候診時) */
    padding: 6px 14px;
    border-radius: 30px;
    white-space: nowrap;
    display: inline-block;
}

/* 當有候診人數時，在 HTML 裡可以直接給予 active 顏色，或用 JS 控制 class */
.doctor-row.active .val-wait {
    background-color: var(--primary); /* 有看診時變綠色 */
}


/* =========================================
   RWD: 電腦版佈局 (重點調整處)
   ========================================= */
@media (min-width: 992px) {
    .doctor-row {
        /* [關鍵調整] 欄位寬度比例 */
        /* 說明：
           1. 醫師名 (1.5fr): 給最多空間
           2. 診別 (auto): 依照文字寬度自動
           3. 診間 (auto): 依照文字寬度自動
           4. 號碼 (1fr): 佔據剩餘空間，推擠右邊
           5. 候診 (auto): 固定寬度
        */
        grid-template-columns: 1.5fr 100px 100px 1fr auto;
        padding: 12px 32px; /* 電腦版左右內距加大 */
    }

    /* 讓中間資訊欄 (診別/診間) 靠中間對齊 */
    .col-session, .col-room {
        text-align: center;
    }

    /* 讓號碼明顯靠右，視覺動線流暢 */
    .col-num {
        text-align: right;
        padding-right: 24px; /* 與候診人數拉開距離 */
    }
}

/* =========================================
   RWD 手機版 - 大字體單行極限版 (Big Text Single Row)
   ========================================= */
@media (max-width: 767px) {

    /* 1. 隱藏不必要的元素 */
    .label-mobile,
    .doctor-row.active::before {
        display: none !important;
    }

    /* 2. 容器極窄邊距 */
    #progressContent.list-view-mode {
        padding: 6px 4px;
        gap: 8px;
    }

    /* 3. 卡片佈局：單行、緊湊 */
    .doctor-row {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap; /* 絕對不換行 */
        align-items: center; /* 垂直置中 */

        padding: 10px 20px; /* 內距縮小，空間給文字 */
        width: 100%;
        box-sizing: border-box;
        gap: 4px; /* 元素間距縮到最小 */

        min-height: 60px; /* 確保卡片有一定高度好點擊 */
    }

    /* --- [左側群組] 姓名 & 標籤 --- */

    /* A. 醫師姓名 (優先級次之，過長可省略) */
    .col-name {
        flex: 0 1 auto; /* 允許縮小 */
        /*overflow: hidden;*/
        white-space: nowrap;
        text-overflow: ellipsis;
        max-width: 35%; /* 限制寬度，保證號碼空間 */
    }

    .val-name {
        font-size: 1.35rem; /* 字體明顯加大 */
        font-weight: 800; /* 加粗提升辨識度 */
        color: #1e293b;
        line-height: 1.1;
    }

    /* B. 時段與診間 (膠囊) */
    .col-session, .col-room {
        flex: 0 0 auto; /* 不縮放 */
        display: flex;
        align-items: center;
        padding-right: 5px;
    }

    .tag-session, .val-room {
        font-size: 0.85rem; /* 字體微調大一點 */
        padding: 2px 4px; /* 內距極小 */
        border-radius: 4px;
        background: #f1f5f9;
        color: #64748b;
        font-weight: 600;
    }

    /* [關鍵] 推擠元素：將右側資訊推到底 */
    .col-room {
        margin-right: auto; /* 佔據中間所有剩餘空間 */
    }

    /* --- [右側群組] 號碼 & 候診 --- */

    /* C. 目前號碼 (視覺焦點，絕對優先) */
    .col-num {
        flex: 0 0 auto; /* 禁止縮小 */
        text-align: right;
        display: flex;
        align-items: baseline;
        justify-content: flex-end;
    }

    .val-num {
        font-size: 2.2rem; /* 超大字體 */
        font-weight: 900; /* 最粗體 */
        color: var(--accent);
        line-height: 1;
        letter-spacing: -0.5px; /* 字距微縮，讓數字更緊湊 */
    }

        .val-num::after {
            display: none;
        }

    /* D. 候診人數 (綠色膠囊) */
    .col-wait {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        margin-left: 2px;
    }

    .val-wait {
        font-size: 0;
        padding: 0;
        border: none;
        background: transparent;
    }

        .val-wait b {
            font-size: 0.9rem; /* 數字清楚 */
            color: #fff;
            background: #cbd5e1;
            padding: 3px 8px; /* 膠囊飽滿一點 */
            border-radius: 12px;
            font-weight: bold;
            display: inline-block;
            vertical-align: middle;
        }

            /* 讓 "人" 字非常小，裝飾用 */
            .val-wait b::after {
                content: '人';
                font-size: 0.65rem;
                margin-left: 1px;
                opacity: 0.9;
                font-weight: normal;
            }

    /* 活耀狀態 */
    .doctor-row.active .val-wait b {
        background: var(--primary);
        box-shadow: 0 2px 4px rgba(47, 89, 53, 0.2);
    }
}



/* 2. 單行樣式 (Row) - 增加高度與質感 */
.doctor-row {
    display: grid;
    grid-template-columns: 1.5fr auto auto 1fr auto;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* 圓角加大，看起來更柔和 */
    /* [關鍵修改] 增加內距，撐開高度 */
    padding: 16px 24px;
    min-height: 80px; /* 設定最小高度，確保視覺份量 */
    /* 手機版預設佈局 */
    gap: 12px;
    align-items: center; /* 垂直置中，這是和諧的關鍵 */

    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02); /* 極淡的陰影增加層次 */
    transition: all 0.2s ease;
}

    /* 狀態：看診中 (Active) */
    .doctor-row.active {
        border: 1px solid var(--primary); /* 邊框變色 */
        background: #fff;
        box-shadow: 0 4px 12px rgba(47, 89, 53, 0.08); /* 浮起感 */
    }

        /* 左側綠條：改為圓角並稍微縮進去一點，比較精緻 */
        .doctor-row.active::before {
            content: "";
            position: absolute;
            left: 6px;
            top: 12px;
            bottom: 12px;
            width: 4px;
            border-radius: 4px;
            background: var(--primary);
        }

/* 詳細候診號碼區域 */
.col-wait-numbers {
    grid-column: 1 / -1; /* 跨滿全寬 */
    display: grid;
    /* 預設手機版：一行 5 個，兩排剛好 10 個 */
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    padding-top: 15px;
    background: #fdfdfd;
    border-top: 2px solid var(--primary-light); /* 加粗分隔線，老人較易辨識 */
    border-radius: 0 0 12px 12px;
}

/* 個別號碼標籤 */
.wait-num-tag {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--primary);
    /* 增大字體：適合老人閱讀 */
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Roboto Mono', monospace;
    /* 固定高度與圓角 */
    height: 44px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    /* 陰影增加立體感 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
    .wait-num-tag.first-one {
        border-color: var(--accent); /* 硃砂紅邊框 */
        background: #fff5f5;
        color: var(--accent);
        box-shadow: 0 0 0 2px rgba(142, 50, 53, 0.1);
        animation: pulse-border 2s infinite; /* 呼吸燈效果 */
    }

/* 呼吸燈動畫 */
@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0px rgba(142, 50, 53, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(142, 50, 53, 0);
    }

    100% {
        box-shadow: 0 0 0 0px rgba(142, 50, 53, 0);
    }
}

/* 當該診為 Active 時的號碼樣式（可選，增加辨識度） */
.doctor-row.active .wait-num-tag {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* RWD: 電腦版或大螢幕改為一排 10 個 */
@media (min-width: 992px) {
    .col-wait-numbers {
        grid-template-columns: repeat(10, 1fr); /* 剛好 10 個一排 */
        gap: 12px;
    }

    .wait-num-tag {
        height: 50px;
        font-size: 1.4rem;
    }
}

/* RWD: 極窄手機版縮小一點字體避免破版 */
@media (max-width: 380px) {
    .doctor-row {
        /* 移除原本的 padding-bottom，讓號碼區塊無縫接軌 */
        padding-bottom: 0 !important;
        flex-wrap: wrap; /* 允許內容與號碼區塊換行 */
    }

    /* 讓上方基本資訊佔滿 100% */
    .col-name, .col-session, .col-room, .col-num, .col-wait {
        margin-bottom: 12px;
    }

    .col-wait-numbers {
        margin: 0 -20px; /* 負邊距讓號碼區塊左右貼齊卡片邊緣 */
        width: calc(100% + 40px);
        padding: 12px 20px;
    }
}