/* Control plane UI — bố cục kiểu Material admin (thanh bên, toolbar, thẻ, widget) với tông "bảng andon":
   than chì + hổ phách, đèn tín hiệu xanh/vàng/đỏ. Tự theo chế độ sáng/tối của trình duyệt. Không dùng font/CDN ngoài. */
:root {
  --bg:#eceee9; --card:#fafaf8; --card-2:#f1f2ee; --ink:#171b21; --mut:#5d6772; --line:#d8dbd4;
  --navy:#171b21; --navy-2:#0f1217; --on-navy:#aeb6c1;
  --accent:#f2a900; --accent-d:#d99a00; --accent-ink:#171b21; --link:#9a6a00;
  --ok:#17924a; --warn:#d98e00; --bad:#d3342b; --idle:#5d6772; --on-c:#fff;
  --display:Bahnschrift,"DIN Alternate","Roboto Condensed","Arial Narrow",system-ui,sans-serif;
  --e1:0 1px 2px rgba(23,27,33,.08), 0 1px 3px rgba(23,27,33,.1);
  --e2:0 3px 6px rgba(23,27,33,.12), 0 2px 4px rgba(23,27,33,.1);
  --radius:4px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0f1217; --card:#171c24; --card-2:#1d232c; --ink:#e8ebef; --mut:#97a1ad; --line:#2a313c;
    --navy:#0a0c10; --navy-2:#06080b; --on-navy:#98a2af;
    --accent:#f2a900; --accent-d:#ffbd2e; --link:#f2b93b;
    --ok:#3fcf7a; --warn:#f0b429; --bad:#ff6b61; --idle:#7b8794; --on-c:#0b0d10;
    --e1:0 0 0 1px #2a313c; --e2:0 0 0 1px #3a424e;
  }
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--ink); font:14px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; -webkit-font-smoothing:antialiased; font-variant-numeric:tabular-nums; }
h1, h2, .display { font-family:var(--display); font-variation-settings:"wdth" 88; font-weight:600; letter-spacing:.005em; }
h1 { font-size:26px; line-height:1.15; margin:0; }
h2 { font-size:20px; margin:0 0 12px; }
p { margin:0 0 12px; }
a { color:var(--ink); text-decoration:underline; text-decoration-color:var(--mut); text-underline-offset:3px; }
a:hover { text-decoration-color:var(--accent); text-decoration-thickness:2px; }
code { font:12px ui-monospace,Consolas,monospace; background:var(--card-2); padding:1px 5px; border-radius:3px; }
pre { white-space:pre-wrap; word-break:break-word; margin:6px 0 0; padding:10px; background:var(--card-2); border:1px solid var(--line); border-radius:var(--radius); font:12px/1.5 ui-monospace,Consolas,monospace; max-width:560px; }
small, .mut { color:var(--mut); }
.sub { color:var(--mut); margin:6px 0 0; }
.ok { color:var(--ok); }
.err { color:var(--bad); margin:0 0 12px; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* ===== Thương hiệu ===== */
.brand { display:inline-flex; align-items:center; gap:10px; font:700 18px var(--display); font-variation-settings:"wdth" 88; color:inherit; text-decoration:none; }
.logo { width:30px; height:30px; border-radius:4px; display:grid; place-items:center; background:var(--accent); color:var(--accent-ink); font:800 17px var(--display); }

/* ===== Form ===== */
label { display:flex; flex-direction:column; gap:6px; color:var(--mut); font-size:13px; font-weight:500; flex:1 1 170px; margin-bottom:14px; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.row label { margin-bottom:0; }
.between { justify-content:space-between; align-items:center; }
input, select { padding:9px 11px; border:1px solid var(--line); border-radius:5px; background:var(--card); color:var(--ink); font:inherit; width:100%; }
input:focus, select:focus { outline:2px solid var(--accent); outline-offset:0; border-color:var(--ink); }
input[type=checkbox] { width:auto; }
button, a.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:8px 16px; border:1px solid var(--accent); border-radius:5px;
  background:var(--accent); color:var(--accent-ink); font:inherit; font-weight:700; cursor:pointer; text-decoration:none; white-space:nowrap; }
button:hover { filter:brightness(1.07); }
button.full { width:100%; padding:11px 16px; }
button.ghost, a.btn { background:transparent; color:var(--ink); border-color:var(--line); font-weight:600; }
button.ghost:hover, a.btn:hover { border-color:var(--ink); filter:none; }
button.danger { background:transparent; color:var(--bad); border-color:color-mix(in srgb, var(--bad) 45%, transparent); font-weight:600; }
button.danger:hover { background:var(--bad); color:var(--on-c); border-color:var(--bad); filter:none; }
button.small, a.btn.small { padding:3px 10px; font-size:12px; border-radius:4px; }
a.btn { padding:4px 11px; font-size:12px; }
button:disabled { opacity:.4; cursor:not-allowed; filter:none; }
form.inline { display:inline; }
input.mini { padding:3px 7px; font-size:12px; width:132px; border-radius:4px; }
input.mini.err { margin:0; color:var(--bad); border-color:var(--bad); }
select.mini { padding:3px 7px; font-size:12px; width:auto; border-radius:4px; }

/* ===== Thẻ / bảng ===== */
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--e1); padding:20px; margin-bottom:20px; }
.card-title { margin:-20px -20px 16px; padding:13px 20px; border-bottom:1px solid var(--line); background:var(--card-2); border-radius:var(--radius) var(--radius) 0 0; font-weight:700; }
details.card { padding:0; }
details.card > summary { list-style:none; cursor:pointer; padding:14px 20px; font-weight:700; display:flex; align-items:center; gap:10px; border-radius:var(--radius); }
details.card > summary::-webkit-details-marker { display:none; }
details.card > summary::before { content:""; width:7px; height:7px; border-right:2px solid var(--mut); border-bottom:2px solid var(--mut); transform:rotate(-45deg); transition:transform .15s; margin:0 4px 0 2px; }
details.card[open] > summary { border-bottom:1px solid var(--line); background:var(--card-2); border-radius:var(--radius) var(--radius) 0 0; }
details.card[open] > summary::before { transform:rotate(45deg); }
details.card > .body { padding:20px; }
details.card summary small { font-weight:400; }
.tbl { overflow-x:auto; margin:-20px; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:12px 16px; border-bottom:1px solid var(--line); vertical-align:top; }
th { color:var(--mut); font-weight:600; font-size:12px; background:var(--card-2); white-space:nowrap; }
tbody tr:hover { background:var(--card-2); }
tbody tr:last-child td { border-bottom:0; }
details summary { cursor:pointer; font-size:12px; }
.pw { font:600 15px ui-monospace,Consolas,monospace; padding:3px 8px; background:var(--card-2); border:1px dashed var(--mut); border-radius:4px; user-select:all; color:var(--ink); }
.notice { padding:10px 14px; border-radius:var(--radius); margin:16px 0 0; background:color-mix(in srgb, var(--ok) 10%, transparent); border:1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.notice.bad { background:color-mix(in srgb, var(--bad) 9%, transparent); border-color:color-mix(in srgb, var(--bad) 40%, transparent); color:var(--bad); }

/* ===== Đèn tín hiệu (trạng thái) ===== */
.badge { display:inline-flex; align-items:center; gap:7px; padding:2px 10px 2px 8px; border-radius:12px; font-size:12px; font-weight:600; color:var(--ink); background:color-mix(in srgb, var(--c, var(--idle)) 16%, transparent); }
.badge::before { content:""; width:10px; height:10px; border-radius:50%; background:var(--c, var(--idle)); box-shadow:0 0 0 3px color-mix(in srgb, var(--c, var(--idle)) 22%, transparent); }
.Active { --c:var(--ok); }
.Failed, .DeleteFailed, .UpdateFailed, .RestoreFailed { --c:var(--bad); }
.Pending, .Provisioning, .Deleting, .Updating, .Suspending, .Resuming, .Restoring { --c:var(--warn); }
.Suspended { --c:var(--idle); }
.badge.Pending::before, .badge.Provisioning::before, .badge.Deleting::before, .badge.Updating::before,
.badge.Suspending::before, .badge.Resuming::before, .badge.Restoring::before { animation:blink 1.1s steps(2,jump-none) infinite; }
@keyframes blink { 50% { opacity:.25; } }
tr.Active td:first-child { box-shadow:inset 3px 0 0 var(--ok); }
tr.Failed td:first-child, tr.DeleteFailed td:first-child, tr.UpdateFailed td:first-child, tr.RestoreFailed td:first-child { box-shadow:inset 3px 0 0 var(--bad); }
tr.Pending td:first-child, tr.Provisioning td:first-child, tr.Deleting td:first-child, tr.Updating td:first-child,
tr.Suspending td:first-child, tr.Resuming td:first-child, tr.Restoring td:first-child { box-shadow:inset 3px 0 0 var(--warn); }
tr.Suspended td:first-child { box-shadow:inset 3px 0 0 var(--idle); }
.slug { font:600 17px var(--display); font-variation-settings:"wdth" 88; }
.role { display:inline-block; padding:0 7px; border-radius:3px; font-size:12px; font-weight:600; border:1px solid var(--line); color:var(--mut); }
.role.Owner { color:var(--accent-ink); background:var(--accent); border-color:var(--accent); }

/* ===== Widget thống kê ===== */
.widgets { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:20px; margin-bottom:20px; }
.widget { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--e1); overflow:hidden; border-top:4px solid var(--c); }
.widget .h { padding:14px 20px 0; font:600 44px/1.1 var(--display); font-variation-settings:"wdth" 82; }
.widget .b { padding:4px 20px 14px; color:var(--mut); }
.widget .b::before { content:""; display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--c); margin-right:8px; }

