:root {
  font-family:
    -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'PingFang SC', 'Helvetica Neue',
    'Microsoft YaHei', Helvetica, Arial, sans-serif;
  color: #1d1d1f;
  background: #f5f5f7;
  font-synthesis: none;
  text-rendering: optimizelegibility;

  --page: #f5f5f7;
  --surface: #fff;
  --surface-soft: #fbfbfd;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --soft-muted: #86868b;
  --line: #e6e6eb;
  --line-strong: #d2d2d7;
  --accent: #0071e3;
  --accent-dark: #0077ed;
  --accent-soft: #e8f1ff;
  --green: #28a745;
  --green-soft: #e8f6ec;
  --danger: #ff3b30;
  --danger-soft: #ffeceb;
  --warning: #d97706;
  --warning-soft: #fff8e6;
  --radius: 8px;
  --sidebar-width: 252px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

h2 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
}

code {
  font-family: SFMono-Regular, Consolas, 'Liberation Mono', monospace;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(255 255 255 / 90%) inset;
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  gap: 8px;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    opacity 180ms ease;
}

.button {
  padding: 8px 13px;
  font-size: 13px;
}

.icon-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.button svg,
.icon-button svg,
.nav-item svg,
.nav-subitem svg,
.back-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  stroke-width: 2;
}

.button:hover,
.icon-button:hover {
  border-color: rgb(0 113 227 / 30%);
  background: var(--accent-soft);
  color: var(--accent);
}

.button:active,
.icon-button:active {
  background: #dceaff;
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 6px 16px -8px rgb(0 113 227 / 55%);
  color: #fff;
}

.button--primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  box-shadow: 0 8px 20px -8px rgb(0 113 227 / 60%);
  color: #fff;
}

.button--secondary {
  background: var(--surface);
}

.button--wide {
  width: 100%;
}

.icon-button--danger {
  color: var(--danger);
}

