*{box-sizing:border-box}html,body{margin:0;width:100%;min-height:100%;font-family:Arial,Roboto,"Segoe UI",sans-serif}body{background:#edf3fb;color:#101a38}.board-screen{height:1080px;min-height:650px;display:flex;flex-direction:column;background:linear-gradient(155deg,#f9fbff 0%,#e9f0fb 100%);overflow:hidden}.board-header{height:clamp(77px,89.64px,96px);flex:0 0 auto;display:grid;grid-template-columns:clamp(235px,441.6px,385px) minmax(0,1fr) clamp(225px,384px,340px);align-items:stretch;background:#142f80;color:#fff;border-bottom:4px solid #efbd30;box-shadow:0 3px 12px #072c6533}.hospital-identity{background:#fff;display:flex;align-items:center;justify-content:center;position:relative;padding:8px 15px}.hospital-identity:after{content:"";position:absolute;right:-18px;top:0;bottom:0;width:30px;background:#fff;transform:skewX(-18deg);z-index:1;border-right:5px solid #e7b32c}.hospital-logo{display:block;width:min(94%,290px);height:61px;object-fit:contain}.board-title{display:flex;justify-content:center;align-items:center;text-align:center;font-size:clamp(23px,47.04px,48px);line-height:1.08;letter-spacing:.02em;font-weight:900;padding:0 22px 0 38px;white-space:nowrap}.board-clock{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;border-left:1px solid #ffffff5c;gap:4px;padding:0 8px}.clock-date{font-size:clamp(14px,22.272px,23px);font-weight:600;text-transform:capitalize}.clock-time{font-size:clamp(23px,38.4px,38px);font-weight:800;font-variant-numeric:tabular-nums}.fixed-zone{min-height:0;flex:1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(12px,19.2px,22px);padding:clamp(12px,15.12px,20px) clamp(12px,19.2px,22px)}.customer-panel{min-height:0;display:flex;flex-direction:column;padding:8px 8px 7px;border-radius:18px;background:white;box-shadow:0 5px 20px #15316c22;border:1px solid #c9d5e7;overflow:hidden}.customer-table-head,.customer-row{display:grid;grid-template-columns:clamp(69px,126.72px,128px) minmax(0,1.7fr) minmax(105px,.87fr) minmax(90px,.73fr);align-items:center;gap:6px}.customer-table-head{flex:0 0 clamp(42px,55.08px,62px);background:#12327e;color:#fff;border-radius:11px;font-size:clamp(13px,24.576px,24px);font-weight:800;text-align:center}.customer-table-head span:nth-child(2){text-align:left;padding-left:4px}.customer-row{min-height:0;flex:1;border-bottom:1px solid #dde4ef;padding:0 5px;font-size:clamp(13px,25.344px,26px)}.customer-row:nth-child(even){background:#f0f5fd}.customer-row:last-child{border-bottom:0}.number-wrap{text-align:center}.number-badge,.ticker-number{display:inline-flex;align-items:center;justify-content:center;background:#f9c828;color:#111f40;border-radius:10px;font-weight:900;font-variant-numeric:tabular-nums}.number-badge{width:clamp(52px,96px,97px);height:clamp(30px,39.96px,50px);font-size:clamp(17px,32.64px,32px)}.customer-name{font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#101e49}.birth-date{white-space:nowrap;font-variant-numeric:tabular-nums}.gender{text-align:center}.gender-pill{display:inline-block;border-radius:100px;min-width:70px;padding:3px 8px;white-space:nowrap;font-weight:700}.gender-pill.male{background:#e2eefd;color:#1359b0}.gender-pill.female{background:#fce4ef;color:#ba2f6f}.ticker-zone{display:flex;align-items:stretch;flex:0 0 clamp(88px,129.6px,138px);padding:8px 12px 12px;gap:0}.ticker-heading{width:clamp(185px,326.4px,330px);flex:none;border-radius:14px 0 0 14px;background:#153682;color:#fff;display:flex;flex-direction:column;justify-content:center;padding:12px 22px;gap:5px;font-size:clamp(17px,30.72px,29px);font-weight:900;position:relative;z-index:1;white-space:nowrap}.ticker-heading:after{content:"";position:absolute;right:-22px;top:0;bottom:0;width:34px;background:#153682;transform:skewX(18deg);border-right:8px solid #f9c828;z-index:-1}.ticker-heading small{font-size:.76em;color:#ffd34e}.ticker-viewport{position:relative;min-width:0;flex:1;background:#fff;border:1px solid #ccd7e9;border-radius:0 14px 14px 0;box-shadow:0 4px 15px #15316c22;display:flex;align-items:center;overflow:hidden;padding:0 0 0 20px}.ticker-track{display:flex;width:max-content;flex:none;will-change:transform;animation:marquee var(--ticker-duration,90s) linear infinite}.ticker-items{display:flex;align-items:center;width:max-content;flex:none}.ticker-item{display:inline-flex;align-items:center;gap:12px;padding:0 24px;white-space:nowrap;border-right:2px solid #c5d0e1;font-weight:800;font-size:clamp(16px,26.88px,27px);color:#172850}.ticker-number{padding:8px 13px;font-size:1em}.ticker-empty{margin-left:28px;color:#5f708a}@keyframes marquee{from{transform:translateX(0)}to{transform:translateX(-50%)}}@media(prefers-reduced-motion:reduce){.ticker-track{animation-duration:var(--ticker-duration,90s)}}
.customer-placeholder{opacity:.25}

/* V4: thu nhỏ chữ riêng vùng KHÁCH TIẾP THEO; bảng 01–20 không đổi */
.ticker-heading { font-size: clamp(15px, 24px, 23px); }
.ticker-heading small { font-size: .72em; }
.ticker-item { font-size: clamp(14px, 21.504px, 21px); gap: 9px; padding: 0 18px; }
.ticker-number { padding: 6px 10px; font-size: .95em; }


/* V9 Multi-panel: màu cấu hình theo từng PanelID, style classic giữ nguyên V8. */
.board-header { background: var(--panel-header, #142f80); border-bottom-color: var(--panel-accent, #efbd30); }
.hospital-identity:after { border-right-color: var(--panel-accent, #efbd30); }
.number-badge, .ticker-number { background: var(--panel-accent, #f9c828); }
.board-theme-dark { background: #111827; color: #edf3ff; }
.board-theme-dark .customer-panel { background: #202d42; border-color: #42526b; }
.board-theme-dark .customer-row { color: #eef3fc; border-color: #3e5067; }
.board-theme-dark .customer-row:nth-child(even) { background: #29374d; }
.board-theme-dark .customer-name, .board-theme-dark .birth-date { color: #f2f6ff; }
.board-theme-dark .ticker-viewport { background: #202d42; border-color: #42526b; }
.board-theme-dark .ticker-item { color: #f2f6ff; border-right-color: #42526b; }
.board-theme-dark .customer-table-head, .board-theme-dark .ticker-heading, .board-theme-dark .ticker-heading:after { background: var(--panel-header, #142f80); }
.board-unavailable { min-height: 1080px; display: grid; place-items: center; background: #f4f7fb; color: #203459; font: bold 24px Arial,sans-serif; padding: 30px; text-align: center; }

/* V10: phòng khám (2 hoặc 4 ô); rotate2/rotate4 chuyển nhóm mỗi 30s */
.room-grid{min-height:0;flex:1;display:grid;gap:14px;padding:14px;overflow:hidden}
.room-grid-two{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr)}
.room-grid-four{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}
.room-card{display:flex;flex-direction:column;min-height:0;overflow:hidden;background:#fff;border:1px solid #cad5e9;border-radius:15px;box-shadow:0 4px 15px #15316c19}
.room-card-title{background:var(--panel-header,#142f80);color:#fff;padding:10px 16px;font-size:clamp(19px,32.64px,32px);font-weight:900;display:flex;align-items:center;justify-content:space-between;gap:12px}
.room-card-title small{font-size:.7em;color:var(--panel-accent,#efbd30)}
.room-table-head,.room-row{display:grid;grid-template-columns:clamp(60px,111.36px,100px) minmax(0,1fr) clamp(95px,172.8px,160px);align-items:center;gap:8px;padding:0 14px}
.room-table-head{background:#e9effa;color:#254175;font-weight:800;min-height:35px}
.room-row{min-height:0;flex:1;border-bottom:1px solid #e4eaf2;font-size:clamp(16px,24.96px,24px)}
.room-row:nth-child(even){background:#f2f6fc}
.room-stt{display:inline-flex;background:var(--panel-accent,#efbd30);padding:5px 9px;border-radius:8px;justify-content:center;width:max-content;min-width:48px}
.room-customer-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.room-empty{padding:24px;text-align:center;color:#6d7e99;font-size:20px}
.room-footer{text-align:center;padding:4px 12px 12px;color:#506482;font-size:16px}
.board-theme-dark .room-card{background:#202d42;color:#f2f6ff;border-color:#42526b}
.board-theme-dark .room-table-head{background:#29374d;color:#edf3ff}
.board-theme-dark .room-row{border-color:#42526b}
.board-theme-dark .room-row:nth-child(even){background:#29374d}


/* V13: single-room full-area layout */
.room-grid-one { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }

/* V13.2: 2/4 phòng: mỗi phòng sử dụng bảng 2 cột x 10 khách như giao diện 1 phòng.
   Banner giữ nguyên; các chế độ nhiều phòng không có ticker 21+. */
.board-room-layout { gap: clamp(8px, 19.2px, 16px); padding: clamp(8px, 10.8px, 14px); }
.board-room-card { min-height: 0; padding: 0; background: transparent; border: 0; box-shadow: none; }
.board-room-heading { flex: 0 0 auto; min-height: clamp(37px, 46.44px, 54px); padding: 4px 14px;
    font-size: clamp(16px, 25.92px, 27px); }
.room-customer-columns { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
    gap: clamp(5px,10.56px,12px); padding: 6px 0 0; }
.room-customer-panel { min-width: 0; min-height: 0; border-radius: 12px; padding: 5px; }
.room-customer-panel .customer-table-head,
.room-customer-panel .customer-row { grid-template-columns: clamp(40px,76.8px,75px) minmax(0,1.5fr) minmax(76px,.95fr) minmax(62px,.75fr); gap: 3px; }
.room-customer-panel .customer-table-head { flex-basis: clamp(29px,38.88px,44px); font-size: clamp(10px,16.512px,16px); }
.room-customer-panel .customer-row { font-size: clamp(11px,17.856px,18px); }
.room-customer-panel .number-badge { width: clamp(34px,57.6px,62px); height: clamp(23px,30.24px,36px); font-size: clamp(12px,21.696px,22px); }
.room-customer-panel .gender-pill { min-width: 0; padding: 2px 4px; }
.room-grid-four .board-room-heading { min-height: clamp(30px,37.8px,42px); font-size: clamp(15px,21.12px,22px); }
.room-grid-four .room-customer-columns { padding-top: 4px; gap: 6px; }
.room-grid-four .room-customer-panel .customer-table-head { flex-basis: 28px; font-size: clamp(9px,13.824px,14px); }
.room-grid-four .room-customer-panel .customer-row { font-size: clamp(10px,14.976px,15px); }
.room-grid-four .room-customer-panel .number-badge { height: clamp(18px,21.6px,28px); font-size: clamp(11px,18.24px,18px); }
.board-theme-dark .room-customer-panel { background: #202d42; border-color: #42526b; }
.board-theme-dark .room-customer-panel .customer-row { color: #eef3fc; border-color: #3e5067; }
.board-theme-dark .room-customer-panel .customer-row:nth-child(even) { background: #29374d; }
.board-theme-dark .room-customer-panel .customer-name,
.board-theme-dark .room-customer-panel .birth-date { color: #f2f6ff; }
.board-theme-dark .room-customer-panel .customer-table-head { background: var(--panel-header,#142f80); }


/* V13.4: 2/4 rooms — one table per room, 10 fixed + 5-row rolling viewport (11–20).
   Shared header is deliberately unchanged from V13.3. */
.board-room-card { display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; }
.room-list-body { --room-row-height:clamp(26px,49.14px,49px); display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;padding:5px 5px 7px;overflow:hidden;background:#fff;border:1px solid #cad5e9;border-radius:0 0 12px 12px; }
.room-list-head, .room-fixed-list .customer-row, .room-next-items .customer-row { display:grid;grid-template-columns:clamp(47px,96px,88px) minmax(0,1.5fr) minmax(93px,.9fr) minmax(70px,.72fr);gap:5px;align-items:center;min-width:0; }
.room-list-head { flex:none;height:clamp(30px,41.04px,42px);font-size:clamp(12px,19.2px,18px);border-radius:8px; }
.room-fixed-list { flex:none;min-height:0; }
.room-fixed-list .customer-row,.room-next-items .customer-row { height:var(--room-row-height);min-height:0;flex:none;padding:0 4px;font-size:clamp(12px,20.736px,20px); }
.room-list-body .number-badge { width:clamp(37px,71.04px,70px);height:calc(var(--room-row-height) - 7px);font-size:clamp(14px,24.96px,25px);border-radius:7px; }
.room-list-body .gender-pill { min-width:0;padding:2px 4px; }
.room-next-viewport { flex:none;position:relative;min-width:0;height:calc(var(--room-row-height) * 5);overflow:hidden;border-top:3px solid var(--panel-accent,#efbd30);background:#f5f8fe; }
.room-next-track { width:100%;will-change:transform;animation:room-loop-up var(--room-scroll-duration,30s) linear infinite; }
.room-next-items { width:100%; }
.room-next-items .customer-row:nth-child(even) { background:#e9f1fc; }
.room-next-empty { display:flex;align-items:center;justify-content:center;height:100%;color:#77849a;font-weight:600;font-size:clamp(11px,18.24px,17px); }
@keyframes room-loop-up { from { transform:translateY(0); } to { transform:translateY(-50%); } }
.room-grid-four .room-list-body { --room-row-height:clamp(16px,24.084px,25px);padding:3px 4px 4px; }
.room-grid-four .room-list-head { height:clamp(22px,30.24px,32px);font-size:clamp(9px,14.784px,14px); }
.room-grid-four .room-fixed-list .customer-row,.room-grid-four .room-next-items .customer-row { grid-template-columns:clamp(32px,57.6px,54px) minmax(0,1.3fr) minmax(68px,.9fr) minmax(50px,.65fr);gap:2px;padding:0 2px;font-size:clamp(9px,14.592px,14px); }
.room-grid-four .room-list-body .number-badge { width:clamp(26px,48px,46px);height:calc(var(--room-row-height) - 3px);font-size:clamp(9px,16.512px,16px);border-radius:5px; }
.room-grid-four .room-list-body .gender-pill { font-size:inherit;padding:0 2px; }
.board-theme-dark .room-list-body { background:#202d42;border-color:#42526b; }
.board-theme-dark .room-list-body .customer-row { color:#eef3fc;border-color:#3e5067; }
.board-theme-dark .room-list-body .customer-row:nth-child(even) { background:#29374d; }
.board-theme-dark .room-list-body .customer-name,.board-theme-dark .room-list-body .birth-date {color:#f2f6ff;}
.board-theme-dark .room-next-viewport { background:#202d42; }

@media (prefers-reduced-motion:reduce) { .room-next-track { animation:none; } }


/* V13.6: Fit 10 fixed + 5 scrolling rows to the entire room content height.
   Prevents empty area below the scroll viewport on 2/4 room panels. */
.board-room-layout .room-list-body {
    display: grid;
    grid-template-rows: auto minmax(0, 2fr) minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}
.board-room-layout .room-fixed-list {
    display: grid;
    grid-template-rows: repeat(10, minmax(0, 1fr));
    min-height: 0;
    overflow: hidden;
}
.board-room-layout .room-fixed-list .customer-row {
    min-height: 0;
    height: 100%;
    overflow: hidden;
}
.board-room-layout .room-next-viewport {
    min-height: 0;
    height: auto;
    overflow: hidden;
    container-type: size;
}
.board-room-layout .room-next-items .customer-row {
    height: 20cqh; /* 5 full rows visible regardless of display resolution */
    min-height: 0;
    overflow: hidden;
}
/* Remove hard minimums on badges on short displays. */
.board-room-layout .room-list-body .number-badge {
    max-height: 90%;
}


/* V13.8 — Reference-size rendering (1920 x 1080).
 * The complete board is uniformly scaled by board-fit.js, including typography,
 * paddings, stripes, list rows and the ticker. Any resolution/aspect ratio fits
 * without cropping. V13.8.2 expands the canvas to fill non-16:9 viewports.
 * Do not add vw/vh media queries to the modern board: it has a fixed design canvas.
 */
html,body { width:100%; min-height:100%; margin:0; }
body:has(.board-screen) { background:#101b34; overflow:hidden; }
.board-screen {
    position:fixed;
    width:1920px;
    height:1080px;
    min-height:0;
    max-height:none;
    left:0;
    top:0;
    margin:0;
    transform-origin:0 0;
    overflow:hidden;
    will-change:transform;
}
/* Avoid shrinking the room panels to zero: 10 fixed rows + 5 next rows always share
   the available room height at the 1920x1080 reference geometry. */
.board-room-layout .room-list-body {
    grid-template-rows: minmax(0,42px) minmax(0,2fr) minmax(0,1fr);
}
.board-room-layout .room-fixed-list { min-height:0; }
.board-room-layout .room-next-viewport { min-height:0; }
.board-room-layout .room-next-items .customer-row { height:20cqh; }

/* V13.8.1: prevent displaying unscaled 1920px canvas before Blazor async render */
.board-screen { visibility:hidden; }

/* V13.8.2 Full Bleed: logical canvas dimensions are set by board-fit.js.
 * Keep all text and UI uniformly scaled; stretch the layout, not the glyphs. */
body:has(.board-screen) { background:#edf3fb; }
.board-screen { max-width:none; max-height:none; }
