/* ==========================================================================
   PLC.TOS.ModuleIfmn — style cấp module
   Design token dùng chung cho toàn bộ màn iForeman.
   Style riêng của từng component nằm ở file .razor.css (scoped).
   ========================================================================== */

:root {
    --ifmn-blue: #0d47a1;
    --ifmn-blue-dark: #0b3c85;
    --ifmn-blue-deep: #093579;
    --ifmn-blue-soft: #e8f0fb;
    --ifmn-amber: #ffe9a8;
    --ifmn-amber-border: #e8c86a;
    --ifmn-text: #17222e;
    --ifmn-text-muted: #64748b;
    --ifmn-border: #d8e0ea;
    --ifmn-surface: #ffffff;
    --ifmn-surface-alt: #f2f5f9;
    --ifmn-canvas-bg: #f5f7fa;
    --ifmn-danger: #c62828;

    --ifmn-header-height: 52px;
    --ifmn-tabbar-height: 54px;
    --ifmn-radius: 10px;

    /* Chiều cao các dòng của một cột bay ở tab KẾ HOẠCH CẨU.
       GIÁ TRỊ THẬT được C# ghi đè trực tiếp lên .plan-stage
       (Models/VesselPlanLayout.cs — VesselPlanMetrics), vì hình thân tàu (SVG)
       và các ô bay (HTML) bắt buộc phải dùng CHUNG một bộ số thì mới khớp nhau.
       Khai báo ở đây chỉ là giá trị dự phòng. */
    --ifmn-planrow-title: 30px;
    --ifmn-planrow-section: 52px;
    --ifmn-planrow-gap: 18px;

    /* Chu kỳ nhấp nháy đỏ của kết quả SearchCont.
       GIÁ TRỊ THẬT đến từ IfmnDemoConfiguration.Search (C# ghi đè khi cần);
       khai báo ở đây chỉ là giá trị dự phòng. */
    --ifmn-blink-period: 620ms;

    --ifmn-z-menu: 70;
    --ifmn-z-dialog: 80;
    --ifmn-z-drag: 90;

    --ifmn-bottomcluster-height: 70px;
    --tos-rtt-bottom: calc(var(--ifmn-tabbar-height) + var(--ifmn-bottomcluster-height) + env(safe-area-inset-bottom, 0px));
}

:root:has(.workspace.is-focus) {
    --tos-rtt-bottom: 12px;
}

/* Breakpoint mobile của module: 900px.
   Renderer PixiJS dùng đúng con số này ở CONFIG.responsive.singleRowMaxViewportPx
   để chọn mặc định 1 hàng / 2 hàng cho tab SƠ ĐỒ TÀU;
   các file .razor.css cũng dùng lại đúng mốc này. */

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    height: 100%;
    /* 100dvh bám theo chiều cao thật khi thanh địa chỉ mobile ẩn/hiện,
       nên module không bị hụt hoặc thừa một dải khi cuộn trên điện thoại. */
    height: 100dvh;
    color: var(--ifmn-text);
    background: var(--ifmn-surface-alt);
    /* Không cho trang cuộn ngang; vùng nào cần cuộn thì tự cuộn bên trong. */
    overflow-x: hidden;
    /* Nội dung module luôn vừa khung -> trang không tự cuộn dọc. */
    overflow-y: hidden;
    overscroll-behavior: none;
}

*, *::before, *::after {
    box-sizing: border-box;
}

#app {
    height: 100%;
    height: 100dvh;
}

/* Module iForeman chiếm toàn màn hình, không dùng sidebar scaffold mặc định. */
.page {
    height: 100%;
}

h1:focus {
    outline: none;
}

 
.ifmn-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--ifmn-z-menu) - 1);
    background: transparent;
}

.ifmn-menu {
    position: fixed;
    /* Cao hơn cụm nút nổi của focus mode (62) để không bị che. */
    z-index: var(--ifmn-z-menu);
    width: 256px;
    transform: translateX(-50%);
    max-height: min(380px, calc(100dvh - 90px));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    background: var(--ifmn-surface);
    border: 1px solid var(--ifmn-border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 30, 50, .22);
}

    .ifmn-menu:focus {
        outline: none;
    }

