@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

:root {
  --brand: #ff6fae;
  --brand-dark: #5ac8fa;
  --accent: #34c759;
  --surface: #fbf7fb;
  --surface-dark: #111113;
  --surface-elevated: rgba(255, 255, 255, 0.82);
  --border-subtle: rgba(255, 111, 174, 0.14);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --soft: #fff3f8;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 111, 174, 0.16), transparent 32%),
    radial-gradient(circle at 88% 10%, rgba(90, 200, 250, 0.18), transparent 30%),
    linear-gradient(180deg, #fffafd 0%, var(--surface) 48%, #fff 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.brand-glow {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 50%;
  width: min(760px, 100vw);
  height: 280px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 111, 174, 0.14), rgba(90, 200, 250, 0.06) 55%, transparent);
}

.auth-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: calc(100vw - 32px);
  max-width: 448px;
  flex-direction: column;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  filter: drop-shadow(0 14px 20px rgba(29, 29, 31, 0.08));
}

.logo-wrap {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.12));
}

.logo-wrap img {
  width: 100%;
  height: 100%;
}

.brand-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.glass-card {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-elevated);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08), inset 0 1px rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(24px) saturate(1.7);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
  border-color: rgba(0, 122, 255, 0.22);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(0, 122, 255, 0.08),
    inset 0 1px rgba(255, 255, 255, 0.64);
}

.auth-card {
  padding: 32px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: block;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
}

.field b {
  margin-left: 2px;
  color: #ef4444;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 50px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 16px;
  color: #111827;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input::placeholder {
  color: #9ca3af;
}

.field input:focus {
  border-color: rgba(0, 122, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.field small,
.standalone-error {
  display: block;
  min-height: 0;
  margin-top: 4px;
  color: #ef4444;
  font-size: 12px;
  line-height: 1.35;
}

.password-row {
  position: relative;
}

.password-row input {
  padding-right: 48px;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: center;
}

.captcha-row input {
  min-width: 0;
}

.captcha-image-btn {
  width: 150px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.captcha-image-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eye-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #9ca3af;
  background: transparent;
  transform: translateY(-50%);
  transition: color 0.15s;
}

.eye-btn:hover {
  color: #4b5563;
}

.eye-btn svg {
  width: 18px;
  height: 18px;
}

.eye-btn .eye-open,
.eye-btn.showing .eye-closed {
  display: block;
}

.eye-btn .eye-closed,
.eye-btn.showing .eye-open {
  display: none;
}

.agree-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #4b5563;
  font-size: 14px;
}

.agree-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.agree-row button,
.login-link a {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  text-decoration: none;
}

.agree-row button:hover,
.login-link a:hover {
  text-decoration: underline;
}

.btn-brand {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  font-weight: 600;
  box-shadow: 0 0 0 rgba(0, 122, 255, 0);
  transition: box-shadow 0.3s, transform 0.15s, opacity 0.15s;
}

.btn-brand:hover:not(:disabled) {
  box-shadow: 0 0 20px 4px rgba(0, 122, 255, 0.3);
}

.btn-brand:active:not(:disabled) {
  transform: scale(0.98);
  box-shadow: 0 0 8px 2px rgba(0, 122, 255, 0.2);
}

.btn-brand:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.login-link {
  margin: 20px 0 0;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
}

.alert {
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 12px 16px;
  color: #dc2626;
  background: #fef2f2;
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.modal[hidden] {
  display: none !important;
  pointer-events: none;
}

.terms-card {
  display: flex;
  width: 100%;
  max-width: 512px;
  max-height: 80vh;
  flex-direction: column;
  overflow: hidden;
}

.terms-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(1.35);
}

.terms-head h2 {
  margin: 0;
  color: #111827;
  font-size: 18px;
  font-weight: 700;
}

.terms-head button {
  border: 0;
  color: #9ca3af;
  background: transparent;
  font-size: 20px;
  transition: color 0.15s;
}

.terms-head button:hover {
  color: #4b5563;
}

.terms-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  color: #374151;
  font-size: 14px;
  line-height: 1.625;
}

.terms-body h1 {
  margin: 16px 0 12px;
  font-size: 20px;
  font-weight: 700;
}

.terms-body h2 {
  margin: 20px 0 8px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
  font-size: 18px;
  font-weight: 700;
}

.terms-body p {
  margin: 0 0 12px;
}

.terms-body hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.terms-body blockquote {
  margin: 8px 0;
  border-left: 2px solid #d1d5db;
  padding-left: 12px;
  color: #9ca3af;
  font-size: 12px;
}

