/* Fleet Hub: bảng điều khiển vận hành. Phẳng, nhiều dữ liệu, một màu nhấn.
   Token chép từ bộ token của skill ui-ux (sáng + tối). Màu chỉ khai ở ba khối đầu file.
   Không CDN, không font ngoài: dùng font hệ thống, số luôn tabular. */

:root {
  color-scheme: light;
  --app-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono-font: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --primary: #181818;
  --primary-hover: #2e2e2e;
  --primary-foreground: #ffffff;
  --background: #f4f4f6;
  --surface: #ffffff;
  --foreground: #2c2c2c;
  --muted: #707070;
  --border: #ececee;
  --border-strong: #e0e0e4;
  --tab-rail: color-mix(in srgb, var(--foreground) 10%, transparent);
  --surface-overlay: #ffffff;
  --elevation-popover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --elevation-modal: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --item-hover: #f4f4f6;
  --secondary: #e7e8ec;
  --secondary-hover: #dbdce2;
  --surface-hover: #f8f8fa;
  --button-hover: #f1f1f3;
  --focus: #2563eb;
  --scrim: rgb(20 20 24 / 0.38);

  --danger: #c70036;
  --danger-bg: rgb(255 32 86 / 0.1);
  --error: #fb2c36;
  --error-text: #e7000b;
  --error-bg: #fef2f2;
  --error-border: #ffc9c9;
  --error-strong: #c10007;
  --success-bg: #ecfdf5;
  --success: #007a55;
  --warning-bg: #fffbeb;
  --warning: #bb4d00;
  --neutral-bg: #f4f4f5;
  --neutral: #52525c;

  --chart-line: #3f3f46;
  --chart-fill: rgb(63 63 70 / 0.08);
  --chart-grid: rgb(0 0 0 / 0.07);

  --radius: 12px;
  --rail-w: 15rem;
  --header-h: 4rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #e9edf5;
  --primary-hover: #cfd5e0;
  --primary-foreground: #05060f;
  --background: #05060f;
  --surface: #0f111a;
  --foreground: #e9edf5;
  --muted: #8b93a7;
  --border: rgba(160, 180, 220, 0.12);
  --border-strong: rgba(160, 180, 220, 0.18);
  --surface-overlay: #171a26;
  --elevation-popover: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --elevation-modal: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);
  --item-hover: rgb(255 255 255 / 0.05);
  --secondary: rgb(255 255 255 / 0.08);
  --secondary-hover: rgb(255 255 255 / 0.13);
  --surface-hover: #141722;
  --button-hover: rgb(255 255 255 / 0.08);
  --focus: #7aa2ff;
  --scrim: rgb(0 0 0 / 0.6);
  --danger: #ff637e;
  --danger-bg: rgb(255 32 86 / 0.12);
  --error: #fb2c36;
  --error-text: #ff6467;
  --error-bg: rgb(251 44 54 / 0.1);
  --error-border: rgb(251 44 54 / 0.3);
  --error-strong: #ff6467;
  --success-bg: rgb(0 188 125 / 0.15);
  --success: #00d492;
  --warning-bg: rgb(254 154 0 / 0.15);
  --warning: #ff8904;
  --neutral-bg: rgb(113 113 123 / 0.15);
  --neutral: #9f9fa9;
  --chart-line: #c8cfdd;
  --chart-fill: rgb(200 207 221 / 0.1);
  --chart-grid: rgb(255 255 255 / 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #e9edf5;
    --primary-hover: #cfd5e0;
    --primary-foreground: #05060f;
    --background: #05060f;
    --surface: #0f111a;
    --foreground: #e9edf5;
    --muted: #8b93a7;
    --border: rgba(160, 180, 220, 0.12);
    --border-strong: rgba(160, 180, 220, 0.18);
    --surface-overlay: #171a26;
    --elevation-popover: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --elevation-modal: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);
    --item-hover: rgb(255 255 255 / 0.05);
    --secondary: rgb(255 255 255 / 0.08);
    --secondary-hover: rgb(255 255 255 / 0.13);
    --surface-hover: #141722;
    --button-hover: rgb(255 255 255 / 0.08);
    --focus: #7aa2ff;
    --scrim: rgb(0 0 0 / 0.6);
    --danger: #ff637e;
    --danger-bg: rgb(255 32 86 / 0.12);
    --error: #fb2c36;
    --error-text: #ff6467;
    --error-bg: rgb(251 44 54 / 0.1);
    --error-border: rgb(251 44 54 / 0.3);
    --error-strong: #ff6467;
    --success-bg: rgb(0 188 125 / 0.15);
    --success: #00d492;
    --warning-bg: rgb(254 154 0 / 0.15);
    --warning: #ff8904;
    --neutral-bg: rgb(113 113 123 / 0.15);
    --neutral: #9f9fa9;
    --chart-line: #c8cfdd;
    --chart-fill: rgb(200 207 221 / 0.1);
    --chart-grid: rgb(255 255 255 / 0.08);
  }
}