/* Bottom sheet: dùng khi trên/dưới điểm neo đều không đủ chỗ (điển hình là điện
   thoại nằm ngang). Bảo đảm LUÔN nhìn thấy đủ các mục, không chỉ một mục. */
.ifmn-menu.is-sheet {
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    width: auto;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    transform: none;
    border-radius: 14px;
    box-shadow: 0 -6px 28px rgba(15, 30, 50, .28);
}

    .ifmn-menu.is-sheet .ifmn-menu-item {
        min-height: 44px;
    }

.ifmn-menu-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 6px 8px;
    border-bottom: 1px solid var(--ifmn-border);
    margin-bottom: 4px;
}

.ifmn-menu-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ifmn-text);
}

.ifmn-menu-subtitle {
    margin: 0 6px 6px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--ifmn-text-muted);
}

.ifmn-menu-dot {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 4px;
    background: var(--ifmn-menu-accent, var(--crane-color, #94a3b8));
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15) inset;
}

.ifmn-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--ifmn-text);
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}

    .ifmn-menu-item:hover:not(:disabled) {
        background: var(--ifmn-blue-soft);
    }

    .ifmn-menu-item:focus-visible {
        outline: 2px solid var(--ifmn-blue);
        outline-offset: -2px;
    }

    .ifmn-menu-item:disabled {
        color: #9aa8b7;
        cursor: not-allowed;
    }

    .ifmn-menu-item.is-quiet {
        color: var(--ifmn-text-muted);
        font-size: 12px;
        min-height: 32px;
    }

.ifmn-menu-tag {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #9aa8b7;
    background: var(--ifmn-surface-alt);
    border-radius: 5px;
    padding: 2px 6px;
}

.startup-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(241, 245, 249, 0.96), rgba(226, 232, 240, 0.98)),
        #f8fafc;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.startup-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.startup-loader__panel {
    width: min(100%, 360px);
    padding: 28px 24px;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    text-align: center;
}

.startup-loader__spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 4px solid rgba(37, 99, 235, 0.16);
    border-top-color: #2563eb;
    animation: startupLoaderSpin 0.85s linear infinite;
}

.startup-loader__title {
    color: var(--ifmn-text);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.startup-loader__message {
    margin-top: 8px;
    color: var(--ifmn-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

@keyframes startupLoaderSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ifmn-menu-label {
    margin: 4px 6px 6px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ifmn-text-muted);
}

.ifmn-menu-note {
    margin: 2px 6px 6px;
    font-size: 12px;
    color: #9a3412;
}

.ifmn-menu-actions {
    display: flex;
    gap: 8px;
    padding: 4px 2px 2px;
}

.ifmn-menu-btn {
    flex: 1;
    min-height: 36px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ifmn-text);
    background: var(--ifmn-surface-alt);
    border: 1px solid var(--ifmn-border);
    border-radius: 8px;
    cursor: pointer;
}

    .ifmn-menu-btn:hover {
        background: #e9eef5;
    }

    .ifmn-menu-btn:focus-visible {
        outline: 2px solid var(--ifmn-blue);
        outline-offset: 2px;
    }

    .ifmn-menu-btn.is-primary {
        color: #fff;
        background: var(--ifmn-blue);
        border-color: var(--ifmn-blue);
    }

        .ifmn-menu-btn.is-primary:hover {
            background: var(--ifmn-blue-dark);
        }

 
.ifmn-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--ifmn-z-dialog);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    background: rgba(15, 30, 50, .38);
}

.ifmn-dialog {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(640px, 100%);
    max-height: min(560px, calc(100dvh - 32px));
    overflow-y: auto;
    padding: 14px 16px 16px;
    background: var(--ifmn-surface);
    border: 1px solid var(--ifmn-border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 30, 50, .3);
}

.ifmn-dialog-info {
    width: min(460px, 100%);
}

.ifmn-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ifmn-dialog-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--ifmn-text);
}

.ifmn-dialog-close {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    font-size: 15px;
    line-height: 1;
    color: var(--ifmn-text-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

    .ifmn-dialog-close:hover {
        background: var(--ifmn-surface-alt);
        color: var(--ifmn-text);
    }

    .ifmn-dialog-close:focus-visible {
        outline: 2px solid var(--ifmn-blue);
        outline-offset: -2px;
    }

.ifmn-dialog-note {
    margin: 0;
    font-size: 12px;
    color: var(--ifmn-text-muted);
}

/* ---------- SearchCont ---------- */
.ifmn-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ifmn-search-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ifmn-text-muted);
}

