/* MIDU OS v3: màn /kenh (Kênh Xưởng). Tiền tố kx-. Thêm .da-kenh cho dòng tóm tắt kênh trên thẻ dự án (/du-an).
 * Chỉ dùng token sẵn có (--accent --good --warn --crit --hair --fill --text-2 --text-3), sáng tối tự theo. */

.kx-trang { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.kx-trang > * { min-width: 0; }
.kx-quay { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.kx-quay .ic, .kx-quay svg { width: 14px; height: 14px; }

/* dải trạng thái */
.kx-dai { padding: 10px 14px; }
.kx-dai-hang { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.kx-dai-ten { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.kx-dai-ten svg { width: 16px; height: 16px; color: var(--accent); }
.kx-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.kx-dai-ghi { margin-top: 6px; }

/* lưới thẻ */
.kx-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.kx-luoi-tk { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.kx-the { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.kx-the:hover { text-decoration: none; box-shadow: 0 0 0 1px var(--accent), var(--sh-1); }
.kx-the-dau { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kx-the-ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--fill); color: var(--accent); }
.kx-the-ic svg { width: 18px; height: 18px; }
.kx-the-ten { min-width: 0; }
.kx-the-ten h2 { font-size: var(--fs-lg); line-height: 1.25; font-weight: 650; overflow-wrap: anywhere; }
.kx-nen { min-height: 24px; }
.kx-so { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.kx-so > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kx-so b { font-size: var(--fs-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.kx-so span { font-size: var(--fs-xs); color: var(--text-3); }
.kx-so .crit b { color: var(--crit); }
.kx-so-4 { grid-template-columns: repeat(4, 1fr); }

/* cảnh báo canh gác */
.kx-canh-khoi { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; }
.kx-canh { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); line-height: 1.4; padding: 7px 10px; border-radius: var(--r); }
.kx-canh svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.kx-canh-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); }
.kx-canh-warn svg { color: var(--warn); }
.kx-canh-crit { background: color-mix(in srgb, var(--crit) 12%, transparent); color: var(--text); }
.kx-canh-crit svg { color: var(--crit); }
.kx-canh em { font-style: normal; }

/* tab */
.kx-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.kx-tabs .tab { white-space: nowrap; flex: none; }
.kx-nt { margin-bottom: 4px; }
.kx-tab-nd { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.kx-tab-nd > * { min-width: 0; }
.kx-dau-tab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kx-ghi-chu { padding: 0 4px; }
.kx-hai-cot { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.kx-cot { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* danh sách mô tả */
.kx-dls { display: flex; flex-direction: column; margin: 0; }
.kx-dl { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 4px 14px; padding: 9px 0; border-bottom: 1px solid var(--hair); }
.kx-dl:last-child { border-bottom: 0; }
.kx-dl dt { color: var(--text-3); font-size: var(--fs-sm); }
.kx-dl dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.kx-dls-nho .kx-dl { padding: 6px 0; grid-template-columns: minmax(90px, 120px) minmax(0, 1fr); font-size: var(--fs-sm); }
.kx-host { display: flex; align-items: center; gap: 10px; }

/* trụ nội dung và thanh */
.kx-tru { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kx-tru-o { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: var(--r); min-width: 0; }
.kx-cham { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.kx-bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.kx-bar i { display: block; height: 100%; border-radius: 3px; }

/* bảng: nút cuối dòng */
.kx-nut-cot { white-space: nowrap; text-align: right; }
.kx-nut-cot .btn { margin-left: 4px; }
.clickable { cursor: pointer; }
.clickable:hover td { background: var(--fill); }

/* tài khoản, số đo */
.kx-tk { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.kx-tk-nen { font-size: var(--fs-md); }
.kx-tk-ten { font-size: var(--fs-md); font-weight: 600; overflow-wrap: anywhere; }
.kx-tk-noi { min-height: 4px; }
.kx-hh.crit { color: var(--crit); font-weight: 600; font-size: var(--fs-sm); }
.kx-hh.warn { color: var(--warn); font-weight: 600; font-size: var(--fs-sm); }
.kx-sd { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.kx-bieu { height: 56px; color: var(--accent); }
.kx-bieu svg, .kx-bieu-cot svg { display: block; width: 100%; max-width: 100%; }
.kx-bieu-cot { min-height: 70px; }
.kx-bieu-nhan { margin-top: -4px; }

/* lọc */
.kx-loc { display: inline-flex; align-items: center; gap: 8px; }
.kx-loc .input { width: auto; min-width: 140px; }

/* luật, bài đăng */
.kx-luat { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.kx-luat p { margin: 0; font-size: var(--fs-md); line-height: 1.5; }
.kx-luat-ma { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: var(--fs-sm); }
.kx-caption { white-space: pre-wrap; padding: 10px 12px; border-radius: var(--r); background: var(--fill); font-size: var(--fs-md); line-height: 1.5; overflow-wrap: anywhere; max-height: 200px; overflow: auto; }
.kx-kiem { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kx-kiem li { display: flex; gap: 10px; align-items: flex-start; }
.kx-kiem li > div { min-width: 0; overflow-wrap: anywhere; }

/* hộp xác nhận */
.kx-hop { gap: 12px; }
.kx-mo-ta { margin: 0; line-height: 1.5; }
.kx-f { display: flex; flex-direction: column; gap: 4px; }
.kx-lenh { overflow-wrap: anywhere; }
.kx-hop-loi:empty { display: none; }
.kx-hop-loi-nd { padding: 9px 12px; border-radius: var(--r); background: color-mix(in srgb, var(--crit) 12%, transparent); color: var(--text); font-size: var(--fs-sm); line-height: 1.4; }
.kx-tich { gap: 8px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.kx-tich input { margin-top: 3px; flex: none; }

/* lỗi mô đun */
.kx-loi { padding: 28px 16px; }
.kx-loi-nd { max-width: 520px; margin: 4px auto 0; line-height: 1.5; }
.kx-loi-nut { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* dòng tóm tắt kênh trên thẻ dự án */
.da-kenh { gap: 10px; flex-wrap: wrap; padding: 8px 10px; margin: 8px 0; border-radius: var(--r); background: var(--fill); }
.da-kenh-tt { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; flex: 1 1 200px; }
.da-kenh-tt svg { flex: none; width: 15px; height: 15px; color: var(--accent); }
.da-kenh-tt b { overflow-wrap: anywhere; }

/* điện thoại */
@media (max-width: 760px) {
  .kx-hai-cot { grid-template-columns: minmax(0, 1fr); }
  .kx-luoi, .kx-luoi-tk { grid-template-columns: minmax(0, 1fr); }
  .kx-so-4 { grid-template-columns: repeat(2, 1fr); }
  .kx-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kx-dls-nho .kx-dl { grid-template-columns: minmax(0, 1fr); }
  .kx-tru { grid-template-columns: minmax(0, 1fr); }
  .kx-loc .input { min-width: 0; }
  /* bảng thành thẻ xếp dọc, không cuộn ngang */
  .kx-tab-nd .table-wrap { overflow: visible; }
  .kx-tab-nd .table, .kx-tab-nd .table tbody, .kx-tab-nd .table tr, .kx-tab-nd .table td { display: block; width: 100%; }
  .kx-tab-nd .table thead { display: none; }
  .kx-tab-nd .table tr { padding: 10px 0; border-bottom: 1px solid var(--hair); }
  .kx-tab-nd .table td { border: 0; padding: 2px 0; text-align: left; }
  .kx-tab-nd .table td.num { text-align: left; }
  .kx-tab-nd .table td[data-nhan]::before { content: attr(data-nhan) ": "; color: var(--text-3); font-size: var(--fs-xs); }
  .kx-nut-cot { text-align: left; padding-top: 6px !important; }
  .kx-nut-cot .btn { margin: 0 6px 0 0; }
}

.kx-tab-nd .li-sub { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.kx-tru-o .hang { justify-content: flex-start; gap: 8px; }

/* vòng tròn trang trí của .pk phủ góc phải trên và nuốt cú bấm vào nút ở đó */
.kx-trang .section-title .right { position: relative; z-index: 1; margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.da-kenh .btn { position: relative; z-index: 1; }
