.access-page {
  --access-nav-width: 256px;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

.access-page *, .access-page *::before, .access-page *::after { box-sizing: border-box; }
.access-page [hidden] { display: none !important; }
.access-page :is(h1, h2, p) { margin: 0; }
.access-page h1 { color: var(--console-title); font-size: 1.5rem; line-height: 2rem; font-weight: 700; }
.access-page h2 { font-size: .9rem; font-weight: 600; }
.access-page a { color: var(--console-accent); text-decoration: none; }
.access-page a:hover { text-decoration: underline; }
.access-page :is(button:not([role="tab"]), input, textarea, select) { font: inherit; }

.access-page :is(button:not([role="tab"]), .button-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: .5rem .9rem;
  border: 1px solid var(--console-border);
  border-radius: .625rem;
  background: #fff;
  color: #374151;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.access-page :is(button:not([role="tab"]), .button-link):hover { background: #f3f4f6; text-decoration: none; }
.access-page button:disabled { opacity: .5; cursor: default; }
.access-page :is(button, a):focus-visible { outline: 2px solid var(--console-accent); outline-offset: 2px; }
.access-page button.primary { color: #fff; background: var(--console-primary); border-color: var(--console-primary); }
.access-page button.primary:hover { background: #1d4ed8; }

.access-page label { display: flex; flex-direction: column; gap: 5px; color: var(--console-muted); font-size: .8125rem; }
.access-page :is(input, select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: .5rem .75rem;
  border: 1px solid var(--console-border);
  border-radius: .5rem;
  color: var(--console-text);
  background: #fff;
  font-size: .875rem;
}

.access-page :is(input, select, textarea):focus {
  outline: none;
  border-color: var(--console-accent);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, .15);
}

.console-icon { width: 20px; height: 20px; flex: 0 0 auto; }
.console-brand-mark .console-icon { width: 24px; height: 24px; }
.access-brand { display: flex; align-items: center; gap: 12px; }
.login-layout { display: grid; place-items: center; min-height: 100svh; padding: 20px; }
.login-panel { display: grid; width: min(100%, 396px); gap: 16px; padding: 28px; }
.login-panel .access-brand { margin-bottom: 4px; }
.login-panel .primary { min-height: 40px; }

.access-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: var(--access-nav-width);
  overflow-y: auto;
}

.access-sidebar .access-brand { padding: 24px; }
.access-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; padding: 0 12px 12px; }
.access-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: .5rem;
  color: var(--console-muted);
  font-size: 1rem;
  font-weight: 500;
}

.access-nav .nav-item:hover { color: var(--console-title); background-color: #f4f6fa; text-decoration: none; }
.access-nav .nav-item:focus-visible { outline-offset: -2px; }
.access-main { width: 100%; max-width: 760px; margin-inline: auto; padding: 32px; }
.has-workspace .access-main { width: auto; max-width: none; margin-inline: var(--access-nav-width) 0; }
.compact-brand { margin-bottom: 24px; }
.has-workspace .compact-brand { display: none; }
.access-header, .profile, .access-actions, .profile-name { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.access-header, .profile { justify-content: space-between; }
.access-header { min-height: 32px; margin-bottom: 24px; }
.access-page .access-header :is(button, .button-link) { min-height: 32px; padding-block: 4px; }
.has-workspace #workspaceLink { display: none; }
.has-workspace #workspaceLink.workspace-entry { display: inline-flex; background: var(--console-primary); color: #fff; }
.access-workbench { padding: 24px; }
.profile { gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--console-border); }
.profile-content { min-width: 0; }
.profile h2 { overflow-wrap: anywhere; }
.profile p { margin-top: 4px; color: var(--console-muted); font-size: .8125rem; }

.access-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}