.ifmn-search-input {
    flex: 0 0 auto;
    width: 120px;
    min-height: 44px;
    padding: 0 12px;
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--ifmn-text);
    background: var(--ifmn-surface);
    border: 2px solid var(--ifmn-border);
    border-radius: 8px;
}

    .ifmn-search-input:focus-visible {
        outline: 2px solid var(--ifmn-blue);
        outline-offset: 1px;
    }

.ifmn-btn {
    min-height: 44px;
    padding: 0 18px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--ifmn-text);
    background: var(--ifmn-surface-alt);
    border: 1px solid var(--ifmn-border);
    border-radius: 8px;
    cursor: pointer;
}

    .ifmn-btn.is-primary {
        color: #fff;
        background: var(--ifmn-blue);
        border-color: var(--ifmn-blue);
    }

        .ifmn-btn.is-primary:hover {
            background: var(--ifmn-blue-dark);
        }

    .ifmn-btn:focus-visible {
        outline: 2px solid var(--ifmn-blue);
        outline-offset: 2px;
    }

.ifmn-search-hint {
    margin: 0;
    font-size: 12px;
    color: var(--ifmn-text-muted);
}

    .ifmn-search-hint .is-invalid {
        font-weight: 600;
        color: var(--ifmn-danger);
    }

/* ---------- Bảng kết quả container ---------- */
.ifmn-result-wrap {
    min-width: 0;
    /* Bảng rộng tự cuộn NGANG trong khung của nó, trang không bao giờ cuộn ngang. */
    overflow-x: auto;
}

.ifmn-result-empty {
    margin: 0;
    font-size: 12px;
    color: var(--ifmn-text-muted);
}

.ifmn-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}

    .ifmn-result-table th,
    .ifmn-result-table td {
        padding: 7px 8px;
        text-align: left;
        border-bottom: 1px solid var(--ifmn-border);
    }

    .ifmn-result-table th {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .4px;
        color: var(--ifmn-text-muted);
        background: var(--ifmn-surface-alt);
        position: sticky;
        top: 0;
    }

    .ifmn-result-table tbody tr:hover {
        background: var(--ifmn-blue-soft);
    }

.ifmn-result-link {
    min-height: 32px;
    padding: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--ifmn-blue);
    background: transparent;
    border: 0;
    cursor: pointer;
    text-decoration: underline;
}

    .ifmn-result-link:focus-visible {
        outline: 2px solid var(--ifmn-blue);
        outline-offset: 2px;
    }

/* Nguồn dữ liệu phân biệt bằng CHỮ + kiểu viền, không chỉ bằng màu. */
.ifmn-source-tag {
    display: inline-block;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    border-radius: 999px;
}

    .ifmn-source-tag.is-current {
        color: #0f766e;
        background: #ccfbf1;
        border: 1px solid #5eead4;
    }

    .ifmn-source-tag.is-future {
        color: #92400e;
        background: #fef3c7;
        border: 1px dashed #f59e0b;
    }

/* ---------- Modal info container ---------- */
.ifmn-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 6px 14px;
    margin: 0;
}

.ifmn-info-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px dotted var(--ifmn-border);
}

    .ifmn-info-row dt {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .3px;
        color: var(--ifmn-text-muted);
    }

    .ifmn-info-row dd {
        margin: 0;
        font-size: 13px;
        font-weight: 600;
        color: var(--ifmn-text);
        text-align: right;
    }

/* ---------- Bản xem trước khi kéo chip cẩu (gắn vào body) ---------- */
.ifmn-crane-drag-preview {
    position: fixed;
    z-index: var(--ifmn-z-drag);
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px 0 26px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ifmn-text);
    background: var(--ifmn-surface);
    border: 2px solid var(--crane-color, #94a3b8);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(15, 30, 50, .28);
    pointer-events: none;
}

    .ifmn-crane-drag-preview::before {
        content: "";
        position: absolute;
        left: 7px;
        width: 12px;
        height: 12px;
        border-radius: 3px;
        background: var(--crane-color, #94a3b8);
    }

/* Chỉ dành cho trình đọc màn hình. */
.ifmn-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .ifmn-dialog {
        max-height: calc(100dvh - 32px);
        padding: 12px;
    }

    .ifmn-result-table th,
    .ifmn-result-table td {
        padding: 9px 8px;
    }

    /* Vùng chạm tối thiểu 44px trên cảm ứng. */
    .ifmn-result-link {
        min-height: 44px;
    }
}