.terms-actions {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  padding: 16px 24px;
}

.btn-secondary {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 16px;
  color: #4b5563;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #f9fafb;
}

.terms-actions .btn-brand {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
}

.logo-glow {
  filter: drop-shadow(0 12px 22px rgba(0, 122, 255, 0.18));
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 2px;
  background: rgba(0, 122, 255, 0.3);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 122, 255, 0.5);
}

@media (prefers-color-scheme: dark) {
  body {
    color: #f9fafb;
    background: var(--surface-dark);
  }

  .brand-glow {
    background: linear-gradient(180deg, rgba(0, 122, 255, 0.16), rgba(88, 86, 214, 0.06) 54%, transparent);
  }

  .brand-header h1,
  .terms-head h2 {
    color: #fff;
  }

  .glass-card {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(31, 41, 55, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.05);
  }

  .glass-card:hover {
    border-color: rgba(0, 122, 255, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 122, 255, 0.15),
      inset 0 1px rgba(255, 255, 255, 0.05);
  }

  .field span {
    color: #d1d5db;
  }

  .field input {
    border-color: #374151;
    color: #fff;
    background: #1f2937;
  }

  .field input:focus {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
  }

  .agree-row,
  .login-link {
    color: #9ca3af;
  }

  .alert {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
  }

  .terms-head,
  .terms-actions {
    border-color: rgba(255, 255, 255, 0.08);
  }

  .terms-body {
    color: #d1d5db;
  }

  .terms-body h2,
  .terms-body hr {
    border-color: #374151;
  }

  .btn-secondary {
    border-color: #4b5563;
    color: #9ca3af;
  }

  .btn-secondary:hover {
    background: #1f2937;
  }
}

@media (max-width: 480px) {
  .auth-shell {
    align-items: flex-start;
    padding: 28px 16px;
  }

  .brand-header {
    margin-bottom: 24px;
  }

  .brand-header h1 {
    font-size: 28px;
  }

  .auth-card {
    padding: 24px;
  }
}

.tx-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tx-logo-img {
  width: 100%;
  height: 100%;
}

.tx-logo-sm {
  width: 28px;
  height: 28px;
}

.tx-logo-md {
  width: 56px;
  height: 56px;
}

.tx-logo-lg {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 13px;
  letter-spacing: 0;
}

.glass {
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2);
}

.muted-link,
.cache-link {
  margin-top: 24px;
  color: #6b7280;
  font-size: 14px;
}

.cache-link {
  margin-top: 12px;
  font-size: 12px;
}

.muted-link button,
.cache-link button,
.login-link a {
  border: 0;
  color: var(--brand);
  background: transparent;
}

.welcome-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 16px;
  background: var(--surface);
  overflow: hidden;
}