/* ---------- nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 400 14px/1.5 var(--app-font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono-font); font-size: 0.93em; }
.muted { color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wrap-any { overflow-wrap: anywhere; }
.text-xs { font-size: 12px; line-height: 16px; }
.strong { font-weight: 600; }
.right { text-align: right; }

/* Thanh cuộn tự ẩn (token của skill) */
* { --scrollbar-thumb: transparent; }
*:hover { --scrollbar-thumb: color-mix(in srgb, var(--foreground) 16%, transparent); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 9999px; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  *:hover { scrollbar-color: color-mix(in srgb, var(--foreground) 18%, transparent) transparent; }
}
.scrollbar-clean { scrollbar-width: none; }
.scrollbar-clean::-webkit-scrollbar { display: none; }

/* Focus bàn phím: chủ dự án yêu cầu trả lại vòng focus (I14), chỉ hiện khi dùng bàn phím */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- khung app ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--surface); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 30; }
.rail-head { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; flex: none; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 20px; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 16px; }
.rail-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.rail-label { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 4px; }
.rail-link { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: var(--radius); color: color-mix(in srgb, var(--foreground) 72%, transparent); text-decoration: none; font-size: 14px; border: 0; background: none; width: 100%; text-align: left; }
.rail-link:hover { background: var(--item-hover); color: var(--foreground); }
.rail-link[aria-current="page"] { background: var(--secondary); color: var(--foreground); font-weight: 500; }
.rail-link .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.rail-link[aria-current="page"] .count { color: var(--foreground); }
.rail-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); flex: none; }
.rail-scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 16px; line-height: 24px; font-weight: 600; white-space: nowrap; }
.topbar-search { flex: 1; max-width: 26rem; margin-left: 8px; position: relative; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.content { padding: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.content.narrow > * { max-width: 48rem; }

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(18rem, 86vw); transform: translateX(-100%); transition: transform 0.2s ease; visibility: hidden; }
  .rail.open { transform: none; box-shadow: var(--elevation-modal); visibility: visible; }
  .rail-scrim.open { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
}
@media (max-width: 639px) {
  .topbar-search { display: none; }
  .topbar h1 { overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- nút, ô nhập ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500; line-height: 1.25; text-align: center; max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--border-strong); background: var(--surface); color: var(--foreground); text-decoration: none; transition: background-color 0.12s; position: relative; }
.btn:hover { background: var(--button-hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { background: var(--secondary); border-color: transparent; }
.btn.secondary:hover { background: var(--secondary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: color-mix(in srgb, var(--foreground) 6%, transparent); color: var(--foreground); }
.btn.danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.btn.sm { min-height: 32px; padding: 4px 12px; border-radius: 8px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; flex: none; }
.btn.icon.sm { width: 32px; }
.btn[aria-disabled="true"], .btn:disabled { cursor: not-allowed; opacity: 0.5; }
.btn[aria-busy="true"] { cursor: progress; opacity: 1; }
.btn[aria-busy="true"] > :not(.spin) { visibility: hidden; }
.btn .spin { position: absolute; inset: 0; margin: auto; }
.link-btn { background: none; border: 0; padding: 0; color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); font-size: inherit; }
.link-btn:hover { text-decoration-color: currentColor; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 500; }
.hint { font-size: 12px; line-height: 16px; color: var(--muted); }
.err { font-size: 12px; line-height: 16px; color: var(--error-text); }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--foreground); font-size: 14px; }
.textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--error); }
.input:disabled, .select:disabled { opacity: 0.6; cursor: not-allowed; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 36px; padding-right: 36px; }
.input-wrap > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-wrap .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input.sm, .select.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
@media (max-width: 767px) {
  .input, .select, .textarea { font-size: 16px; min-height: 44px; }
  .input.sm, .select.sm { min-height: 36px; font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }
  .btn.icon { width: 44px; }
  .btn.icon.sm { width: 36px; }
}

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; min-height: 28px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 9999px; background: var(--border-strong); transition: background-color 0.12s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform 0.12s; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--primary-foreground); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .track { opacity: 0.5; }

