:root {
  color-scheme: light;
  --zw-bg: #f4f5f7;
  --zw-surface: #ffffff;
  --zw-surface-muted: #edf1f5;
  --zw-surface-strong: #e4e9ef;
  --zw-text: #16181c;
  --zw-text-secondary: #5e6570;
  --zw-text-tertiary: #7b828c;
  --zw-line: rgba(28, 35, 45, .11);
  --zw-line-strong: rgba(28, 35, 45, .18);
  --zw-blue: #0877e8;
  --zw-blue-pressed: #0566c9;
  --zw-blue-soft: #eaf4ff;
  --zw-green: #21864a;
  --zw-green-soft: #eaf7ef;
  --zw-red: #c92d3a;
  --zw-red-soft: #fcecef;
  --zw-amber: #a76600;
  --zw-amber-soft: #fff4df;
  --zw-radius: 12px;
  --zw-radius-sm: 9px;
  --zw-shadow: 0 4px 16px rgba(30, 38, 52, .075);
  --zw-shadow-raised: 0 12px 32px rgba(30, 38, 52, .12);
  --zw-ease-out: cubic-bezier(.23, 1, .32, 1);
  --zw-ease-drawer: cubic-bezier(.32, .72, 0, 1);
}

html:has(body[data-zw-system]) {
  min-width: 0;
  background: var(--zw-bg);
}

body[data-zw-system],
body[data-zw-system] * {
  box-sizing: border-box;
  letter-spacing: 0;
}

