:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #181a1f;
  --surface-alt: #20232a;
  --surface-soft: #272a31;
  --border: #33363e;
  --border-strong: #454953;
  --text: #f4f1ed;
  --text-muted: #aaa8a3;
  --text-faint: #777873;
  --primary: #f26a3d;
  --primary-strong: #dc4f32;
  --primary-soft: rgba(242, 106, 61, 0.13);
  --accent: #e94872;
  --success: #36b878;
  --success-soft: rgba(54, 184, 120, 0.13);
  --warning: #e0a23d;
  --warning-soft: rgba(224, 162, 61, 0.14);
  --danger: #e25c5c;
  --danger-soft: rgba(226, 92, 92, 0.13);
  --info: #6e9be8;
  --info-soft: rgba(110, 155, 232, 0.13);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  --focus: 0 0 0 3px rgba(242, 106, 61, 0.24);
  --fire-grad: linear-gradient(135deg, #f4a33d 0%, #f26a3d 52%, #e94872 100%);
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --sidebar-width: 232px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f5;
  --surface: #ffffff;
  --surface-alt: #f7f7f6;
  --surface-soft: #eceeec;
  --border: #dedfdd;
  --border-strong: #c6c8c5;
  --text: #242522;
  --text-muted: #666862;
  --text-faint: #8a8d86;
  --primary: #d95831;
  --primary-strong: #bd4328;
  --primary-soft: rgba(217, 88, 49, 0.1);
  --accent: #c83e66;
  --success: #21875a;
  --success-soft: rgba(33, 135, 90, 0.1);
  --warning: #a96c10;
  --warning-soft: rgba(169, 108, 16, 0.11);
  --danger: #bd4444;
  --danger-soft: rgba(189, 68, 68, 0.1);
  --info: #406db8;
  --info-soft: rgba(64, 109, 184, 0.1);
  --shadow: 0 8px 24px rgba(30, 32, 29, 0.08);
  --focus: 0 0 0 3px rgba(217, 88, 49, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand,
.mobile-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--fire-grad);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: 16px;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.sidebar .sidebar-close {
  display: none;
}

.nav-groups {
  display: grid;
  gap: 18px;
}

.nav-group-title {
  margin: 0 8px 6px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
}

.nav-group {
  display: grid;
  gap: 3px;
}

.nav-item {
  min-height: 40px;
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
}

.user-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.user-copy {
  min-width: 0;
}

.user-copy strong,
.user-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy small {
  color: var(--text-faint);
  font-size: 11px;
}

.main-area {
  min-width: 0;
  padding: 22px 24px 36px;
}

.page-header {
  min-width: 0;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.page-header-actions,
.action-bar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.action-bar form {
  margin: 0;
}

.page-body,
.dashboard-stack,
.console-shell,
.settings-stack {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.dashboard-section {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.account-management-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.advanced-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.section-actions,
.section-form {
  margin-top: 12px;
}

.mobile-topbar,
.sidebar-backdrop {
  display: none;
}

.button,
.link-button,
.ghost-button,
.soft-button,
.danger-button,
.success-button {
  min-height: 38px;
  border-radius: 7px;
  padding: 9px 13px;
  border: 1px solid transparent;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.button:hover,
.link-button:hover {
  background: var(--primary-strong);
}

.button:focus-visible,
.link-button:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.button:disabled,
.link-button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #fff;
  background: var(--primary);
}

.button-quiet,
.ghost-button {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.button-quiet:hover,
.ghost-button:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.button-soft,
.soft-button {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(242, 106, 61, 0.24);
}

.button-soft:hover,
.soft-button:hover {
  background: rgba(242, 106, 61, 0.2);
}

.button-danger,
.danger-button {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(226, 92, 92, 0.28);
}

.button-danger:hover,
.danger-button:hover {
  color: #fff;
  background: var(--danger);
}

.button-success,
.success-button {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(54, 184, 120, 0.28);
}

.button-block {
  width: 100%;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.theme-light-icon,
html[data-theme="light"] .theme-dark-icon {
  display: none;
}

html[data-theme="light"] .theme-light-icon {
  display: block;
}

.panel,
.account-row,
.account-console,
.data-section,
.collapsible-section {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-header,
.section-header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-header h2,
.panel-header h3,
.section-header h2,
.section-header h3 {
  margin: 0;
}

.section-title {
  font-size: 18px;
}

.muted {
  color: var(--text-muted);
}

.compact {
  margin: 4px 0 0;
  font-size: 13px;
}

.flash {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.flash-success {
  color: var(--success);
  background: var(--success-soft);
}

.flash-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.flash-error {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-banner {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-banner strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-banner.success {
  color: var(--success);
  background: var(--success-soft);
}

.status-banner.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-banner.info {
  color: var(--info);
  background: var(--info-soft);
}

.status-banner.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.overview-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(150px, 0.7fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overview-primary,
.overview-cell {
  min-width: 0;
  padding: 18px;
}

.overview-cell {
  border-left: 1px solid var(--border);
}

.overview-primary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.progress-badge {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
}

.progress-badge strong {
  font-size: 22px;
  line-height: 1;
}

.progress-badge small {
  font-size: 10px;
  opacity: 0.84;
}

.overview-label,
.metric-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.overview-value,
.metric-value {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

.overview-help,
.metric-help {
  margin-top: 5px;
  color: var(--text-faint);
  font-size: 12px;
}

.metric-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card.success {
  border-top: 3px solid var(--success);
}

.metric-card.warning {
  border-top: 3px solid var(--warning);
}

.metric-card.danger {
  border-top: 3px solid var(--danger);
}

.metric-card.info {
  border-top: 3px solid var(--info);
}

.table-shell {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  overflow-wrap: normal;
  word-break: normal;
}

th {
  color: var(--text-muted);
  background: var(--surface-alt);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--surface-alt);
}

.status-chip,
.pill {
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip.success,
.pill.success {
  color: var(--success);
  background: var(--success-soft);
}

.status-chip.warning,
.pill.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-chip.danger,
.pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-chip.info,
.pill.info {
  color: var(--info);
  background: var(--info-soft);
}

.account-summary-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.account-row {
  padding: 13px 14px;
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) minmax(170px, 1fr) repeat(3, minmax(90px, auto)) auto;
  align-items: center;
  gap: 12px;
}

.account-row:hover {
  border-color: var(--border-strong);
}

.account-ident {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 7px;
  color: #fff;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.account-name {
  min-width: 0;
}

.account-name strong,
.account-name small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name small {
  color: var(--text-faint);
  font-size: 11px;
}

.progress-line {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.progress-track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.progress-text {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.summary-value {
  text-align: center;
}

.summary-value strong {
  display: block;
  font-size: 17px;
}

.summary-value small {
  color: var(--text-faint);
  font-size: 11px;
}

.section-link {
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.section-link:hover {
  text-decoration: underline;
}

.collapsible-section {
  overflow: hidden;
}

.collapsible-section > summary {
  min-width: 0;
  padding: 14px 16px;
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

.summary-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-copy > svg {
  flex: 0 0 auto;
  color: var(--primary);
}

.summary-copy strong,
.summary-copy small {
  display: block;
}

.summary-copy small {
  color: var(--text-muted);
  font-size: 12px;
}

.summary-chevron {
  color: var(--text-faint);
  transition: transform 0.16s ease;
}

.collapsible-section[open] .summary-chevron {
  transform: rotate(180deg);
}

.collapsible-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.form-grid,
.settings-grid,
.two-column-grid,
.login-workspace-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stack-form {
  min-width: 0;
  display: grid;
  gap: 12px;
}

label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

label > span,
.field-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
  color: var(--text);
  background: var(--surface-alt);
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.account-assignment-picker {
  border: 0;
  padding: 0;
  margin: 0;
}

.account-assignment-picker legend {
  padding: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.account-assignment-picker .check-row {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-alt);
}

.button-row,
.button-grid,
.form-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.button-grid > form,
.button-grid > .button,
.button-grid > .link-button {
  flex: 1 1 160px;
}

.friend-picker {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-alt);
}

.friend-picker-toolbar {
  min-width: 0;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.friend-picker-list {
  max-height: 230px;
  overflow: auto;
  margin-top: 10px;
  display: grid;
  gap: 4px;
}

.friend-option {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.friend-option.selected {
  border-color: rgba(242, 106, 61, 0.24);
  background: var(--primary-soft);
}

.friend-option input {
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.friend-picker-empty,
.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  background: var(--surface-alt);
}

.login-workspace-grid {
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  align-items: start;
}

.login-actions,
.login-status-panel {
  display: grid;
  gap: 12px;
}

.login-qr-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-alt);
  text-align: center;
}

.login-qr-image {
  width: min(320px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}

.login-qr-panel .button-row {
  justify-content: center;
}

.native-login-panel {
  min-height: 380px;
  padding: 32px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  background: var(--surface-alt);
}

.native-login-panel[hidden] {
  display: none !important;
}

.native-login-panel > svg {
  width: 42px;
  height: 42px;
  color: var(--accent);
}

.native-login-panel p {
  max-width: 420px;
  margin: 0;
}

.native-login-mode .desktop-frame {
  display: none;
}

.desktop-frame-wrap {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #090a0c;
}

.desktop-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 0;
  display: block;
}

.account-console-list {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.account-console {
  overflow: hidden;
}

.account-console > summary {
  min-width: 0;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.account-console > summary::-webkit-details-marker {
  display: none;
}

.account-console[open] > summary {
  border-bottom: 1px solid var(--border);
}

.account-console.state-attention,
.account-console.state-paused {
  border-left: 3px solid var(--danger);
}

.account-console.state-warning,
.account-console.state-pending {
  border-left: 3px solid var(--warning);
}

.account-console.state-healthy {
  border-left: 3px solid var(--success);
}

.account-console-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.account-console-body {
  min-width: 0;
  padding: 14px;
}

.account-meta-strip {
  min-width: 0;
  margin-bottom: 12px;
  padding: 10px 11px;
  border-radius: 7px;
  color: var(--text-muted);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented-control {
  min-width: 0;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-alt);
}

.segment-button {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.segment-button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}

.segment-panel[hidden] {
  display: none;
}

.target-list {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.target-record {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(150px, 1.2fr) minmax(90px, auto) auto;
  align-items: center;
  gap: 10px;
}

.target-record-main {
  min-width: 0;
}

.target-record-main strong,
.target-record-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-record-main small {
  color: var(--text-faint);
  font-size: 11px;
}

.target-message,
.target-reason {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.target-meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.warning-box {
  margin-bottom: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(224, 162, 61, 0.28);
  border-radius: 7px;
  color: var(--warning);
  background: var(--warning-soft);
}

.danger-box {
  margin-bottom: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(226, 92, 92, 0.28);
  border-radius: 7px;
  color: var(--danger);
  background: var(--danger-soft);
}

.code-block {
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-alt);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.confirm-dialog {
  width: min(92vw, 420px);
  padding: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.confirm-dialog h2 {
  margin: 10px 0 6px;
  font-size: 19px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--text-muted);
}

.confirm-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.poll-stale {
  color: var(--warning);
}

.refresh-notice {
  display: none;
}

.refresh-notice.visible {
  display: flex;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  background: var(--bg);
}

.login-brand-panel {
  min-width: 0;
  padding: 40px;
  border-right: 1px solid var(--border);
  background: #171519;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
}

.login-brand-copy {
  max-width: 540px;
}

.login-brand-copy h1 {
  margin: 0 0 14px;
  font-size: 40px;
  line-height: 1.18;
}

.login-brand-copy h1 span {
  color: var(--primary);
}

.login-brand-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.8;
}

.login-features {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
}

.login-features svg {
  color: var(--primary);
}

.login-form-panel {
  min-width: 0;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(100%, 420px);
}

.login-card h2 {
  margin: 0;
  font-size: 24px;
}

.login-card > p {
  margin: 5px 0 20px;
  color: var(--text-muted);
}

.login-foot {
  margin-top: 16px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1180px) {
  .overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-primary {
    grid-column: 1 / -1;
  }

  .overview-cell {
    border-top: 1px solid var(--border);
  }

  .overview-cell:nth-child(2),
  .overview-cell:nth-child(4) {
    border-left: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-row {
    grid-template-columns: minmax(170px, 1.2fr) minmax(150px, 1fr) repeat(2, minmax(80px, auto)) auto;
  }

  .account-row .summary-value:nth-of-type(4) {
    display: none;
  }

  .advanced-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 56px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-brand {
    font-size: 15px;
    font-weight: 800;
  }

  .mobile-brand .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .app-shell {
    display: block;
    min-height: calc(100vh - 56px);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.35);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.56);
  }

  body.nav-open .sidebar-backdrop {
    display: block;
  }

  .main-area {
    padding: 16px 16px 28px;
  }

  .desktop-theme-toggle {
    display: none;
  }

  .page-header {
    display: grid;
    gap: 12px;
  }

  .page-heading h1 {
    font-size: 23px;
  }

  .page-header-actions,
  .action-bar {
    justify-content: flex-start;
  }

  .action-bar {
    width: 100%;
  }

  .action-bar > form,
  .action-bar > .button,
  .action-bar > .link-button,
  .action-bar > a {
    flex: 1 1 140px;
  }

  .overview-strip {
    grid-template-columns: 1fr 1fr;
  }

  .overview-primary {
    grid-column: 1 / -1;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .account-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .account-row .progress-line {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .account-row .summary-value {
    display: none;
  }

  .account-console > summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .account-console-metrics {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .form-grid,
  .settings-grid,
  .two-column-grid,
  .login-workspace-grid {
    grid-template-columns: 1fr;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 300px;
    padding: 28px;
  }

  .login-brand-copy h1 {
    font-size: 29px;
  }

  .login-form-panel {
    padding: 28px;
  }
}

@media (max-width: 620px) {
  .main-area {
    padding-inline: 12px;
  }

  .status-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-actions .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-actions .button-row .button {
    width: 100%;
    justify-content: center;
  }

  .desktop-frame {
    aspect-ratio: auto;
    min-height: 68vh;
  }

  .overview-strip,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .overview-primary {
    grid-column: auto;
  }

  .overview-cell {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .overview-primary,
  .overview-cell {
    padding: 15px;
  }

  .panel {
    padding: 14px;
  }

  .panel-header,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-row {
    padding: 12px;
  }

  .target-record {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .target-message,
  .target-reason {
    grid-column: 1 / -1;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .target-record .button,
  .target-record form {
    grid-column: 1 / -1;
    width: 100%;
  }

  .target-record form .button {
    width: 100%;
  }

  .segmented-control {
    width: 100%;
    overflow-x: auto;
  }

  .segment-button {
    flex: 1 0 auto;
  }

  .friend-picker-toolbar {
    flex-direction: column;
  }

  .button-row > *,
  .button-grid > * {
    flex: 1 1 100%;
  }

  .login-brand-panel,
  .login-form-panel {
    padding: 24px 20px;
  }

  .login-features {
    display: none;
  }
}
[data-sms-login-form][hidden] { display: none !important; }
.login-sms-form { display: grid; gap: 12px; margin-top: 14px; }
.login-sms-form label { display: grid; gap: 6px; }
.login-sms-form input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 16px; }
.login-sms-form button { min-height: 44px; }
.cards-panel { min-width:0; }
.cards-create { margin:18px 0 24px; padding-bottom:18px; border-bottom:1px solid var(--border); }
.cards-create > summary { width:max-content; cursor:pointer; }
#card-bulk-form[hidden] { display:none !important; }
.cards-panel .cards-table { min-width:760px; }
.cards-table th:nth-child(6), .cards-table td.cards-created { display:none; }
.cards-panel .cards-audit { min-width:130px; }
@media(max-width:700px) {
  .cards-panel .cards-table { min-width:0; display:block; }
  .cards-panel .cards-table thead { display:block; padding:12px; }
  .cards-panel .cards-table thead tr { display:block; }
  .cards-panel .cards-table th { display:none; }
  .cards-panel .cards-table th:first-child { display:block; border:0; }
  .cards-panel .cards-table th:first-child::after { content:' 全选当前页'; }
  .cards-panel .cards-table tbody { display:grid; gap:12px; padding:12px; }
  .cards-panel .cards-table tbody tr { display:grid; grid-template-columns:32px minmax(0,1fr); padding:12px; border:1px solid var(--border); border-radius:10px; background:var(--surface); }
  .cards-panel .cards-table td { padding:6px 0; border:0; grid-column:2; overflow-wrap:anywhere; white-space:normal; }
  .cards-panel .cards-table td:first-child { grid-column:1; grid-row:1 / span 2; }
  .cards-panel .cards-table td:nth-child(4)::before { content:'注册用户：'; color:var(--text-muted); }
  .cards-panel .cards-table td:nth-child(5)::before { content:'使用时间：'; color:var(--text-muted); }
  .cards-panel .cards-table td:nth-child(7)::before { content:'备注：'; color:var(--text-muted); }
  .cards-panel .cards-table td.cards-created { display:none; }
  .cards-panel .cards-note { max-width:none; }
  .cards-panel .cards-table td .button-row > * { flex:0 1 auto; }
}
.cards-toolbar,.cards-pagination { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin:16px 0; }
.cards-generate { display:flex; align-items:end; flex-wrap:wrap; gap:14px; padding:18px 0; }
.cards-generate label,.cards-page-form label { display:grid; gap:6px; }
.cards-generate label:first-of-type { width:110px; }
.cards-generate label:nth-of-type(2) { flex:1; min-width:200px; }
.cards-create .cards-generate { display:grid; grid-template-columns:100px minmax(200px,1fr) 160px 160px auto; align-items:end; gap:16px; }
.cards-create .cards-generate label:first-of-type,
.cards-create .cards-generate label:nth-of-type(2) { width:auto; min-width:0; }
.cards-create .cards-generate label { min-width:0; }
.cards-create .cards-generate input { width:100%; height:42px; }
.cards-create .cards-generate > button { height:42px; white-space:nowrap; }
@media(max-width:1200px) {
  .cards-create .cards-generate { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cards-create .cards-generate label:nth-of-type(2) { grid-column:2; }
  .cards-create .cards-generate > button { grid-column:1 / -1; justify-self:end; }
}
@media(max-width:520px) {
  .cards-create .cards-generate { gap:14px 12px; }
  .cards-create .cards-generate label:nth-of-type(2) { grid-column:1 / -1; grid-row:3; }
  .cards-create .cards-generate > button { justify-self:stretch; width:100%; }
}
.cards-page-form { display:flex; align-items:end; gap:10px; }
.cards-page-form input,.cards-page-form select { width:100px; }
.cards-panel > textarea { width:100%; }
.cards-table-scroll { max-width:100%; overflow-x:auto; border:1px solid var(--border); border-radius:12px; }
.cards-table { width:100%; border-collapse:collapse; min-width:1060px; font-size:13px; }
.cards-table th,.cards-table td { padding:14px 12px; text-align:left; vertical-align:top; border-bottom:1px solid var(--border); }
.cards-table th { white-space:nowrap; opacity:.75; }
.cards-table td small { display:block; margin-top:5px; font-size:11px; opacity:.6; }
.cards-time { white-space:nowrap; }
.cards-note { min-width:100px; max-width:180px; overflow-wrap:anywhere; }
.cards-status { display:inline-block; padding:4px 8px; border-radius:6px; background:rgba(255,123,67,.12); white-space:nowrap; }
.cards-status-unused { color:var(--info); background:var(--info-soft); }
.cards-status-used { color:var(--success); background:var(--success-soft); }
.cards-status-revoked { color:var(--warning); background:var(--warning-soft); }
.cards-status-deleted { color:var(--text-muted); background:var(--surface-soft); }
.cards-audit { margin-top:10px; min-width:180px; }
.cards-audit summary { cursor:pointer; }
.cards-audit p,.cards-audit li { font-size:12px; margin-top:8px; }
.cards-table .button { min-height:32px; padding:6px 10px; font-size:12px; }
.cards-empty { text-align:center !important; padding:32px !important; }
.cards-select { width:18px !important; height:18px; margin:0; cursor:pointer; }
.developer-contact { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:8px 16px; padding:20px 16px; font-size:13px; color:var(--text-muted, #888); text-align:center; }
.developer-contact strong { color:var(--text, inherit); user-select:all; letter-spacing:.5px; }
.announcement-dialog { width:min(640px,calc(100vw - 32px)); max-height:85vh; overflow:auto; padding:32px; border:1px solid var(--border); border-top:4px solid var(--primary); border-radius:20px; background:var(--surface); color:var(--text); box-shadow:0 24px 80px rgba(0,0,0,.3); }
.announcement-dialog h2 { font-size:24px; line-height:1.4; margin:0 0 20px; }
.announcement-dialog::backdrop { background:rgba(0,0,0,.6); }
.announcement-body { white-space:pre-wrap; overflow-wrap:anywhere; font-size:17px; line-height:1.9; margin:18px 0 28px; }
.announcement-dialog .button { min-height:44px; font-size:16px; }
@media(max-width:520px) { .announcement-dialog { padding:24px 20px; } .announcement-dialog h2 { font-size:22px; } .announcement-body { font-size:16px; line-height:1.85; } }
.announcement-dialog .check-row { margin:16px 0; }
.login-page { --bg:#f6f7fb; --surface:#fff; --text:#263044; --text-muted:#758096; --text-faint:#8d96a6; --border:#e6eaf1; --surface-alt:#f6f7fb; background:#f6f7fb; color:#263044; grid-template-columns:minmax(0,1.1fr) minmax(400px,.9fr); }
.login-page .login-brand-panel { position:relative; background:radial-gradient(ellipse at 50% 65%,#ffdeb7 0%,#fff2e2 40%,#fff9f2 80%); border:0; padding:40px 9%; gap:24px; }
.login-page .login-brand-copy { text-align:center; max-width:540px; }
.login-page .login-brand-copy h1 { color:#413025; font-size:44px; line-height:1.25; letter-spacing:-1px; }
.login-page .login-brand-copy h1 span { color:#ed7240; }
.login-page .login-brand-copy p { color:#947b68; }
.login-mascot { width:min(380px,100%); height:auto; display:block; margin:10px auto; object-fit:contain; filter:drop-shadow(0 24px 22px #e7983335); }
.login-page .login-features { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; margin-top:8px; }
.login-page .login-features li { padding:8px 12px; border:1px solid #f0dcc6; border-radius:999px; color:#9a7455; font-size:12px; background:#ffffff75; }
.login-page .login-features li:last-child { display:none; }
.login-page .login-form-panel { padding:40px; }
.login-page .login-card { background:#fff; border:1px solid #e8ecf3; border-radius:24px; box-shadow:0 24px 70px #3445630c; padding:38px; width:min(100%,460px); }
.login-welcome { display:block; font-size:11px; letter-spacing:3px; color:#df8e61; margin-bottom:12px; }
.brand-mark.mascot-brand { background:transparent; box-shadow:none; width:44px; height:44px; flex-shrink:0; }
.brand-mark.mascot-brand img { display:block; width:100%; height:100%; object-fit:contain; }
.login-page .login-card h2 { font-size:30px; }
.login-page .login-card > p { font-size:14px; margin:10px 0 28px; }
.login-page input:not([type=hidden]) { background:#f8f9fc; color:#263044; border:1px solid #e4e8ef; border-radius:10px; }
.login-page .button-primary { border-radius:11px; min-height:46px; box-shadow:0 8px 20px #ef6b3e20; }
.login-page .login-card > details { margin-top:24px; padding-top:18px; border-top:1px solid #edf0f5; color:#758096; }
.login-page .login-card > details summary { cursor:pointer; font-size:13px; }
.login-page .login-foot { font-size:11px; margin-top:22px; }
@media(max-width:900px) { .login-page { grid-template-columns:1fr; } .login-page .login-brand-panel { min-height:250px; padding:24px; gap:18px; } .login-page .login-brand-copy { text-align:left; padding-right:140px; } .login-page .login-brand-copy h1 { font-size:28px; } .login-page .login-brand-copy p { font-size:12px; } .login-mascot { position:absolute; width:145px; right:12px; bottom:20px; margin:0; } .login-page .login-features,.login-brand-disclaimer { display:none; } .login-page .login-form-panel { padding:24px 16px 40px; align-items:flex-start; } .login-page .login-card { padding:28px 24px; } }
#card-bulk-form label { width:auto; flex:initial; }
#card-bulk-form label[data-bulk-note] { flex:1; min-width:200px; }
#card-bulk-form [hidden] { display:none !important; }
#card-bulk-form small { flex-basis:100%; }
@media(max-width:600px) { .cards-generate > button { width:100%; } .cards-toolbar .button-row { flex-wrap:wrap; } .cards-pagination { align-items:stretch; } }