.welcome-card {
  position: relative;
  z-index: 1;
  width: min(340px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
}

.welcome-card h1 {
  margin: 0;
  color: #111827;
  font-size: 28px;
  font-weight: 800;
}

.vip-pill,
.role-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  color: #fff;
  background: linear-gradient(90deg, #007aff, #5856d6);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 3px 12px rgba(0, 122, 255, 0.42);
}

.vip-card {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 26px;
}

.vip-card .small-label {
  margin: 0 0 8px;
  color: #9ca3af;
  font-size: 11px;
  letter-spacing: 0;
}

.vip-card strong {
  color: #10b981;
  font-size: 32px;
  line-height: 1;
}

.vip-card span {
  color: #9ca3af;
  font-size: 13px;
}

.quota-mini {
  width: 100%;
  padding: 16px 20px;
  color: #4b5563;
  font-size: 14px;
}

.quota-mini b {
  color: var(--brand);
}

.welcome-actions {
  position: relative;
  z-index: 1;
  width: min(340px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.welcome-main {
  padding: 16px;
  border-radius: 18px;
  font-size: 15px;
  letter-spacing: 0;
  box-shadow: 0 8px 30px rgba(0, 122, 255, 0.3);
}

.split-actions {
  display: flex;
  gap: 8px;
}

.utility-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.utility-grid button {
  min-height: 42px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 12px;
  color: #007aff;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.soft-action {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  padding: 12px;
  color: #6b7280;
  background: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  backdrop-filter: blur(12px);
}

.soft-action.violet {
  color: #5856d6;
  border-color: rgba(88, 86, 214, 0.35);
}

.fortune-card,
.qr-card {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.buy-card {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.fortune-body {
  padding: 22px 26px;
  color: #4b5563;
  line-height: 1.7;
}

.fortune-body .taichi {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  margin: 0 auto 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  font-size: 30px;
}

.fortune-body h3 {
  margin: 16px 0 6px;
  color: #007aff;
  font-size: 14px;
  letter-spacing: 0;
}

.fortune-body small {
  display: block;
  margin-top: 18px;
  color: #9ca3af;
  text-align: center;
}

.buy-intro {
  margin: 0;
  padding: 18px 22px 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.7;
}

.buy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 22px;
}

.buy-grid div {
  position: relative;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 8px;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), #fff);
  text-align: center;
}

.buy-grid div.featured {
  border-color: rgba(0, 122, 255, 0.42);
  background: linear-gradient(180deg, #f8fbff, #fff);
  box-shadow: 0 14px 34px rgba(0, 122, 255, 0.16);
}

.buy-grid b,
.buy-grid strong,
.buy-grid span,
.buy-grid small {
  display: block;
}

.buy-grid b {
  color: #007aff;
}

.buy-grid strong {
  margin: 10px 0;
  color: #111827;
  font-size: 26px;
}

.buy-grid span {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}

.buy-grid small {
  margin-top: 10px;
  color: #9ca3af;
  font-size: 11px;
}

.vip-contact {
  display: flex;
  justify-content: center;
  padding: 0 22px 24px;
}

.vip-contact .btn-brand {
  width: min(280px, 100%);
}

.qr-card {
  max-width: 320px;
  text-align: center;
}

.qr-card p {
  margin: 0 0 24px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}

.qr-card small {
  color: #9ca3af;
  font-size: 12px;
}

.fake-qr {
  width: 190px;
  height: 190px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 24px auto 14px;
  border-radius: 18px;
  padding: 18px;
  background:
    linear-gradient(90deg, #111 10px, transparent 10px) 0 0 / 24px 24px,
    linear-gradient(#111 10px, transparent 10px) 0 0 / 24px 24px,
    #fff;
  box-shadow: inset 0 0 0 10px #fff, 0 8px 24px rgba(0, 0, 0, 0.08);
}

.fake-qr span {
  border: 10px solid #111;
  border-radius: 6px;
  background: #fff;
}

.org-modal-qr {
  width: 190px;
  height: 190px;
  display: block;
  margin: 24px auto 14px;
  border-radius: 18px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.service-card {
  max-width: 360px;
}

.service-qr-img {
  width: 210px;
  height: 210px;
  display: block;
  margin: 24px auto 14px;
  border-radius: 22px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(255, 111, 174, 0.18);
}

.chat-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  position: relative;
}

.topbar {
  height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-width: 0 0 1px;
  padding: 0 16px;
  flex-shrink: 0;
}

.top-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}

.icon-button,
.top-actions button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  color: #9ca3af;
  background: transparent;
  font-size: 20px;
}

.top-actions {
  display: flex;
  gap: 4px;
}

.top-actions button {
  font-size: 15px;
}

.top-actions button:hover,
.icon-button:hover {
  color: var(--brand);
  background: #eef5ff;
}

.notice-strip {
  padding: 8px 16px;
  color: #9a3412;
  background: #fff7ed;
  font-size: 12px;
  text-align: center;
}

.chat-context-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 760px;
  margin: 14px auto 0;
  padding: 12px 14px;
}

.chat-context-card div {
  min-width: 0;
}

.chat-context-card span {
  display: block;
  margin-bottom: 4px;
  color: #9ca3af;
  font-size: 11px;
}

.chat-context-card b {
  display: block;
  overflow: hidden;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-body {
  flex: 1;
  overflow: auto;
  padding: 24px 16px 220px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.empty-chat {
  width: fit-content;
  margin: 40px auto 28px;
  padding: 32px 40px;
  text-align: center;
}

.empty-chat div {
  font-size: 38px;
}

.empty-chat p {
  margin: 10px 0 4px;
  color: #4b5563;
  font-weight: 300;
}

.empty-chat span {
  color: #9ca3af;
  font-size: 12px;
}

.message {
  max-width: 74%;
  border-radius: 18px;
  margin: 12px 0;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
}

.user-msg {
  margin-left: auto;
  color: #fff;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
}

.message-text + .message-media-grid,
.message-media-grid + .message-text {
  margin-top: 10px;
}

.message-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  max-width: min(360px, 70vw);
}

.message-media-link {
  display: block;
  color: inherit;
}

.message-media-item {
  display: block;
  width: 100%;
  max-height: 260px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  object-fit: cover;
}

.user-msg .message-media-item {
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.ai-msg {
  color: #374151;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.streaming-output {
  color: #374151;
  white-space: normal;
}

.streaming-output::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 3px;
  border-radius: 999px;
  background: var(--brand);
  vertical-align: -2px;
  animation: streamCursor 0.9s steps(2, jump-none) infinite;
}

@keyframes streamCursor {
  50% {
    opacity: 0;
  }
}

.structured-reply {
  display: grid;
  gap: 12px;
}

.reply-section {
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 12px;
}

.reply-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.reply-section h3 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 15px;
  letter-spacing: 0;
}

.reply-section h3 span {
  margin-left: 6px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 600;
}

.reply-section p {
  margin: 6px 0;
}

.reply-section.warning {
  border-radius: 8px;
  border: 1px solid #fecdd3;
  padding: 10px;
  background: #fff1f2;
}

.reply-card {
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  background: #fafafa;
}

.reply-card h4 {
  margin: 0 0 6px;
  color: #007aff;
  font-size: 14px;
}

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

.inline-copy-list {
  margin-top: 0;
}

.copy-reply {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid #cfe5ff;
  border-radius: 8px;
  padding: 9px 10px;
  color: #374151;
  text-align: left;
  background: #fff;
}

.copy-reply span {
  min-width: 0;
  line-height: 1.55;
}

.copy-reply span i {
  margin-right: 6px;
  color: #007aff;
  font-style: normal;
  font-weight: 800;
}

.copy-reply b {
  border-radius: 999px;
  padding: 4px 8px;
  color: #007aff;
  background: #eef5ff;
  font-size: 12px;
  white-space: nowrap;
}

.composer-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 80px 16px 16px;
  background: linear-gradient(to top, var(--surface), rgba(249, 250, 251, 0.84), transparent);
}

.skill-row,
.composer {
  max-width: 760px;
  margin: 0 auto;
}

.skill-row {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 10px;
}

.skill-row button {
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 7px 12px;
  color: #6b7280;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.skill-row button.active {
  color: var(--brand);
  border-color: rgba(0, 122, 255, 0.25);
  background: rgba(0, 122, 255, 0.06);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
}

.composer-main {
  flex: 1;
  min-width: 0;
}

.composer button {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: #6b7280;
  background: #f3f4f6;
}

.composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: #111827;
}

.media-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.media-preview span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #007aff;
  background: #eef5ff;
  font-size: 12px;
}