body[data-zw-system] {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: var(--zw-bg);
  color: var(--zw-text);
  caret-color: var(--zw-blue);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

body[data-zw-system] ::selection {
  background: rgba(8, 119, 232, .2);
  color: #0d2844;
}

body[data-zw-system] :where(button, a, input, select, textarea) {
  font: inherit;
}

body[data-zw-system] :where(button, [role="button"], a) {
  touch-action: manipulation;
}

body[data-zw-system] :where(button, [role="button"]) {
  min-height: 44px;
}

body[data-zw-system] :where(button, [role="button"]):not(:disabled):active {
  transform: scale(.97);
  transition-duration: 100ms;
}

body[data-zw-system] :where(input, select, textarea) {
  min-height: 44px;
  border: 1px solid var(--zw-line-strong);
  border-radius: var(--zw-radius-sm);
  background: var(--zw-surface);
  color: var(--zw-text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

body[data-zw-system] :where(input, select, textarea)::placeholder {
  color: var(--zw-text-tertiary);
  opacity: 1;
}

body[data-zw-system] :where(input, select, textarea):focus {
  border-color: var(--zw-blue);
  box-shadow: 0 0 0 3px rgba(8, 119, 232, .14);
}

body[data-zw-system] :where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(8, 119, 232, .35);
  outline-offset: 2px;
}

body[data-zw-system] :where(button, input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: .52;
}

body[data-zw-system] a {
  color: var(--zw-blue);
  text-underline-offset: 3px;
}

body[data-zw-system] :where(.btn, .primary-btn, .secondary-btn, .modal-btn, .login-btn, .send-btn, .pm-send-btn) {
  min-height: 44px;
  border: 0;
  border-radius: var(--zw-radius-sm);
  box-shadow: none;
  font-weight: 700;
  transition: transform 120ms ease-out, background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

body[data-zw-system] :where(.btn-primary, .primary-btn, .modal-btn, .login-btn, .send-btn, .pm-send-btn) {
  background: var(--zw-blue);
  color: #fff;
}

body[data-zw-system] a.modal-btn,
body[data-zw-system] a.primary-btn {
  color: #fff !important;
}

body[data-zw-system] .modal a.modal-btn {
  min-height: 48px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 48px !important;
}

body[data-zw-system] :where(.btn-secondary, .secondary-btn, .modal-btn-secondary) {
  border: 1px solid var(--zw-line);
  background: var(--zw-surface-muted);
  color: var(--zw-text);
}

body[data-zw-system] :where(.btn-danger, .danger-btn) {
  background: var(--zw-red);
  color: #fff;
}

body[data-zw-system] :where(.btn-success, .success-btn) {
  background: var(--zw-green);
  color: #fff;
}

body[data-zw-system] :where(.spinner, .login-spinner, .shield-spinner) {
  border-color: rgba(8, 119, 232, .18);
  border-top-color: var(--zw-blue);
}

body[data-zw-system] :where(.hidden, [hidden]) {
  display: none !important;
}

body[data-zw-system] * {
  scrollbar-color: rgba(95, 105, 118, .45) transparent;
  scrollbar-width: thin;
}

body[data-zw-system] *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body[data-zw-system] *::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(95, 105, 118, .42);
  background-clip: padding-box;
}

body[data-zw-system] *::-webkit-scrollbar-track {
  background: transparent;
}

/* Normalize the legacy enterprise token sets onto the shared system. */
body[data-zw-system] {
  --ent-bg: var(--zw-bg);
  --ent-surface: var(--zw-surface);
  --ent-surface-2: var(--zw-surface-muted);
  --ent-text: var(--zw-text);
  --ent-text-2: var(--zw-text-secondary);
  --ent-text-3: var(--zw-text-tertiary);
  --ent-border: var(--zw-line);
  --ent-border-strong: var(--zw-line-strong);
  --ent-primary: var(--zw-blue);
  --ent-primary-light: var(--zw-blue-pressed);
  --ent-primary-bg: var(--zw-blue-soft);
  --ent-accent: var(--zw-blue);
  --ent-success: var(--zw-green);
  --ent-success-bg: var(--zw-green-soft);
  --ent-warning: var(--zw-amber);
  --ent-warning-bg: var(--zw-amber-soft);
  --ent-danger: var(--zw-red);
  --ent-danger-bg: var(--zw-red-soft);
  --ent-gold: var(--zw-amber);
  --ent-purple: #6f5b9b;
  --ent-cyan: #167f92;
  --ent-dark: #313842;
  --ent-radius: var(--zw-radius);
  --ent-radius-sm: var(--zw-radius-sm);
  --ent-radius-lg: var(--zw-radius);
  --ent-shadow: var(--zw-shadow);
  --ent-shadow-md: var(--zw-shadow);
  --ent-shadow-lg: var(--zw-shadow-raised);
  --ent-grad: var(--zw-blue);
  --ent-grad-soft: var(--zw-blue-soft);
}

/* Administrator shell */
body[data-zw-system="admin"] {
  min-height: 100dvh;
  padding: 18px;
}

body[data-zw-system="admin"] > .app {
  width: min(100%, 1180px);
  min-width: 0;
  margin: 0 auto;
  padding: 22px;
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow-raised);
}

body[data-zw-system="admin"] #adminPanel > .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 20px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--zw-line);
  background: transparent;
  box-shadow: none;
}

body[data-zw-system="admin"] #adminPanel > .header h1 {
  margin: 0;
  color: var(--zw-text);
  font-size: 24px;
  font-weight: 780;
  line-height: 1.2;
}

body[data-zw-system="admin"] #adminPanel > .header h1 .ico {
  color: var(--zw-blue);
}

body[data-zw-system="admin"] .stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

body[data-zw-system="admin"] .stat-card {
  min-width: 0;
  min-height: 98px;
  padding: 16px;
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: var(--zw-surface-muted) !important;
  box-shadow: none;
}

body[data-zw-system="admin"] .stat-card::before {
  display: none;
}

body[data-zw-system="admin"] .stat-value {
  color: var(--zw-text) !important;
  font-size: 25px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

body[data-zw-system="admin"] .stat-label {
  margin-top: 9px;
  color: var(--zw-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

body[data-zw-system="admin"] #adminPanel > .tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0 -4px 22px;
  padding: 4px;
  overflow-x: auto;
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: var(--zw-surface-muted);
  box-shadow: none;
  scrollbar-width: none;
}

body[data-zw-system="admin"] #adminPanel > .tabs::-webkit-scrollbar {
  display: none;
}

body[data-zw-system="admin"] .tab-btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--zw-text-secondary);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

body[data-zw-system="admin"] .tab-btn.active {
  background: var(--zw-surface);
  color: var(--zw-blue);
  box-shadow: 0 1px 4px rgba(30, 38, 52, .1);
}