/* ---------- khối, bảng ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head h2 { font-size: 18px; line-height: 26px; font-weight: 600; text-wrap: balance; }
.page-head p { color: var(--muted); max-width: 55ch; margin-top: 2px; text-wrap: pretty; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; min-width: 0; }
.panel > .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; font-weight: 600; line-height: 22px; }
.panel-body { padding: 16px 20px; }
.rows > .row { display: grid; gap: 8px 24px; padding: 16px 20px; border-top: 1px solid var(--border); }
.rows > .row:first-child { border-top: 0; }
@media (min-width: 720px) { .rows > .row { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); align-items: start; } }
.row-label { font-weight: 500; font-size: 14px; min-height: 40px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.row-label .hint { font-weight: 400; }
.row-control { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-control .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unit { color: var(--muted); font-size: 13px; }

.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow-x: auto; position: relative; }
.loadbar { position: absolute; inset: 0 0 auto 0; height: 2px; overflow: hidden; z-index: 2; }
.loadbar::after { content: ""; display: block; height: 100%; width: 33%; background: var(--primary); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.dt { font-size: 14px; }
.dt th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.dt th.right, .dt td.right { text-align: right; }
.dt td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.dt tbody tr:first-child td { border-top: 0; }
.dt tr.clickable { cursor: pointer; }
.dt tbody tr:hover td { background: var(--surface-hover); }
.dt tr.group-row td { background: var(--background); font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 12px 6px 20px; text-transform: uppercase; letter-spacing: 0.04em; }
.dt tbody tr.group-row:hover td { background: var(--background); }
.dt th:first-child, .dt td:first-child { padding-left: 20px; }
.dt th:last-child, .dt td:last-child { padding-right: 20px; }
.dt .name-cell { display: flex; flex-direction: column; min-width: 0; max-width: 22rem; }
.dt .name-cell .n { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt .name-cell .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sort-btn:hover { color: var(--foreground); }
.sort-btn[data-active="true"] { color: var(--foreground); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); flex-wrap: wrap; }

/* trạng thái: ô vuông nhỏ + chữ, màu theo nghĩa */
.st { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--neutral); }
.st.ok { color: var(--success); } .st.ok::before { background: var(--success); }
.st.degraded { color: var(--warning); } .st.degraded::before { background: var(--warning); }
.st.offline { color: var(--error-strong); } .st.offline::before { background: var(--error); }
.st.pending { color: var(--neutral); } .st.pending::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--neutral); }
.st.maintenance { color: var(--neutral); } .st.maintenance::before { background: var(--neutral); border-radius: 50%; }
.st-since { font-weight: 400; color: var(--muted); font-size: 12px; display: block; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 6px; font-size: 12px; background: var(--secondary); color: color-mix(in srgb, var(--foreground) 78%, transparent); white-space: nowrap; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.tag.warn { background: var(--warning-bg); color: var(--warning); }
.tag.bad { background: var(--error-bg); color: var(--error-strong); }
.tag.good { background: var(--success-bg); color: var(--success); }
.bad-text { color: var(--error-text); } .warn-text { color: var(--warning); } .good-text { color: var(--success); }
.bar { height: 6px; background: var(--secondary); border-radius: 3px; overflow: hidden; min-width: 56px; }
.bar > i { display: block; height: 100%; background: var(--chart-line); border-radius: 3px; }
.bar.warn > i { background: var(--warning); } .bar.bad > i { background: var(--error); }

/* thanh tổng quan: chữ + số, không ô nổi */
.summary { display: flex; flex-wrap: wrap; gap: 4px 28px; align-items: baseline; }
.summary button { background: none; border: 0; padding: 4px 0; display: inline-flex; align-items: baseline; gap: 8px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; }
.summary button b { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--foreground); }
.summary button:hover { color: var(--foreground); }
.summary button[aria-pressed="true"] { border-bottom-color: var(--foreground); color: var(--foreground); }
.summary button.warn b { color: var(--warning); } .summary button.bad b { color: var(--error-strong); }
.summary button.zero b { color: var(--muted); font-weight: 500; }