.media-preview button {
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: 0 4px;
  color: #007aff;
  background: transparent;
}

.composer .send {
  color: #fff;
  background: var(--brand);
}

.composer .send:disabled {
  cursor: wait;
  opacity: 0.7;
}

.config-tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 10px;
}

.config-tabs button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  color: #6b7280;
  background: #f3f4f6;
  font-size: 13px;
  white-space: nowrap;
}

.config-tabs button.active {
  color: #fff;
  background: #111827;
}

.config-panel {
  display: grid;
  gap: 14px;
}

.permission-note {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 14px;
  color: #374151;
  background: #f9fafb;
  font-size: 13px;
  line-height: 1.6;
}

.invite-hint {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
  color: #1d4ed8;
  background: rgba(0, 122, 255, 0.08);
  font-size: 12px;
}

.invite-hint b {
  color: #111827;
  font-size: 13px;
}

.invite-hint.err {
  border-color: rgba(220, 38, 38, 0.2);
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

.form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.config-list {
  display: grid;
  gap: 10px;
}

.config-item {
  display: grid;
  gap: 6px;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.config-item b {
  color: #111827;
  font-size: 14px;
}

.config-item small,
.config-item span {
  color: #6b7280;
  font-size: 12px;
}

.config-item pre {
  max-height: 150px;
  overflow: auto;
  border-radius: 8px;
  padding: 10px;
  color: #4b5563;
  background: #f9fafb;
  font-size: 12px;
  white-space: pre-wrap;
}

.config-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-editor-list {
  margin-top: 16px;
}

.file-editor textarea {
  min-height: 150px;
  resize: vertical;
}

.inline-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.inline-row input,
.inline-row select {
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 12px;
}

.inline-row button {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff;
  background: #111827;
  font-size: 12px;
}

.scene-editor-list {
  display: grid;
  gap: 14px;
}

.scene-create {
  margin-bottom: 18px;
  border: 1px solid rgba(255, 111, 174, 0.16);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 246, 251, 0.7));
}