body[data-zw-system="admin"] :where(.generate-card, .filter-bar, .batch-bar, .table-container, .settings-card, .inventory-card) {
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow);
}

body[data-zw-system="admin"] :where(.btn-primary, .login-brand-mark) {
  box-shadow: none !important;
}

body[data-zw-system="admin"] .generate-card {
  padding: 20px;
}

body[data-zw-system="admin"] .filter-bar,
body[data-zw-system="admin"] .batch-bar {
  gap: 10px;
  padding: 12px;
}

body[data-zw-system="admin"] .form-group label,
body[data-zw-system="admin"] .modal label {
  color: var(--zw-text-secondary);
  font-weight: 650;
}

body[data-zw-system="admin"] :where(.table-container, .table-wrapper) {
  max-width: 100%;
  overflow-x: auto;
}

body[data-zw-system="admin"] table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

body[data-zw-system="admin"] th {
  background: var(--zw-surface-muted);
  color: var(--zw-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

body[data-zw-system="admin"] :where(th, td) {
  border-color: var(--zw-line);
}

body[data-zw-system="admin"].admin-login-mode {
  display: grid;
  place-items: center;
  padding: 18px;
}

body[data-zw-system="admin"] #loginPage.login-container {
  width: min(100%, 820px);
  min-height: 500px;
  overflow: hidden;
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow-raised);
}

body[data-zw-system="admin"] .login-brand {
  background: #20252d;
  color: #fff;
}

body[data-zw-system="admin"] .login-brand::before,
body[data-zw-system="admin"] .login-brand::after {
  display: none;
}

body[data-zw-system="admin"] .login-brand-kicker,
body[data-zw-system="admin"] .login-kicker {
  color: var(--zw-blue);
}

body[data-zw-system="admin"] .login-card {
  border: 0;
  background: var(--zw-surface);
  box-shadow: none;
}

body[data-zw-system="admin"] .login-field {
  min-height: 58px;
  border: 1px solid var(--zw-line-strong);
  border-radius: var(--zw-radius-sm);
  background: var(--zw-surface);
  box-shadow: none;
}

body[data-zw-system="admin"] .login-field:focus-within {
  border-color: var(--zw-blue);
  box-shadow: 0 0 0 3px rgba(8, 119, 232, .14);
}

body[data-zw-system="admin"] .login-field input {
  min-height: 45px !important;
}

body[data-zw-system="admin"] .login-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
}

/* Link recharge and explanatory screens */
body[data-zw-system="recharge"],
body[data-zw-system="link-guide"] {
  min-height: 100dvh;
}

body[data-zw-system="recharge"] :where(.link-recharge-header, .lr-header, .topbar),
body[data-zw-system="link-guide"] :where(.topbar, header) {
  border-color: var(--zw-line);
  background: rgba(244, 245, 247, .92);
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
}

body[data-zw-system="recharge"] :where(.link-recharge-body, .container, main),
body[data-zw-system="link-guide"] :where(.container, main) {
  width: min(100%, 760px);
  margin: 0 auto;
}

body[data-zw-system="recharge"] :where(.card, .lr-card, .link-card, .account-card, .result-card),
body[data-zw-system="link-guide"] :where(.card, .panel, .step) {
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow);
}

body[data-zw-system="recharge"] :where(.tabs, .mode-tabs, .segment),
body[data-zw-system="link-guide"] :where(.tabs, .segment) {
  padding: 4px;
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: var(--zw-surface-muted);
  box-shadow: none;
}

body[data-zw-system="recharge"] :where(.tab, .mode-tab).active,
body[data-zw-system="link-guide"] .tab.active {
  background: var(--zw-surface);
  color: var(--zw-blue);
  box-shadow: 0 1px 4px rgba(30, 38, 52, .1);
}

body[data-zw-system="recharge"] .splash-overlay {
  background: var(--zw-bg);
  color: var(--zw-text);
}

body[data-zw-system="recharge"] .splash-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--zw-radius);
  background: var(--zw-blue-soft);
  box-shadow: none;
  animation: none;
}

