/* Aeris AI Assistant — futuristic glass UI. Design tokens mirror the MP surface. */
:root {
  --bg: #0B0F17;
  --text-1: #EDF2F7;
  --text-2: #94A3B8;
  --accent-from: #34D399;
  --accent-to: #22D3EE;
  --accent: linear-gradient(135deg, #34D399, #22D3EE);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- background flow-field + drifting blobs ---- */
#flow {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

.blob {
  position: fixed;
  z-index: 0;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.30;
  pointer-events: none;
  will-change: transform;
}
.blob-a {
  top: -12vmax; left: -8vmax;
  background: radial-gradient(circle at 30% 30%, #34D399, transparent 70%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
.blob-b {
  bottom: -14vmax; right: -10vmax;
  background: radial-gradient(circle at 70% 70%, #22D3EE, transparent 70%);
  animation: drift-b 32s ease-in-out infinite alternate;
}
@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(8vmax, 6vmax) scale(1.15); }
}
@keyframes drift-b {
  from { transform: translate(0, 0) scale(1.1); }
  to   { transform: translate(-7vmax, -5vmax) scale(0.95); }
}

/* ---- layout ---- */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 20px 40px;
}

.nav {
  position: fixed;
  z-index: 2;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(11, 15, 23, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
}
.nav .brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  text-decoration: none;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav .brand span { color: var(--text-2); -webkit-text-fill-color: var(--text-2); font-weight: 500; font-size: 14px; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text-2); text-decoration: none; font-size: 15px; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text-1); }

/* ---- glass card ---- */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 32px;
  width: 100%;
}
.auth-card { max-width: 420px; }
.chat-card, .files-card, .billing-card { max-width: 760px; }

.logo, .brand {
  font-weight: 700;
  letter-spacing: 0.5px;
}
.logo {
  font-size: 30px;
  text-align: center;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span { color: var(--text-2); -webkit-text-fill-color: var(--text-2); font-weight: 500; font-size: 18px; }

h1, h2 { color: var(--text-1); }
h2 {
  font-size: 22px;
  margin-bottom: 6px;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { color: var(--text-2); font-size: 14px; text-align: center; margin: 8px 0 22px; }
.files-card .subtitle, .billing-card .subtitle { text-align: left; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 15px;
  transition: all .2s;
}
.tab.active { color: var(--text-1); border-color: transparent; background: rgba(52, 211, 153, 0.12); }

/* ---- forms ---- */
.auth-form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
input, textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text-1);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-from);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.btn-primary {
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #04140E;
  cursor: pointer;
  background: var(--accent);
  transition: filter .2s, opacity .2s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  border: 1px solid var(--glass-border);
  background: transparent;
  border-radius: 10px;
  padding: 11px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  transition: color .2s, border-color .2s;
}
.btn-ghost:hover { color: var(--text-1); border-color: var(--accent-to); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent-to);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.msg { font-size: 13px; color: var(--text-2); margin-top: 12px; min-height: 18px; text-align: center; }
.msg.error { color: #FCA5A5; }
.msg.ok { color: var(--accent-from); }

/* ---- chat ---- */
.chat-card { display: flex; flex-direction: column; height: min(78vh, 720px); padding: 20px; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 8px 4px; }
.bubble { max-width: 80%; line-height: 1.55; font-size: 15px; }
.bubble.user {
  align-self: flex-end;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.30);
  color: var(--text-1);
  padding: 11px 15px;
  border-radius: 16px 16px 4px 16px;
}
.bubble.assistant {
  align-self: flex-start;
  display: flex;
  gap: 10px;
  color: var(--text-1);
}
.bubble.assistant .orb {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  margin-top: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
}
.bubble.assistant .body { white-space: pre-wrap; }
.typing .body::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.chat-input { display: flex; gap: 10px; padding-top: 14px; align-items: flex-end; }
.chat-input textarea { flex: 1; resize: none; max-height: 140px; }
.chat-input .btn-primary { padding: 12px 20px; }

/* ---- files ---- */
.dropzone {
  margin: 18px 0;
  padding: 28px;
  text-align: center;
  border: 1.5px dashed var(--glass-border);
  border-radius: 14px;
  color: var(--text-2);
  transition: border-color .2s, background .2s;
}
.dropzone.drag { border-color: var(--accent-from); background: rgba(52, 211, 153, 0.06); }
.files-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.files-table th, .files-table td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 14px;
}
.files-table th { color: var(--text-2); font-weight: 500; }
.files-table td { color: var(--text-1); }
.del-btn { color: #FCA5A5; background: none; border: none; cursor: pointer; font-size: 14px; }
.del-btn:hover { text-decoration: underline; }

/* ---- billing ---- */
.badge {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--accent-from);
  -webkit-text-fill-color: var(--accent-from);
  vertical-align: middle;
}
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.price-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 22px;
}
.price-card.current { border-color: var(--accent-from); box-shadow: 0 0 0 1px var(--accent-from); }
.price-card h3 { font-size: 17px; margin-bottom: 6px; }
.price-card .price { font-size: 30px; font-weight: 700; margin: 8px 0 14px;
  background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.price-card .price small { font-size: 14px; color: var(--text-2); -webkit-text-fill-color: var(--text-2); }
.price-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.price-card li { font-size: 13px; color: var(--text-2); padding-left: 20px; position: relative; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-from); }
.price-card .current-tag { margin-top: 14px; font-size: 13px; color: var(--accent-from); font-weight: 600; }

.hidden { display: none !important; }

/* ---- reduced motion: no canvas / blob animation ---- */
@media (prefers-reduced-motion: reduce) {
  #flow { display: none; }
  .blob { animation: none; }
}

/* ---- flows / 邮件自动化 ---- */
.flows-card { width: min(880px, 100%); }
.flows-toolbar { display: flex; gap: 16px; align-items: flex-end; margin: 4px 0 8px; }
.flows-toolbar select {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-1);
  padding: 10px 12px;
  min-width: 280px;
  font-size: 14px;
}
.flows-toolbar select:focus { outline: none; border-color: var(--accent-from); }
.flows-empty { color: var(--text-2); font-size: 14px; text-align: center; padding: 28px 0; }

.flows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.flow-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .2s, box-shadow .2s;
}
.flow-card.on {
  border-color: var(--accent-from);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.25), 0 8px 30px rgba(34, 211, 238, 0.08);
}
.flow-head { display: flex; align-items: flex-start; gap: 10px; }
.flow-icon { font-size: 22px; line-height: 1; }
.flow-title { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.flow-title h3 { margin: 0; font-size: 15px; color: var(--text-1); }
.flow-desc { color: var(--text-2); font-size: 13px; margin: 12px 0 10px; line-height: 1.5; }
.flow-config label { font-size: 12px; }
.flow-config input { width: 90px; }

.safety-badge {
  align-self: flex-start;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  color: var(--text-2);
}
.safety-badge.safe { color: var(--accent-from); border-color: rgba(52, 211, 153, 0.4); }
.safety-badge.warn { color: #FBBF24; border-color: rgba(251, 191, 36, 0.4); }
.safety-badge.danger { color: #F87171; border-color: rgba(248, 113, 113, 0.4); }
.rec-badge {
  align-self: flex-start;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  color: #0B0F17;
  background: var(--accent);
}

/* glass toggle switch */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; flex: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  transition: background .2s, border-color .2s;
}
.toggle .track::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform .2s, background .2s;
}
.toggle input:checked + .track { background: var(--accent); border-color: transparent; }
.toggle input:checked + .track::before { transform: translateX(20px); background: #0B0F17; }