/* ---------- Blazor error UI (giữ nguyên hành vi mặc định) ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--ifmn-blue);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* ==================================================================
   BIỂU ĐỒ CÔNG VIỆC CẨU (CraneWorkChart.razor)

   Vì sao ở ĐÂY chứ không ở CraneWorkChart.razor.css:
   Razor giữ riêng thẻ <text> làm ký hiệu chuyển ngữ cảnh, nên mọi nhãn của biểu đồ
   buộc phải dựng bằng RenderTreeBuilder. Phần tử dựng bằng builder KHÔNG nhận thuộc tính
   scope (b-xxxxxxxxxx), nên nếu để trong file scoped CSS thì quy tắc chữ sẽ không bao giờ
   ăn. Toàn bộ .cwc-* gom về CSS toàn cục để hình và chữ dùng chung một nguồn.
   Tiền tố .cwc- chỉ tồn tại trong biểu đồ này nên không đụng thành phần khác.
   ================================================================== */

/* SVG phủ toàn bộ sân khấu, chỉ vẽ ở dải dưới đáy tàu.
   Không chặn click để thao tác trên thẻ bay phía trên vẫn hoạt động bình thường. */
.crane-work-chart {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
}

/* Thẻ công việc CÓ nhận tooltip và tín hiệu con trỏ -> bật lại pointer cho riêng nhóm thẻ.
   touch-action:none để cử chỉ pan/pinch vẫn do khung nhìn xử lý, không bị trình duyệt
   nuốt thành cuộn trang giữa chừng (giống .plan-viewport). */
.cwc-card {
    pointer-events: auto;
}

/* Khối đang được xem nhanh: tô sáng NHẸ, KHÔNG phóng to, KHÔNG đổi hình học.
   Chỉ thêm một vòng sáng bên ngoài viền sẵn có nên thẻ không "nhảy" khi mở preview. */
.cwc-card.is-preview .cwc-card-frame {
    stroke-opacity: 1;
    filter: drop-shadow(0 0 3px rgba(13, 71, 161, .85));
}

.cwc-caption {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    fill: #3f5f7d;
}

/* Lưới mốc thời gian và biên khoang. */
.cwc-grid {
    stroke: #cbd5e1;
    stroke-width: 1.5;
}

/* KHUNG TRỤC — vạch đen dày. KHÔNG phải mốc thời gian hiện tại. */
.cwc-axis {
    stroke: #1f2937;
    stroke-width: 2.5;
}

.cwc-time {
    font-size: 10px;
    fill: var(--ifmn-text-muted);
}

    /* Mốc 00:xx / 01:xx = qua ngày, tô đỏ như Ship Planning. */
    .cwc-time.is-midnight {
        fill: var(--ifmn-danger);
        font-weight: 700;
    }

/* Mảng tô (nền tầng trên + từng ô trạng thái). KHÔNG stroke: mọi đường kẻ đều do
   .cwc-divider-* và .cwc-card-frame vẽ, nên không nét nào bị stroke chồng thành đậm gấp đôi. */
.cwc-part {
    stroke: none;
}

/* ---- PHÂN CẤP ĐƯỜNG KẺ: viền ngoài > chia hai tầng > chia ô trạng thái.
       Không dùng 2px ở bất kỳ cấp nào. ---- */

.cwc-card-frame {
    fill: none;
    stroke-width: 1;
    stroke-opacity: .85;
}

.cwc-divider-h {
    stroke-width: 1;
    stroke-opacity: .38;
}

.cwc-divider-v {
    stroke-width: 1;
    stroke-opacity: .22;
}

/* Lớp nhãn vẽ SAU mọi nền/pattern/đường kẻ -> không rect nào có thể đè lên chữ.
   Không nhận chuột để tooltip và tín hiệu con trỏ của thẻ bên dưới vẫn hoạt động. */
.cwc-label-layer {
    pointer-events: none;
}