body[data-zw-system="recharge"] .splash-logo svg {
  width: 30px;
  height: 30px;
  color: var(--zw-blue);
  animation: none;
}

body[data-zw-system="recharge"] .splash-title {
  color: var(--zw-text);
  animation: none;
  opacity: 1;
}

body[data-zw-system="recharge"] .splash-subtitle {
  color: var(--zw-text-secondary);
  animation: none;
  opacity: 1;
}

body[data-zw-system="recharge"] .splash-bar {
  background: var(--zw-surface-strong);
  animation: none;
  opacity: 1;
}

body[data-zw-system="recharge"] .splash-bar-fill {
  background: var(--zw-blue);
  animation: splashBarLoad 360ms var(--zw-ease-out) both;
}

body[data-zw-system="recharge"] .splash-dots {
  display: none;
}

/* Chat */
body[data-zw-system="chat"] {
  height: 100dvh;
  min-height: 100dvh;
  background: var(--zw-bg);
}

body[data-zw-system="chat"] :where(.top-bar, .header, .chat-header, .bottom-nav, .input-area, .pm-input-area) {
  border-color: var(--zw-line);
  background: rgba(255, 255, 255, .94);
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
}

body[data-zw-system="chat"] :where(.chat-app, .app, .container) {
  background: var(--zw-bg);
}

body[data-zw-system="chat"] :where(.message-bubble, .message-content, .pm-bubble) {
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: 0 2px 8px rgba(30, 38, 52, .06);
}

body[data-zw-system="chat"] :where(.ent-logo, .avatar-btn) {
  box-shadow: none;
}

body[data-zw-system="chat"] .friend-item[style*="border-left"] {
  border-left: 0 !important;
  box-shadow: inset 0 0 0 1px rgba(8, 119, 232, .18);
}

body[data-zw-system="chat"] img:not([src]),
body[data-zw-system="chat"] img[src=""] {
  visibility: hidden;
}

body[data-zw-system="chat"] :where(.message.mine .message-bubble, .message-mine .message-content, .pm-message.mine .pm-bubble) {
  background: var(--zw-blue);
  color: #fff;
}

body[data-zw-system="chat"] :where(.emoji-panel, .action-panel, .mention-inline, .cmd-hint, .online-panel, .modal) {
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow-raised);
}

body[data-zw-system="chat"] :where(.emoji-btn, .image-btn, .pm-emoji-btn, .pm-image-btn, .online-panel-close, .pm-chat-back) {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--zw-text-secondary);
}

body[data-zw-system="chat"] :where(.chat-input, .pm-input) {
  font-size: 16px;
}

/* Music player */
body[data-zw-system="music"] {
  min-height: 100dvh;
  background: var(--zw-bg);
}

body[data-zw-system="music"] :where(.topbar, .player-bar, .tabbar, .mini-player) {
  border-color: var(--zw-line);
  background: rgba(255, 255, 255, .94);
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
}

body[data-zw-system="music"] :where(.ent-nav-back, .ent-nav-home) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--zw-blue);
}

body[data-zw-system="music"] #island,
body[data-zw-system="music"] #island.min {
  width: min(calc(100vw - 32px), 480px);
  max-width: 480px;
  margin-top: 10px;
  transition: none;
}

body[data-zw-system="music"] #island .island-box,
body[data-zw-system="music"] #island.min .island-box,
body[data-zw-system="music"] #island.expanded .island-box {
  height: auto;
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: border-radius 180ms ease-out, box-shadow 180ms ease-out;
}

body[data-zw-system="music"] #island.min .pill {
  height: 56px;
  padding: 0 14px;
}

body[data-zw-system="music"] #island .pill-cover {
  width: 36px;
  height: 36px;
  border-radius: var(--zw-radius-sm);
}

body[data-zw-system="music"] img:not([src]),
body[data-zw-system="music"] img[src=""] {
  visibility: hidden;
}

body[data-zw-system="link-guide"] .progress-fill {
  background: var(--zw-blue);
  box-shadow: none;
}

body[data-zw-system="music"] :where(.card, .song-card, .playlist-card, .sheet, .modal) {
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow);
}