.scene-editor {
  gap: 14px;
  border-color: #e5e7eb;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.06);
}

.scene-editor header,
.scene-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scene-editor header div {
  display: grid;
  gap: 4px;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  font-size: 12px;
  white-space: nowrap;
}

.switch-row input {
  width: 16px;
  height: 16px;
  accent-color: #007aff;
}

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

.scene-grid label {
  display: grid;
  gap: 6px;
  color: #6b7280;
  font-size: 12px;
}

.scene-grid .full {
  grid-column: 1 / -1;
}

.scene-grid input,
.scene-grid select,
.scene-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  color: #111827;
  background: #f9fafb;
  outline: none;
  font: inherit;
  font-size: 13px;
}

.scene-grid textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.65;
}

.scene-actions button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(135deg, #1d1d1f, #3a3a3c);
}

.scene-actions button + button {
  color: #e84f95;
  background: rgba(255, 111, 174, 0.1);
}

.scene-actions button:disabled {
  opacity: 0.58;
}

.scene-result {
  font-size: 12px;
}

.scene-result.ok {
  color: #0f766e;
}

.scene-result.err {
  color: #dc2626;
}

.dashboard-shell {
  height: 100vh;
  display: flex;
  background: var(--surface);
}

.side-nav {
  width: 256px;
  display: flex;
  flex-direction: column;
  border-width: 0 1px 0 0;
  flex-shrink: 0;
}

.side-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 28px 20px;
  text-align: center;
}

.side-profile p {
  margin: 0;
  color: #9ca3af;
  font-size: 10px;
  letter-spacing: 0;
}

.side-profile strong {
  max-width: 180px;
  color: #111827;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-nav nav {
  flex: 1;
  padding: 16px 12px;
  overflow: auto;
}

.side-nav nav button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  margin-bottom: 4px;
  padding: 10px 16px;
  color: #6b7280;
  background: transparent;
  text-align: left;
  transition: 0.2s;
}

.side-nav nav button span {
  position: absolute;
  left: 0;
  width: 2px;
  height: 20px;
  border-radius: 999px;
  background: transparent;
}

.side-nav nav button.active {
  color: #111827;
  background: rgba(0, 122, 255, 0.08);
  font-weight: 700;
  transform: translateX(2px);
}

.side-nav nav button.active span {
  background: var(--brand);
}

.side-nav footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding: 16px;
}

.side-nav footer button:not(.btn-brand) {
  border: 0;
  color: #9ca3af;
  background: transparent;
  font-size: 12px;
}

.dash-content {
  flex: 1;
  min-width: 0;
  overflow: auto;
}

.mobile-head {
  display: none;
}

.mobile-tabbar {
  display: none;
}

.content-narrow {
  max-width: 672px;
  margin: 0 auto;
  padding: 24px 16px;
}

.content-wide {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px;
}

.panel-card {
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
}

.section-title {
  margin-bottom: 16px;
}

.section-title p,
.tiny {
  margin: 0 0 4px;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-title span {
  color: #9ca3af;
  font-size: 12px;
}

.profile-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  overflow: hidden;
}

.avatar {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #9ca3af;
  background: #f3f4f6;
  font-size: 32px;
  font-weight: 800;
  flex: 0 0 auto;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar-has-image {
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 122, 255, 0.16);
}

