:root {
  --bg: #eef1f5;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e3e7ed;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --up: #16a34a;
  --up-bg: #dcfce7;
  --down: #dc2626;
  --down-bg: #fee2e2;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --paused: #94a3b8;
  --bar-empty: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
/* Khóa kéo ngang cả trang (PWA iPhone hay bị lệch/kéo qua lại khi có phần tử rộng hơn màn hình). Dùng clip, không dùng hidden:
   hidden biến body thành scroll container làm hỏng position: sticky của .topbar. Các vùng cuộn ngang bên trong (.nav, .table-wrap…) vẫn cuộn bình thường. */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; overscroll-behavior-x: none; touch-action: pan-y; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Zen Kaku Gothic New đứng ngay sau font chính: chữ Nhật (tên website, ghi chú…) ở mọi trang đều dùng font này */
  font: 16px/1.6 "Merriweather Sans", "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; letter-spacing: -.01em; margin: 0; line-height: 1.3; }
h2 { font-size: 17px; margin: 0 0 12px; }
code { background: var(--bg); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.warn { color: var(--warn); }
.ok { color: var(--up); }
.bad { color: var(--down); }
[hidden] { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 48px; }

/* ---------- Topbar ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top); -webkit-transform: translateZ(0); transform: translateZ(0); }
.topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { color: var(--text); font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; white-space: nowrap; font-size: 15px; font-weight: 500; }
.nav a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.nav a.is-active { background: #e8effd; color: var(--primary); }
.nav__logout { opacity: .7; }

/* ---------- Common ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.head--sm { margin-bottom: 20px; }
.head--sm h2 { margin: 0; }
.head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head__actions form { margin: 0; }
/* Trang chi tiết website: nút chia 2 hàng, canh phải */
.head__actions--rows { flex-direction: column; align-items: flex-end; gap: 8px; }
.head__row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Nút chuyển ngôn ngữ gọn: VI | JA | EN */
.lang { position: relative; flex: none; font-size: 14px; }
.lang summary { list-style: none; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; user-select: none; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { background: var(--bg); }
.lang__flag { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); flex: none; }
.lang__caret { width: 9px; height: 6px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lang__menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 150px; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.lang__menu a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text); white-space: nowrap; }
.lang__menu a:hover { background: var(--bg); text-decoration: none; }
.lang__menu a.is-active { color: var(--primary); font-weight: 600; }
.lang-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn--primary:hover { filter: brightness(1.08); border-color: var(--primary); }
.btn--danger { color: var(--down); border-color: var(--down); background: transparent; }
.btn--danger:hover { background: var(--down-bg); border-color: var(--down); }
.btn--sm { height: 32px; padding: 0 10px; font-size: 14px; }
.icon { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.22em; }
.btn--block { width: 100%; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--up-bg); color: var(--up); font-weight: 500; }
.flash--error { background: var(--down-bg); color: var(--down); }
.flash--warn { background: var(--warn-bg); color: var(--warn); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.tag--ok { background: var(--up-bg); color: var(--up); }
.tag--bad { background: none; color: var(--down); }

.empty { text-align: center; padding: 48px 20px; }
.empty p { color: var(--muted); margin: 0 0 16px; }

/* ---------- Status ---------- */
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--paused); display: inline-block; flex-shrink: 0; }
.status--up .dot { background: var(--up); box-shadow: 0 0 0 4px var(--up-bg); }
.status--slow .dot, .status--failing .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.status--down .dot { background: var(--down); box-shadow: 0 0 0 4px var(--down-bg); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px transparent; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } /* trang chi tiết website: 2 hàng × 3 cột */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat__n { font-size: 30px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat__n small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat__n--sm { font-size: 18px; }
.stat__l { color: var(--muted); font-size: 14px; }
.stat--up .stat__n, .stat.status--up .stat__n { color: var(--up); }
.stat--down .stat__n, .stat.status--down .stat__n { color: var(--down); }
.stat.status--slow .stat__n, .stat.status--failing .stat__n { color: var(--warn); }
.stat--paused .stat__n { color: var(--paused); }

/* ---------- Site list ---------- */
.sites { display: flex; flex-direction: column; gap: 10px; }
.site {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 20px;
  padding: 14px 16px; margin: 0;
}
.site.status--down { border-color: var(--down); }
.site.status--paused { opacity: .65; filter: grayscale(1); } /* tạm dừng: cả thẻ chuyển xám (nhãn, dòng SSL / hết hạn, vạch uptime cũ) */
.site__main { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 8px; align-items: center; color: var(--text); min-width: 0; line-height: 1.45; }
.site__main:hover { text-decoration: none; }
.site__main:hover .site__name { text-decoration: underline; }
.site__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.site__name { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site__url, .site__err { grid-column: 2; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site__url { color: var(--muted); }
.site__err { color: var(--down); font-weight: 500; }
.status--failing .site__err { color: var(--warn); }
.site__meta { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); text-align: right; min-width: 120px; }
.site__meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.site__actions { display: flex; gap: 6px; }
.site__actions form { margin: 0; }
.site__actions .btn { width: 32px; padding: 0; box-sizing: border-box; }


/* ---------- Detail ---------- */
.head h1 { display: flex; align-items: flex-start; gap: 10px; }
.head h1 .dot { margin-top: calc((1.3em - 12px) / 2); } /* đốm nằm giữa dòng đầu (line-height 1.3), không bị kéo xuống giữa khối khi tên xuống dòng */
.chart__svg { width: 100%; height: 160px; display: block; }
.chart__line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.chart__fail { fill: var(--down); opacity: .35; }
.chart__axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table--nowrap-head th { white-space: nowrap; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-open td { background: var(--down-bg); }
@media (min-width: 761px) { .table .td-time { white-space: nowrap; } }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-2--top { grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2--top > .card { margin: 0; overflow-x: auto; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }

/* ---------- Forms ---------- */
.form h2:not(:first-of-type) { margin-top: 12px; padding-top: 20px; border-top: 1px solid var(--border); }
.field { display: block; margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field > span { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.field > span small { display: inline; font-weight: 400; font-size: 14px; margin: 0; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=search], input[type=date], select {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit; font-size: 16px; border-color: #d5dbe3;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type=search] { -webkit-appearance: none; appearance: none; }
.input-group { display: flex; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.checks { margin: 6px 0 0 26px; padding-left: 12px; border-left: 2px solid var(--border); }
.form__foot { padding-top: 8px; }

.danger { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.danger__actions { display: flex; gap: 8px; }
.danger__actions form { margin: 0; }
.test-results { margin-top: 8px; font-size: 15px; }

.devices { list-style: none; margin: 12px 0 0; padding: 0; }
.devices li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }

.list { display: flex; flex-direction: column; gap: 10px; }
.list__item { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; color: var(--text); }
.list__item:hover { text-decoration: none; border-color: var(--muted); }
.list__right { color: var(--muted); text-align: right; }

.code {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; font-size: 14px;
  overflow-x: auto; cursor: pointer; position: relative; margin: 0 0 16px;
}
.code.copied::after { content: 'Đã copy ✓'; position: absolute; right: 10px; top: 10px; color: #4ade80; font-family: sans-serif; }

/* ---------- Link mời ---------- */
.invite { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.invite__text { flex: 1; min-width: 0; }
.invite__text p { margin: 0 0 12px; }
.invite__reset { margin: 8px 0 0; }
.invite__qr { background: #fff; padding: 8px; border-radius: 8px; line-height: 0; flex-shrink: 0; }
.invite__qr:empty { display: none; }
.invite__qr img, .invite__qr canvas { width: 160px; height: 160px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- Trang người nhận ---------- */
.join__hero { text-align: center; padding: 16px 0 8px; }
.join__hero img { border-radius: 14px; }
.join__hero h1 { margin: 12px 0 4px; }
.join__hero p { margin: 0 0 20px; }
.join__card { text-align: center; }
.join__card p { margin: 0 0 12px; }
.join__ok { font-size: 18px; font-weight: 600; color: var(--up); }
.join__actions { display: flex; gap: 8px; justify-content: center; }
.btn--lg { height: 52px; font-size: 17px; border-radius: 12px; }
.steps { text-align: left; margin: 0 0 12px; padding-left: 22px; line-height: 1.9; }
.ios-share { display: inline-block; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 13px; }
/* Danh sách website của người nhận: dùng thẻ như Tổng quan, luôn xếp dạng dọc (cột trang hẹp) */
.page-join .main { max-width: 640px; }
/* giữ 3 cột cả trên điện thoại (ghi đè .stats 1 cột ở mobile) */
.stats.stats--join { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stats--join .stat { padding: 10px 12px; }
.stats--join .stat__n { font-size: 22px; }
.sites--join { margin-bottom: 12px; }
.sites--join .site { grid-template-columns: minmax(0, 1fr); gap: 10px; box-shadow: none; }
.sites--join .site__main { grid-column: 1 / -1; }
.sites--join .site__title { flex-wrap: wrap; gap: 4px 8px; }
.sites--join .site__meta { flex-direction: row; gap: 12px; text-align: left; min-width: 0; flex-wrap: wrap; }

/* ---------- Người nhận trong trang website ---------- */
.people__list { list-style: none; margin: 0 0 16px; padding: 0; }
.people__list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.people__info { display: flex; flex-direction: column; min-width: 0; }
.people__info small { font-size: 14px; color: var(--muted); }
.people__actions { display: flex; gap: 6px; flex-shrink: 0; }
.people__actions form { margin: 0; }
.people__add { max-width: 100%; }
.people__add small { display: block; font-size: 13px; margin-top: 6px; }
.site__people { grid-column: 2; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Tìm website ---------- */
.search { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; margin-bottom: 12px; }
.search input[type=search] { height: 46px; font-size: 16px; }
.search__filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.chip:hover { color: var(--text); border-color: #c5ccd6; }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.search__count { margin: 0 0 10px 2px; }

/* ---------- Bộ chọn có ô lọc ---------- */
.picker { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.picker__tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; background: var(--bg); border-bottom: 1px solid var(--border); }
.picker__tools input[type=search] { flex: 1; min-width: 180px; height: 36px; }
.picker__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; padding: 6px 12px; max-height: 380px; overflow-y: auto; }
.picker--people .picker__list { max-height: none; }
.picker__item { align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); min-width: 0; line-height: 1.35; }
.picker__item input { margin-top: 1px; }
.picker__item .dot { width: 8px; height: 8px; margin-top: 7px; box-shadow: none !important; animation: none; }
.picker__label { display: flex; flex-direction: column; min-width: 0; }
.picker__label, .picker__label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__label small { font-size: 13px; }
.people__hint { margin: 10px 0 0; }
.input-group select { flex: 1; }
.list__main { min-width: 0; }
.form__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Issues ---------- */
.badge { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--down); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; vertical-align: 1px; }
.stat--link { color: inherit; text-decoration: none !important; }
.stat--link:hover { border-color: #c5ccd6; }
.issues { display: flex; flex-direction: column; gap: 10px; }
.issue { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin: 0; padding: 14px 16px; border-left: 4px solid var(--down); }
.issue--resolved { border-left-color: var(--up); }
.issue__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.issue__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.issue__title a { color: var(--text); }
.issue__code { background: var(--down-bg); border-color: transparent; color: var(--down); font-weight: 600; }
.issue--resolved .issue__code { background: var(--bg); color: var(--muted); }
.issue__code--lg { font-size: 16px; vertical-align: -.22em; }
.issue__error { font-size: 15px; overflow-wrap: anywhere; }
.issue__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.issue__note { background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }
.issue__actions { display: flex; gap: 6px; flex-shrink: 0; }
.issue__actions form { margin: 0; }
/* Trang Issues: chọn nhiều issue để đổi tình trạng nhanh */
.issues--bulk .issue { position: relative; }
.issue__check { display: none; }
.issues--bulk.is-selecting .issue { padding-left: 46px; cursor: pointer; }
.issues--bulk.is-selecting .issue__check { display: flex; }
.issues--bulk.is-selecting .issue__actions { display: none; } /* đang chọn nhiều: thao tác qua thanh bên dưới */
.issue__check { position: absolute; left: 0; top: 0; bottom: 0; width: 44px; justify-content: center; padding-top: 16px; cursor: pointer; }
.issue__check input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--primary); }
.issue:has(.issue__check input:checked) { box-shadow: 0 0 0 2px var(--primary); }
.bulkbar { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin: 12px 0 0; box-shadow: 0 6px 24px rgba(15, 23, 42, .18); }
.bulkbar__count { font-weight: 600; margin-right: 4px; }
.bulkbar__all { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.bulkbar__all input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.search__select { margin-left: auto; height: 32px; border-radius: 999px; }
.search__select[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.bulkbar__actions { display: flex; gap: 6px; margin-left: auto; }
.issues--compact .issue { box-shadow: none; background: var(--bg); border-top: 0; border-right: 0; border-bottom: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.issue__raw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.radios { display: flex; gap: 20px; flex-wrap: wrap; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid #d5dbe3; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 16px; resize: vertical; }
textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

/* Thông tin khách hàng / server */
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.secret > summary { cursor: pointer; color: var(--primary); font-size: 14px; }
.secret[open] > summary { margin-bottom: 4px; }
.table--preview .pre { max-width: 260px; max-height: 6.5em; overflow: auto; }

/* Chọn nhiều người nhận trong trang website */
.people__pick { margin-top: 12px; }
.people__pick > summary { list-style: none; cursor: pointer; }
.people__pick > summary::-webkit-details-marker { display: none; }
.people__pick[open] > summary { margin-bottom: 10px; }
.people__save { margin-top: 12px; }

/* ---------- Ngày hết hạn ---------- */
.site__expiry { grid-column: 2; font-size: 14px; font-weight: 500; }
.site__ssl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site__ssl.muted { font-weight: 400; }
#ssl .head form { margin: 0; }
.tpl { margin-top: 12px; }
.tpl > summary { list-style: none; cursor: pointer; max-width: 100%; }
.tpl > summary::-webkit-details-marker { display: none; }
.tpl[open] > summary { margin-bottom: 8px; }
.tpl__block { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); }
.tpl__lang { display: block; margin-bottom: 4px; }
.tpl__head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 6px; }
.tpl textarea { font-size: 16px; /* <16px: iOS tự zoom khi focus rồi để trang kéo lệch ngang */ line-height: 1.55; }
/* ---------- Lỗ hổng CVE ---------- */
#cve .head form { margin: 0; }
.cve { padding: 10px 14px; margin: 10px 0; border: 1px solid var(--border); border-left: 4px solid var(--down); border-radius: 8px; }
.cve__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cve__list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; }
.cve__list li { padding: 4px 0; overflow-wrap: anywhere; }
.cve__list .icon { width: 14px; height: 14px; vertical-align: -2px; }
.cve__more > summary { cursor: pointer; color: var(--primary); padding: 2px 0; }
.cve-site { border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; margin: 10px 0; }
.cve-site[open] { padding-bottom: 6px; }
.cve-site__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0 10px 18px; position: relative; cursor: pointer; list-style: none; }
.cve-site__head::-webkit-details-marker { display: none; }
.cve-site__head::before { content: '▸'; color: var(--muted); position: absolute; left: 0; top: 10px; } /* mũi tên ngang dòng tên website; nội dung thụt 18px nên hàng nhãn xuống dòng vẫn thẳng cột */
.cve-site[open] > .cve-site__head::before { content: '▾'; }
.cve-site__name { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.cve-site__head > span:last-child { flex: 0 1 auto; max-width: 100%; display: flex; flex-wrap: wrap; gap: 4px; } /* co lại vừa khung, nhãn thừa tự xuống dòng */
.cve-site__name small { font-size: 13px; }
.cve-site .cve { margin: 8px 0; }
.sev { font-size: 12px; white-space: nowrap; }
.sev--critical { background: var(--down); color: #fff; }
.sev--high { background: var(--down-bg); color: var(--down); }
.sev--medium { background: var(--warn-bg); color: var(--warn); }
.sev--low, .sev--none { background: var(--bg); color: var(--muted); }
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.45; background: #0f172a; color: #e2e8f0; border-color: #0f172a; white-space: pre; }
/* ---------- Alive VPS ---------- */
/* Cấu hình VPS: lưới ô thông số 3 cột (điện thoại: 2 cột) */
.spec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.spec { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 10px; background: var(--bg); min-width: 0; }
.spec__l { font-size: 13px; color: var(--muted); font-weight: 500; }
.spec__v { font-size: 20px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.spec__n { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; } /* ghi chú nằm cạnh giá trị: "6 vCPU AMD G3" */
@media (max-width: 760px) {
  .spec-grid { grid-template-columns: minmax(0, 1fr); }
}
.vps__table .num { text-align: right; white-space: nowrap; }
.vps__table tfoot td { border-top: 2px solid var(--border); }
/* Domain màu xám (giống địa chỉ website ở dashboard) để khác với tên website màu xanh */
.vps__domain { color: var(--muted); }
.vps__domain:hover { color: var(--text); }
.vps__disk { margin-bottom: 12px; }
.vps__money { margin-bottom: 0; }
.meter { height: 10px; border-radius: 999px; background: var(--bar-empty); overflow: hidden; margin-bottom: 10px; }
.meter i { display: block; height: 100%; background: var(--up); border-radius: inherit; }
.meter--over i { background: var(--down); }
.stat--warn .stat__n { color: var(--warn); }
.meter--res { display: flex; }
.meter--res i { border-radius: 0; flex-shrink: 0; }
.meter--res .meter__cache { background: var(--primary); opacity: .35; }
.res__legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 14px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw--used { background: var(--up); }
.sw--cache { background: var(--primary); opacity: .35; }
.sw--cpu { background: var(--warn); }
.vps__res .stat__l { overflow-wrap: anywhere; }
.chart__grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 4; }
.chart__line--ram { stroke: var(--up); }
.chart__line--cpu { stroke: var(--warn); }

/* Văn bản tiếng Nhật: dùng Zen Kaku Gothic New cho cả chữ Latin xen kẽ */
/* Nét Zen Kaku mảnh hơn Merriweather Sans → tăng 1 bậc độ đậm để chữ Nhật đậm tương đương chữ Việt */
[lang="ja"], [lang="ja"] input, [lang="ja"] textarea { font-family: "Zen Kaku Gothic New", sans-serif; font-weight: 500; }
[lang="ja"] b { font-weight: 700; }
.stat--expiry .stat__l .ok, .stat--expiry .stat__l .warn, .stat--expiry .stat__l .bad { font-weight: 600; }
.field--date input { max-width: 240px; }
.upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload input[type=file] { font: inherit; font-size: 15px; }
.preview { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.table-wrap { overflow-x: auto; margin-bottom: 12px; }
.table--preview td { vertical-align: top; }
.table--preview tr.is-same td { opacity: .55; }
.table--preview td:first-child, .table--preview th:first-child { width: 32px; }

/* ---------- Nhãn dịch vụ ---------- */
.search__labels { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 10px; border-top: 1px dashed var(--border); }
.search__labels-title { font-size: 13px; color: var(--muted); margin-right: 2px; }
.label-chip { border: 2px solid transparent; cursor: pointer; font: inherit; font-size: 13px; opacity: .55; transition: opacity .12s; }
.label-chip:hover { opacity: .85; }
.label-chip.is-active { opacity: 1; border-color: currentColor; }
.label-chip small { font-size: 12px; opacity: .8; margin-left: 2px; }
.label-chip[disabled] { opacity: .25; cursor: default; }
.search__clear { font-size: 13px; }
.vps-badge { display: inline-block; flex-shrink: 0; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: middle; background: #0f172a; color: #4ade80; }
.page-site .vps-badge { position: relative; top: -2px; }
.labels { display: inline-flex; gap: 5px; flex-wrap: wrap; flex-shrink: 0; }
.labels--head { display: flex; margin-top: 8px; }
.label { display: inline-block; padding: 1px 9px; border-radius: 6px; font-size: 13px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.label--blue   { background: #cfe5f7; color: #0b4f8a; }
.label--orange { background: #ffcfb3; color: #8a3a0b; }
.label--yellow { background: #ffe8a3; color: #7a5600; }
.label--green  { background: #d4edbc; color: #2c5e12; }
.label--gray   { background: #e6e6e6; color: #444; }
.label--purple { background: #e6d4f5; color: #5b2a86; }
.label--red    { background: #f9c9c9; color: #8a1f1f; }
.label--dark   { background: #333; color: #fff; }
.label--teal   { background: #c8eee9; color: #0f5b52; }
.label--basic    { background: #22b573; color: #fff; }
.label--standard { background: #3b82f6; color: #fff; }
.label--premium  { background: #dc3f3f; color: #fff; }
.label--custom   { background: #fde9a2; color: #7a5600; }
.label-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.label-pick__item { cursor: pointer; }
.label-pick__item input { position: absolute; opacity: 0; pointer-events: none; }
.label-pick__item .label { font-size: 15px; padding: 5px 12px; opacity: .45; border: 2px solid transparent; transition: opacity .12s; }
.label-pick__item .label::before { content: '+ '; }
.label-pick__item input:checked + .label { opacity: 1; border-color: currentColor; }
.label-pick__item input:checked + .label::before { content: '✓ '; font-family: sans-serif; }
.label-pick__item input:focus-visible + .label { outline: 2px solid var(--primary); outline-offset: 2px; }
.label-pick__item:hover .label { opacity: .8; }
[data-maintenance] > .label-pick { margin-bottom: 16px; }
/* Merriweather Sans có ascent/descent lệch: trên Windows chữ bị xích lên. Cắt theo cap height để chữ nằm giữa label ở mọi OS */
@supports (text-box: trim-both cap alphabetic) {
  .label { text-box: trim-both cap alphabetic; padding-block: 6px; line-height: 1.2; }
  .label-pick__item .label { padding-block: 8px; }
  .tag { text-box: trim-both cap alphabetic; padding-block: 6.5px; line-height: 1.2; }
  .badge { text-box: trim-both cap alphabetic; height: auto; padding-block: 5.5px; line-height: 1.2; }
}

/* ---------- Login ---------- */
.page-login .main { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login { width: 100%; max-width: 360px; text-align: center; }
.login h1 { margin: 8px 0 24px; }
.login__flash { text-align: left; margin: -8px 0 16px; font-size: 15px; }
.login .field { text-align: left; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .brand span, .nav__logout { display: none; }
  .topbar__in { height: 52px; }
  .nav a { padding: 6px 10px; }
  .site { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; }
  .site__main { grid-column: 1 / -1; }
  .site__title { flex-wrap: wrap; gap: 4px 8px; }
  .site__main > .dot { align-self: start; margin-top: 6px; } /* đốm luôn nằm ngang dòng tên, kể cả khi nhãn xuống dòng */
  .site__meta { flex-direction: row; gap: 12px; text-align: left; min-width: 0; flex-wrap: wrap; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .list__item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .list__right { text-align: left; }
  .invite { flex-direction: column-reverse; align-items: stretch; }
  .people__list li { flex-direction: column; align-items: flex-start; }
  .issue { flex-direction: column; gap: 10px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .invite__qr { align-self: center; }
  .stat__n { font-size: 22px; }
  .stats, .stats--3 { grid-template-columns: minmax(0, 1fr); }
  /* Tổng quan: 4 ô số liệu 2 cột, ô Issues chiếm cả hàng */
  .stats.stats--dash { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats--dash .stat { padding: 12px 14px; }
  .stats--dash .stat:last-child { grid-column: 1 / -1; }
  .cve-site__head > span:last-child { margin-top: 5px; }
}

/* ---------- PWA (mở từ màn hình chính): không cho zoom như app thật ---------- */
@media (display-mode: standalone) {
  html { touch-action: manipulation; } /* bỏ double-tap zoom */
}

.multiselect { position: relative; }
.multiselect > summary { list-style: none; cursor: pointer; padding: 8px 32px 8px 10px; border: 1px solid var(--border, #ccc); border-radius: 6px; background: #fff; min-height: 38px; position: relative; }
.multiselect > summary::-webkit-details-marker { display: none; }
.multiselect > summary::after { content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-75%) rotate(45deg); }
.multiselect[open] > summary { outline: 2px solid var(--primary); outline-offset: -1px; }
.multiselect__menu { position: absolute; z-index: 20; left: 0; right: 0; margin-top: 4px; padding: 6px; background: #fff; border: 1px solid var(--border, #ccc); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 260px; overflow: auto; }
.multiselect__menu label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.multiselect__menu label:hover { background: #f2f2f2; }

.expiry-rows { display: flex; flex-direction: column; gap: 12px; }
.expiry-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 12px 14px; border: 1px solid var(--border, #ddd); border-left: 4px solid var(--primary); border-radius: 8px; background: #fafafa; }
.expiry-row[hidden] { display: none; }
@media (max-width: 640px) { .expiry-row { grid-template-columns: 1fr; } }
.kv-group { padding: 10px 14px; margin-bottom: 10px; border: 1px solid var(--border, #ddd); border-left: 4px solid var(--primary); border-radius: 8px; background: #fafafa; }

/* Báo cáo GA4 theo tháng */
#ga4 .head form { margin: 0; }
#ga4 .stat small { font-size: 12px; margin-top: 2px; }
.ga-detail > summary { height: auto; min-height: 32px; padding-top: 6px; padding-bottom: 6px; line-height: 1.3; white-space: normal; text-align: left; max-width: 100%; }
.ga-detail .table-wrap { margin-bottom: 14px; }
@media (min-width: 761px) { .ga-detail .table-wrap { overflow: visible; } }  /* PC: không có thanh trượt; SP: trượt ngang */
.ga-table { table-layout: fixed; width: 100%; }
@media (max-width: 760px) { .ga-table { min-width: 460px; } }
.ga-table th:not(:first-child), .ga-table td:not(:first-child) { width: 84px; padding-left: 6px; padding-right: 6px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ga-table th { white-space: nowrap; }
.ga-table td:first-child { overflow-wrap: anywhere; }

/* Đầu việc trong tháng (Maintenance) */
.months-nav { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; }
.months-nav a { text-decoration: none; font-size: 20px; line-height: 1; padding: 2px 8px; border: 1px solid var(--border); border-radius: 8px; color: inherit; }
.task-table .task-h { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; width: 64px; }
.task-table .task-x { width: 44px; text-align: right; }
.task-table .task-x form { margin: 0; }
.task-edit { cursor: pointer; color: var(--primary); list-style: none; }
.task-edit::-webkit-details-marker { display: none; }
.task-form { margin-top: 10px; }
.task-form__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
#tasks .tpl > summary.btn { margin-top: 4px; }

.cve-site__update { margin: 6px 0 0; align-self: flex-start; }
.cve__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cve pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; }

/* Chọn khoảng ngày GA4 */
.ga-range { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 14px; }
.ga-range__presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ga-range__custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }
.ga-range__custom label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ga-range__custom input[type=date] { width: auto; }
.ga-range__wd { flex-basis: 100%; }
@media (min-width: 900px) { .ga-range__wd { flex-basis: auto; } }
.ga-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* Xem trước slide báo cáo vẽ bằng canvas (report-canvas.js) */
.rc-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.rc-modal__box { display: flex; flex-direction: column; gap: 12px; width: min(1100px, 100%); max-height: 100%; padding: 16px; border-radius: 12px; background: var(--card); overflow: auto; }
.rc-modal__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rc-modal__canvas { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.rc-modal__body { display: flex; flex-direction: column; gap: 20px; }
.rc-modal__fig { margin: 0; }
.rc-modal__fig figcaption { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-weight: 600; }

.ga-shot { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 24px; margin: 12px 0; }
.ga-shot form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ga-shot__list { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; }
.ga-drop { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 280px; max-width: 460px; padding: 14px 18px; border: 2px dashed var(--border, #dadce0); border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; }
.ga-drop:hover, .ga-drop.is-over { border-color: var(--accent, #2563eb); background: rgba(37, 99, 235, .06); }
.ga-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ga-drop__status:not(:empty) { font-weight: 600; }
.ga-shot__cur img { border: 1px solid var(--border, #dadce0); border-radius: 4px; vertical-align: middle; }