.icon-button--danger:hover {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.is-loading svg {
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

[hidden] {
  display: none;
}

.brand,
.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.admin-page {
  background: #f6f7f9;
}

.auth-page,
.public-page {
  background: radial-gradient(720px 360px at 92% -8%, rgb(91 141 239 / 8%) 0%, transparent 68%), #f6f7f9;
}

.auth-shell {
  display: grid;
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-panel,
.public-auth {
  width: min(100%, 440px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 30px -22px rgb(16 24 40 / 35%);
  text-align: left;
}

.auth-brand {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 11px;
}

.auth-brand__emblem {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid #cfe3ff;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.auth-brand__emblem svg {
  width: 19px;
  height: 19px;
}

.auth-brand__copy {
  display: grid;
  line-height: 1.25;
}

.auth-brand__copy strong {
  font-size: 14px;
  font-weight: 700;
}

.auth-brand__subtitle {
  margin-top: 2px;
  color: var(--soft-muted);
  font-size: 10px;
}

.auth-heading {
  margin-top: 32px;
}

.auth-panel h1,
.public-auth h1 {
  margin-bottom: 7px;
  font-size: 25px;
  font-weight: 700;
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  text-align: left;
}

label {
  display: grid;
  min-width: 0;
  color: #424245;
  font-size: 12px;
  font-weight: 600;
  gap: 7px;
}

label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

input::placeholder {
  color: var(--soft-muted);
}

input:hover,
select:hover {
  border-color: rgb(0 113 227 / 30%);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(0 113 227 / 14%);
}

.auth-panel input,
.public-auth input {
  height: 42px;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.auth-panel .button,
.public-auth .button {
  min-height: 42px;
  border-radius: var(--radius);
  font-size: 13px;
}

.notice {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.notice--warning {
  border-color: #fedf89;
  background: var(--warning-soft);
  color: #93370d;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-message[data-kind='error'],
.page-state[data-kind='error'] {
  color: var(--danger);
}

.form-message[data-kind='success'] {
  color: var(--green);
}

.page-state[data-kind='warning'] {
  color: var(--warning);
}

.admin-shell {
  display: grid;
  min-height: 100vh;
  background: radial-gradient(720px 360px at 92% -8%, rgb(91 141 239 / 8%) 0%, transparent 68%), #f6f7f9;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  padding: 20px 14px 16px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  box-shadow: 8px 0 28px rgb(16 24 40 / 2%);
  backdrop-filter: saturate(150%) blur(18px);
}

.brand {
  min-height: 44px;
  padding: 0 8px;
  color: var(--ink);
  gap: 11px;
}

.brand-emblem {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgb(0 113 227 / 13%);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.brand-emblem svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.brand-copy {
  display: grid;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 720;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--soft-muted);
  font-size: 10px;
  font-weight: 550;
}

.sidebar-navigation {
  margin-top: 30px;
}

.nav-section-label {
  display: block;
  padding: 0 10px;
  color: var(--soft-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  min-height: 42px;
  padding: 9px 11px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  gap: 10px;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.nav-item:hover {
  background: #f5f7fa;
  color: var(--ink);
}

.nav-item.is-active {
  border-color: rgb(0 113 227 / 10%);
  background: #edf5ff;
  color: #06c;
}

.nav-group {
  position: relative;
}

.nav-group > summary {
  cursor: pointer;
  list-style: none;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: auto;
  transition: transform 180ms ease;
}

.nav-group[open] .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: grid;
  margin: 4px 0 6px 20px;
  padding-left: 15px;
  border-left: 1px solid var(--line);
  gap: 2px;
}

.nav-subitem {
  display: flex;
  min-height: 36px;
  padding: 7px 9px;
  align-items: center;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 580;
  gap: 9px;
}

.nav-subitem:hover {
  background: #f5f7fa;
  color: var(--ink);
}

.nav-subitem.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-footer {
  padding-top: 14px;
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.sidebar-account {
  display: grid;
  min-height: 46px;
  padding: 4px 6px;
  align-items: center;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 9px;
}

.sidebar-account__avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #cfe3ff;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-account__copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.sidebar-account__copy strong {
  font-size: 12px;
  font-weight: 650;
}

.sidebar-account__copy small {
  margin-top: 2px;
  color: var(--soft-muted);
  font-size: 10px;
}

.sidebar-logout {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sidebar-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-logout svg {
  width: 16px;
  height: 16px;
}

.main-content {
  width: 100%;
  max-width: 1500px;
  padding: 0 44px 64px;
}

.main-content--narrow {
  max-width: 1120px;
}

.topbar,
.topbar-slot .topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 68px;
  margin: 0 -44px 34px;
  padding: 0 44px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgb(246 247 249 / 86%);
  color: var(--muted);
  backdrop-filter: saturate(150%) blur(18px);
}

.topbar__breadcrumb,
.topbar__tools,
.topbar-status,
.topbar-user {
  display: flex;
  align-items: center;
}

.topbar__breadcrumb,
.topbar__tools {
  gap: 10px;
}

.topbar__breadcrumb {
  font-size: 12px;
}

.topbar__breadcrumb svg {
  width: 14px;
  height: 14px;
  color: var(--soft-muted);
}

.topbar__section {
  color: var(--muted);
}

.topbar__breadcrumb strong {
  color: var(--ink);
  font-weight: 650;
}

.topbar-status {
  color: #475467;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
}

.topbar-status__dot {
  width: 7px;
  height: 7px;
  border: 2px solid #d7f5df;
  border-radius: 50%;
  background: var(--green);
  box-sizing: content-box;
}

.topbar-separator {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.topbar-user {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  gap: 7px;
}

.topbar-user__avatar {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgb(0 113 227 / 12%);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.page-header,
.section-heading,
.form-section__heading,
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.page-header {
  margin-bottom: 26px;
}

.page-header--compact {
  align-items: flex-start;
}

.back-link {
  display: inline-flex;
  margin-bottom: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}

.back-link:hover {
  color: var(--accent-dark);
}

.metric-grid {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: flex;
  min-height: 116px;
  padding: 20px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 22px -18px rgb(16 24 40 / 30%);
  gap: 16px;
}

.metric-card__icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 10px;
}

.metric-card__icon svg {
  width: 20px;
  height: 20px;
}

.metric-card__icon--blue {
  background: #e8f2ff;
  color: #0969da;
}

.metric-card__icon--green {
  background: #eaf7ee;
  color: #238636;
}

.metric-card__icon--amber {
  background: #fff4df;
  color: #b35c00;
}

.metric-card > div {
  display: grid;
  min-width: 0;
}

.metric-card__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.metric-card strong {
  margin: 3px 0 2px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 720;
  line-height: 1;
}

.metric-card small {
  overflow: hidden;
  color: var(--soft-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.85fr);
  gap: 14px;
}

.dashboard-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 22px -18px rgb(16 24 40 / 28%);
}

.panel-heading {
  display: flex;
  min-height: 74px;
  padding: 16px 20px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.panel-heading h2 {
  margin-bottom: 3px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  gap: 5px;
}

.text-link svg {
  width: 14px;
  height: 14px;
}

.recent-list,
.quick-list {
  display: grid;
}

.recent-row {
  display: grid;
  min-height: 68px;
  padding: 11px 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 36px minmax(0, 1fr) auto 128px 16px;
  gap: 12px;
  transition: background-color 160ms ease;
}

.recent-row:last-child {
  border-bottom: 0;
}

.recent-row:hover {
  background: #f8fafc;
}

.recent-row__icon,
.quick-row__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--muted);
}

.recent-row__icon svg,
.quick-row__icon svg {
  width: 16px;
  height: 16px;
}

.recent-row__main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.recent-row__main strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-row__main code,
.recent-row time {
  overflow: hidden;
  color: var(--soft-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-row time {
  text-align: right;
}

.recent-row__arrow {
  width: 15px;
  height: 15px;
  color: var(--soft-muted);
}

.quick-row {
  display: grid;
  min-height: 76px;
  padding: 12px 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  gap: 12px;
  transition: background-color 160ms ease;
}

.quick-row:hover {
  background: #f8fafc;
}

.quick-row:last-child {
  border-bottom: 0;
}

.quick-row__copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.quick-row strong,
.quick-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-row strong {
  font-size: 12px;
  font-weight: 650;
}

.quick-row small {
  color: var(--soft-muted);
  font-size: 10px;
}

.quick-row > svg {
  width: 15px;
  height: 15px;
  color: var(--soft-muted);
}

.content-section {
  min-width: 0;
}

.section-heading {
  margin-bottom: 12px;
}

.table-toolbar {
  display: flex;
  min-height: 36px;
  margin-bottom: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.table-toolbar .form-message {
  flex: 1;
}

.search-field {
  position: relative;
  display: flex;
  width: min(100%, 260px);
  align-items: center;
  color: var(--muted);
}

.search-field svg {
  position: absolute;
  left: 11px;
  z-index: 1;
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.search-field input {
  height: 36px;
  padding-left: 34px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(16 24 40 / 3%);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 22px -18px rgb(16 24 40 / 28%);
}

.data-table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 180ms ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table th {
  background: #fafbfc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.audit-table th {
  width: 25%;
}

.record-count {
  display: inline-flex;
  min-height: 34px;
  padding: 7px 11px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  gap: 7px;
}

.record-count svg,
.audit-action svg {
  width: 15px;
  height: 15px;
}

.audit-action {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
  gap: 8px;
}

.audit-action svg {
  color: var(--accent);
}

.page-table {
  min-width: 1000px;
}

.page-table th:nth-child(1) {
  width: 20%;
}

.page-table th:nth-child(2) {
  width: 18%;
}

.page-table th:nth-child(3) {
  width: 19%;
}

.page-table th:nth-child(4) {
  width: 22%;
}

.page-table th:nth-child(5) {
  width: 9%;
}

.page-table th:nth-child(6) {
  width: 12%;
}

.cell-title,
.api-host {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-subtitle {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-note {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  color: #424245;
  font-size: 11px;
  line-height: 1.55;
  gap: 7px;
}

.page-note__icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  flex: 0 0 14px;
  color: var(--accent);
}

.page-note__copy {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-note[data-empty='true'] {
  color: var(--soft-muted);
}

.page-note[data-empty='true'] .page-note__icon {
  color: #a8adb5;
}

.status-line {
  display: flex;
  align-items: center;
  color: #424245;
  font-size: 12px;
  gap: 7px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #98a2b3;
}

.status-dot--green {
  background: var(--green);
}

.status-dot--red {
  background: var(--danger);
}

.status-dot--gray {
  background: #98a2b3;
}

.pill {
  display: inline-flex;
  min-height: 24px;
  padding: 3px 8px;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.pill--green {
  background: var(--green-soft);
  color: #1e7e34;
}

.pill--gray {
  background: #f2f4f7;
  color: #475467;
}

.table-actions {
  text-align: right;
  white-space: nowrap;
}

.table-actions > * {
  margin-left: 4px;
}

.empty-state {
  display: grid;
  min-height: 150px;
  padding: 30px;
  align-content: center;
  justify-items: center;
  color: var(--muted);
  gap: 8px;
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.empty-state strong {
  color: var(--ink);
  font-size: 15px;
}

.empty-state--large {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 22px -18px rgb(16 24 40 / 28%);
}

.empty-state--compact {
  min-height: 120px;
  padding: 20px;
}

.form-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 22px -18px rgb(16 24 40 / 28%);
}

.form-card--small {
  display: grid;
  width: 100%;
  max-width: 680px;
  padding: 0;
  gap: 0;
}

.form-card__heading {
  display: flex;
  min-height: 78px;
  padding: 18px 24px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.form-card__heading h2 {
  margin-bottom: 3px;
}

.form-card--small > label {
  margin: 18px 24px 0;
}

.form-section {
  padding: 26px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  border-bottom: 0;
}

.form-section__heading {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid__wide {
  grid-column: 1 / -1;
}

.account-picker__toolbar {
  display: flex;
  margin-bottom: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-picker__toolbar .search-field {
  width: min(100%, 360px);
}

.account-picker__actions {
  display: flex;
  gap: 8px;
}

.account-picker__list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.account-option {
  display: grid;
  min-height: 66px;
  padding: 10px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  grid-template-columns: 18px minmax(160px, 1.2fr) minmax(130px, 1fr) 74px;
  gap: 12px;
  transition: background-color 160ms ease;
}

.account-option:last-child {
  border-bottom: 0;
}

.account-option:hover {
  background: #f8fbff;
}

.account-option > input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.account-option__identity,
.account-option__meta {
  display: block;
  min-width: 0;
}

.account-option__identity strong,
.account-option__identity small,
.account-option__meta strong,
.account-option__meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-option__identity strong,
.account-option__meta strong {
  color: var(--ink);
  font-size: 12px;
}

.account-option__identity small,
.account-option__meta small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.account-option__status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  gap: 7px;
}

.input-prefix,
.input-action {
  display: flex;
  min-width: 0;
}

.input-prefix > span {
  display: flex;
  height: 42px;
  padding: 0 10px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: #fafafc;
  color: var(--muted);
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  white-space: nowrap;
}

.input-prefix input {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.input-action {
  gap: 8px;
}

.input-action .button {
  flex: 0 0 auto;
}

.toggle-list {
  display: grid;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.toggle-row {
  display: grid;
  min-height: 64px;
  padding: 14px 2px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
}

.toggle-row:last-child {
  border-bottom: 0;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-control {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #d1d1d6;
  transition: background-color 180ms ease;
}

.toggle-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(16 24 40 / 20%);
  content: '';
  transition: transform 180ms ease;
}

.toggle-row input:checked + .toggle-control {
  background: var(--accent);
}

.toggle-row input:checked + .toggle-control::after {
  transform: translateX(16px);
}

.toggle-row input:focus-visible + .toggle-control {
  outline: 3px solid rgb(0 113 227 / 20%);
  outline-offset: 2px;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.select-label {
  max-width: 240px;
}

.form-actions {
  display: flex;
  min-height: 72px;
  padding: 16px 24px;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  gap: 10px;
}

.settings-layout {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.6fr);
  gap: 38px;
}

.settings-context {
  max-width: 290px;
  padding: 6px 0;
}

.settings-context__icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid #cfe3ff;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.settings-context__icon svg {
  width: 20px;
  height: 20px;
}

.settings-context > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.settings-note {
  display: flex;
  padding-top: 16px;
  align-items: flex-start;
  border-top: 1px solid var(--line);
  color: var(--soft-muted);
  font-size: 10px;
  gap: 9px;
}

.settings-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.form-actions .form-message {
  margin-right: auto;
  order: -1;
}

.toast {
  position: fixed;
  right: auto;
  bottom: 28px;
  left: 50%;
  z-index: 50;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 14px;
  transform: translateX(-50%) translateY(8px);
  border: 0;
  border-radius: 999px;
  background: rgb(29 29 31 / 92%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.clipboard-helper {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.public-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 0 56px;
}

.public-page .public-shell:not(.public-shell--center) {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.public-shell--center {
  display: grid;
  place-items: center;
}

.public-brand {
  margin-bottom: 30px;
  color: var(--ink);
}

.public-overview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 30px -22px rgb(16 24 40 / 35%);
}

.public-header {
  min-height: 92px;
  margin-bottom: 0;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.public-stats {
  display: flex;
  min-height: 64px;
  margin: 0;
  padding: 12px 22px;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.public-stats > div {
  display: inline-flex;
  min-height: 32px;
  margin-right: 18px;
  padding: 0 18px 0 0;
  align-items: center;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  gap: 4px;
}

.public-stats > div:last-child {
  margin-right: 0;
  border: 0;
}

.public-stats span {
  color: var(--muted);
  font-size: 11px;
}

.public-stats strong {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.text-green {
  color: var(--green) !important;
}

.text-red {
  color: var(--danger) !important;
}

.public-meta {
  min-height: 32px !important;
  margin-left: auto;
  padding: 0 !important;
  align-items: flex-end !important;
  flex-direction: column;
  justify-content: center;
  background: transparent !important;
  box-shadow: none !important;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  color: var(--accent) !important;
  gap: 5px;
}

.privacy-note svg {
  width: 15px;
  height: 15px;
}

.page-state {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.account-list-heading {
  display: flex;
  min-height: 56px;
  padding: 0 2px;
  align-items: flex-end;
  justify-content: space-between;
}

.account-list-heading h2 {
  margin-bottom: 3px;
  font-size: 17px;
  font-weight: 600;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.account-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 22px -18px rgb(16 24 40 / 28%);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.account-card:hover {
  border-color: #b7d4f7;
  box-shadow: 0 10px 24px -18px rgb(16 24 40 / 36%);
}

.account-card > header {
  display: flex;
  min-height: 72px;
  padding: 15px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.account-identity {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 9px;
}

.account-identity .status-dot {
  margin-top: 6px;
}

.account-identity__text {
  min-width: 0;
}

.account-identity strong,
.account-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity strong {
  color: var(--ink);
  font-size: 13px;
}

.account-identity span,
.account-status {
  color: var(--muted);
  font-size: 10px;
}

.account-card dl {
  display: grid;
  min-height: 108px;
  margin: 0;
  padding: 13px 15px;
  align-content: center;
  gap: 12px;
}

.account-detail {
  display: grid;
  min-width: 0;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.account-card dt {
  color: var(--muted);
  font-size: 10px;
}

.account-card dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-secret {
  font-family: SFMono-Regular, Consolas, monospace;
}

.account-card footer {
  display: flex;
  min-height: 48px;
  padding: 6px 9px;
  align-items: center;
  border-top: 1px solid var(--line);
  gap: 6px;
}

.account-card footer .icon-button {
  width: auto;
  min-width: 0;
  min-height: 28px;
  padding: 0 9px;
  border-color: #cfe3ff;
  border-radius: var(--radius);
  background: var(--accent-soft);
  box-shadow: none;
  color: var(--accent);
  font-size: 10px;
}

.account-card footer .icon-button:hover {
  background: var(--accent);
  color: #fff;
}

.password-hint {
  display: flex;
  min-height: 44px;
  margin-top: 20px;
  padding: 10px 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #1769aa;
  font-size: 12px;
  gap: 9px;
}

.password-hint svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid rgb(0 113 227 / 42%);
  outline-offset: 2px;
}

@media (width <= 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-stats {
    display: flex;
  }

  .public-meta {
    min-height: 32px !important;
    margin-left: 0;
    align-items: flex-start !important;
    border-top: 0;
  }
}

@media (width <= 760px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 30;
    top: 0;
    width: 100%;
    min-width: 0;
    height: auto;
    display: grid;
    padding: 9px 12px;
    align-items: center;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  .sidebar .brand {
    min-height: 36px;
    padding: 0;
    flex: 0 0 auto;
  }

  .brand-emblem {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand-copy small,
  .nav-section-label,
  .sidebar-account__avatar,
  .sidebar-account__copy {
    display: none;
  }

  .sidebar-navigation {
    min-width: 0;
    margin: 0;
  }

  .nav-list {
    display: flex;
    min-width: 0;
    margin: 0;
    justify-content: flex-end;
    overflow: visible;
    gap: 3px;
  }

  .nav-item {
    width: 36px;
    min-height: 36px;
    padding: 0;
    justify-content: center;
    white-space: nowrap;
  }

  .nav-item > span,
  .nav-group-chevron {
    display: none;
  }

  .nav-group {
    position: relative;
  }

  .nav-submenu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 60;
    width: 214px;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgb(255 255 255 / 98%);
    box-shadow: 0 18px 42px -16px rgb(16 24 40 / 32%);
  }

  .nav-subitem {
    min-height: 40px;
    padding: 8px 10px;
  }

  .sidebar-footer {
    padding: 0;
    margin: 0;
    border: 0;
  }

  .sidebar-account {
    display: block;
    min-height: 32px;
    padding: 0;
  }

  .main-content {
    padding: 0 16px 48px;
  }

  .topbar,
  .topbar-slot .topbar {
    position: static;
    min-height: 56px;
    margin: 0 -16px 28px;
    padding: 0 16px;
  }

  .topbar-status,
  .topbar-separator {
    display: none;
  }

  .topbar__breadcrumb {
    gap: 5px;
  }

  .topbar-user {
    font-size: 11px;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .metric-grid {
    margin-bottom: 14px;
    gap: 10px;
  }

  .metric-card {
    min-height: 104px;
    padding: 16px;
  }

  .recent-row {
    grid-template-columns: 36px minmax(0, 1fr) auto 16px;
  }

  .recent-row time {
    display: none;
  }

  .settings-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .settings-context {
    max-width: 640px;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .search-field {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .account-picker__toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .account-picker__toolbar .search-field {
    width: 100%;
  }

  .account-option {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .account-option__meta {
    grid-column: 2 / -1;
  }

  .account-option__status {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }

  .form-actions {
    margin: 0;
  }

  .public-shell {
    width: min(100% - 32px, 680px);
    padding-top: 24px;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (width <= 520px) {
  h1 {
    font-size: 24px;
  }

  .page-header,
  .public-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header > .button,
  .public-header > .button {
    width: 100%;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .topbar__section,
  .topbar__breadcrumb svg {
    display: none;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 88px;
    padding: 14px 16px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .panel-heading {
    min-height: 68px;
    padding: 14px 16px;
  }

  .recent-row {
    padding: 10px 14px;
    grid-template-columns: 34px minmax(0, 1fr) auto 14px;
    gap: 9px;
  }

  .recent-row__main code {
    max-width: 160px;
  }

  .quick-row {
    padding: 11px 14px;
  }

  .form-section {
    padding: 20px 16px;
  }

  .form-actions {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .form-actions .button {
    flex: 1;
    white-space: nowrap;
  }

  .form-actions .form-message {
    width: 100%;
    flex: 0 0 100%;
    order: -1;
  }

  .account-picker__actions .button {
    min-width: 0;
    flex: 1;
  }

  .form-card__heading {
    padding: 16px;
  }

  .form-card--small > label {
    margin: 16px 16px 0;
  }

  .public-stats > div {
    min-height: 30px;
    padding: 5px 11px;
  }

  .public-stats strong {
    font-size: 12.5px;
  }

  .public-overview {
    border-radius: var(--radius);
  }

  .auth-panel,
  .public-auth {
    padding: 24px 20px;
    border-radius: var(--radius);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
