:root {
  --bg: #f0f2f8;
  --bg-soft: linear-gradient(180deg, #eef1f8 0%, #f8f9fc 40%, #f0f2f8 100%);
  --card: #fff;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(79, 70, 229, 0.18);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --danger: #ef4444;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 60px;
  --header-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  background-image: var(--bg-soft);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: transparent;
}

.app-header {
  flex-shrink: 0;
  height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 52%, #a855f7 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
  position: relative;
  z-index: 2;
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.header-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-user {
  font-size: 12px;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.header-balance {
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.panel {
  display: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.panel.active {
  display: flex;
}

/* AI 功能网格 — 现代卡片式 3×2 */
.ai-tab-section {
  flex-shrink: 0;
  padding: 12px 12px 0;
  background: transparent;
}

.ai-tab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-md);
}

.ai-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 10px 6px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ai-tab-item:active {
  transform: scale(0.96);
}

.ai-tab-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-tab-item:nth-child(1) .ai-tab-icon-wrap { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.ai-tab-item:nth-child(2) .ai-tab-icon-wrap { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }
.ai-tab-item:nth-child(3) .ai-tab-icon-wrap { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.ai-tab-item:nth-child(4) .ai-tab-icon-wrap { background: linear-gradient(135deg, #cffafe, #a5f3fc); }
.ai-tab-item:nth-child(5) .ai-tab-icon-wrap { background: linear-gradient(135deg, #ffedd5, #fed7aa); }
.ai-tab-item:nth-child(6) .ai-tab-icon-wrap { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }

.ai-tab-item.active {
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06));
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1.5px rgba(99, 102, 241, 0.22);
}

.ai-tab-item.active .ai-tab-icon-wrap {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
}

.ai-tab-item.active .ai-tab-label {
  color: var(--primary-dark);
  font-weight: 700;
}

.ai-tab-icon {
  font-size: 20px;
  line-height: 1;
}

.ai-tab-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
  letter-spacing: -0.01em;
}

/* 兼容旧类名 */
.ai-tab-bar { display: none; }

.gen-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.gen-panel-inner {
  margin: 8px 12px 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.gen-text-result {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.pool-block.hidden { display: none; }

.hidden { display: none !important; }

/* legacy ai-subnav removed */
.ai-subnav {
  display: none;
}

.mode-row {
  display: flex;
  gap: 4px;
  margin: 10px 12px 0;
  padding: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.mode-row > span:first-child {
  display: none;
}

.mode-pill {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: none;
  transition: all 0.22s ease;
  text-align: center;
}

.mode-pill.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.mode-pill.cloud.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.stats-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  background: transparent;
}

.pool-block {
  margin: 8px 12px 0;
  padding: 4px 0 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pool-block .stats-row {
  padding-top: 12px;
}

.pool-block .field.compact {
  padding: 0 12px 10px;
}

.pool-block .nodes-fold {
  margin: 0 12px 10px;
}

.stat-chip {
  flex: 1;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.stat-chip .lbl {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat-chip.low-balance span:last-child { color: var(--danger); }

.field.compact {
  padding: 0 12px 10px;
  background: transparent;
}

.field.compact select {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nodes-fold {
  background: transparent;
  margin: 0 12px 10px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.nodes-fold summary {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nodes-fold summary::-webkit-details-marker { display: none; }

.nodes-box {
  padding: 0 8px 10px;
  max-height: 220px;
  overflow-y: auto;
}

.m-node-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.m-node-card:active {
  transform: scale(0.99);
}

.m-node-card.auto {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.04));
  border-color: rgba(16, 185, 129, 0.25);
  font-weight: 600;
}

.m-node-card.selected {
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm);
  background: var(--primary-soft);
}

.m-node-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.m-node-title { font-weight: 600; margin-bottom: 4px; }
.m-node-meta { font-size: 11px; color: var(--muted); }
.m-node-badge { display: inline-block; margin-top: 4px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #ecfdf5; color: #047857; }

#chatPoolBlock.hidden,
#imagePoolBlock.hidden,
#imageNegativeField.hidden { display: none; }

.image-panel { padding-top: 0; }

/* Chat */
.chat-scroll-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.chat-body {
  flex: none;
  overflow: visible;
  padding: 12px;
  min-height: 120px;
}

.msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

.msg-row.user .msg-avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.msg-bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.chat-input-bar {
  flex-shrink: 0;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 42px;
  max-height: 100px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: inherit;
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-input-bar textarea:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: #fff;
}

.btn-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: transform 0.15s ease;
}

.btn-send:active {
  transform: scale(0.94);
}

.btn-send:disabled { opacity: 0.5; }

/* Image gen */
.image-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field select,
.field textarea,
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select:focus,
.field textarea:focus,
.field input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  letter-spacing: -0.01em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.field textarea { min-height: 88px; resize: vertical; }

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.btn-primary:disabled { opacity: 0.55; }

.gen-result {
  margin-top: 16px;
  text-align: center;
}

.gen-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.gen-result img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gen-status {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
  transition: width 0.3s;
}

/* Tasks */
.tasks-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.task-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.task-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.task-type {
  font-size: 14px;
  font-weight: 600;
}

.task-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}

.task-status.success { background: #ecfdf5; color: #047857; }
.task-status.running, .task-status.pending { background: #eff6ff; color: #1d4ed8; }
.task-status.failed, .task-status.timeout { background: #fef2f2; color: var(--danger); }

.task-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.task-thumb {
  margin-top: 8px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  width: 100%;
}

.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}

/* Me */
.me-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.me-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.me-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.me-balance { font-size: 30px; font-weight: 800; color: var(--primary-dark); margin: 8px 0; letter-spacing: -0.03em; }

.me-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.me-label { font-size: 13px; color: var(--muted); }

.me-link {
  display: block;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.me-link:active {
  transform: scale(0.99);
}

.btn-logout {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(254, 242, 242, 0.9);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.pwa-tip {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #92400e;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}

/* Bottom nav — 毛玻璃底栏 */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
  gap: 0;
}

.bottom-nav button {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 0;
  position: relative;
  transition: color 0.2s ease;
}

.bottom-nav button .icon {
  font-size: 22px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav button.active {
  color: var(--primary-dark);
}

.bottom-nav button.active .icon {
  transform: scale(1.12);
}

.bottom-nav button.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.hidden { display: none !important; }

.ai-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.ai-view.gen-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.ai-view#view-chat.active {
  display: flex;
}

.ai-view.gen-scroll.active {
  display: block;
}

/* Auth pages (/m/login, /m/register) */
body.auth-page {
  overflow: auto;
  background: var(--bg);
  background-image: var(--bg-soft);
}

.auth-header {
  position: relative;
  padding: calc(24px + var(--safe-t)) 20px 36px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 52%, #a855f7 100%);
  color: #fff;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.35);
}

.auth-back {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 12px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-brand h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-card {
  flex: 1;
  margin: -20px 16px 24px;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.auth-card h2 {
  margin: 0 0 22px;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.auth-field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  background: #f8fafc;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: #fff;
}

.auth-shell {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.auth-brand {
  text-align: center;
  padding-top: 8px;
}

.auth-brand p {
  margin: 0;
  font-size: 14px;
  opacity: 0.92;
}

.auth-msg {
  min-height: 20px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-msg.error { color: var(--danger); }
.auth-msg.success { color: var(--accent); }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.auth-field .optional {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.auth-submit {
  margin-top: 6px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

.auth-submit:disabled {
  opacity: 0.7;
}

.auth-footer {
  margin: 20px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.auth-footer a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}