body[data-zw-system="music"] :where(.play-btn, .control-primary, .primary) {
  background: var(--zw-blue);
  color: #fff;
}

body[data-zw-system="music"] :where(.sheet, .modal) {
  background: var(--zw-surface) !important;
  transition: transform 240ms var(--zw-ease-drawer), opacity 180ms ease-out;
}

body[data-zw-system="music"] :where(.ambient, .bg-orb, .glow) {
  display: none !important;
}

/* Dashboard, including its unauthenticated login */
body[data-zw-system="dashboard"] {
  min-height: 100dvh;
  padding: 22px;
  --bg: var(--zw-bg);
  --bg-card: var(--zw-surface);
  --bg-hover: var(--zw-surface-muted);
  --border: var(--zw-line);
  --text: var(--zw-text);
  --text-muted: var(--zw-text-secondary);
  --brand: var(--zw-blue);
  --brand-light: var(--zw-blue-pressed);
  --green: var(--zw-green);
  --green-bg: var(--zw-green-soft);
  --blue: var(--zw-blue);
  --blue-bg: var(--zw-blue-soft);
  --orange: var(--zw-amber);
  --orange-bg: var(--zw-amber-soft);
  --red: var(--zw-red);
  --red-bg: var(--zw-red-soft);
  --cyan: #167f92;
  --cyan-bg: #e7f5f7;
  --radius: var(--zw-radius);
}

body[data-zw-system="dashboard"] .container {
  width: min(100%, 1180px);
  margin: 0 auto;
}

body[data-zw-system="dashboard"]:not(:has(.container)) {
  display: flex;
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 24px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

body[data-zw-system="dashboard"]:not(:has(.container)) > :where(h1, h2, h3, input, button, form) {
  width: min(100%, 380px);
  margin: 0;
}

body[data-zw-system="dashboard"]:not(:has(.container)) > :where(h1, h2, h3) {
  margin-bottom: 8px;
  font-size: 26px;
  font-weight: 780;
  line-height: 1.2;
}

body[data-zw-system="dashboard"]:not(:has(.container)) button {
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: var(--zw-blue) !important;
  color: #fff;
  font-weight: 700;
}

body[data-zw-system="dashboard"] header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--zw-line);
}

body[data-zw-system="dashboard"] :where(.kpi-card, .card) {
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow);
}

body[data-zw-system="dashboard"] .kpi-card .value {
  font-variant-numeric: tabular-nums;
}

body[data-zw-system="dashboard"] table {
  font-variant-numeric: tabular-nums;
}

/* Security interstitial */
body[data-zw-system="shield"] {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 18px;
  background: var(--zw-bg);
}

body[data-zw-system="shield"] .shield-header {
  position: fixed;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  height: calc(52px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--zw-line);
  background: rgba(244, 245, 247, .92);
  color: var(--zw-text);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
}

body[data-zw-system="shield"] .shield-card {
  width: min(100%, 380px);
  margin: 44px 0 0;
  padding: 28px 24px;
  border: 0;
  border-radius: var(--zw-radius);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow-raised);
}

body[data-zw-system="shield"] .shield-title {
  color: var(--zw-text);
  font-size: 22px;
  font-weight: 780;
}

body[data-zw-system="shield"] .shield-subtitle,
body[data-zw-system="shield"] .shield-status {
  color: var(--zw-text-secondary);
}

body[data-zw-system="shield"] .countdown-track {
  stroke: var(--zw-surface-muted);
}

body[data-zw-system="shield"] .countdown-progress {
  stroke: var(--zw-blue);
}

body[data-zw-system="shield"] .countdown-number {
  color: var(--zw-blue);
  font-variant-numeric: tabular-nums;
}

/* Diagnostic output remains readable without becoming a second visual world. */
body[data-zw-system="diagnostic"] {
  min-height: 100dvh;
  padding: 24px;
}

body[data-zw-system="diagnostic"] > * {
  width: min(100%, 900px);
  margin-right: auto;
  margin-left: auto;
}

body[data-zw-system="diagnostic"] h1,
body[data-zw-system="diagnostic"] h2 {
  color: var(--zw-text);
  border-color: var(--zw-line);
}

