:root {
  --brand: #0d9bb5;
  --brand-2: #14b8a6;
  --brand-grad: linear-gradient(135deg, #0ea5e9, #14b8a6 52%, #22d3ee);
  --td-brand-color: #0d9bb5;
  --td-brand-color-hover: #2bb3c6;
  --td-brand-color-active: #0a8497;
  --td-brand-color-light: #e2f6f7;

  --glass: rgba(255, 255, 255, 0.6);
  --glass-soft: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.75);
  --text: #1f2a44;
  --muted: #69748f;
  --danger: #ef5d8a;
  --ok: #22b07d;
  --warn: #f0a020;
  --radius: 24px;
  --shadow: 0 24px 60px rgba(70, 90, 160, 0.18);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #e3f6f3;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Liquid-glass animated background ---------- */
.bg { position: fixed; inset: 0; z-index: -2; background: linear-gradient(125deg, #e0f5f3 0%, #e6f7f4 40%, #e3f3fb 68%, #eefcfa 100%); }
.orb { position: fixed; border-radius: 50%; filter: blur(70px); opacity: 0.5; z-index: -1; animation: float 18s ease-in-out infinite; will-change: transform; }
.orb1 { width: 460px; height: 460px; background: #8fd9d4; top: -140px; left: -100px; }
.orb2 { width: 420px; height: 420px; background: #9fe3f0; bottom: -150px; right: -80px; animation-delay: -5s; }
.orb3 { width: 340px; height: 340px; background: #bfe9e0; top: 45%; left: 58%; animation-delay: -9s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(36px, -30px) scale(1.06); } }

/* ---------- Entrance animations ---------- */
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  background: var(--glass-soft);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-orb { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-grad); box-shadow: 0 0 18px rgba(120, 140, 255, 0.6); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); }
.lang-switch { display: flex; gap: 6px; background: rgba(255,255,255,0.5); padding: 4px; border-radius: 999px; border: 1px solid var(--glass-border); flex: 0 0 auto; }
.lang-btn { border: none; background: transparent; cursor: pointer; padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); transition: all 0.25s var(--ease); }
.lang-btn.active { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(90,140,239,0.25); font-weight: 600; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 18px; }
.stage { min-height: calc(100vh - 150px); display: flex; align-items: center; justify-content: center; padding: 28px 18px; }
.glass-card {
  width: min(440px, 94vw);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(185%);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 34px 30px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  display: flex; flex-direction: column; gap: 14px;
  animation: cardIn 0.55s var(--ease) backwards;
  transition: transform 0.4s var(--ease), box-shadow 0.4s ease;
}
.glass-card:hover { transform: translateY(-3px); box-shadow: 0 30px 70px rgba(70,90,160,0.22), inset 0 1px 0 rgba(255,255,255,0.6); }
.glass-card .t-input, .glass-card .t-input__wrap { border-radius: 14px; }
.glass-card .t-input { background: rgba(255, 255, 255, 0.6); }
.glass-card .t-button { border-radius: 14px; }

.panel {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: riseIn 0.5s var(--ease) backwards;
  transition: transform 0.4s var(--ease), box-shadow 0.4s ease, border-color 0.3s ease;
}
.panel:hover { transform: translateY(-2px); border-color: rgba(13,155,181,0.35); box-shadow: 0 28px 64px rgba(70,90,160,0.2), inset 0 1px 0 rgba(255,255,255,0.6); }
.dash-grid .panel:nth-child(1) { animation-delay: 0.04s; }
.dash-grid .panel:nth-child(2) { animation-delay: 0.10s; }
.dash-grid .panel:nth-child(3) { animation-delay: 0.16s; }
.dash-grid .panel:nth-child(4) { animation-delay: 0.22s; }
.dash-grid .panel:nth-child(5) { animation-delay: 0.28s; }
.dash-grid .panel:nth-child(6) { animation-delay: 0.34s; }
.title { margin: 0; font-size: 24px; font-weight: 700; }
.title.sm { font-size: 20px; }
.subtitle { margin: 0; font-size: 14px; color: var(--muted); }
.alt { text-align: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.link { color: var(--brand); cursor: pointer; font-weight: 600; margin-left: 4px; transition: color 0.2s ease, opacity 0.2s ease; }
.link:hover { text-decoration: underline; opacity: 0.85; }

/* Smooth, tactile controls */
.t-button { transition: transform 0.16s ease, box-shadow 0.2s ease; }
.t-button:active { transform: translateY(1px) scale(0.99); }
input, .t-input, textarea, .t-input__inner { transition: border-color 0.2s ease, box-shadow 0.2s ease; }

/* ---------- Dashboard grid ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-grid .full { grid-column: 1 / -1; }
@media (max-width: 780px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar { width: 52px; height: 52px; border-radius: 18px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #fff; background: var(--brand-grad); box-shadow: 0 6px 18px rgba(120, 140, 255, 0.4); }
.sep { border-top: 1px solid rgba(255, 255, 255, 0.65); margin: 8px 0; }
.sep.danger { border-top: 1px solid rgba(239, 93, 138, 0.35); }
.field-group { display: flex; flex-direction: column; gap: 10px; }
.field-group label { font-size: 14px; font-weight: 600; }
.danger-text { color: var(--danger) !important; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.field-group .row { display: flex; gap: 10px; align-items: center; }
.field-group .row .t-input { flex: 1; min-width: 0; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge.ok { background: rgba(34,176,125,0.15); color: var(--ok); }
.badge.warn { background: rgba(240,160,32,0.18); color: var(--warn); }
.badge.off { background: rgba(105,116,143,0.15); color: var(--muted); }

/* ---------- password strength ---------- */
.strength { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.strength-bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(105,116,143,0.18); overflow: hidden; }
.strength-bar > span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.35s var(--ease), background-color 0.35s var(--ease); }
.strength-bar > span.lv1 { width: 25%; background: #ef5d8a; }
.strength-bar > span.lv2 { width: 50%; background: #f0a020; }
.strength-bar > span.lv3 { width: 75%; background: #4f8cff; }
.strength-bar > span.lv4 { width: 100%; background: #22b07d; }
.strength-label { font-size: 12px; color: var(--muted); min-width: 56px; text-align: right; }

/* ---------- MFA ---------- */
.mfa-qr { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.qr { width: 160px; height: 160px; padding: 8px; background: #fff; border-radius: 14px; box-shadow: 0 6px 18px rgba(70,90,160,0.15); }
.qr img, .qr canvas { display: block; }
.secret-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: rgba(255,255,255,0.6); padding: 8px 12px; border-radius: 10px; word-break: break-all; border: 1px dashed var(--glass-border); }
.codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 6px 0 14px; }
.codes-grid span { font-family: ui-monospace, monospace; background: rgba(255,255,255,0.6); padding: 8px 10px; border-radius: 8px; text-align: center; letter-spacing: 1px; }

/* ---------- activity log ---------- */
.act-list { display: flex; flex-direction: column; gap: 8px; }
.act-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.4); transition: background-color 0.25s ease, transform 0.2s ease; }
.act-item:hover { background: rgba(255,255,255,0.65); transform: translateX(2px); }
.act-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.act-dot.ok { background: var(--ok); }
.act-dot.fail { background: var(--danger); }
.act-main { flex: 1; font-size: 14px; }
.act-sub { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }

/* ---------- result dialog ---------- */
.result-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 8px 4px 4px; }
.result-icon { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: #fff; animation: pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.result-icon.success { background: linear-gradient(135deg, #22b07d, #14b8a6); box-shadow: 0 8px 22px rgba(34,176,125,0.4); }
.result-icon.error { background: linear-gradient(135deg, #ef5d8a, #f0a020); box-shadow: 0 8px 22px rgba(239,93,138,0.4); }
.result-box p { margin: 0; font-size: 14px; color: var(--text); }

/* ---------- footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 18px; opacity: 0.85; }
.footer .dot { margin: 0 8px; }
.boot { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--muted); font-size: 15px; }

/* ---------- Responsive: tablet / mobile ---------- */
@media (max-width: 640px) {
  .field-group .row { flex-direction: column; align-items: stretch; }
  .field-group .row .t-button { width: 100%; }
  .dash-head { flex-wrap: wrap; gap: 12px; }
  .dash-head > .t-button { margin-left: 0; }
  .mfa-qr { gap: 14px; }
  .qr { width: 140px; height: 140px; }
}
@media (max-width: 480px) {
  .glass-card { padding: 26px 20px; border-radius: 20px; }
  .title { font-size: 21px; }
  .panel { padding: 18px; }
  .wrap { padding: 0 12px; }
  .topbar { padding: 12px 14px; }
}
@media (max-width: 380px) {
  .brand-sub { display: none; }
  .brand-name { font-size: 15px; }
  .lang-btn { padding: 5px 9px; }
}

/* ---------- Accessibility: respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