/* ===== Khung quản trị ===== */
.shell { display:grid; grid-template-columns:248px minmax(0,1fr); min-height:100vh; }
.side { background:var(--navy); color:var(--on-navy); display:flex; flex-direction:column; position:sticky; top:0; height:100vh; }
.side .brand { color:#fff; height:64px; padding:0 20px; border-bottom:1px solid var(--navy-2); }
.side nav { display:flex; flex-direction:column; padding:14px 0; gap:2px; }
.side nav a { display:flex; align-items:center; gap:14px; padding:0 20px; height:44px; color:var(--on-navy); text-decoration:none; font-weight:500; margin-right:12px; border-radius:0 22px 22px 0; }
.side nav a:hover { background:var(--navy-2); color:#fff; }
.side nav a.active { background:var(--accent); color:var(--accent-ink); font-weight:700; }
.side svg { width:20px; height:20px; fill:currentColor; flex:none; }
.main { display:flex; flex-direction:column; min-width:0; }
.toolbar { height:64px; background:var(--card); border-bottom:1px solid var(--line); box-shadow:var(--e1); display:flex; align-items:center; justify-content:space-between; padding:0 28px; position:sticky; top:0; z-index:5; }
.toolbar .title { font:600 20px var(--display); font-variation-settings:"wdth" 88; }
.toolbar .user { display:flex; align-items:center; gap:12px; }
.avatar { width:34px; height:34px; border-radius:50%; background:var(--navy); color:#fff; border:1px solid var(--line); display:grid; place-items:center; font-weight:600; }
.who { display:flex; flex-direction:column; align-items:flex-end; line-height:1.25; }
.who .role { margin-top:2px; }
.content { padding:28px; width:100%; min-width:0; }
.page-head { margin-bottom:22px; }

/* ===== Trang công khai ===== */
.auth { min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:22px; padding:32px 16px; }
.auth > .card { width:100%; max-width:420px; margin:0; padding:28px; }
.auth > .card h1 { margin-bottom:6px; }
.auth-wide > .brand { display:none; }
.split { width:100%; max-width:960px; display:grid; grid-template-columns:minmax(0,5fr) minmax(0,6fr); border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--card); box-shadow:var(--e1); }
.split .hero { padding:44px 36px; background:var(--navy); color:var(--on-navy); display:flex; flex-direction:column; gap:26px; }
.split .hero .brand { color:#fff; }
.split .hero h2 { font-size:30px; line-height:1.12; margin:0; color:#fff; }
.split .hero p { margin:0; }
.split .formside { padding:44px 36px; }
.split .formside h1 { font-size:24px; }
.seq { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.seq li { display:grid; grid-template-columns:16px 1fr; gap:2px 14px; padding:12px 0; border-top:1px solid #2b323d; color:#fff; font-weight:600; }
.seq li::before { content:""; width:12px; height:12px; margin-top:5px; border-radius:50%; background:#323a46; animation:lamp .4s ease forwards; animation-delay:calc(var(--i) * .8s + .4s); }
.seq li small { grid-column:2; color:var(--on-navy); font-weight:400; }
@keyframes lamp { to { background:var(--ok); box-shadow:0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); } }
.seq.light li { color:var(--ink); border-top-color:var(--line); }
.seq.light li small { color:var(--mut); }
.seq.light li::before { background:var(--line); }
.seq.loop li::before { animation:lamp-loop 3.6s ease-in-out infinite; animation-delay:calc(var(--i) * .9s); }
@keyframes lamp-loop { 0%,45% { background:var(--line); box-shadow:none; } 55%,100% { background:var(--warn); box-shadow:0 0 0 4px color-mix(in srgb, var(--warn) 25%, transparent); } }
.seq.done li::before { animation:none; background:var(--ok); box-shadow:0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
@media (prefers-reduced-motion: reduce) { .seq li::before { animation:none !important; background:var(--ok); } .seq.loop li::before { background:var(--warn) !important; } .badge::before { animation:none !important; } }
.pw-wrap { position:relative; display:block; }
.pw-wrap input { padding-right:64px; }
.pw-wrap button { position:absolute; right:5px; top:50%; transform:translateY(-50%); padding:3px 9px; font-size:12px; }
.checks { display:flex; flex-wrap:wrap; gap:4px 14px; font-size:12px; font-weight:400; }
.checks span { color:var(--mut); } .checks span.on { color:var(--ok); font-weight:600; }
.checks span::before { content:"○ "; } .checks span.on::before { content:"● "; }
.state h1 { margin-bottom:6px; }
.state .sub { margin-bottom:18px; }
.kv { background:var(--card-2); border:1px solid var(--line); border-radius:var(--radius); padding:8px 14px; margin:18px 0; }
.kv div { display:flex; justify-content:space-between; gap:12px; padding:5px 0; }
.kv div span:first-child { color:var(--mut); }

/* Bảng tenant: ngày, hạn dùng và dòng tag không xuống dòng */
#list td:nth-child(4), #list td:nth-child(5), #list .slug + .mut { white-space:nowrap; }

/* ===== Màn hình nhỏ ===== */
@media (max-width: 900px) {
  .shell { grid-template-columns:1fr; }
  .side { position:static; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center; }
  .side .brand { height:56px; border:0; }
  .side nav { flex-direction:row; flex-wrap:wrap; padding:0; }
  .side nav a { height:40px; margin:0; border-radius:4px; padding:0 12px; }
  .toolbar { position:static; padding:0 16px; }
  .content { padding:16px; }
  .widgets { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .split { grid-template-columns:1fr; }
  .split .hero, .split .formside { padding:26px 22px; }
  .split .hero h2 { font-size:24px; }
}

/* ===== Lớp hiện đại hoá: bo góc lớn, đổ bóng mềm, ít viền, khoảng thở rộng ===== */
:root {
  --bg:#f3f4f1; --card:#fff; --card-2:#f6f7f4; --line:#e6e8e2; --radius:14px;
  --e1:0 1px 2px rgba(23,27,33,.04), 0 4px 16px rgba(23,27,33,.06);
  --e2:0 8px 28px rgba(23,27,33,.12);
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#0d1014; --card:#161b22; --card-2:#1b212a; --line:#242b35; --e1:0 1px 0 rgba(255,255,255,.03) inset, 0 6px 20px rgba(0,0,0,.35); }
}
body { font-size:14px; letter-spacing:.005em; }
.card, .widget { border:0; box-shadow:var(--e1); }
.card { padding:24px; }
.card-title { margin:-24px -24px 16px; padding:16px 24px; background:transparent; font:600 16px var(--display); }
details.card > summary { padding:16px 24px; font-family:var(--display); font-size:16px; }
details.card[open] > summary { background:transparent; }
details.card > .body { padding:4px 24px 24px; }
.tbl { margin:-24px; }
.card-title + .tbl { margin-top:0; }
th { background:transparent; text-transform:uppercase; letter-spacing:.06em; font-size:11px; padding:14px 18px; border-bottom:1px solid var(--line); }
td { padding:16px 18px; border-bottom:1px solid var(--line); }
tbody tr:hover { background:color-mix(in srgb, var(--accent) 5%, transparent); }
tr.Active td:first-child, tr.Failed td:first-child, tr.DeleteFailed td:first-child, tr.UpdateFailed td:first-child, tr.RestoreFailed td:first-child,
tr.Pending td:first-child, tr.Provisioning td:first-child, tr.Deleting td:first-child, tr.Updating td:first-child,
tr.Suspending td:first-child, tr.Resuming td:first-child, tr.Restoring td:first-child, tr.Suspended td:first-child { box-shadow:none; }

/* Nút / ô nhập */
input, select { border:1px solid transparent; background:var(--card-2); border-radius:10px; padding:10px 12px; transition:border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover { border-color:var(--line); }
input:focus, select:focus { outline:0; border-color:var(--accent); background:var(--card); box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
button, a.btn { border-radius:10px; padding:9px 18px; transition:transform .1s, box-shadow .15s, background .15s, filter .15s; }
button:not(.ghost):not(.danger):not(:disabled):hover { box-shadow:0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent); filter:none; transform:translateY(-1px); }
button.ghost, a.btn { background:var(--card-2); border-color:transparent; }
button.ghost:hover, a.btn:hover { background:color-mix(in srgb, var(--ink) 9%, var(--card-2)); border-color:transparent; }
button.danger { background:color-mix(in srgb, var(--bad) 10%, transparent); border-color:transparent; }
button.small, a.btn.small { padding:5px 12px; border-radius:8px; }
input.mini { border-radius:8px; }

/* Trạng thái dạng viên thuốc */
.badge { padding:4px 12px 4px 10px; border-radius:999px; }
.badge::before { width:8px; height:8px; box-shadow:0 0 0 3px color-mix(in srgb, var(--c, var(--idle)) 25%, transparent); }
.role { border-radius:999px; padding:1px 9px; border:0; background:var(--card-2); }
.notice { border-radius:12px; }
.pw { border-radius:8px; }
pre, code { border-radius:8px; }

/* Widget: số lớn + vòng màu mờ */
.widgets { gap:22px; }
.widget { position:relative; border-top:0; border-radius:var(--radius); padding:4px 0 6px; }
.widget::after { content:""; position:absolute; right:-28px; top:-28px; width:120px; height:120px; border-radius:50%; background:var(--c); opacity:.1; }
.widget .h { padding:18px 24px 0; font-size:46px; position:relative; z-index:1; }
.widget .b { padding:2px 24px 18px; font-size:13px; position:relative; z-index:1; }
.widget .b::before { width:8px; height:8px; }

/* Khung: thanh bên bo tròn, toolbar nhẹ */
.side { background:linear-gradient(180deg, var(--navy), var(--navy-2)); }
.side .brand { border-bottom:0; height:72px; }
.logo { border-radius:10px; box-shadow:0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent); }
.side nav { padding:8px 14px; gap:4px; }
.side nav a { margin:0; height:42px; border-radius:10px; padding:0 14px; transition:background .15s, color .15s; }
.side nav a:hover { background:rgba(255,255,255,.07); }
.side nav a.active { background:var(--accent); color:var(--accent-ink); box-shadow:0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.toolbar { background:color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter:blur(10px); box-shadow:none; border-bottom:1px solid var(--line); height:68px; }
.avatar { background:var(--accent); color:var(--accent-ink); border:0; font-weight:800; }
.content { padding:32px; }
.split { border-radius:18px; box-shadow:var(--e2); border:0; }
.auth > .card { border-radius:18px; box-shadow:var(--e2); }
@media (max-width: 900px) {
  .widgets { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .content { padding:18px; }
}

/* Cột thao tác gọn: nút cách đều, link không gạch chân */
#list td.act { width:1%; white-space:nowrap; }
#list td, #list th { padding-left:14px; padding-right:14px; }
#list td { vertical-align:middle; }
td a:not(.btn) { color:var(--link); text-decoration:none; font-weight:600; font-size:12px; margin-right:6px; }
td a:not(.btn):hover { text-decoration:underline; }

/* Người dùng ở cuối thanh bên */
.side nav { flex:1; }
.side .me { display:flex; align-items:center; gap:10px; margin:12px; padding:12px; border-radius:12px; background:rgba(255,255,255,.06); }
.side .me .who { align-items:flex-start; flex:1; min-width:0; color:#fff; }
.side .me .who strong { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
.side .me .role { background:rgba(255,255,255,.1); color:var(--on-navy); }
.side .me .role.Owner { background:var(--accent); color:var(--accent-ink); }
.side .me .avatar { flex:none; }
.side .me form { margin:0; }
button.out { padding:6px; background:transparent; border:0; color:var(--on-navy); border-radius:8px; }
button.out:hover { background:rgba(255,255,255,.1); color:#fff; box-shadow:none; transform:none; }
button.out svg { width:20px; height:20px; fill:currentColor; }
.toolbar { justify-content:flex-start; }

/* Cảnh báo vận hành + nhật ký */
.alerts ul { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.alerts li { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:10px; background:color-mix(in srgb, var(--c) 10%, transparent); }
.alerts li.warn { --c:var(--warn); } .alerts li.bad { --c:var(--bad); }
.alerts .dot { width:8px; height:8px; border-radius:50%; background:var(--c); flex:none; }
.nw { white-space:nowrap; }

/* Trang chi tiết tenant */
.widgets.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.widget.ok { --c:var(--ok); } .widget.warn { --c:var(--warn); } .widget.bad { --c:var(--bad); } .widget.idle { --c:var(--idle); }
.widget .h.sm { font-size:20px; padding-top:20px; }
.widget .b div + div { margin-top:2px; }
.widgets.three .widget .b::before { display:none; }
.bar { height:8px; border-radius:99px; background:var(--card-2); overflow:hidden; margin:8px 0 4px; }
.bar i { display:block; height:100%; background:var(--c); border-radius:99px; }
pre.logs { max-width:none; max-height:520px; overflow:auto; margin-top:16px; font-size:12px; line-height:1.55; white-space:pre; word-break:normal; background:#0d1014; color:#cfd6df; border:0; border-radius:12px; padding:16px; }
@media (max-width: 900px) { .widgets.three { grid-template-columns:1fr; } }

/* Gói & giới hạn */
.role.plan { margin-left:8px; vertical-align:middle; }
.usage { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
.bar.warn { --c:var(--warn); } .bar.bad { --c:var(--bad); } .bar { --c:var(--ok); }
@media (max-width: 700px) { .usage { grid-template-columns:1fr; } }

/* Cột thao tác: nút chính + menu "⋯" */
.acts { display:flex; align-items:center; justify-content:flex-end; gap:6px; }
.acts form { margin:0; }
form.expiry { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
details.menu { position:relative; }
details.menu > summary { list-style:none; cursor:pointer; padding:5px 11px; font-size:16px; line-height:1; font-weight:700; }
details.menu > summary::-webkit-details-marker { display:none; }
details.menu[open] > summary { background:color-mix(in srgb, var(--ink) 12%, var(--card-2)); }
.pop { position:absolute; right:0; top:calc(100% + 6px); z-index:20; min-width:200px; padding:6px; background:var(--card); border-radius:12px; box-shadow:var(--e2); border:1px solid var(--line); display:flex; flex-direction:column; gap:2px; }
.pop a, .pop button { display:block; width:100%; text-align:left; padding:8px 12px; border:0; border-radius:8px; background:transparent; color:var(--ink); font:inherit; font-size:13px; font-weight:500; text-decoration:none; cursor:pointer; box-shadow:none; transform:none; }
.pop a:hover, .pop button:hover { background:var(--card-2); box-shadow:none; transform:none; filter:none; }
.pop button.del { color:var(--bad); }
.pop button.del:hover { background:color-mix(in srgb, var(--bad) 12%, transparent); }
.pop hr { border:0; border-top:1px solid var(--line); margin:4px 0; }
@media (min-width: 1000px) { .tbl { overflow:visible; } }
[hidden] { display:none !important; }
td .pop a { color:var(--ink); font-size:13px; font-weight:500; margin:0; }
.mini.s { width:84px; }

/* Thông tin khách đăng ký */
textarea { padding:10px 12px; border:1px solid transparent; border-radius:10px; background:var(--card-2); color:var(--ink); font:inherit; width:100%; resize:vertical; transition:border-color .15s, box-shadow .15s, background .15s; }
textarea:hover { border-color:var(--line); }
textarea:focus { outline:0; border-color:var(--accent); background:var(--card); box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.co { font-weight:600; font-size:13px; }

/* Form đăng ký: lưới 2 cột đều, hàng đầy đủ dùng .span2 */
.fgrid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px 16px; align-items:start; }
.fgrid > label { margin-bottom:0; flex:none; }
.fgrid .span2 { grid-column:1 / -1; }
.fgrid .hint { display:block; color:var(--mut); font-size:12px; line-height:1.4; }
.fgrid .checks { display:flex; flex-wrap:wrap; gap:6px 14px; font-size:12px; }
.fgrid .pw-wrap { display:flex; gap:8px; }
.fgrid .pw-wrap input { flex:1 1 auto; min-width:0; }
.fgrid .pw-wrap button { flex:none; padding:8px 12px; }
.split .formside { display:flex; flex-direction:column; justify-content:center; }
.split { max-width:1040px; }
@media (max-width: 640px) { .fgrid { grid-template-columns:1fr; } }

/* Các bước tạo hệ thống: xong = xanh, đang chạy = vàng nhấp nháy, chưa tới = xám */
.seq.steps li::before { animation:none; background:var(--line); transition:background .3s, box-shadow .3s; }
.seq.steps li.ok::before { background:var(--ok); box-shadow:0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.seq.steps li.cur::before { background:var(--warn); box-shadow:0 0 0 4px color-mix(in srgb, var(--warn) 25%, transparent); animation:blink 1.2s ease-in-out infinite; }
.seq.steps li:not(.ok):not(.cur) { color:var(--mut); }
@media (prefers-reduced-motion: reduce) { .seq.steps li.cur::before { animation:none !important; } }

/* Hộp thoại xác nhận (site.js) */
.dlg-back { position:fixed; inset:0; z-index:1000; display:flex; align-items:center; justify-content:center; padding:16px;
  background:rgba(10,12,16,.55); backdrop-filter:blur(3px); animation:dlg-fade .14s ease-out; }
.dlg-back.out { opacity:0; transition:opacity .12s; }
.dlg { width:min(440px,100%); display:grid; grid-template-columns:auto 1fr; gap:4px 16px; padding:22px 22px 18px;
  background:var(--card); color:var(--ink); border:1px solid var(--line); border-radius:16px; box-shadow:0 24px 60px rgba(0,0,0,.35); animation:dlg-pop .16s ease-out; }
.dlg-ico { grid-row:1; width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font:700 20px var(--display); background:color-mix(in srgb, var(--accent) 22%, transparent); color:var(--link); }
.dlg-ico.bad { background:color-mix(in srgb, var(--bad) 16%, transparent); color:var(--bad); }
.dlg-body h3 { margin:2px 0 6px; font-size:17px; }
.dlg-body p { margin:0; color:var(--mut); line-height:1.55; white-space:pre-line; overflow-wrap:anywhere; }
.dlg-act { grid-column:1 / -1; display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
button.danger.solid { background:var(--bad); color:var(--on-c); border-color:var(--bad); }
button.danger.solid:hover { filter:brightness(1.08); background:var(--bad); }
@keyframes dlg-fade { from { opacity:0 } }
@keyframes dlg-pop { from { opacity:0; transform:translateY(8px) scale(.97) } }
@media (prefers-reduced-motion:reduce) { .dlg-back, .dlg { animation:none } }

/* Trang Cấu hình: lưới đều, nhãn trên, ô nhập thẳng hàng, ghi chú dưới */
.sgrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:18px 20px; align-items:start; }
.sgrid > label { margin:0; flex:none; min-width:0; }
.sgrid > label.wide { grid-column:1 / -1; }
.sgrid input, .sgrid select { width:100%; }
.sgrid small { font-weight:400; line-height:1.45; }
.sgrid small input[type=checkbox] { width:auto; vertical-align:-2px; margin-right:6px; }
.sgrid > label.mod { color:var(--link); }
.sgrid > label.mod input:not([type=checkbox]), .sgrid > label.mod select { border-color:var(--accent); background:color-mix(in srgb, var(--accent) 10%, var(--card-2)); color:var(--ink); }
.mod-key { color:var(--link); font-weight:600; }