.avatar-uploader {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(0, 122, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
  background: rgba(249, 250, 251, 0.72);
}

.avatar-uploader b {
  display: block;
  color: #374151;
  font-size: 14px;
}

.avatar-uploader small {
  display: block;
  margin-top: 4px;
  color: #9ca3af;
  font-size: 12px;
}

.avatar-preview {
  width: 68px;
  height: 68px;
  font-size: 28px;
}

.avatar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.avatar-actions .inline-result {
  margin-top: 0;
}

.profile-hero h2 {
  margin: 6px 0 2px;
}

.profile-hero small {
  color: #9ca3af;
}

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

.form-grid .section-title,
.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid label {
  color: #6b7280;
  font-size: 12px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.feedback-box input,
.feedback-box textarea,
.redeem-row input,
.filters input,
.filters select {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 6px;
  color: #374151;
  background: #f9fafb;
  outline: none;
}

.form-grid textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}

.toggle-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toggle-line input {
  width: auto;
  margin: 0;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.choice-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #1d1d1f;
  font-size: 13px;
  font-weight: 700;
}

.choice-chip input {
  width: auto;
  margin: 0;
  accent-color: #007aff;
}

.helper-text {
  margin: 0;
  color: #8e8e93;
  font-size: 12px;
  line-height: 1.6;
}

.quota-row {
  margin-bottom: 18px;
}

.quota-row > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.quota-row span {
  color: #9ca3af;
  font-size: 12px;
}

.quota-row b {
  color: #4b5563;
  font-size: 14px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #f3f4f6;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
}

.tier-table > div:not(.section-title) {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #6b7280;
  font-size: 13px;
}

.tier-table .active {
  color: #111827;
  background: #eef5ff;
  font-weight: 700;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
  color: #6b7280;
}

.redeem-row {
  display: flex;
  gap: 10px;
}

.empty-state {
  text-align: center;
  color: #9ca3af;
}

.empty-state p {
  margin: 18px 0 6px;
  font-size: 36px;
}

.page-title {
  margin: 0 0 20px;
}

.page-head-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.soft-mini {
  border: 1px solid rgba(255, 111, 174, 0.24);
  border-radius: 999px;
  padding: 7px 12px;
  color: #e84f95;
  background: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 700;
}

.soft-list,
.history-list {
  display: grid;
  gap: 12px;
}

.soft-list article,
.history-card {
  border: 1px solid rgba(255, 111, 174, 0.12);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 246, 251, 0.76));
}

.soft-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.soft-list b,
.history-card b {
  color: #1d1d1f;
}

.soft-list span,
.soft-list em,
.history-card span {
  color: #8e8e93;
  font-size: 12px;
  font-style: normal;
}

.history-card {
  display: grid;
  gap: 10px;
}

.history-card header,
.notice-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-card p {
  margin: 0;
  color: #4b5563;
  line-height: 1.6;
}

.history-reply {
  border-radius: 12px;
  padding: 12px;
  color: #6b7280;
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.6;
}

.risk-score {
  display: inline-flex;
  min-width: 38px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  color: #2563eb;
  background: #eff6ff;
  font-weight: 800;
}

.risk-block {
  color: #dc2626;
  background: #fef2f2;
}

.risk-observe {
  color: #d97706;
  background: #fffbeb;
}

.risk-bypass {
  color: #059669;
  background: #ecfdf5;
}

.risk-reason {
  display: inline-block;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  padding: 4px 8px;
  color: #6b7280;
  background: #f3f4f6;
  font-size: 11px;
}

.notice-card {
  border-left: 4px solid var(--brand);
}

.notice-card p {
  color: #6b7280;
}

.notice-card span {
  color: #d1d5db;
  font-size: 10px;
  letter-spacing: 0;
}

.notice-card.read {
  opacity: 0.65;
  border-left-color: transparent;
}

.notice-toast {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  width: min(420px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 14px;
  border-color: rgba(255, 111, 174, 0.28);
  background: rgba(255, 255, 255, 0.94);
}

.notice-toast b {
  color: #1d1d1f;
}

.notice-toast p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.notice-toast button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  font-size: 12px;
}

.notice-toast [data-toast-close] {
  width: 30px;
  height: 30px;
  padding: 0;
  color: #8e8e93;
  background: rgba(242, 242, 247, 0.9);
}

.feedback-box {
  border: 2px dashed #e5e7eb;
}

.feedback-box textarea {
  resize: none;
}

.feedback-box > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feedback-box span {
  color: #9ca3af;
  font-size: 11px;
}

.inline-result {
  margin-top: 12px;
  min-height: 18px;
  color: #6b7280;
  font-size: 13px;
}

.inline-result.ok {
  color: #059669;
}

.inline-result.err {
  color: #ef4444;
}