/* Viền ngoài vẽ SAU CÙNG nhưng KHÔNG tô nền, nên nằm trên mọi mảng tô mà không che chữ. */
.cwc-frame-layer {
    pointer-events: none;
}

/* Nhãn số lượng ở TẦNG TRÊN và số trong Ô TRẠNG THÁI.
   Cỡ chữ, màu chữ và màu viền chữ đến từ thuộc tính inline (chọn theo độ sáng nền màu cẩu);
   ở đây chỉ định nghĩa nét chữ, cách vẽ viền và NGƯỠNG HIỆN THEO ZOOM.

   ẨN/HIỆN THEO KÍCH THƯỚC THẬT TRÊN MÀN HÌNH
   ------------------------------------------
     --cwc-cam : camera scale hiện tại, do ifmnPlanViewport.js ghi lên .plan-stage
                 mỗi lần transform đổi -> LUÔN đúng pha với chính transform đó.
     --cwc-min : camera scale tối thiểu để CHÍNH nhãn này đọc được, do C# tính từ
                 cỡ chữ của riêng nó (MinLabelScreenFontPx / fontSize).

   opacity = clamp(0, (cam - min) × 14, 1):
     • cam < min            -> 0   : nhãn không đủ chỗ trên màn hình, ẩn hẳn;
     • cam > min + 1/14     -> 1   : hiện đầy đủ;
     • ở giữa               -> mờ dần trong dải ~0.07 scale.
   Dải chuyển tiếp đó chính là HYSTERESIS: scale rung quanh ngưỡng chỉ đổi độ mờ vài phần
   trăm thay vì bật/tắt, nên không bao giờ nhấp nháy.

   Mỗi nhãn có --cwc-min RIÊNG, nên nhãn chính và từng số S1/S2/S3 hiện/ẩn hoàn toàn độc lập.
   Thiếu var (JS chưa chạy / SSR) -> mặc định --cwc-cam:1 ở .plan-stage, nhãn vẫn hiện. */
.cwc-main-text,
.cwc-seg-text {
    font-weight: 600;
    pointer-events: none;
    /* Viền vẽ TRƯỚC chữ: số vẫn đọc rõ khi nằm trên lưới chấm hoặc sọc chéo. */
    paint-order: stroke;
    stroke-linejoin: round;
    /* Viền theo EM: cỡ chữ nhỏ thì viền mảnh theo, không bao giờ nuốt mất nét chữ. */
    stroke-width: .2em;
    opacity: clamp(0, calc((var(--cwc-cam, 1) - var(--cwc-min, 0)) * 14), 1);
}

.cwc-main-text {
    letter-spacing: .2px;
}

.cwc-empty {
    font-size: 11px;
    fill: var(--ifmn-text-muted);
}

/* ---------- MỞ / ĐÓNG CHI TIẾT NGAY TRÊN THẺ ----------
   CHEVRON ĐÃ BỊ GỠ HẲN: không còn .cwc-toggle-layer, .cwc-toggle-hit hay .cwc-toggle-mark,
   nên không còn hình vẽ rối mắt và cũng không còn hit-area vô hình nào ở cạnh dưới thẻ.
   Bản thân thẻ (.cwc-card) là nút mở/đóng — vùng bấm rộng đúng bằng thẻ. */

.cwc-card {
    cursor: pointer;
    /* Nhấn giữ để mở thẻ xem nhanh: chặn bôi đen và callout của trình duyệt mobile. */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

    /* Bàn phím: viền tiêu điểm vẽ trên khung sẵn có, KHÔNG thêm hình mới nên
       hình học và bố cục thẻ không đổi. */
    .cwc-card:focus {
        outline: none;
    }

    .cwc-card:focus-visible .cwc-card-frame,
    .cwc-card.is-open .cwc-card-frame {
        stroke-opacity: 1;
        stroke-width: 1.6;
    }

/* Phần CHI TIẾT (dải trạng thái S1/S2/S3 + các số của nó).
   Chỉ ĐỘ MỜ được animate, trong ~180ms. Không transform, không scale, không đổi
   toạ độ/kích thước -> mở/đóng không làm layout hay khung nhìn nhảy một pixel nào. */
@keyframes cwc-detail-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cwc-detail {
    animation: cwc-detail-in 180ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    .cwc-detail {
        animation: none;
    }
}
