﻿/* CLINIC-SCOPE: shared */
/* ============================================================================
   nen-chung.css — NỀN CHUNG của host: bôi đen văn bản, khung #divBody,
   menu người dùng góc phải, ô tích, dấu * trường bắt buộc.
   ----------------------------------------------------------------------------

   ============================================================================ */

/* ════════════════════════════════════════════════════════════════════════════
   MÀU THƯƠNG HIỆU HỆ CŨ — KHÔNG dùng cho màn mới.
   ----------------------------------------------------------------------------

        --main-color  #055952   <- khối này, hệ cũ, 182 chỗ
        --brand       #1d6f5c   <- design-tokens.css, hệ mới, 515 chỗ

   Chúng chỉ chênh nhau 1,36:1 nên đứng riêng gần như không phân biệt được, nhưng
   cạnh nhau trên cùng màn thì lộ vệt chuyển sắc. Trước đó đã có tiền lệ: vạch
   dòng đang chọn từng bị hai sắc này làm lệch (wdGrid lấy --brand, 3 lưới kia
   lấy --main-color) và phải gom về --row-sel-bar.

   --brand = #055952 ở design-tokens.css, còn --main-color dưới đây chỉ là BÍ DANH trỏ về --brand — một nguồn duy nhất,
   đổi màu thương hiệu toàn hệ = sửa đúng một dòng bên design-tokens.css.

   Hệ quả: 515 chỗ dùng --brand sẫm lại một bậc; tương phản với chữ trắng tăng
   6,03 -> 8,21. Đối chiếu hai màu: docs/mocks/giao-dien-chung/hai-mau-thuong-hieu.html
   ════════════════════════════════════════════════════════════════════════════ */
:root {
    --main-color: var(--brand); /* BÍ DANH của --brand — đừng đặt lại giá trị ở đây */
    --lever2-color: #1d4ed8;    /* cấp 2 — 3 chỗ */
    --tranfer-color: #2563eb85; /* chủ đạo, mờ 52% — 4 chỗ */
    --tranfer-color2: #2563eb33;/* chủ đạo, mờ 20% — 1 chỗ */
    /* Đã bỏ --constrast-color (#440000): sai chính tả "constrast" và 0 nơi dùng. */
}

/* Boi den van ban: truoc day khong khai gi nen dung xam mac dinh cua trinh duyet,
   nhin khong ra dang chon toi dau. Lay DUNG nguon mau chon dung chung cua he
   (--row-sel / --dk-grid-sel o tokens.css), khong che mau rieng -> boi den van ban
   va dong dang chon o luoi cung mot sac. */
::selection {
    background: var(--row-sel);
    color: var(--text);
    text-shadow: none;
}

::-moz-selection {
    background: var(--row-sel);
    color: var(--text);
    text-shadow: none;
}

/* Vach nhay + con tro chu I chi thuoc ve cho GO DUOC.
   Trinh duyet dang bat duyet bang con tro (caret browsing, F7) ve vach nhay o MOI doan chu
   bam vao, ke ca o readonly -> nguoi dung tuong go duoc. Mac dinh trong suot, chi tra lai
   cho o nhap/vung soan con mo; o readonly/disabled them con tro mui ten thay chu I.
   :where() = specificity 0 nen rule rieng cua man (pointer o o bam-mo-popup, not-allowed
   cua khoa-man.css, flatpickr...) van thang ma khong can !important. */
:where(html) {
    caret-color: transparent;
}

:where(input, textarea, [contenteditable]:not([contenteditable="false"])) {
    caret-color: auto;
}

:where(input, textarea):where([readonly], :disabled) {
    caret-color: transparent;
    cursor: default;
}

/* Ô nhập/ô chọn trần (không class) ra viền đen kiểu thô của trình duyệt — cấm xuất hiện.
   :where() = độ ưu tiên 0: màn nào tự vẽ (form-control, TomSelect, lưới, flatpickr) vẫn thắng; chỉ lấp phần bỏ trống. */