.inline-result button {
  margin-left: 10px;
  border: 1px solid rgba(0, 122, 255, 0.22);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--brand);
  background: rgba(0, 122, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.inline-result pre {
  margin: 10px 0 0;
  overflow: auto;
  border: 1px solid rgba(5, 150, 105, 0.16);
  border-radius: 8px;
  padding: 10px;
  color: #047857;
  background: rgba(236, 253, 245, 0.88);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.api-config textarea {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 6px;
  color: #374151;
  background: #f9fafb;
  outline: none;
  resize: vertical;
}

.admin-content {
  background: #f9fafb;
}

.admin-page {
  max-width: 1152px;
  margin: 0 auto;
  padding: 24px;
}

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

.admin-head h1 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
}

.admin-subtitle {
  display: block;
  margin-top: 6px;
  color: #8e8e93;
  font-size: 12px;
}

.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.segmented,
.tabline {
  display: flex;
  gap: 6px;
}

.segmented button,
.tabline button,
.dark-btn {
  border: 0;
  border-radius: 9px;
  padding: 7px 12px;
  color: #6b7280;
  background: #f3f4f6;
  font-size: 12px;
}

.segmented .active,
.dark-btn {
  color: #fff;
  background: #1f2937;
}

.dark-btn.light {
  color: var(--brand);
  border: 1px solid rgba(0, 122, 255, 0.2);
  background: rgba(0, 122, 255, 0.08);
}

.tabline {
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 18px;
}

.tabline button {
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 10px 16px;
}

.tabline .active {
  color: #111827;
  border-bottom-color: #111827;
  font-weight: 700;
}

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

.metric span {
  color: #9ca3af;
  font-size: 12px;
}

.metric strong {
  display: block;
  margin: 8px 0;
  color: #111827;
  font-size: 26px;
}

.metric em {
  color: #10b981;
  font-size: 12px;
  font-style: normal;
}

.usage-page .metric {
  margin-bottom: 0;
}

.usage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.usage-bars,
.hour-bars {
  height: 210px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 16px 4px 0;
}

.usage-day {
  flex: 1;
  min-width: 34px;
  display: grid;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.usage-stack {
  height: 170px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  align-items: end;
}

.usage-stack i,
.hour-bars i {
  display: block;
  border-radius: 5px 5px 0 0;
}

.bar-users {
  background: #34c759;
}

.bar-chats {
  background: var(--brand);
}

.bar-skills {
  background: var(--brand-dark);
}

.bar-fortune {
  background: var(--accent);
}

.admin-shortcuts {
  margin-bottom: 14px;
}

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

.shortcut-grid button {
  border: 1px solid rgba(0, 122, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.92));
}

.shortcut-grid b,
.shortcut-grid span {
  display: block;
}

.shortcut-grid b {
  color: #111827;
  font-size: 14px;
}

.shortcut-grid span {
  margin-top: 6px;
  color: #8e8e93;
  font-size: 12px;
}

.usage-day span,
.hour-bars span {
  color: #8e8e93;
  font-size: 11px;
}

.hour-bars {
  gap: 7px;
}

.hour-bars div {
  flex: 1;
  min-width: 12px;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.hour-bars i {
  width: 100%;
  min-height: 5px;
  background: linear-gradient(180deg, var(--brand), rgba(0, 122, 255, 0.18));
}

.rank-list,
.quota-stat-list,
.signal-grid {
  display: grid;
  gap: 12px;
}

.rank-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.68);
}

.rank-item b,
.quota-stat b,
.signal-grid b {
  display: block;
  color: #1d1d1f;
  font-size: 14px;
}

.rank-item span,
.quota-stat span,
.signal-grid span,
.signal-grid small {
  display: block;
  color: #8e8e93;
  font-size: 12px;
}

.rank-item strong {
  color: var(--brand);
  font-size: 14px;
}

.rank-item i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
}

.quota-stat {
  display: grid;
  gap: 9px;
}

.quota-stat > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.signal-grid section {
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.68);
}

.signal-grid b {
  margin: 7px 0 3px;
  font-size: 20px;
}

.loading-line {
  min-height: 120px;
  align-items: center;
  justify-content: center;
  color: #8e8e93;
  font-size: 13px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.chart {
  min-height: 260px;
}

.bars {
  height: 190px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding-top: 28px;
}

.bars i {
  flex: 1;
  min-width: 18px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, var(--brand), rgba(0, 122, 255, 0.18));
}

.chart li {
  margin: 12px 0;
  color: #6b7280;
  font-size: 14px;
}

.filters {
  display: flex;
  gap: 12px;
}

.table-card {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid #f3f4f6;
  padding: 12px;
  color: #4b5563;
  font-size: 13px;
  text-align: left;
}

th {
  color: #9ca3af;
  font-size: 11px;
  letter-spacing: 0;
}

td button {
  border: 0;
  color: var(--brand);
  background: transparent;
  font-size: 12px;
}

.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 280px;
}

.row-actions {
  min-width: 108px;
}

