* { box-sizing: border-box; }

body.auth-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 45%, #e0f2fe 100%);
  color: #0f172a;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.auth-logo {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
  margin-bottom: 6px;
}

.auth-sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: #64748b;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
}

.auth-tab.active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.auth-field input {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.auth-field input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.auth-code-row {
  display: flex;
  gap: 8px;
}

.auth-code-row input { flex: 1; min-width: 0; }

.auth-code-btn {
  flex-shrink: 0;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.auth-code-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  color: #64748b;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.auth-submit {
  margin-top: 4px;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  cursor: pointer;
}

.auth-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.auth-hint {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
}

.auth-msg {
  margin: 16px 0 0;
  min-height: 20px;
  font-size: 13px;
  color: #dc2626;
}

.auth-msg.ok { color: #059669; }

/* 覆盖 Stitch Tailwind 的 sm:inline-flex 等响应式显示 */
[data-auth-hidden="1"] {
  display: none !important;
}

/* 首屏：用户中心默认隐藏，auth.js 就绪后再展示 */
[data-nav-wrap="me"] {
  visibility: hidden;
}
html.auth-ready [data-nav-wrap="me"]:not([data-auth-hidden="1"]) {
  visibility: visible;
}

/* 工作台顶栏 */
.ws-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 96px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(8px);
  font-size: 13px;
}

.ws-brand {
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
}

.ws-topnav { display: flex; gap: 12px; }
.ws-topnav a {
  color: #64748b;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}
.ws-topnav a:hover { color: #1e293b; background: #f1f5f9; }
.ws-topnav a.active { color: #1d4ed8; font-weight: 600; }

.ws-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-credit { color: #059669; font-weight: 600; font-size: 12px; }
.ws-credit.hidden { display: none; }

.ws-auth-guest {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.ws-auth-guest a {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
}
.ws-auth-guest a:hover { color: #1d4ed8; }
.ws-auth-guest .sep { color: #cbd5e1; }

.ws-auth-user {
  color: #1e293b;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.ws-auth-user:hover {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

body:has(.ws-topbar) .app-nav { padding-top: 48px; box-sizing: border-box; }
body:has(.ws-topbar) .booth-layout {
  margin-top: 48px;
  height: calc(100vh - 48px);
  box-sizing: border-box;
}
body:has(.ws-topbar) .app-main {
  margin-top: 48px;
  min-height: calc(100vh - 48px);
  box-sizing: border-box;
}