:where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file], [type=button], [type=submit], [type=reset], [type=image], [type=hidden]), select, textarea) {
    padding: 0 var(--sp-2, 8px);
    border: 1px solid var(--line, #cbd5d0);
    border-radius: var(--radius, 2px);
    background-color: var(--surface, #fff);
    color: var(--text, #0f172a);
    font: inherit;
}
:where(textarea) { padding: var(--sp-1, 4px) var(--sp-2, 8px); }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file], [type=button], [type=submit], [type=reset], [type=image], [type=hidden]):focus, select:focus, textarea:focus) {
    border-color: var(--focus-bd, #1d6f5c);
    outline: 2px solid var(--focus-bd, #1d6f5c);
    outline-offset: -1px;
}

#divBody {
    min-height: calc(100vh - 80px);
    width: calc(100% - 220px);
    user-select: none;
    float: left;
}
    #divBody .e-spinner-pane {
        background:rgba(0,0,0,0.4);
    }

.divTitle {
    width: 100%;
    float: left;
    border-bottom: 1px solid var(--main-color);
    padding: 5px;
    text-transform: uppercase;
    font-size: 16pt;
    font-weight: bold
}

.button {
    padding: 5px;
    border: 1px solid var(--main-color);
    background: var(--surface, #fff);
    text-align: center;
    font-size: 14px;
    cursor: pointer
}

    .button:hover {
        background: var(--main-color);
        color: var(--btn-on, #fff);
    }

.buttonactive {
    background: var(--main-color);
    color: var(--btn-on, #fff);
}

.buttondeactive {
    background: var(--surface, #fff);
    color: var(--main-color);
}

.divBot {
    width: 100%;
    float: left;
    margin-top: 10px;
    padding: 5px;
    text-transform: uppercase;
    font-size: 16pt;
    font-weight: bold
}

#divNguoiDung {
    position: relative;
    float: right;
    text-align: right;
    cursor: pointer;
    width: 150px;
    user-select: none;
}

#divThongTin {
    position: absolute;
    top: 25px;
    right: 20px;
    width: 160px;
    background: var(--surface, #fff);
    border-radius: var(--radius, 2px);
    border: 1px solid var(--line, #ddd);
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    padding: 0px !important;
    padding-bottom: 10px !important;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 100000 ;
}

#divTenDangNhap:hover #divThongTin {
    font-weight: bold;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#divTenDangNhap:hover div {
    opacity: 1;
    display: block
}

@media (max-width: 768px) {
    #divBody {
        width: 100%
    }
}

input[type="checkbox"] {
    box-sizing: border-box !important;
    flex: 0 0 16px;
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle;
    accent-color: var(--main-color) !important;
}

/* Dấu * đánh dấu trường bắt buộc — MỘT chỗ khai cho toàn hệ.
Màn mới chỉ cần <span class="req">*</span>, KHÔNG khai màu lại. */
/* Dạng phổ biến: markup tự viết <span class="req">*</span> cạnh nhãn -> tô đỏ chính nó. */
.req, .xn-req, .ckh-req, .dc-req, .ksk-field-req {
    color: var(--req);
    font-weight: var(--fw-bold);
    font-style: normal;
}
/* Dạng thứ hai: .req nằm TRÊN chính <label> và dấu * do CSS sinh. Ở đây KHÔNG được
   tô màu phần tử (sẽ đỏ cả chữ "Ngày", "Người trả"), chỉ tô riêng dấu * ở ::after. */
.ws-tl .req, .ws-tt .req, .chm-f.req > label, .tck-req { color: inherit; font-weight: inherit; }
.ws-tl .req::after, .ws-tt .req::after, .chm-f.req > label::after, .tck-req::after {
    content: " *";
    color: var(--req);
    font-weight: var(--fw-bold);
}

/* Chữ MP / MT trong nhãn, tiêu đề cột, tóm tắt — toàn hệ cùng một màu (token ở design-tokens.css).
   JS dựng chuỗi thì gọi toMauMat(html) (fSupport.js) thay vì tự bọc span. */
.chu-mp, .chu-mt { font-weight: var(--fw-semibold, 600); }
.chu-mp { color: var(--mat-mp); }
.chu-mt { color: var(--mat-mt); }

/* Switch dùng slider ẩn checkbox gốc, giữ nguyên kích thước 0 của control đó. */
.switch input[type="checkbox"] {
    flex: 0 0 0;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
}

/* Mắt hiện/ẩn mật khẩu — wdMatKhauCoMat() ở fSupport.js bọc ô password trong .wd-mk-bao. */
.wd-mk-bao { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; width: 100%; }
.wd-mk-bao > input { flex: 1 1 auto; min-width: 0; width: 100%; padding-right: 34px; }
.wd-mk-mat { position: absolute; right: 0; top: 0; bottom: 0; width: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted, #475569); }
.wd-mk-mat:hover { color: var(--brand, #0e7490); }
