/* system: cài đặt (st-), tên miền link (dm-, bt-), tài khoản nội bộ (us-), nhật ký (au-), sao lưu (bk-) */

/* ---- Cài đặt */
.st-search { position: relative; flex: 0 1 340px; min-width: 0; }
.page-head .st-search input[type=search] { width: 100%; padding-right: 34px; }
.st-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 11px/1 ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; background: var(--surface-2); pointer-events: none; }
.st-health { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; padding: 14px 16px; }
.st-ring { --p: 0; flex: none; width: 72px; height: 72px; border-radius: 50%; display: grid; place-content: center; text-align: center; line-height: 1.1;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%), conic-gradient(#f59e0b calc(var(--p) * 1%), var(--surface-2) 0); }
.st-health.ok .st-ring { background: radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%), conic-gradient(var(--ok) 100%, var(--surface-2) 0); }
.st-ring b { font-size: 17px; } .st-ring small { font-size: 11px; color: var(--muted); }
.st-hbody { min-width: 0; flex: 1; }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.st-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text); }
.st-chip:hover { border-color: var(--brand-2); }
.st-chip.done { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.st-chip.red { background: #fef2f2; border-color: #fecaca; color: #b91c1c; font-weight: 600; }
.st-chip.amber { background: #fffbeb; border-color: #fde68a; color: #b45309; font-weight: 600; }
.st-chip.opt { color: var(--muted); border-style: dashed; }
.st-chip i { font-style: normal; font-size: 11px; opacity: .75; }
.st-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.st-nav { position: sticky; top: 16px; display: grid; gap: 2px; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); padding: 6px; }
.st-nb { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.st-nb:hover { background: var(--surface-2); }
.st-nb.on { background: #eff6ff; box-shadow: inset 3px 0 0 var(--brand-2); }
.st-nb.on b { color: var(--brand-2); }
.st-nl { min-width: 0; flex: 1; display: grid; }
.st-nl b { font-size: 14px; font-weight: 600; }
.st-nl small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-ico { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); font-size: 16px; }
.st-ico.big { width: 42px; height: 42px; font-size: 22px; border-radius: 10px; }
.st-bad { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.st-main { min-width: 0; }
.st-main form > .card + .card { margin-top: 14px; }
.st-card { padding: 0 0 4px; overflow: hidden; }
.st-gh { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.st-gh > div { flex: 1; min-width: 0; }
.st-gh h3 { margin: 0; font-size: 17px; color: var(--brand); }
.st-gh p { margin: 2px 0 0; }
.st-card > .cu-tip { margin: 12px 18px 0; box-shadow: none; background: var(--surface-2); }
.st-sec { margin: 0; padding: 16px 18px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.st-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 6px 20px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); position: relative; transition: background .2s; }
.st-sec + .st-row { border-top: 0; }
.st-row.wide { grid-template-columns: minmax(0, 1fr); }
.st-row.chk .st-ctl { justify-self: end; }
.st-row.chg { background: #fffbeb; }
.st-row.chg::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #f59e0b; }
.st-row.flash { animation: st-flash 1.6s ease; }
@keyframes st-flash { 0%, 40% { background: #dbeafe; } 100% { background: transparent; } }
.st-row.st-off { display: none; }
.st-lab label { font-weight: 600; font-size: 14px; color: var(--text); }
.st-lab small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.st-lab mark, .st-row mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 1px; }
.st-ipd { color: var(--brand-2) !important; }
.st-ctl { min-width: 0; }
.st-ctl > select, .st-ctl > textarea, .st-ctl input { width: 100%; }
.st-in { display: flex; align-items: stretch; }
.st-in.u input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.st-in em { font-style: normal; display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.st-secret { display: flex; gap: 6px; align-items: center; }
.st-secret input { flex: 1; min-width: 0; }
.st-secret input[readonly] { background: var(--surface-2); color: var(--muted); letter-spacing: .15em; }
.st-secret .pill { white-space: nowrap; }
.st-tool { margin: 12px 18px 4px; display: grid; gap: 8px; }
.st-tool > .cu-tip { box-shadow: none; background: var(--surface-2); }
.st-url { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed #bfdbfe; background: #f5f9ff; border-radius: 10px; }
.st-url > span:first-child { font-size: 12px; font-weight: 700; color: var(--brand-2); text-transform: uppercase; letter-spacing: .03em; }
.st-url code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.st-url small { flex-basis: 100%; }
.st-url input[type=email] { flex: 1; min-width: 160px; }
.st-qr { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.st-qr img { flex: none; border-radius: 6px; background: var(--surface-2); }
.st-found { margin: 0 0 8px; }
.st-save { position: sticky; bottom: 12px; z-index: 20; display: none; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border-radius: 14px; background: var(--brand); color: #fff; box-shadow: 0 12px 30px rgb(2 35 82 / 35%); }
.st-save.on { display: flex; animation: st-up .18s ease; }
@keyframes st-up { from { transform: translateY(8px); opacity: 0; } }
.st-save .btn.ghost { color: #fff; border-color: rgb(255 255 255 / 35%); background: transparent; }
.st-save .btn.primary { background: #fff; color: var(--brand); border-color: #fff; }
.st-save #st-dirty b { color: #fde68a; }
.st-acc { display: grid; gap: 6px; }
.st-accb { display: flex; justify-content: space-between; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 12px; cursor: pointer; font: inherit; }
.st-accb:hover { border-color: var(--brand-2); background: #eff6ff; }
@media (max-width: 900px) {
  .st-wrap { grid-template-columns: minmax(0, 1fr); }
  .st-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 4px; scrollbar-width: none; }
  .st-nav::-webkit-scrollbar { display: none; }
  .st-nb { flex: none; width: auto; padding: 6px 10px; }
  .st-nb small { display: none; }
  .st-nb .st-ico { width: 24px; height: 24px; font-size: 14px; }
  .st-nb.on { box-shadow: inset 0 -3px 0 var(--brand-2); }
  .st-search { flex-basis: 100%; }
  .st-row { grid-template-columns: minmax(0, 1fr); padding: 10px 14px; }
  .st-row.chk { grid-template-columns: minmax(0, 1fr) auto; }
  .st-gh, .st-sec { padding-left: 14px; padding-right: 14px; }
  .st-tool, .st-card > .cu-tip { margin-left: 14px; margin-right: 14px; }
  .st-health { padding: 12px; gap: 12px; align-items: flex-start; }
  .st-ring { width: 58px; height: 58px; }
  .st-chip.done { display: none; }
  .st-chips { gap: 4px; }
  .st-url code { flex-basis: 100%; }
  .st-url > span:first-child { flex-basis: 100%; }
  .st-save { bottom: calc(8px + var(--sab, 0px)); }
}

/* ---- Tên miền link */
.dm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 14px; }
.dm-card { display: grid; gap: 8px; align-content: start; border-top: 3px solid var(--line); }
.dm-card.st-active { border-top-color: var(--ok); }
.dm-card.st-blocked { border-top-color: var(--danger); background: linear-gradient(180deg, #fff7f7, var(--surface) 60px); }
.dm-card.st-disabled { opacity: .78; }
.dm-card.prim { box-shadow: 0 0 0 2px #bfdbfe, var(--shadow); }
.dm-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dm-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.dm-name b { font-size: 17px; overflow-wrap: anywhere; color: var(--brand); }
.dm-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.dm-note { text-align: left; border: 1px dashed transparent; background: var(--surface-2); border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.dm-note:hover { border-color: var(--line); }
.dm-st { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.dm-st button { border: 0; background: var(--surface); padding: 6px 4px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.dm-st button + button { border-left: 1px solid var(--line); }
.dm-st button:hover { background: var(--surface-2); color: var(--text); }
.dm-st button.on.k-active { background: #ecfdf5; color: #047857; font-weight: 700; }
.dm-st button.on.k-blocked { background: #fef2f2; color: #b91c1c; font-weight: 700; }
.dm-st button.on.k-disabled { background: #f1f5f9; color: #334155; font-weight: 700; }
.dm-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-res { border-radius: 8px; padding: 8px 10px; display: grid; gap: 3px; font-size: 13px; border: 1px solid var(--line); }
.dm-res.green { background: #ecfdf5; border-color: #a7f3d0; } .dm-res.green > b { color: #047857; }
.dm-res.red { background: #fef2f2; border-color: #fecaca; } .dm-res.red > b { color: #b91c1c; }
.dm-res.amber { background: #fffbeb; border-color: #fde68a; } .dm-res.amber > b { color: #b45309; }
.dm-res.blue { background: #eff6ff; border-color: #bfdbfe; }
.dm-res code { overflow-wrap: anywhere; }
.dm-steps { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.dm-dns { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.dm-dns code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.bt-list { display: grid; margin-top: 10px; }
.bt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.bt-row b { overflow-wrap: anywhere; }
.bt-row a.pill { text-decoration: none; }

/* ---- Tài khoản nội bộ */
.us-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.us-card { display: grid; gap: 10px; align-content: start; }
.us-card.off { background: var(--surface-2); }
.us-card.off .cu-av { filter: grayscale(1); opacity: .6; }
.us-card header { display: flex; align-items: center; gap: 10px; }
.us-who { flex: 1; min-width: 0; display: grid; }
.us-who b { font-size: 15px; }
.us-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.us-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.us-dl .w { grid-column: 1 / -1; }
.us-dl dt { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.us-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.us-card footer { display: flex; flex-wrap: wrap; gap: 6px; }
.us-matrix { margin-top: 16px; }
.us-matrix td.center, .us-matrix th.center { text-align: center; }
.us-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.us-roles > div { display: grid; gap: 4px; justify-items: start; }
.us-pw { display: flex; gap: 6px; }
.us-pw input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; letter-spacing: .03em; }

/* ---- Nhật ký */
.au-filters { margin-bottom: 12px; padding: 12px; }
.au-filters input[type=search] { width: auto; }
.au-filters select, .au-filters input[type=date] { width: auto; flex: none; max-width: 100%; }
.au-list { padding: 0; overflow: hidden; }
.au-row { display: grid; grid-template-columns: 74px 170px minmax(0, 1fr) 56px; gap: 12px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line); }
.au-row:first-child { border-top: 0; }
.au-row:hover { background: var(--surface-2); }
.au-row.err { background: #fff7f7; }
.au-t, .au-who { display: grid; min-width: 0; }
.au-u { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); text-align: left; min-width: 0; overflow-wrap: anywhere; }
.au-u:hover { color: var(--brand-2); }
.au-a { min-width: 0; }
.au-a code { overflow-wrap: anywhere; }
.au-d { margin-top: 3px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.au-d:hover { -webkit-line-clamp: unset; }
.au-s { text-align: right; }
.au-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }
@media (max-width: 700px) {
  .au-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .au-t { grid-column: 1; grid-row: 1; display: flex; gap: 6px; align-items: baseline; }
  .au-s { grid-column: 2; grid-row: 1; }
  .au-who { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
  .au-a { grid-column: 1 / -1; }
  .au-filters input[type=date] { flex: 1; min-width: 0; }
  .bt-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bt-row > .pill, .bt-row > a.pill { grid-row: 2; justify-self: start; }
  .us-grid, .dm-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Sao lưu */
.bk-list { padding: 0; overflow: hidden; }
.bk-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.bk-row.cm-head { border-top: 0; }
.bk-name { overflow-wrap: anywhere; font-size: 13.5px; }
.bk-acts { display: flex; gap: 6px; justify-content: flex-end; }
.bk-f { display: grid; gap: 10px; }
.bk-f .btn { justify-self: start; }
.bk-dir { overflow-wrap: anywhere; font-size: 11.5px; }
.bk-steps { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 6px; }
@media (max-width: 700px) {
  .bk-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bk-row > div:nth-child(2) { grid-row: 2; }
  .bk-row.cm-head > div:nth-child(2) { display: none; }
}
@media (max-width: 700px) { #us-q { max-width: none !important; margin-left: 0 !important; flex: 1 1 100%; } }

/* ---- Sao lưu & lưu trữ ngoài (admin-backups.js) */
.bk-dots { display: flex; gap: 10px; font-size: 15px !important; flex-wrap: wrap; }
.bk-dot { color: var(--muted); font-weight: 600; }
.bk-dot.on { color: var(--ok); }
.bk-restore { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.bk-restore > div { flex: 1; min-width: 260px; }
.bk-flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.bk-step { display: inline-grid; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
.bk-step small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.bk-step.on { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.bk-arrow { color: var(--muted); font-size: 18px; }
.bk-sf { display: grid; gap: 10px; }
.bk-sf .switch { font-size: 13px; align-items: flex-start; }
.bk-sf .switch > span:first-of-type { margin-top: 1px; }
.bk-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bk-msg:empty { display: none; }
.bk-msg { padding: 8px 10px; border-radius: 8px; }
.bk-msg.ok-box { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.bk-msg.bad-box { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.bk-pre { flex: 1; min-width: 0; margin: 0; max-height: 180px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); padding: 8px; border-radius: 8px; font-size: 11px; }
.bk-rlist { display: grid; gap: 0; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; max-height: 320px; overflow: auto; }
.bk-rrow { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--line); }
.bk-rrow:first-child { border-top: 0; }
.bk-rrow > div:first-child { min-width: 0; }
.bk-kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; font-size: 13px; max-width: 520px; }
.bk-kv span { color: var(--muted); }
.bk-log { display: grid; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.bk-log > div { display: grid; grid-template-columns: 120px 22px minmax(0, 1fr); gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); align-items: start; }
.bk-log > div:first-child { border-top: 0; }
.bk-log > div.bad { background: #fff7ed; }
.rs-wait { text-align: center; padding: 16px; }
.rs-spin { width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-2); animation: rs-spin .8s linear infinite; }
@keyframes rs-spin { to { transform: rotate(360deg); } }
.rs-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.rs-cmp { width: 100%; font-size: 13px; }
.rs-cmp td, .rs-cmp th { padding: 5px 8px; }
.rs-opt { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 6px 0; cursor: pointer; }
.rs-opt input { margin-top: 3px; }
@media (max-width: 700px) {
  .bk-2 { grid-template-columns: 1fr; }
  .bk-arrow { display: none; }
  .bk-log > div { grid-template-columns: 1fr; gap: 2px; }
  .rs-form .grid-form { grid-template-columns: 1fr !important; }
}
@media (max-width: 700px) {
  .bk-list .bk-row:not(.cm-head) { grid-template-columns: minmax(0, 1fr) 90px; }
  .bk-list .bk-row:not(.cm-head) .bk-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .bk-list .bk-row.cm-head > :nth-child(2) { display: none; }
  .bk-rrow { flex-wrap: wrap; }
}