/* thanh lọc, chip, tab */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .grow { flex: 1; min-width: 12rem; max-width: 24rem; }
.toolbar .select { width: auto; min-width: 8.5rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 9999px; font-size: 13px; background: color-mix(in srgb, var(--foreground) 6%, transparent); color: color-mix(in srgb, var(--foreground) 75%, transparent); border: 0; max-width: 14rem; }
.chip:hover { background: color-mix(in srgb, var(--foreground) 10%, transparent); color: var(--foreground); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }
.chip.applied { background: var(--surface); border: 1px solid var(--border-strong); color: var(--foreground); padding-right: 8px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--tab-rail); overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 0 9px; color: var(--muted); font-size: 14px; white-space: nowrap; margin-bottom: -1px; text-decoration: none; }
.tab:hover { color: var(--foreground); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--foreground); border-bottom-color: var(--foreground); font-weight: 500; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); font-size: 14px; }
.banner .ico { flex: none; margin-top: 3px; }
.banner .b-body { flex: 1; min-width: 0; }
.banner .b-title { font-weight: 600; }
.banner.error { background: var(--error-bg); border-color: var(--error-border); }
.banner.error .ico, .banner.error .b-title { color: var(--error-strong); }
.banner.warn { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.banner.warn .ico, .banner.warn .b-title { color: var(--warning); }
.banner.info .ico { color: var(--muted); }
.banner.ok { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.banner.ok .ico, .banner.ok .b-title { color: var(--success); }

.empty { text-align: center; padding: 56px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h3 { font-size: 15px; font-weight: 600; }
.empty p { color: var(--muted); max-width: 44ch; text-wrap: pretty; }
.empty .actions { margin-top: 8px; justify-content: center; }

.skel { display: block; height: 12px; border-radius: 6px; background: color-mix(in srgb, var(--foreground) 6%, transparent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.skel-row { display: grid; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--border); }
.skel-row:first-child { border-top: 0; }

/* ---------- lớp nổi ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.scrim.right { justify-content: flex-end; padding: 0; align-items: stretch; }
.dialog { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--elevation-modal); width: min(32rem, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; min-height: 0; }
.dialog.wide { width: min(44rem, 100%); }
.dialog.drawer { width: min(46rem, 100%); max-height: none; border-radius: 0; border-width: 0 0 0 1px; height: 100%; }
.dialog-head { padding: 18px 20px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 16px; font-weight: 600; line-height: 24px; overflow-wrap: anywhere; }
.dialog-body { padding: 0 20px 16px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.dialog-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.popover { position: fixed; z-index: 60; min-width: 12rem; max-width: 20rem; background: var(--surface-overlay); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--elevation-popover); padding: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 12px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 14px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--item-hover); }
.menu-item[aria-checked="true"] { font-weight: 600; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-head { padding: 8px 12px 6px; font-size: 12px; color: var(--muted); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(24rem, calc(100vw - 32px)); }
.toast { background: var(--surface-overlay); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--elevation-popover); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.toast .ico { flex: none; margin-top: 3px; }
.toast.error .ico { color: var(--error-strong); } .toast.ok .ico { color: var(--success); }
.toast .t-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.savebar { position: sticky; bottom: 12px; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--elevation-popover); }

/* ---------- chi tiết server ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 16px 24px; }
.kv > div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.reasons { display: flex; flex-direction: column; gap: 4px; }
.reasons li { display: flex; gap: 8px; align-items: baseline; }
.reasons li::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: var(--warning); flex: none; transform: translateY(-1px); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 16px; }
.chart-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.chart-card .c-title { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.chart-card .c-val { font-size: 18px; font-weight: 600; margin-top: 2px; }
.chart-svg { width: 100%; height: 110px; display: block; margin-top: 6px; overflow: visible; }
.chart-tip { position: fixed; z-index: 70; pointer-events: none; background: var(--surface-overlay); border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 8px; font-size: 12px; box-shadow: var(--elevation-popover); white-space: nowrap; }
.uptime-bar { display: flex; gap: 2px; height: 28px; align-items: stretch; }
.uptime-bar i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--border-strong); }
.uptime-bar i.ok { background: var(--success); } .uptime-bar i.warn { background: var(--warning); } .uptime-bar i.bad { background: var(--error); }
.code { position: relative; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 48px 12px 14px; font-family: var(--mono-font); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.code .copy { position: absolute; top: 6px; right: 6px; }
.timeline { display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); }
@media (max-width: 639px) { .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.two-col { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) { .two-col.split { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; } }

/* ---------- đăng nhập ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(24rem, 100%); display: flex; flex-direction: column; gap: 20px; }
.auth-card h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth .panel { padding: 24px; }

/* ---------- tiện ích ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.hstack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot 0.7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.updated { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.updated::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.updated.stale::before { background: var(--warning); }
.updated.paused::before { background: var(--neutral); }
.readonly-note { font-size: 12px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--secondary); color: var(--foreground); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
@media (max-width: 1099px) { .hide-md { display: none; } }
@media (max-width: 767px) { .hide-sm { display: none; } .dt th:first-child, .dt td:first-child { padding-left: 14px; } .dt th:last-child, .dt td:last-child { padding-right: 14px; } }

/* ---------- bổ sung ---------- */
.input-wrap.plain .input { padding-left: 12px; }
.crumb { min-width: 0; }
.crumb-nav { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; }
.crumb-nav a { color: var(--muted); text-decoration: none; }
.crumb-nav a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.crumb-nav [aria-current] { color: var(--foreground); }
.user-btn { padding: 4px 8px; min-height: 40px; max-width: 14rem; }
.search-pop { min-width: 0; padding: 4px; }
.search-pop .menu-item[aria-selected="true"] { background: var(--item-hover); }
.login-submit { width: 100%; }
.topbar .input-wrap .input { min-height: 40px; }
.nowrap { white-space: nowrap; }
.two-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
.btn.fit { width: fit-content; }
.name-cell a { text-decoration: none; }
.tabs-wrap { margin-bottom: 4px; }

.btn.menu-btn { display: none; }
.content > div:empty { display: none; }
.tablewrap.flat { border: 0; border-radius: 0 0 16px 16px; }
.row-control .inline .input { width: 9rem; }
.dt td { white-space: nowrap; }
.dt td.wrap-any, .dt td .wrap-any { white-space: normal; }
td.right .hstack, td .actions.end { justify-content: flex-end; flex-wrap: nowrap; }
.cell-disk { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.cell-disk .bar { width: 52px; min-width: 52px; }
.cell-svc { display: block; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767px) {
  .dt .name-cell { max-width: 13rem; }
  .toolbar .grow { flex-basis: 100%; max-width: none; }
  .toolbar .select { flex: 1; min-width: 0; }
  .updated { display: none; }
}
.input.auto { width: auto; }
@media (max-width: 1023px) { .btn.menu-btn { display: inline-flex; } }
@media (max-width: 1499px) { .hide-lg { display: none; } }
@media (max-width: 1279px) { .hide-xl { display: none; } }
.dt th, .dt td { padding-left: 10px; padding-right: 10px; }
.dt th:first-child, .dt td:first-child { padding-left: 20px; }
.dt th:last-child, .dt td:last-child { padding-right: 20px; }
@media (max-width: 767px) { .toolbar .select { flex: 1 1 42%; } .dt th:first-child, .dt td:first-child { padding-left: 14px; } .dt th:last-child, .dt td:last-child { padding-right: 14px; } }
.crumb-nav { white-space: nowrap; }
.crumb-nav [aria-current] { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 639px) {
  .page-head .grow { flex-basis: 100%; }
  .topbar .crumb { flex: 1; min-width: 0; }
  .crumb-nav a { display: none; }
  .crumb-nav .ico { display: none; }
}
.rows.stacked > .row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.rows.stacked .row-label { min-height: 0; }
@media (max-width: 767px) {
  .dt.stack-sm, .dt.stack-sm tbody, .dt.stack-sm tr, .dt.stack-sm td { display: block; width: auto; }
  .dt.stack-sm thead { display: none; }
  .dt.stack-sm tr { padding: 12px 14px; border-top: 1px solid var(--border); }
  .dt.stack-sm tbody tr:first-child { border-top: 0; }
  .dt.stack-sm td, .dt.stack-sm td:first-child, .dt.stack-sm td:last-child { border: 0; padding: 2px 0; white-space: normal; text-align: left; }
  .dt.stack-sm td.right .hstack, .dt.stack-sm td .actions.end { justify-content: flex-start; flex-wrap: wrap; padding-top: 6px; }
  .dt.stack-sm tbody tr:hover td { background: transparent; }
  .toolbar .input.auto { flex: 1 1 100%; width: auto; }
}
.toolbar .select { max-width: 12rem; }
.dt .name-cell { max-width: 17rem; }
.topbar .crumb { flex: 0 1 auto; min-width: 0; max-width: 34rem; }
.crumb-nav { min-width: 0; }
.page-head p.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 767px) { .dt .name-cell { max-width: 13rem; } .toolbar .select { max-width: none; } }

/* ---------------------------------------------------------------- Thao tác từ xa (tab của máy chủ) */
.page-tabs { margin-top: -4px; }
.ops-ready { gap: 12px; }
.ops-list > .op { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto; align-items: center; gap: 12px 20px; padding: 16px 20px; border-top: 1px solid var(--border); }
.ops-list > .op:first-child { border-top: 0; }
.op-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.op-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-title .t { font-weight: 500; }
.op-main .d { color: var(--muted); font-size: 13px; max-width: 62ch; text-wrap: pretty; }
.op-note { margin-top: 2px; }
.op-args { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; min-width: 0; }
.op-arg { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.op-arg .select, .op-arg .input { min-width: 9rem; max-width: 16rem; }
.op-arg .narrow-num { min-width: 0; width: 6.5rem; }
.op-run { display: flex; justify-content: flex-end; }
.op.off .op-main .t { color: var(--muted); }
.output-bar { display: flex; align-items: center; gap: 8px; }
.output { margin: 0; padding: 12px 14px; max-height: 360px; overflow: auto; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--mono-font); font-size: 12.5px; line-height: 1.55; white-space: pre; tab-size: 2; }
.output.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.output:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0; font-size: 13px; }
.steps li { position: relative; flex: 1; padding: 0 0 0 22px; color: var(--muted); min-width: 0; }
.steps li::before { content: ""; position: absolute; left: 0; top: 4px; width: 10px; height: 10px; border-radius: 2px; box-shadow: inset 0 0 0 1.5px var(--border-strong); background: transparent; }
.steps li.done { color: var(--foreground); } .steps li.done::before { background: var(--foreground); box-shadow: none; }
.steps li.now { color: var(--foreground); font-weight: 500; } .steps li.now::before { box-shadow: inset 0 0 0 2px var(--foreground); }
.steps li.end.ok::before { background: var(--success); } .steps li.end.offline::before { background: var(--error); } .steps li.end.degraded::before { background: var(--warning); }
@media (max-width: 760px) {
  .ops-list > .op { grid-template-columns: 1fr; }
  .op-run { justify-content: flex-start; }
  .steps { flex-direction: column; gap: 6px; }
}
.dt .name-cell .cell-link { align-self: flex-start; background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 500; color: var(--foreground); text-align: left; cursor: pointer; text-decoration: none; }
.dt .name-cell .cell-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.dt .name-cell .cell-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.scrim.right { text-align: left; }

/* ======================= Báo cáo, lịch sử dài hạn, lịch gửi ======================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi .k-label { font-size: 12px; color: var(--muted); }
.kpi .k-value { font-size: 22px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.kpi .k-sub { font-size: 12px; color: var(--muted); min-height: 16px; }
.delta { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.delta.good { color: var(--success); } .delta.bad { color: var(--error-strong); } .delta.flat { color: var(--muted); }
.range-note { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.toolbar .field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.toolbar .input.date { width: 9.5rem; }
.chart-svg.wide { width: 100%; height: auto; margin-top: 4px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.chart-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ranklist, .distlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ranklist li, .distlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.ranklist li:first-child, .distlist li:first-child { border-top: 0; padding-top: 0; }
.ranklist .r-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ranklist .r-name a { color: inherit; text-decoration: none; } .ranklist .r-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ranklist .r-val { font-weight: 600; }
.ranklist .r-sub, .distlist .d-sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.distlist .d-bar { grid-column: 1 / -1; }
.ustrip { display: flex; gap: 1px; align-items: stretch; width: 100%; }
.uc { flex: 1 1 0; min-width: 1px; border-radius: 1px; background: var(--secondary); display: block; }
.uc.ok { background: var(--success); }
.uc.w1 { background: color-mix(in srgb, var(--success) 50%, var(--warning)); }
.uc.w2 { background: var(--warning); }
.uc.bad { background: var(--error); }
.uc.none { background: var(--secondary); }
.ulegend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.ulegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.mini-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 10px 16px; margin: 0; }
.mini-kv dt { font-size: 12px; color: var(--muted); }
.mini-kv dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; }
.report-doc { display: flex; flex-direction: column; gap: 20px; }
.report-head { display: flex; flex-direction: column; gap: 2px; }
.report-head .r-org { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.report-head h2 { font-size: 22px; line-height: 30px; font-weight: 600; text-wrap: balance; }
.report-head .r-meta { color: var(--muted); font-size: 13px; }
.report-section { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.report-section > h3 { font-size: 16px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.report-section h4 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.report-section .two-up { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .report-section .two-up { grid-template-columns: 1fr 1fr; } }
.report-foot { font-size: 12px; color: var(--muted); max-width: 80ch; text-wrap: pretty; }
.tablewrap.flat { border: 0; border-radius: 0; background: transparent; }
.sched-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 14px 20px; border-top: 1px solid var(--border); align-items: center; }
.sched-row:first-child { border-top: 0; }
.sched-row .s-name { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sched-row .s-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.sched-row .s-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .sched-row { grid-template-columns: 1fr; } .sched-row .s-actions { justify-content: flex-start; } }
.run-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.run-list li { padding: 10px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.run-list li:first-child { border-top: 0; }
.run-list .r-line { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.run-list .r-det { font-size: 12px; color: var(--muted); }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.disk-proj { font-size: 13px; }
.print-only { display: none; }

/* in/PDF: nền trắng, chữ đen, ẩn khung điều hướng; thanh uptime đổi sang thang xám để đọc được khi in đen trắng */
html.print-mode .rail, html.print-mode .rail-scrim, html.print-mode .topbar, html.print-mode .no-print { display: none !important; }
html.print-mode .app { display: block; }
html.print-mode .content { padding: 16px; max-width: 980px; margin: 0 auto; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light;
    --background: #ffffff; --surface: #ffffff; --foreground: #000000; --muted: #4a4a4a; --border: #bdbdbd; --border-strong: #8a8a8a;
    --secondary: #e6e6e6; --surface-hover: #ffffff; --item-hover: #ffffff;
    --success: #1b5e20; --warning: #7a4a00; --error: #8e0000; --error-strong: #8e0000; --error-text: #8e0000; --neutral: #4a4a4a;
    --chart-line: #000000; --chart-fill: rgb(0 0 0 / 0.07); --chart-grid: rgb(0 0 0 / 0.15);
    --success-bg: #ffffff; --warning-bg: #ffffff; --error-bg: #ffffff; --neutral-bg: #ffffff;
  }
  html, body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .rail, .rail-scrim, .topbar, .toolbar, .no-print, .toasts, .savebar, .page-tabs, .scrim, .popover { display: none !important; }
  .app { display: block !important; }
  .main { display: block !important; }
  .content { padding: 0 !important; gap: 10px !important; max-width: none !important; }
  .panel, .report-section, .kpi, .tablewrap { break-inside: avoid; page-break-inside: avoid; box-shadow: none !important; }
  .report-section { padding: 12px 14px; border-radius: 6px; }
  .tablewrap { overflow: visible !important; border-radius: 6px; }
  .dt tr { break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
  .uc.ok { background: #d9d9d9 !important; } .uc.w1 { background: #a6a6a6 !important; } .uc.w2 { background: #666666 !important; } .uc.bad { background: #000000 !important; } .uc.none { background: #ffffff !important; outline: 1px solid #bdbdbd; outline-offset: -1px; }
  .print-only { display: block; }
  .chart-svg text { fill: #333 !important; }
  .st::before { border: 1px solid #000; }
  .report-section .two-up { grid-template-columns: 1fr 1fr !important; gap: 12px; }
  .report-section .three-up { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 12px; }
  .report-section > div, .report-section .two-up > div, .report-section .three-up > div, .report-head, .kpis, .range-note { break-inside: avoid; page-break-inside: avoid; }
  .report-section > h3 { break-after: avoid; }
  .report-section { gap: 10px; }
  .dt .name-cell, .dt .name-cell .n { max-width: none !important; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  .dt td, .dt th { padding-top: 6px; padding-bottom: 6px; }
  .mini-kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.chart-legend .lg-off { background: var(--error); } .chart-legend .lg-deg { background: var(--warning); }
.section-title { font-size: 15px; font-weight: 600; }
@media (min-width: 1000px) { .two-col.even { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.report-section .three-up { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .report-section .three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dt td.reason { min-width: 14rem; overflow-wrap: break-word; }

/* ------------------------------------------------------------------ xem trước tin nhắn thông báo */
.pv { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pv-head h3 { font-size: 14px; font-weight: 600; line-height: 20px; }
.pv-body { min-height: 120px; min-width: 0; }
.pv-skel { height: 160px; border-radius: 12px; }
.pv-test { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pv-subject { font-size: 13px; margin-bottom: 8px; overflow-wrap: anywhere; }
.pv-email { width: 100%; height: 520px; border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; }
.err-inline { color: var(--error-text); font-size: 13px; }

.tg-chat { background: var(--background); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tg-bubble { max-width: min(22rem, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px 14px 14px 4px; padding: 10px 12px; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-bubble code { font-family: var(--mono-font); font-size: 13px; background: var(--secondary); border-radius: 4px; padding: 0 4px; }
.tg-btn { width: min(22rem, 100%); text-align: center; padding: 8px 12px; border-radius: 8px; background: var(--secondary); font-size: 13px; font-weight: 600; }
.tg-note { max-width: 22rem; font-size: 12px; line-height: 16px; color: var(--muted); }
.tg-sticker { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.tg-sticker-emoji { font-size: 44px; line-height: 1; }
.tg-sticker-note { font-size: 12px; color: var(--muted); }

.pv-surface { background: var(--background); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pv-app { font-size: 13px; font-weight: 700; }
.pv-note { font-size: 12px; color: var(--muted); }
.pv-card { display: flex; max-width: 34rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.pv-bar { width: 5px; flex: none; background: var(--bar, var(--muted)); }
.pv-main { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pv-title { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.pv-text { font-size: 13px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.pv-fl { font-size: 12px; font-weight: 700; color: var(--muted); }
.pv-fv { font-size: 13px; overflow-wrap: anywhere; }
.pv-foot { font-size: 12px; color: var(--muted); }

.stk { display: flex; flex-direction: column; gap: 8px; }
.stk-rows { display: flex; flex-direction: column; gap: 6px; }
.stk-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.stk-ev { font-size: 13px; font-weight: 600; }
.stk-val { font-size: 13px; overflow-wrap: anywhere; }
.stk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 8px; max-height: 320px; overflow-y: auto; }
.stk-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); }
.stk-chip:hover { background: var(--item-hover); }
.stk-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.stk-emoji { font-size: 34px; line-height: 1.1; }
.stk-set { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .stk-row { grid-template-columns: minmax(0, 1fr); } .pv-fields { grid-template-columns: minmax(0, 1fr); } .pv-email { height: 420px; } }
