/* OpenLink Owner Admin (2.5.0 UI) – cùng design system với extension (tokens.css). Chỉ giao diện, không đổi logic / API. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.topbar {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 10px var(--sp-6); background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: var(--fw-bold); font-size: var(--fs-lg); white-space: nowrap; }
.brand .logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--accent-strong); color: var(--on-accent); font-size: 12px; letter-spacing: .5px; }
.brand > span:last-child { color: var(--muted); font-weight: var(--fw-medium); font-size: var(--fs-xs); }
.nav-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; min-width: 0; }
nav button { background: transparent; border: 0; padding: 0 12px; min-height: 32px; border-radius: var(--r-md); color: var(--muted); font-weight: var(--fw-semi); }
nav button:hover { background: var(--surface-2); color: var(--text); }
nav button.active { background: var(--accent-soft); color: var(--accent); }
main { max-width: 1160px; margin: 0 auto; padding: var(--sp-5) var(--sp-6) 48px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--sh-1); min-width: 0; }
.card .card { background: var(--surface-2); box-shadow: none; padding: var(--sp-3) var(--sp-4); }
.card.narrow { max-width: 420px; margin: 72px auto; padding: var(--sp-6); }
h1 { font-size: var(--fs-xl); margin: 0 0 var(--sp-2); }
h2 { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-lg); margin: 0 0 var(--sp-3); }
h3 { font-size: var(--fs-md); margin: 0 0 var(--sp-2); }
.muted { color: var(--muted); font-size: var(--fs-sm); }
code { font-family: var(--mono); background: var(--surface-3); padding: 1px 6px; border-radius: var(--r-sm); font-size: 12px; word-break: break-all; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: var(--fw-semi); font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--sp-3); }
label.check { flex-direction: row; align-items: center; gap: var(--sp-2); font-weight: var(--fw-medium); color: var(--text); margin-bottom: var(--sp-2); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 0 10px; min-height: var(--ctl-h); min-width: 0;
  transition: border-color var(--dur), box-shadow var(--dur);
}
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent-strong); flex: none; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder { color: var(--muted); }
button {
  font: inherit; font-size: var(--fs-md); font-weight: var(--fw-semi); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}
button:hover { background: var(--surface-3); border-color: var(--muted); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button.primary { background: var(--accent-strong); color: var(--on-accent); border-color: transparent; }
button.primary:hover { background: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-2); color: var(--text); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: transparent; }
button.danger:hover { background: var(--bad-soft); }
button.small { min-height: var(--ctl-h-sm); padding: 0 10px; font-size: var(--fs-sm); }
button:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
form.inline input, form.inline select { flex: 1; min-width: 180px; }
.grid { display: grid; gap: var(--sp-4); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: var(--sp-4); }
.grid.stats .card { margin: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.two .card { margin: 0 0 var(--sp-4); }
.stat .label { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: .3px; }
.stat .value { font-size: 28px; font-weight: var(--fw-bold); }
.kv div { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: .3px; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions button { margin-left: 4px; }
.table a { color: var(--accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table .title { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.card:has(> .table) { overflow-x: auto; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semi); background: var(--surface-3); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.empty { text-align: center; padding: var(--sp-3) 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.row-end { display: flex; justify-content: flex-end; margin-top: var(--sp-3); }
.steps li { margin-bottom: 6px; color: var(--text-2); }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--r-full); transition: background var(--dur); cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform var(--dur); }
.switch input:checked + span { background: var(--ok); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }
dialog { border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); max-width: 560px; width: calc(100% - 32px); padding: var(--sp-5); box-shadow: var(--sh-2); }
dialog::backdrop { background: rgba(3, 6, 12, .6); }
.secret-box { display: flex; gap: var(--sp-2); align-items: center; margin-top: 10px; }
.secret-box code { flex: 1; padding: 10px; font-size: 13px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); border-left: 3px solid var(--ok); padding: 10px 16px; border-radius: var(--r-md); font-weight: var(--fw-semi); box-shadow: var(--sh-2); z-index: 20; }
#toast.bad { border-left-color: var(--bad); }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px var(--sp-4); gap: var(--sp-2); }
  .nav-wrap { order: 3; flex-basis: 100%; }
  nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; scroll-padding-inline: 28px; }
  nav::-webkit-scrollbar { display: none; }
  nav button { flex: none; white-space: nowrap; }
  /* còn mục bị che → mép mờ + mũi tên (JS bật more-left / more-right theo vị trí cuộn) */
  .nav-wrap::before, .nav-wrap::after {
    position: absolute; top: 0; bottom: 0; width: 34px; display: flex; align-items: center; z-index: 1;
    pointer-events: none; opacity: 0; transition: opacity var(--dur); color: var(--accent); font-weight: var(--fw-bold); font-size: 18px;
  }
  .nav-wrap::before { content: "‹"; left: 0; justify-content: flex-start; padding-left: 2px; background: linear-gradient(90deg, var(--surface) 45%, transparent); }
  .nav-wrap::after { content: "›"; right: 0; justify-content: flex-end; padding-right: 2px; background: linear-gradient(270deg, var(--surface) 45%, transparent); }
  .nav-wrap.more-left::before, .nav-wrap.more-right::after { opacity: 1; }
  #logoutBtn { margin-left: auto; }
  main { padding: var(--sp-4) var(--sp-3) 40px; }
  .card { padding: var(--sp-3) var(--sp-4); }
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .table td { display: block; border: 0; padding: 3px 0; }
  .table td.actions { text-align: left; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-semi); margin-right: 6px; }
}

/* 2.5.0: member / license / quyền kênh */
div.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-2) 0; }
#memberList > .card > h2 { margin-bottom: var(--sp-2); }
#memberList .card .card { margin-top: var(--sp-3); margin-bottom: 0; }
.member-subs { margin: var(--sp-2) 0 0; }
.member-subs b { color: var(--text); }
.notice { display: block; margin: var(--sp-3) 0; padding: 9px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); font-weight: var(--fw-semi); line-height: 1.5; }
.notice.warn-note { background: var(--surface-2); color: var(--text-2); font-weight: 400; border: 1px solid var(--border); }
.notice.warn-note b { color: var(--warn); }
#bindingNotice { display: block; white-space: normal; padding: 8px 12px; border-radius: var(--r-md); line-height: 1.45; }
#autoGlobalBtn { border-color: var(--bad); }