.access-status:empty { display: none; }
.access-status[data-state="admin"], .access-status[data-state="unused"] { background: #dbeafe; color: #1e40af; }
.access-status[data-state="active"], .access-status[data-state="used"] { background: #d1fae5; color: #065f46; }
.access-status[data-state="expired"], .access-status[data-state="inactive"] { background: #fef3c7; color: #92400e; }
.access-status[data-state="disabled"] { background: #fee2e2; color: #991b1b; }
.access-tabs { margin-bottom: 20px; }
.access-tabs button { background: transparent; font-family: inherit; }
.access-tabs button[aria-selected="true"] { background: white; }
.compact-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 14px; }
.compact-form label { flex: 1 1 160px; min-width: 0; }
.compact-form .form-status { flex: 0 0 100%; }
#redeemForm label { flex: 1 1 260px; max-width: 520px; }

.code-box { display: grid; gap: 12px; }
.code-box .access-actions { justify-content: flex-end; }
.code-note { color: var(--console-muted); font-size: .8125rem; }
.code-box textarea { resize: vertical; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.form-status { color: #a42a36; font-size: .8125rem; overflow-wrap: anywhere; }
.form-status:empty { display: none; }
.form-status[data-tone="success"] { color: #116341; }
#pageStatus:not(:empty), #managerStatus:not(:empty) { margin-top: 10px; }

.list-panel { padding-bottom: 14px; }
.list-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-toolbar input { flex: 0 1 240px; }
.list-toolbar select { width: auto; }
.list-toolbar > .access-actions { margin-left: auto; }
.table-wrap { margin-top: 12px; overflow-x: auto; }
.access-page table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: .8125rem; }
.access-page :is(th, td) { padding: 9px 12px; border-bottom: 1px solid #e5e7eb; }
.access-page th { color: var(--console-muted); font-size: .75rem; font-weight: 600; background: #f9fafb; }
.access-page tbody tr:nth-child(even) { background: rgba(0, 0, 0, .015); }
.access-page tbody tr:hover { background: rgba(0, 82, 204, .04); }
.access-page tbody tr:last-child td { border-bottom: 0; }
.access-page th:last-child, .access-page td[data-label="操作"] { text-align: right; }
#cardRows td[data-label="卡密"] { white-space: normal; }
.access-page button.card-code {
  display: inline-block;
  min-height: 30px;
  max-width: 100%;
  padding: 3px 5px;
  border-color: transparent;
  color: var(--console-accent);
  background: transparent;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .75rem;
  font-weight: 500;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  user-select: text;
}
.access-page button.card-code:hover { background: #dbeafe; }
.table-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.access-page .table-actions button { min-height: 32px; padding: 4px 9px; font-size: .75rem; }
.access-page .table-empty { padding: 18px 12px; color: var(--console-muted); text-align: center; }
.list-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0 0; color: var(--console-muted); font-size: .8125rem; }
.list-footer .table-actions { align-items: center; }

.access-page dialog { width: min(384px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--console-border); border-radius: 1rem; color: var(--console-text); box-shadow: var(--console-panel-shadow); }
.access-page dialog::backdrop { background: #0006; }
.access-page dialog form { display: grid; gap: 12px; }
#cardDialog { width: min(440px, calc(100% - 32px)); }
.dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#dialogDetail { color: var(--console-muted); }
.dialog-actions { justify-content: flex-end; }
.dialog-actions button { flex: 1; }
.access-page dialog[data-tone="danger"] { text-align: center; }
.access-page dialog[data-tone="danger"] .primary { border-color: #dc2626; background: #dc2626; }
.access-page dialog[data-tone="danger"] .primary:hover { border-color: #b91c1c; background: #b91c1c; }

@media (max-width: 900px) {
  .access-page { --access-nav-width: 72px; }
  .access-sidebar .access-brand { justify-content: center; padding: 16px; }
  .access-sidebar .console-brand-label { display: none; }
  .access-nav { margin-top: 2px; padding-inline: 5px; }
  .access-nav .nav-item { position: relative; justify-content: center; min-height: 42px; padding: 8px; }
  .access-nav .nav-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .access-main { padding: 16px; }
  .access-workbench { padding: 16px; }
  .has-workspace #workspaceLink { display: inline-flex; }
}

@media (max-width: 600px) {
  .access-main { padding: 12px; }
  .access-header { margin-bottom: 12px; }
  .access-header h1 { font-size: 1.25rem; }
  .access-workbench { padding: 12px; }
  .access-page .config-card { padding: 12px; }
  .profile { margin-bottom: 12px; padding-bottom: 12px; }
  .access-tabs { margin-bottom: 12px; }
  .compact-form > label { flex: 1 1 100%; }
  .compact-form > button { width: 100%; }
  .list-toolbar input { flex-basis: 100%; }
  .list-toolbar > .access-actions { margin-left: 0; }
  .access-page .list-toolbar button { padding-inline: .65rem; font-size: .8125rem; }
  .access-page table { white-space: normal; }
  .access-page thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .access-page :is(table, tbody) { display: block; }
  .access-page tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 10px 8px; border-bottom: 1px solid #e5e7eb; }
  .access-page tbody tr:last-child { border-bottom: 0; }
  .access-page tbody td { min-width: 0; padding: 0; border-bottom: 0; overflow-wrap: anywhere; }
  .access-page td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--console-muted); font-size: .75rem; }
  #cardRows td[data-label="卡密"] { grid-column: 1 / -1; }
  .access-page :is(td[data-label="操作"], .table-empty) { grid-column: 1 / -1; text-align: left; }
  .access-page :is(td[data-label="操作"]:empty, td[data-empty="true"]) { display: none; }
  .table-actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .access-page .segmented-control button { transition: none; }
}
