﻿/* ══════════════════════════════════════════════════════════════
   StarCat Core — Helpdesk Dashboard + Ticket List Page
   ══════════════════════════════════════════════════════════════ */

/* ── Page Layout ─────────────────────────────────────────────── */
.hd-page        { display:flex; flex-direction:column; height:calc(100vh - var(--sc-header-h,60px)); overflow:hidden; padding:20px; box-sizing:border-box; }
.hd-layout      { display:flex; flex:1; overflow:hidden; border:1px solid var(--sc-border); border-radius:12px; min-height:0; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.hd-sidebar {
    width:220px; flex-shrink:0;
    background:var(--sc-surface);
    border-right:1px solid var(--sc-border);
    display:flex; flex-direction:column;
    overflow-y:auto; padding:12px 8px;
}
.hd-sidebar-title {
    display:flex; align-items:center; gap:10px;
    padding:8px 10px 14px;
    border-bottom:1px solid var(--sc-border);
    margin-bottom:8px;
}
.hd-sidebar-title-icon {
    width:32px; height:32px; border-radius:8px;
    background:color-mix(in srgb,var(--sc-primary) 15%,transparent);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.hd-sidebar-title-name { font-size:13px; font-weight:700; color:var(--sc-text-1); }
.hd-sidebar-title-sub  { font-size:11px; color:var(--sc-text-3); }
.hd-nav-item {
    display:flex; align-items:center; gap:9px;
    padding:9px 12px; border-radius:8px;
    font-size:13px; color:var(--sc-text-2);
    cursor:pointer; transition:background .15s,color .15s;
    margin-bottom:2px;
}
.hd-nav-item:hover  { background:var(--sc-surface-2); color:var(--sc-text-1); }
.hd-nav-item.active { background:var(--sc-primary-light,#dbeafe); color:var(--sc-primary); font-weight:600; }

/* ── Report view tabs (แนวนอน แทน OpsSubNav aside เดิม — กัน nav ซ้อน sidebar)
   ใช้ .ops-tab เดียวกับ Patch Management (/patchmanagement .pm-tabrow) และ Dashboard หลัก (/dashboard
   .ops-tab-bar) เพื่อให้ style ตรงกัน — .hd-tabrow เป็นแค่ wrapper แถว (เหมือน .pm-tabrow) ส่วน look ของ
   ปุ่มมาจาก .ops-tab ใน dashboard-page.css (โหลดอยู่แล้วในหน้านี้) ── */
/* หัวหน้าเป็นแถบเดียวแบบหน้าอื่น (2026-10-09): ไล่สีจากพื้นแท็บ (--sc-bg) ลงเป็นสีพื้นผิว เต็มความกว้าง
   (หักระยะขอบของ .hd-content) · ติดหัวไว้ตอนเลื่อนเนื้อหา (top = -padding ของ .hd-content)
   · จอแคบ: ซ่อนไอคอน + ลดระยะก่อน (container query ข้างล่าง) ถ้ายังไม่พอค่อยขึ้นบรรทัดใหม่ — เคยลองเลื่อนข้าง
     แบบซ่อนแถบเลื่อน แท็บท้าย ๆ หายไปจากจอโดยไม่มีอะไรบอก (user 2026-10-09) */
.hd-tabrow {
    display:flex; align-items:flex-end; flex-wrap:wrap; flex-shrink:0;
    margin:-14px -18px 0; padding:6px 18px 0;
    position:sticky; top:-14px; z-index:3;
    /* จบที่สีพื้นของ shell ไม่ใช่ขาว — เนื้อหาใต้แถบใช้พื้นเดียวกับ shell แล้ว (ต้องทึบ เพราะติดหัวตอนเลื่อน) */
    background:linear-gradient(to bottom, var(--sc-bg), var(--ops-bg, #f6f7f9));
    /* เส้นฐานวาดด้วยเงาด้านใน ไม่ใช่ border: แถวนี้เลื่อนข้างได้ (overflow) ⇒ เส้นใต้แท็บวางทับ border ไม่ได้
       (โดนตัด) แต่ทับเงาด้านในได้ ⇒ แท็บที่เปิดอยู่มีเส้นเดียว ไม่ใช่เส้นดำลอยเหนือเส้นเทา */
    box-shadow:inset 0 -1px 0 var(--sc-border);
}
.hd-tabrow .ops-tab { margin-right:20px; flex-shrink:0; }
/* แท็บที่เปิดอยู่ใช้สีธีม (--sc-accent ตัวเดียวกับปุ่มหลัก ตามชุดสีที่ผู้ใช้เลือก) แทนเส้นดำ --ops-text */
.hd-tabrow .ops-tab::after { background:var(--sc-accent); height:2px; border-radius:0; }
/* ↑ ขอบเหลี่ยม: มุมโค้งบนเส้นที่บางเท่ารัศมี (3px/3px) จอวาดปลายเป็นครึ่งวงกลมเบลอ — เส้นดูไม่คม */
/* แปดแท็บพร้อมไอคอนต้องการราว 1,000px · แคบกว่านั้นตัดไอคอนและลดระยะ (ได้คืนราว 200px) ก่อนจะขึ้นบรรทัดใหม่ */
.hd-content { container-type:inline-size; }
@container (max-width: 1040px) {
    .hd-tabrow .ops-tab { margin-right:16px; }
    .hd-tabrow .ops-tab svg { display:none; }
}
.hd-tabrow .ops-tab.active { color:var(--sc-accent); }
.hd-tabrow .ops-tab svg { flex-shrink:0; }

/* ── Date bar ────────────────────────────────────────────────── */
.hd-date-bar {
    display:flex; align-items:center; gap:12px; flex-wrap:wrap;
    margin:-12px -18px 0;   /* ติดกับแถวแท็บ (หักช่อง gap ของ .hd-content) และเต็มความกว้าง */
    padding:10px 18px 0;
    /* ไม่มีเส้นใต้และไม่มีพื้นขาว (user 2026-10-09) — แถบตัวกรองอยู่บนพื้นเดียวกับเนื้อหา */
}
.hd-date-picker {
    display:flex; align-items:center; gap:6px;
    background:var(--sc-surface);   /* พื้นหน้าเป็นเทาแล้ว ⇒ ช่องวันที่เป็นขาวแบบช่องกรอก */
    border:1px solid var(--sc-border);
    border-radius:8px; padding:5px 10px;
}
.hd-date-picker input[type=date] {
    background:transparent; border:none; outline:none;
    font-size:12px; color:var(--sc-text-1); font-family:inherit;
}
.hd-date-sep { color:var(--sc-text-3); font-size:12px; }
.hd-date-clear {
    background:none; border:none; cursor:pointer;
    color:var(--sc-text-3); font-size:13px; padding:0 2px;
}
.hd-date-stamp { font-size:11px; color:var(--sc-text-3); }

/* ── Content ─────────────────────────────────────────────────── */
.hd-content {
    flex:1; overflow-y:auto;
    padding:14px 18px;
    /* ไม่ใช้พื้นขาว (user 2026-10-09) — ให้พื้นเทาของ .helpdesk-shell อยู่หลังการ์ด การ์ดขาวจึงแยกจากพื้น */
    background:transparent;
    display:flex; flex-direction:column; gap:12px;
}

/* ── Stat Row ────────────────────────────────────────────────── */
.hd-stat-row { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; }
.hd-stat-card {
    background:var(--sc-surface);
    border:1px solid var(--sc-border);
    border-radius:var(--sc-radius-lg,12px);
    padding:14px 16px;
}
.hd-stat-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.hd-stat-label { font-size:11px; color:var(--sc-text-2); font-weight:500; }
.hd-stat-badge {
    font-size:10px; font-weight:700; padding:2px 7px; border-radius:99px;
}
.hd-stat-badge-up   { background:rgba(22,163,74,.12); color:var(--ops-success, #16a34a); }
.hd-stat-badge-down { background:rgba(220,38,38,.12); color:var(--ops-danger, #dc2626); }
.hd-stat-badge-neu  { background:var(--sc-surface-2); color:var(--sc-text-3); }
.hd-stat-value { font-size:28px; font-weight:800; line-height:1.1; }
.hd-stat-sub   { font-size:10px; color:var(--sc-text-3); margin-top:4px; }
.hd-stat-blue   { border-left:3px solid var(--sc-primary); }
.hd-stat-red    { border-left:3px solid var(--sc-error,#dc2626); }
.hd-stat-green  { border-left:3px solid var(--sc-success,#16a34a); }
.hd-stat-yellow { border-left:3px solid #ca8a04; }
.hd-stat-orange { border-left:3px solid #d97706; }
.hd-stat-blue-val   { color:var(--sc-primary); }
.hd-stat-red-val    { color:var(--sc-error,#dc2626); }
.hd-stat-green-val  { color:var(--sc-success,#16a34a); }
.hd-stat-yellow-val { color:var(--ops-warning, #ca8a04); }
.hd-stat-orange-val { color:var(--ops-warning, #d97706); }

/* ── Mid Row ─────────────────────────────────────────────────── */
.hd-mid-row {
    display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px;
}
@media(max-width:900px) { .hd-mid-row { grid-template-columns:1fr 1fr; } }
@media(max-width:600px) { .hd-mid-row { grid-template-columns:1fr; } }

/* ── Cards ───────────────────────────────────────────────────── */
.hd-card {
    background:var(--sc-surface);
    border:1px solid var(--sc-border);
    border-radius:var(--sc-radius-lg,12px);
    overflow:hidden;
}
.hd-card-hdr {
    display:flex; align-items:center; gap:8px;
    padding:11px 14px;
    border-bottom:1px solid var(--sc-border);
}
.hd-card-hdr-left { display:flex; align-items:center; gap:8px; flex:1; }
.hd-card-dot      { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.hd-card-title    { font-size:12px; font-weight:700; color:var(--sc-text-1); }
.hd-card-sub      { font-size:11px; color:var(--sc-text-3); }
.hd-card-body     { padding:12px 14px; }

/* ── Status bars ─────────────────────────────────────────────── */
.hd-status-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.hd-status-dot  { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.hd-status-name { font-size:12px; color:var(--sc-text-2); min-width:100px; }
.hd-status-bar-wrap { flex:1; height:6px; background:var(--sc-surface-2); border-radius:99px; overflow:hidden; }
.hd-status-bar  { height:100%; border-radius:99px; transition:width .4s; }
.hd-status-count{ font-size:12px; font-weight:700; color:var(--sc-text-1); min-width:28px; text-align:right; }

/* ── Priority bars ───────────────────────────────────────────── */
.hd-pri-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.hd-pri-dot  { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.hd-pri-name { font-size:12px; color:var(--sc-text-2); min-width:70px; }
.hd-pri-bar-wrap { flex:1; height:18px; background:var(--sc-surface-2); border-radius:4px; overflow:hidden; position:relative; }
.hd-pri-bar-fill { height:100%; border-radius:4px; display:flex; align-items:center; padding-left:6px; min-width:24px; }
.hd-pri-bar-num  { font-size:10px; font-weight:700; }

/* ── SLA gauge ───────────────────────────────────────────────── */
.hd-sla-body       { display:flex; flex-direction:column; align-items:center; gap:10px; }
.hd-sla-gauge-wrap { position:relative; }
.hd-sla-gauge-val  {
    position:absolute; bottom:4px; left:50%; transform:translateX(-50%);
    font-size:20px; font-weight:800; color:var(--sc-primary);
}
.hd-sla-gauge-unit { font-size:13px; }
.hd-sla-label      { font-size:11px; color:var(--sc-text-2); text-align:center; }
.hd-sla-levels     { display:flex; gap:12px; }
.hd-sla-level      { text-align:center; }
.hd-sla-level-val  { font-size:14px; font-weight:800; }
.hd-sla-level-lbl  { font-size:10px; color:var(--sc-text-3); }
.hd-sla-mini-row   { display:flex; gap:8px; width:100%; }
.hd-sla-mini {
    flex:1; text-align:center; border-radius:8px; padding:8px;
}
.hd-sla-mini-val   { font-size:16px; font-weight:800; }
.hd-sla-mini-lbl   { font-size:10px; color:var(--sc-text-2); }

/* ── Category bars ───────────────────────────────────────────── */
.hd-cat-section { margin-top:10px; }
.hd-cat-sec-lbl { font-size:11px; font-weight:600; color:var(--sc-text-2); margin-bottom:6px; }
.hd-cat-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.hd-cat-dot   { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.hd-cat-name  { font-size:11px; color:var(--sc-text-2); min-width:100px; }
.hd-cat-bar-wrap { flex:1; height:5px; background:var(--sc-surface-2); border-radius:99px; overflow:hidden; }
.hd-cat-bar-fill { height:100%; border-radius:99px; }
.hd-cat-count { font-size:11px; font-weight:700; color:var(--sc-text-1); min-width:24px; text-align:right; }

/* ── Sparkline ───────────────────────────────────────────────── */
.hd-spark-wrap { background:var(--sc-surface-2); border-radius:8px; padding:8px 10px; }
.hd-spark-label { font-size:10px; color:var(--sc-text-3); margin-bottom:4px; }
.hd-spark-days { display:flex; justify-content:space-between; margin-top:4px; }
.hd-spark-days span { font-size:9px; color:var(--sc-text-3); }

/* ── Bottom Row ──────────────────────────────────────────────── */
.hd-bot-row { display:grid; grid-template-columns:2fr 1fr; gap:12px; }
@media(max-width:900px) { .hd-bot-row { grid-template-columns:1fr; } }

/* ── Ticket table ────────────────────────────────────────────── */
.hd-ticket-tbl { width:100%; border-collapse:collapse; font-size:12px; }
.hd-ticket-tbl th {
    background:var(--sc-surface-2); color:var(--sc-text-2);
    padding:7px 10px; text-align:left; font-weight:600;
    border-bottom:1px solid var(--sc-border); white-space:nowrap;
}
.hd-ticket-tbl td {
    padding:8px 10px;
    border-bottom:1px solid var(--sc-border-2,var(--sc-border));
    color:var(--sc-text-1);
}
.hd-ticket-tbl tbody tr:hover { background:var(--sc-surface-2); }
.hd-ticket-id   { font-family:var(--sc-font-mono); font-size:11px; color:var(--sc-primary); font-weight:700; white-space:nowrap; }
/* ป้ายสถานะใต้เลขใบงาน (Recent Tickets) */
.hd-ticket-status { margin-top:4px; }
.hd-ticket-subj { font-weight:600; font-size:12px; }
.hd-ticket-meta { font-size:10px; color:var(--sc-text-3); }

/* ── Badges ──────────────────────────────────────────────────── */
/* nowrap: ในตาราง Recent Tickets คอลัมน์สถานะแคบ "In progress" เคยตัดเป็นสองบรรทัดจนป้ายสูงเบี้ยว */
.hd-badge { display:inline-block; font-size:10px; font-weight:700; padding:2px 8px; border-radius:99px; white-space:nowrap; line-height:1.5; }
.hd-badge-critical { background:rgba(220,38,38,.12); color:var(--ops-danger, #dc2626); }
.hd-badge-high     { background:rgba(249,115,22,.12); color:#f97316; }
.hd-badge-medium   { background:rgba(202,138,4,.12); color:var(--ops-warning, #ca8a04); }
.hd-badge-low      { background:rgba(37,99,235,.12); color:var(--ops-accent, #2563eb); }
.hd-badge-open     { background:rgba(220,38,38,.12); color:var(--ops-danger, #dc2626); }
.hd-badge-inprog   { background:rgba(249,115,22,.12); color:#f97316; }
.hd-badge-pending  { background:rgba(139,92,246,.12); color:#7c3aed; }
.hd-badge-resolved { background:rgba(22,163,74,.12); color:var(--ops-success, #16a34a); }
.hd-badge-closed   { background:rgba(100,116,139,.12); color:var(--ops-text-2, #475569); }

/* ── Time chip ───────────────────────────────────────────────── */
.hd-chip { font-family:var(--sc-font-mono); font-size:11px; padding:2px 8px; border-radius:99px; font-weight:700; }
.hd-chip-ok   { background:rgba(22,163,74,.1); color:var(--ops-success, #16a34a); }
.hd-chip-warn { background:rgba(202,138,4,.1); color:var(--ops-warning, #ca8a04); }
.hd-chip-over { background:rgba(220,38,38,.1); color:var(--ops-danger, #dc2626); }

/* ── Assignee ────────────────────────────────────────────────── */
.hd-assignee { display:flex; align-items:center; gap:6px; }
.hd-avatar {
    width:22px; height:22px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:9px; font-weight:700; color:#fff; flex-shrink:0;
}
.hd-assignee-name { font-size:11px; color:var(--sc-text-2); }

/* ── Agent row ───────────────────────────────────────────────── */
.hd-agent-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.hd-agent-rank { font-size:12px; font-weight:800; color:var(--sc-text-3); min-width:14px; }
.hd-agent-avatar {
    width:26px; height:26px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:10px; font-weight:700; flex-shrink:0;
}
.hd-agent-info { flex:1; }
.hd-agent-name { font-size:12px; font-weight:600; color:var(--sc-text-1); }
.hd-agent-tickets { font-size:13px; font-weight:800; color:var(--sc-text-1); }

/* ── Stars ───────────────────────────────────────────────────── */
.hd-stars { display:flex; align-items:center; gap:2px; }
.hd-star-label { font-size:10px; color:var(--sc-text-2); margin-left:4px; }

/* ── Satisfaction ────────────────────────────────────────────── */
.hd-sat-header { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.hd-sat-big { font-size:36px; font-weight:900; color:var(--sc-text-1); }
.hd-sat-sub { font-size:10px; color:var(--sc-text-3); }
.hd-sat-row { display:flex; align-items:center; gap:8px; margin-bottom:5px; }
.hd-sat-num { font-size:11px; color:var(--sc-text-2); min-width:10px; }
.hd-sat-bar-wrap { flex:1; height:8px; background:var(--sc-surface-2); border-radius:99px; overflow:hidden; }
.hd-sat-bar-fill { height:100%; border-radius:99px; }
.hd-sat-pct { font-size:10px; color:var(--sc-text-3); min-width:28px; text-align:right; }

/* ── Ticket List Page ────────────────────────────────────────── */
.hd-list-page { display:flex; flex-direction:column; height:calc(100vh - var(--sc-header-h,60px)); overflow:hidden; }
/* หัวหน้ารายการใบงาน (Request/Incident/Problem/Change/Release · 2026-10-09): แถบไล่สีแบบหน้า Overview
   สองแถว — แถวบนชื่อ + จำนวน + สร้างใบงาน · แถวล่างค้นหา + มุมมอง + ปุ่มตัวกรอง · แผงตัวกรองขั้นสูงเปิดใต้แถว */
.hd-list-toolbar {
    display:flex; flex-direction:column; align-items:stretch; gap:10px;
    padding:12px 18px;
    background:linear-gradient(to bottom, var(--sc-bg), var(--sc-surface));
    border-bottom:1px solid var(--sc-border);
}
.hd-list-head { display:flex; align-items:center; gap:10px; min-height:34px; }
.hd-list-spacer { flex:1; }
.hd-list-filters { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.hd-list-searchbox { position:relative; flex:1 1 260px; max-width:440px; }
.hd-list-searchbox > svg { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--sc-text-3); pointer-events:none; }
.hd-list-searchbox .hd-list-search { width:100%; padding-left:31px; background:var(--sc-surface); }
.hd-list-filter-btn.on { border-color:var(--sc-accent); color:var(--sc-accent); background:color-mix(in srgb, var(--sc-accent) 8%, var(--sc-surface)); }
.hd-list-filter-count {
    display:inline-flex; align-items:center; justify-content:center; min-width:16px; height:16px; padding:0 5px;
    border-radius:99px; background:var(--sc-accent); color:#fff; font-size:10px; font-weight:700;
}
.hd-list-btn-link { background:none; color:var(--sc-text-2); padding:0 6px; }
.hd-list-btn-link:hover { color:var(--sc-accent); text-decoration:underline; }
.hd-list-adv {
    display:flex; align-items:center; gap:18px; flex-wrap:wrap;
    padding:10px 12px; background:var(--sc-surface);
    border:1px solid var(--sc-border); border-radius:8px;
}
.hd-list-adv label { margin:0; }
.hd-list-adv-field { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:600; color:var(--sc-text-2); }
.hd-list-title { font-size:15px; font-weight:700; color:var(--sc-text-1); }
.hd-list-search {
    height:34px; padding:0 12px;
    background:var(--sc-surface-2);
    border:1px solid var(--sc-border); border-radius:6px;
    font-size:12px; color:var(--sc-text-1); outline:none; width:200px;
}
.hd-list-search:focus { border-color:var(--sc-primary); background:var(--sc-surface); }
.hd-list-select {
    background:var(--sc-surface); color:var(--sc-text-1);
    border:1px solid var(--sc-border); border-radius:6px;
    font-size:12px; padding:0 10px; height:34px; outline:none;
}
.hd-list-btn {
    height:34px; padding:0 14px; border-radius:6px;
    border:none; font-size:12px; font-weight:600; cursor:pointer;
    display:flex; align-items:center; gap:6px; white-space:nowrap;
}
.hd-list-btn-primary  { background:var(--sc-primary); color:#fff; }
.hd-list-btn-danger   { background:var(--sc-error,#dc2626); color:#fff; }
.hd-list-btn-ghost    { background:var(--sc-surface-2); color:var(--sc-text-2); border:1px solid var(--sc-border); }
.hd-list-btn-ghost:hover { background:var(--sc-border); color:var(--sc-text-1); }
/* empty-state CTA ในตาราง: td[colspan] มีแค่แถว empty-state — ทำปุ่มเป็น inline-flex เพื่อให้ text-align:center
   ของ cell จัดกึ่งกลางได้ (ปกติ .hd-list-btn เป็น display:flex=block เลยชิดซ้าย). ไม่กระทบปุ่ม toolbar/action. */
td[colspan] .hd-list-btn { display:inline-flex; }
/* พื้น body ของ list เป็นขาว (var(--sc-surface)) แทนที่จะปล่อยโปร่งใสโชว์เทา #f6f7f9 ของ .helpdesk-shell
   ทะลุมา = ตารางดูหม่น. เฉพาะ list เท่านั้น ไม่แตะ shell ของหน้าอื่น. */
.hd-list-body { flex:1; overflow-y:auto; padding:0; background:var(--sc-surface); }
.hd-list-footer {
    padding:10px 18px;
    background:var(--sc-surface);
    border-top:1px solid var(--sc-border);
    display:flex; align-items:center; justify-content:space-between;
    font-size:12px; color:var(--sc-text-2);
}

/* ── Ticket table (list page) ────────────────────────────────── */
.hd-list-tbl { width:100%; border-collapse:collapse; font-size:12px; }
.hd-list-tbl th {
    /* โทนเดียวกับตาราง Contract (.csp-table shell): header เทาอมฟ้าอ่อน */
    background:var(--ops-surface-2, #f7f8fa); color:var(--ops-muted, #6b7384);
    padding:11px 14px; text-align:left; font-weight:600; font-size:12px;
    border-bottom:1px solid var(--ops-border, #e6e8ec); white-space:nowrap;
    position:sticky; top:0; z-index:10;
}
.hd-list-tbl td {
    padding:11px 14px;
    border-bottom:1px solid var(--ops-border, #e6e8ec);
    color:var(--sc-text-1); vertical-align:middle;
}
.hd-list-tbl tbody tr { cursor:pointer; }
/* สไตล์เดียวกับตาราง Contract (.csp-table): body ขาวสะอาด ไม่มี zebra, hover เทาอ่อน */
.hd-list-tbl tbody tr:not(.hd-row-overdue):hover td { background:var(--ops-surface-2, #f7f8fa); }
/* nowrap: เลขใบงานอยู่บรรทัดเดียวเต็มคอลัมน์ — คอลัมน์ตั้งไว้ 110px เลข "SWR-2610-0001" เลยตัดเป็นสองบรรทัด
   (ตารางจัดคอลัมน์แบบ auto คอลัมน์จึงขยายตามเลขเอง) ใช้กับทุกรายการ: Request/Incident/Problem/Change/Release */
.hd-ticket-link { color:var(--sc-primary); font-weight:600; text-decoration:none; font-family:var(--sc-font-mono); white-space:nowrap; }
.hd-ticket-link:hover { text-decoration:underline; }
.hd-overdue-badge {
    display:inline-block; font-size:9px; font-weight:700;
    padding:1px 5px; border-radius:99px;
    background:rgba(202,138,4,.12); color:var(--ops-warning, #ca8a04); margin-left:4px;
}

/* ── Page buttons ────────────────────────────────────────────── */
.hd-page-btns { display:flex; gap:4px; }
.hd-page-btn {
    height:30px; padding:0 10px; border-radius:6px;
    border:1px solid var(--sc-border); background:var(--sc-surface);
    font-size:12px; color:var(--sc-text-2); cursor:pointer;
}
.hd-page-btn:disabled { opacity:.4; cursor:not-allowed; }
.hd-page-btn.active { background:var(--sc-primary); color:#fff; border-color:var(--sc-primary); }

/* ── Skel ────────────────────────────────────────────────────── */
.hd-skel {
    background:linear-gradient(90deg,var(--sc-surface-2) 25%,var(--sc-border) 50%,var(--sc-surface-2) 75%);
    background-size:200% 100%;
    animation:hd-shimmer 1.4s infinite;
    border-radius:4px;
}
@keyframes hd-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── TechGroup cards ─────────────────────────────────────────── */
/* auto-fit: ไทล์ "มอบหมายแต่ไม่มีคนรับ" ขึ้นเป็นไทล์ที่ 5 เฉพาะเมื่อมีจริง — repeat(4) ทำให้มันตกไปอยู่แถวใหม่คนเดียว */
.hd-tg-kpi-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:10px; margin-bottom:14px; }
.hd-tg-kpi {
    border-radius:var(--sc-radius-lg,12px); padding:14px 16px;
    border:1px solid var(--sc-border); background:var(--sc-surface);
}
.hd-tg-kpi-tag { font-size:10px; color:var(--sc-text-3); font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }
.hd-tg-kpi-num { font-size:28px; font-weight:900; color:var(--sc-text-1); margin:4px 0; }
.hd-tg-kpi-sub { font-size:10px; color:var(--sc-text-3); }
.hd-tg-kpi-bar { height:3px; border-radius:99px; margin-top:10px; opacity:.5; }
.hd-tg-blue  { border-left:3px solid var(--sc-primary); }   .hd-tg-blue  .hd-tg-kpi-bar { background:var(--sc-primary); }
.hd-tg-green { border-left:3px solid var(--sc-success); }   .hd-tg-green .hd-tg-kpi-bar { background:var(--sc-success); }
.hd-tg-amber { border-left:3px solid #d97706; }             .hd-tg-amber .hd-tg-kpi-bar { background:#d97706; }
.hd-tg-red   { border-left:3px solid var(--sc-error); }     .hd-tg-red   .hd-tg-kpi-bar { background:var(--sc-error); }

.hd-tg-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:12px; }
.hd-tg-card {
    background:var(--sc-surface); border:1px solid var(--sc-border);
    border-radius:var(--sc-radius-lg,12px); overflow:hidden;
}
.hd-tg-hdr {
    display:flex; align-items:center; gap:8px;
    padding:10px 14px;
    border-bottom:1px solid var(--sc-border);
}
.hd-tg-hdr-icon {
    width:28px; height:28px; border-radius:8px;
    background:rgba(37,99,235,.1); display:flex; align-items:center; justify-content:center;
}
.hd-tg-hdr-title { font-size:13px; font-weight:700; color:var(--sc-text-1); flex:1; }
.hd-tg-badge {
    font-size:9px; font-weight:700; padding:2px 7px; border-radius:99px;
    background:rgba(37,99,235,.1); color:var(--sc-primary);
}
.hd-tg-img-badge { width:28px; height:28px; border-radius:6px; object-fit:cover; }
/* รูปของกลุ่มวางทับไอคอน — รูปที่ไฟล์หายถูกซ่อน (onerror) เหลือไอคอนแทนภาพแตก */
.hd-tg-avatar { position:relative; width:28px; height:28px; flex-shrink:0; }
.hd-tg-avatar .hd-tg-img-badge { position:absolute; inset:0; background:var(--sc-surface); }
.hd-tg-body { padding:12px 14px; }

/* ── TechGroup type tabs (TicketList toolbar) ─────────────────── */
.hd-tg-tab-row { display:flex; gap:4px; }
.hd-tg-tab {
    height:30px; padding:0 12px; border-radius:6px;
    border:1px solid var(--sc-border); background:var(--sc-surface-2);
    font-size:11px; font-weight:600; color:var(--sc-text-2); cursor:pointer;
}
.hd-tg-tab.active { background:var(--sc-primary); color:#fff; border-color:var(--sc-primary); }
.hd-tg-tab:hover:not(.active) { background:var(--sc-border); color:var(--sc-text-1); }

/* ── TicketList extras ────────────────────────────────────────── */
.hd-list-badge {
    display:inline-block; font-size:10px; font-weight:700; padding:2px 8px; border-radius:99px;
    background:rgba(37,99,235,.1); color:var(--sc-primary);
}
.hd-list-sel-bar {
    display:flex; align-items:center; gap:8px;
    padding:6px 18px;
    background:rgba(37,99,235,.06);
    border-bottom:1px solid var(--sc-border);
    font-size:12px; color:var(--sc-text-2);
}
.hd-tbl-wrap { height:100%; overflow-x:auto; }
.hd-row-overdue td { background:rgba(220,38,38,.04); }
.hd-row-overdue:hover td { background:rgba(220,38,38,.08) !important; }
.hd-dot-warn {
    display:inline-flex; align-items:center; justify-content:center;
    width:16px; height:16px; border-radius:50%;
    background:var(--ops-warning-soft, #fef3c7); color:var(--ops-warning, #d97706); font-size:10px; font-weight:800;
}
.hd-dot-info {
    display:inline-flex; align-items:center; justify-content:center;
    width:16px; height:16px; border-radius:50%;
    background:var(--ops-accent-soft, #dbeafe); color:var(--ops-accent, #2563eb); font-size:10px; font-weight:800;
}
/* ป้าย ! (เกินกำหนด / ตอบช้า) อยู่ใต้เลขใบงาน ไม่ใช่ข้างเลข (user 2026-10-09) — ข้างเลขมันแย่งความกว้าง
   จนป้ายถูกบีบเหลือ 9px เป็นวงรี · เซลล์เลขใบงานทุกหน้ารายการ (Request/Incident/Problem/Change/Release)
   เป็น div flex แถวเดียว: ให้ขึ้นบรรทัดได้ แล้วให้ลิงก์เลขกินเต็มแถว ป้ายจึงลงบรรทัดถัดไป */
.csp-table td.primary > div:has(> .hd-ticket-link) { flex-wrap:wrap; row-gap:3px; }
.csp-table td.primary > div > .hd-ticket-link { flex:0 0 100%; }
.hd-dot-warn, .hd-dot-info { flex-shrink:0; line-height:1; }
/* ทั้งสองป้ายเป็นนาฬิกาจับเวลา (user 2026-10-09 — ลองนาฬิกาทรายก่อน แล้วขอเปลี่ยน) แทนเครื่องหมาย ! แยกกันด้วยสี:
   ฟ้า = ตอบรับเกินเวลา (Over Response) ขึ้นก่อน · เหลือง = แก้ไขเกินกำหนด (overdue) ตามลำดับของ SLA · วาดด้วย mask จึงเปลี่ยนทุกหน้ารายการพร้อมกัน
   โดยไม่แตะ markup ทั้งห้าหน้า · "!" ยังอยู่ในเนื้อ (ขนาด 0) ให้โปรแกรมอ่านจอ ส่วน title บอกความหมายเหมือนเดิม */
.hd-dot-warn, .hd-dot-info { font-size:0; }
.hd-dot-info { order:1; }   /* ลิงก์เลขใบงาน order 0 อยู่บรรทัดบน */
.hd-dot-warn { order:2; }
.hd-dot-warn::before, .hd-dot-info::before {
    content:""; width:11px; height:11px; background:currentColor;
    -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 2h4M12 14l3-3'/%3E%3Ccircle cx='12' cy='14' r='8'/%3E%3C/svg%3E") center / contain no-repeat;
            mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 2h4M12 14l3-3'/%3E%3Ccircle cx='12' cy='14' r='8'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hd-cell-subject { font-size:12px; color:var(--sc-text-1); font-weight:500; }
.hd-cell-muted   { font-size:11px; color:var(--sc-text-2); }
.hd-tech-chip {
    display:inline-block; font-size:10px; padding:1px 7px; border-radius:99px;
    margin:1px 2px 1px 0;
}
.hd-tech-main { background:rgba(37,99,235,.12); color:var(--sc-primary); font-weight:700; }
.hd-tech-sub  { background:var(--sc-surface-2); color:var(--sc-text-3); }
.hd-list-btn-danger-ghost {
    height:34px; padding:0 10px; border-radius:6px;
    border:1px solid rgba(220,38,38,.3); background:rgba(220,38,38,.06);
    color:var(--sc-error,#dc2626); font-size:12px; cursor:pointer;
    display:flex; align-items:center;
}
.hd-list-btn-danger-ghost:hover { background:rgba(220,38,38,.12); }

/* ── Column visibility dropdown ───────────────────────────────── */
.hd-col-menu {
    position:absolute; top:calc(100% + 4px); right:0; z-index:200;
    background:var(--sc-surface); border:1px solid var(--sc-border);
    border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.15);
    padding:6px 0; min-width:160px;
}
.hd-col-item {
    display:flex; align-items:center; gap:8px;
    padding:6px 14px; font-size:12px; color:var(--sc-text-1);
    cursor:pointer; user-select:none;
}
.hd-col-item:hover { background:var(--sc-surface-2); }
.hd-col-item input[type=checkbox] { accent-color:var(--sc-primary); }

/* ── Sub-wrap ─────────────────────────────────────────────────── */
.hd-sub-wrap { padding:12px 0; }

/* ── แถบ KPI ของหน้า Overview แบบกะทัดรัด (user 2026-10-09 "มันใหญ่ไปหน่อย") ──────────
   คอมโพเนนต์ OpsKpiStrip ใช้ร่วมกับ Dashboard หลัก/อุปกรณ์/แพตช์ ⇒ ย่อเฉพาะในหน้า ITSM:
   ไอคอนอยู่ซ้าย ชื่อ-ตัวเลข-คำอธิบายเรียงขวา แทนไอคอนแถวบนแล้วตัวเลขข้างล่าง (การ์ดเตี้ยลงราวครึ่ง) */
.hd-content .ops-kpi-strip { gap:12px; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); }
.hd-content .ops-kpi {
    display:grid; grid-template-columns:auto minmax(0,1fr); column-gap:12px; align-items:center;
    padding:12px 14px;
}
.hd-content .ops-kpi-top { grid-row:1 / span 3; min-height:0; align-self:center; }
.hd-content .ops-kpi-ico { width:36px; height:36px; }
.hd-content .ops-kpi-ico svg { width:18px; height:18px; }
.hd-content .ops-kpi-label { grid-column:2; margin-top:0; font-size:12px; }
.hd-content .ops-kpi-vals { grid-column:2; margin-top:0; }
.hd-content .ops-kpi-val { font-size:22px; line-height:1.2; }
.hd-content .ops-kpi-sub { grid-column:2; margin-top:1px; font-size:11px; line-height:1.35; }

/* ── แท็บรายงานแบบตาราง (หมวด / SLA / แบบสอบถาม) ──────────────────────
   ตารางอยู่ในการ์ดแบบเดียวกับแท็บ Overview · หัวการ์ดบอกว่าแท็บนี้ดูอะไร เพราะ Average / Summary
   ใช้คอลัมน์ชุดเดียวกัน · คอลัมน์ใบงานมีแท่งเทียบกับหมวดที่มากที่สุด */
.hd-rep-card .hd-card-hdr { align-items:flex-start; }
.hd-rep-card .hd-card-hdr-left { flex-direction:column; align-items:flex-start; gap:2px; }
.hd-rep-card .hd-card-title { font-size:13px; }
.hd-rep-card .hd-rep-count { font-size:11px; color:var(--sc-text-3); white-space:nowrap; padding-top:2px; }
.hd-rep-card .csp-table { margin:0; }
.hd-rep-card .csp-table th:first-child, .hd-rep-card .csp-table td:first-child { padding-left:14px; }
.hd-rep-card .csp-table th:last-child, .hd-rep-card .csp-table td:last-child { padding-right:14px; }
.hd-rep-num { display:inline-flex; align-items:center; justify-content:flex-end; gap:8px; width:100%; }
.hd-rep-bar { width:72px; height:6px; border-radius:99px; background:var(--sc-surface-2); overflow:hidden; flex-shrink:0; }
.hd-rep-bar > i { display:block; height:100%; border-radius:99px; background:var(--sc-primary); }
/* .csp-table td ตั้งสีตัวอักษรไว้ (0,1,1) ⇒ ต้องเจาะจงกว่านั้น ไม่งั้นผ่าน/ไม่ผ่านเป็นสีดำทั้งคู่ */
.hd-rep-card .csp-table td.hd-rep-pass { color:var(--sc-success, #16a34a); }
.hd-rep-card .csp-table td.hd-rep-fail { color:var(--sc-error, #dc2626); }
.hd-rep-card .csp-table td.hd-rep-none { color:var(--sc-text-3); }

/* ── Keyframes ────────────────────────────────────────────────── */
@keyframes hd-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Embedded mode (rendered as a tab inside the main Dashboard) ── */
.hd-page.embedded { height: auto; overflow: visible; padding: 0; }
.hd-page.embedded .hd-layout { height: auto; border: none; border-radius: 0; overflow: visible; gap: 14px; background: transparent; }
.hd-page.embedded .hd-content { background: transparent; padding: 0; overflow: visible; }
/* ฝังในหน้าอื่น: ไม่มีระยะขอบให้หัก และหน้าแม่มีหัวของตัวเองอยู่แล้ว ⇒ แถวแท็บ/ตัวกรองกลับเป็นแถวธรรมดา */
.hd-page.embedded .hd-tabrow { margin:0; padding:0; position:static; background:none; }
.hd-page.embedded .hd-date-bar { margin:0; padding:10px 0; }

/* ── ตัวเรนเดอร์ผังฟอร์ม (Components/Form/DynamicFormCom.razor) ─────────────────────────
   มาร์กอัปถูกสร้างด้วย RenderTreeBuilder จึงใช้ scoped CSS (.razor.css) ไม่ได้ — element ที่
   สร้างแบบนั้นไม่ได้รับแอตทริบิวต์ b-xxxx ของ Blazor · และผูกไว้ในบล็อก <style> ของหน้าใดหน้าหนึ่ง
   ก็ไม่ได้ เพราะหน้าอื่นที่เรียกคอมโพเนนต์เดียวกันจะได้กริดที่ไม่มีกฎ: DOM ถูกต้องทุกอย่าง
   --ct-cols ก็มี แต่หน้าจอเรียงลงมาเป็นแถวเดียว และการตรวจ DOM มองไม่เห็นความต่างนี้เลย
   (ของจริง 2026-09-14: กล่องกดปุ่มเดินขั้นในหน้ารายละเอียดใบงาน)
   ⇒ กฎต้องอยู่ในไฟล์ที่ _Host.cshtml โหลดทุกหน้า ซึ่งคือไฟล์นี้
   --ct-cols ตั้งจากคอมโพเนนต์ต่อหนึ่งกล่อง · จอแคบ auto-stack เป็น 1 คอลัมน์ (ห้าม body scroll แนวนอน) */
.ct-grid { display:grid; grid-template-columns:repeat(var(--ct-cols,1), minmax(0,1fr)); gap:14px; align-items:start; }
.ct-grid + .ct-grid { margin-top:14px; }
.ct-grid-col { display:flex; flex-direction:column; gap:14px; min-width:0; }

/* "label" ในผัง = ข้อความล้วน ไม่ใช่ช่องกรอก จึงไม่ต้องมีกรอบ/ระยะแบบฟิลด์จริง */
.csp-form-group-label-only { font-weight:600; margin:4px 0; }

@media (max-width: 720px) {
    .ct-grid { grid-template-columns:1fr !important; }
}

/* ── ป้ายชื่อบริการบนสุดของฟอร์มเปิดเรื่อง (CreateTicket) ──
   ขึ้นเฉพาะเมื่อแถบหัวถูกปิด (ShowHeader=false · ตอนนี้คือพอร์ทัลผู้แจ้ง) เพื่อแทนชื่อบริการที่
   เคยต่อท้ายแถบหัว · ใช้กรอบ/รัศมี/ระยะเดียวกับ .csp-section ให้เรียงเป็นแนวเดียวกับการ์ดข้างล่าง
   แต่เตี้ยกว่า เพราะเป็นป้ายบอก ไม่ใช่ส่วนให้กรอก */
.ct-svc-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    background: var(--sc-surface);
    border: 1px solid var(--sc-border);
    border-left: 3px solid var(--sc-primary);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 14px;
}
.ct-svc-label-k {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sc-text-3);
}
.ct-svc-label-v {
    font-size: 15px;
    font-weight: 650;
    color: var(--sc-text);
}
/* คำอธิบายบริการขึ้นบรรทัดใหม่เสมอ — ยาวแค่ไหนก็ได้เพราะผู้ดูแลเขียนเอง */
.ct-svc-label-d {
    flex-basis: 100%;
    font-size: 12px;
    color: var(--sc-text-3);
    line-height: 1.5;
}

/* ── ความพึงพอใจรายช่าง (TechnicianSatisfactionCard) ─────────────────── */
.hd-csat-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "meta meta";
    gap: 2px 8px; padding: 7px 4px; border-bottom: 1px solid var(--sc-border); font-size: 12px;
}
.hd-csat-click { cursor: pointer; }
.hd-csat-click:hover { background: var(--sc-surface-2); }
.hd-csat-name { grid-area: name; font-weight: 600; color: var(--sc-text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-csat-score { grid-area: score; }
.hd-csat-avg { font-weight: 700; color: #d97706; }
.hd-csat-thin { opacity: .45; }
.hd-csat-meta { grid-area: meta; color: var(--sc-text-3); font-size: 11px; }
.hd-csat-low { color: var(--sc-error, #ef4444); }
.hd-csat-comments { margin: 4px 0 6px 12px; padding-left: 12px; font-size: 11.5px; color: var(--sc-text-2); }
.hd-csat-comments li { margin: 2px 0; }
.hd-csat-note { margin-top: 6px; font-size: 11px; color: var(--sc-text-3); }

/* ── คะแนนเบื้องหลังตัวเลขตอบกลับ (แท็บแบบสำรวจ) ─────────────────── */
.hd-link-btn { background: none; border: none; padding: 0; color: var(--sc-primary, #2563eb); cursor: pointer; font: inherit; text-decoration: underline dotted; }
.hd-link-btn:hover { text-decoration: underline; }
.hd-survey-list { background: var(--sc-surface-2); padding: 8px 12px !important; }
.hd-survey-item { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12px; padding: 3px 0; }
.hd-survey-star { color: #d97706; min-width: 28px; }
.hd-survey-no { font-family: var(--sc-mono, monospace); color: var(--sc-text-2); }

/* ── รายละเอียดใบงานที่ผู้ช่วยไอทีเขียน (TicketDescriptionText) — หน้าช่าง .td-desc และพอร์ทัล .pt-desc ──
   ทั้งสองกล่องเป็น pre-wrap · ที่นี่กลับเป็น normal เพราะแต่ละบรรทัดเป็น element ของมันเองแล้ว */
.desc-tx { display: flex; flex-direction: column; gap: 14px; white-space: normal; }
.desc-tx p { margin: 0; }
.desc-tx-hd { font-size: 12px; font-weight: 600; color: var(--sc-text-3); margin-bottom: 5px; }
.desc-tx-say {
    padding: 7px 12px; border-left: 3px solid color-mix(in srgb, var(--sc-primary) 45%, transparent);
    background: color-mix(in srgb, var(--sc-primary) 5%, transparent); border-radius: 0 8px 8px 0;
    font-weight: 500; color: var(--sc-text-1);
}
.desc-tx ul { margin: 0; padding-left: 20px; }
.desc-tx li { margin: 3px 0; }
.desc-tx li::marker { color: var(--sc-text-3); }
.desc-tx .desc-tx-note { margin-top: 4px; font-size: 12px; color: var(--sc-text-3); }