body[data-zw-system="diagnostic"] pre {
  overflow-x: auto;
  border-radius: var(--zw-radius-sm);
  background: #20252d;
  color: #eef2f6;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (hover: hover) and (pointer: fine) {
  body[data-zw-system] :where(.btn-primary, .primary-btn, .modal-btn, .login-btn, .send-btn, .pm-send-btn):not(:disabled):hover {
    background: var(--zw-blue-pressed);
  }

  body[data-zw-system] :where(.btn-secondary, .secondary-btn, .tab-btn, .modal-btn-secondary):not(:disabled):hover {
    background: var(--zw-surface-strong);
  }
}

@media (max-width: 760px) {
  body[data-zw-system] :where(input, select, textarea) {
    font-size: 16px;
  }

  body[data-zw-system="admin"] {
    padding: 0;
  }

  body[data-zw-system="admin"] > .app {
    width: 100%;
    min-height: 100dvh;
    padding: 0 14px max(28px, env(safe-area-inset-bottom));
    border-radius: 0;
    box-shadow: none;
  }

  body[data-zw-system="admin"] #adminPanel > .header {
    position: sticky;
    z-index: 80;
    top: 0;
    margin: 0 -14px 16px;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
    background: rgba(244, 245, 247, .92);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    backdrop-filter: blur(18px) saturate(145%);
  }

  body[data-zw-system="admin"] #adminPanel > .header h1 {
    font-size: 19px;
  }

  body[data-zw-system="admin"] .header-right {
    gap: 4px;
  }

  body[data-zw-system="admin"] .header-right .btn {
    min-width: 44px;
    padding: 0 10px;
    font-size: 12px;
  }

  body[data-zw-system="admin"] #accountInfo {
    display: none;
  }

  body[data-zw-system="admin"] .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body[data-zw-system="admin"] .stat-card {
    min-height: 86px;
    padding: 14px;
  }

  body[data-zw-system="admin"] #adminPanel > .tabs {
    position: sticky;
    z-index: 70;
    top: calc(60px + env(safe-area-inset-top));
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
    border-radius: 0;
  }

  body[data-zw-system="admin"] .form-row,
  body[data-zw-system="admin"] .filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-zw-system="admin"] .form-group,
  body[data-zw-system="admin"] .filter-bar > * {
    width: 100% !important;
    min-width: 0 !important;
  }

  body[data-zw-system="admin"] .form-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-zw-system="admin"] :where(.generate-card, .settings-card, .inventory-card) {
    padding: 16px;
  }

  body[data-zw-system="admin"].admin-login-mode {
    padding: 0;
  }

  body[data-zw-system="admin"].admin-login-mode > .app {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    padding: 0;
  }

  body[data-zw-system="admin"] #loginPage.login-container {
    display: block;
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }

  body[data-zw-system="admin"] .login-brand {
    display: none;
  }

  body[data-zw-system="admin"] .login-card {
    display: flex;
    min-height: 100dvh;
    padding: calc(64px + env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
    flex-direction: column;
    justify-content: center;
    margin: 0;
  }

  body[data-zw-system="dashboard"] {
    padding: 16px 14px max(28px, env(safe-area-inset-bottom));
  }

  body[data-zw-system="dashboard"] .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-zw-system="shield"] .shield-card {
    padding: 24px 18px;
  }

  body[data-zw-system="diagnostic"] {
    padding: 18px 14px;
  }
}

@media (max-width: 360px) {
  body[data-zw-system="admin"] .header-right .btn {
    width: 44px;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  body[data-zw-system="admin"] .header-right .btn::first-letter {
    color: var(--zw-text);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-zw-system] *,
  body[data-zw-system] *::before,
  body[data-zw-system] *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  body[data-zw-system] :where(.header, .topbar, .bottom-nav, .input-area, .player-bar, .shield-header) {
    background: var(--zw-bg) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-contrast: more) {
  body[data-zw-system] {
    --zw-line: rgba(22, 24, 28, .35);
    --zw-line-strong: rgba(22, 24, 28, .62);
  }
}
