:root {
  color-scheme: light;
  --bg: #ffffff;
  --sidebar-bg: #f7f7f7;
  --text: #111111;
  --text-secondary: #666666;
  --text-muted: #999999;
  --line: #e5e5e5;
  --hover: #f5f5f5;
  --active: #f0f0f0;
  --black: #000000;
  --white: #ffffff;
  --link: #0066cc;
  --radius-sm: 2px;
  --radius-md: 4px;
  --header-h: 32px;
  --sidebar-w: 180px;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
p,
dl,
dt,
dd {
  margin: 0;
}

mark {
  padding: 0;
  background: transparent;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.icon-button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 150ms ease, opacity 150ms ease;
}

.icon-button:hover {
  background: var(--hover);
}

.icon-button:active {
  opacity: 0.7;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.icon-menu {
  position: relative;
  width: 14px;
  height: 10px;
  display: inline-block;
}

.icon-menu {
  position: relative;
}

.icon-menu::before,
.icon-menu::after,
.icon-menu {
  background: transparent;
}

.icon-menu::before,
.icon-menu::after {
  content: '';
  position: absolute;
  left: 0;
  width: 14px;
  height: 1.5px;
  background: currentColor;
}

.icon-menu::before {
  top: 1px;
}

.icon-menu::after {
  bottom: 1px;
}

.icon-menu {
  border-top: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.app-shell {
  min-height: 100vh;
  padding-top: var(--header-h);
}

.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  padding: 12px 0;
  overflow: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
}

.sidebar-group + .sidebar-group {
  margin-top: 20px;
}

.sidebar-label {
  padding: 0 16px 8px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-note {
  padding: 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.sidebar-item {
  position: relative;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.sidebar-item:hover {
  background: var(--hover);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--active);
  color: var(--text);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--black);
}

.content {
  margin-left: var(--sidebar-w);
  background: var(--bg);
}

.search-hero,
.stats-bar,
.filter-toolbar,
.status-line,
.results-section {
  border-bottom: 1px solid var(--line);
}

.search-hero {
  min-height: 120px;
  padding: 24px;
}

.hero-copy h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hero-copy p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.hero-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 18px;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d0d0d0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--black);
}

.hero-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.shortcut-link,
.text-button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 150ms ease, opacity 150ms ease, color 150ms ease;
}

.shortcut-link {
  padding: 0;
  font-size: 12px;
  text-decoration: none;
}

.shortcut-link:hover,
.text-button:hover {
  color: var(--text);
}

.shortcut-link:hover {
  text-decoration: underline;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.text-button.compact {
  min-height: 28px;
  padding: 0 6px;
  font-size: 13px;
}

.text-button:active,
.shortcut-link:active {
  opacity: 0.7;
}

.stats-bar {
  height: 60px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 20px;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--line);
}

.stat-item span {
  color: var(--text-secondary);
  font-size: 12px;
}

.stat-item strong {
  color: var(--black);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.filter-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-left {
  min-width: 0;
}

.toolbar-right {
  flex: none;
}

.filter-button,
.view-button {
  min-width: 56px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.filter-button:hover,
.view-button:hover {
  background: var(--hover);
  color: var(--text);
}

.filter-button.active,
.view-button.active {
  background: var(--black);
  color: var(--white);
}

.filter-button:active,
.view-button:active {
  opacity: 0.7;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding: 8px 20px;
}

.status-line p {
  font-size: 14px;
  color: var(--text-secondary);
}

.results-section {
  min-height: calc(100vh - 260px);
}

.table-scroll {
  overflow: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table thead th {
  height: 40px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
}

.results-table tbody td {
  height: 48px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
  vertical-align: middle;
}

.result-row:hover td {
  background: var(--hover);
}

.result-row .cell-role {
  color: var(--text-secondary);
}

.result-row .cell-account {
  font-variant-numeric: tabular-nums;
}

.result-row .cell-pinyin {
  color: var(--text-secondary);
}

.cell-action {
  text-align: right;
}

.empty-row td {
  height: 120px;
  color: var(--text-muted);
  text-align: center;
}

.skeleton-row td,
.skeleton-card {
  background: var(--bg);
}

.skeleton-block {
  display: inline-block;
  height: 12px;
  border-radius: var(--radius-sm);
  background: #efefef;
  animation: pulse 1.2s ease-in-out infinite;
}

.skeleton-block.tiny {
  width: 40px;
}

.skeleton-block.short {
  width: 96px;
}

.skeleton-block.medium {
  width: 140px;
}

.card-view {
  display: grid;
  gap: 0;
}

.card-view.cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-card-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.result-card-item:hover {
  background: var(--hover);
}

.card-main {
  min-width: 0;
}

.card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.card-role,
.card-pinyin,
.card-account-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.card-pinyin {
  margin-top: 4px;
}

.card-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.card-account {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-actions {
  justify-self: end;
}

.mobile-only {
  display: none;
}

.empty-state {
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 1024px) {
  .stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }

  .stat-item {
    min-height: 60px;
  }

  .stat-item:nth-child(3),
  .stat-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .stat-item:nth-child(3) {
    border-left: 0;
  }
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex;
  }

  .brand-title {
    font-size: 13px;
  }

  .sidebar {
    display: none;
    z-index: 30;
  }

  body[data-sidebar-open='true'] .sidebar {
    display: block;
  }

  .content {
    margin-left: 0;
  }

  .search-hero,
  .filter-toolbar,
  .status-line {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-search-row {
    grid-template-columns: 1fr;
  }

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

  .filter-toolbar,
  .status-line {
    min-height: auto;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0;
    padding-bottom: 0;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    display: grid;
    gap: 0;
  }

  .toolbar-left {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
  }

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

  .filter-button,
  .view-button {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 8px;
    border-radius: 0;
    border-right: 1px solid var(--line);
    font-size: 13px;
    text-align: center;
  }

  .filter-button:last-child,
  .view-button:last-child {
    border-right: 0;
  }

  .filter-button.active,
  .view-button.active {
    border-color: var(--black);
  }

  .status-line {
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .table-view {
    display: none;
  }

  .card-view {
    display: grid;
  }

  .result-card-item {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
    padding: 14px 16px;
  }

  .card-meta,
  .card-actions {
    justify-items: start;
    justify-self: start;
  }

  .results-section {
    border-top: 0;
  }

  .card-view {
    border-top: 1px solid var(--line);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}