.row-actions summary {
  width: fit-content;
  list-style: none;
  border: 1px solid rgba(90, 200, 250, 0.22);
  border-radius: 999px;
  padding: 7px 12px;
  color: #007aff;
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.row-actions summary::-webkit-details-marker {
  display: none;
}

.row-actions[open] summary {
  color: #e84f95;
  border-color: rgba(255, 111, 174, 0.26);
}

.row-actions .admin-inline-actions {
  margin-top: 8px;
}

.admin-inline-actions.full {
  grid-column: 1 / -1;
}

.admin-inline-actions button,
.admin-inline-actions select {
  border: 1px solid rgba(255, 111, 174, 0.18);
  border-radius: 999px;
  padding: 7px 10px;
  color: #e84f95;
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.admin-inline-actions label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #8e8e93;
  font-size: 12px;
}

.admin-inline-actions em,
.config-item em {
  color: #0f766e;
  font-size: 12px;
  font-style: normal;
}

.admin-inline-actions .err,
.config-item .err {
  color: #dc2626;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  color: #8e8e93;
  font-size: 12px;
}

.pager button {
  border: 1px solid rgba(90, 200, 250, 0.22);
  border-radius: 999px;
  padding: 7px 12px;
  color: #007aff;
  background: rgba(255, 255, 255, 0.78);
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

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

.org-card {
  border: 0;
  text-align: left;
}

.org-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.org-card b,
.org-card small {
  display: block;
}

.org-card header span {
  border-radius: 999px;
  padding: 2px 8px;
  color: #059669;
  background: #dcfce7;
  font-size: 12px;
}

.org-card header span.off {
  color: #6b7280;
  background: #f3f4f6;
}

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

.org-card-grid .full {
  grid-column: 1 / -1;
}

.org-card-grid label {
  display: grid;
  gap: 6px;
  color: #6b7280;
  font-size: 12px;
}

.org-card-grid input,
.org-card-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 9px 10px;
  color: #111827;
  background: #f9fafb;
  outline: none;
}

.copy-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-line button,
.org-qr-row button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  background: #111827;
  white-space: nowrap;
}

.org-qr-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.org-qr {
  display: grid;
  place-items: center;
  width: 96px;
  aspect-ratio: 1;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  color: #9ca3af;
  background: #f9fafb;
  font-size: 12px;
  text-align: center;
}

.org-qr img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.org-card small {
  color: #9ca3af;
  margin-bottom: 8px;
}

.org-card em {
  margin-left: 8px;
  color: #0f766e;
  font-size: 12px;
  font-style: normal;
}

.org-card em.err {
  color: #dc2626;
}

.activity-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  border-radius: 999px;
  padding: 3px 8px;
  color: #047857;
  background: #d1fae5;
  font-size: 12px;
  font-weight: 700;
}

.activity-score.low {
  color: #b91c1c;
  background: #fee2e2;
}

@media (max-width: 860px) {
  .side-nav {
    display: none;
  }

  .mobile-head {
    height: 57px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-width: 0 0 1px;
    padding: 0 16px;
  }

  .dashboard-shell {
    padding-bottom: 68px;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    justify-content: space-around;
    border-width: 1px 0 0;
    padding: 8px 6px max(8px, env(safe-area-inset-bottom));
  }

  .mobile-tabbar button {
    min-width: 0;
    flex: 1;
    border: 0;
    color: #9ca3af;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-tabbar i,
  .mobile-tabbar span {
    display: block;
    font-style: normal;
  }

  .mobile-tabbar i {
    margin-bottom: 2px;
    font-size: 17px;
  }

  .mobile-tabbar .active {
    color: var(--brand);
  }

  .mobile-head button {
    margin-left: auto;
    border: 0;
    color: #9ca3af;
    background: transparent;
  }

  .metric-grid,
  .org-grid,
  .chart-grid,
  .usage-layout,
  .chat-context-card {
    grid-template-columns: 1fr;
  }

  .admin-head,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-head-actions,
  .shortcut-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .admin-head-actions {
    display: grid;
  }

  .segmented,
  .tabline {
    overflow: auto;
  }
}

@media (max-width: 560px) {
  .notice-toast {
    left: 16px;
    right: 16px;
    top: 12px;
    grid-template-columns: 1fr auto;
  }

  .notice-toast [data-toast-read],
  .notice-toast [data-go] {
    grid-row: 2;
  }

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

  .captcha-image-btn {
    width: 100%;
  }

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

  .avatar-uploader {
    align-items: flex-start;
  }

  .message {
    max-width: 92%;
  }

  .redeem-row,
  .feedback-box > div {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-card {
    border-radius: 8px;
  }

  .buy-grid,
  .utility-grid {
    grid-template-columns: 1fr;
  }
}
