/* ==========================================================================
   银河奶牛规划助手 · 多用户网页版 (Hosted Mode)
   Scoped strictly to html.is-hosted-mode and .hosted-* so Local Personal Mode
   (127.0.0.1:8769) remains 100% visually & functionally identical.
   ========================================================================== */

/* ==================== Hosted Visibility Guards ==================== */
.hosted-only {
  display: none;
}
html.is-hosted-mode .hosted-only:not([hidden]) {
  display: inline-flex;
}
.hosted-only-block {
  display: none;
}
html.is-hosted-mode .hosted-only-block:not([hidden]) {
  display: block;
}
html.is-hosted-mode .local-only {
  display: none !important;
}
.hosted-unified-off-only {
  display: none;
}
html.is-hosted-mode.is-unified-disabled .hosted-unified-off-only:not([hidden]) {
  display: inline-flex;
}
html.is-hosted-mode.is-unified-disabled .command-bar {
  display: none !important;
}
#hosted-sync-modal {
  z-index: 140;
}
.bopt-scene-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bopt-scene-links {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bopt-lab-level-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bopt-lab-level-row input[type="number"] {
  width: 86px;
}
.bopt-lab-env-box {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.4;
}

/* Hide local-Mac-only browser automation controls in Hosted Mode */
html.is-hosted-mode [data-action="game-read"],
html.is-hosted-mode [data-buff-action="read-live"],
html.is-hosted-mode #import-help,
html.is-hosted-mode.is-simulator-disabled #first-open-sim,
html.is-hosted-mode.is-simulator-disabled #insp-open-sim,
html.is-hosted-mode.is-simulator-disabled #focus-insp-open-sim,
html.is-hosted-mode.is-simulator-disabled #party-insp-open-sim,
html.is-hosted-mode.is-simulator-disabled #bopt-open-sim,
html.is-hosted-mode.is-simulator-disabled [data-sandbox-open-sim],
html.is-hosted-mode.is-simulator-disabled [data-party-sb-sim],
html.is-hosted-mode.is-simulator-disabled [data-nav="simulator"],
html.is-hosted-mode.is-simulator-disabled [data-view="simulator"] {
  display: none !important;
}

/* Lock background workspace while unauthenticated login gate is open */
html.is-hosted-locked {
  overflow: hidden;
}
html.is-hosted-locked .app-header,
html.is-hosted-locked #main,
html.is-hosted-locked #connection {
  visibility: hidden;
  pointer-events: none;
}

/* ==================== Header Account & User Pill ==================== */
.header-account-pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-width: 0;
}
.header-account-pill[hidden] {
  display: none;
}
.header-account-pill.has-profile-switcher.has-hosted-user {
  gap: 3px;
  padding: 2px 4px 2px 4px;
  border-radius: 999px;
  background: var(--header-surface);
  border: 1px solid var(--header-line);
  box-shadow: 0 1px 2px rgba(20, 44, 39, 0.04);
  min-height: 30px;
}
.header-account-pill.has-profile-switcher.has-hosted-user > .profile-switcher-btn {
  background: transparent;
  border-color: transparent;
  border-width: 0;
  box-shadow: none;
  padding: 2px 8px 2px 6px;
  height: 24px;
  min-height: 24px;
  color: var(--header-ink);
}
.header-account-pill.has-profile-switcher.has-hosted-user > .profile-switcher-btn:hover {
  background: var(--header-surface-hover);
}
.header-account-pill.has-profile-switcher.has-hosted-user > .hosted-user-pill {
  padding: 0;
  gap: 4px;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.header-account-pill.has-profile-switcher.has-hosted-user .hosted-user-dot,
.header-account-pill.has-profile-switcher.has-hosted-user #hosted-user-name {
  display: none;
}
@supports selector(:has(*)) {
  .header-account-pill:not(:has(> :not([hidden]))) {
    display: none;
  }
  .header-account-pill:has(> #profile-switcher-btn:not([hidden])):has(> #hosted-user-pill:not([hidden])) {
    gap: 3px;
    padding: 2px 4px 2px 4px;
    border-radius: 999px;
    background: var(--header-surface);
    border: 1px solid var(--header-line);
    box-shadow: 0 1px 2px rgba(20, 44, 39, 0.04);
    min-height: 30px;
  }
  .header-account-pill:has(> #profile-switcher-btn:not([hidden])):has(> #hosted-user-pill:not([hidden])) > .profile-switcher-btn {
    background: transparent;
    border-color: transparent;
    border-width: 0;
    box-shadow: none;
    padding: 2px 8px 2px 6px;
    height: 24px;
    min-height: 24px;
    color: var(--header-ink);
  }
  .header-account-pill:has(> #profile-switcher-btn:not([hidden])):has(> #hosted-user-pill:not([hidden])) > .profile-switcher-btn:hover {
    background: var(--header-surface-hover);
  }
  .header-account-pill:has(> #profile-switcher-btn:not([hidden])):has(> #hosted-user-pill:not([hidden])) > .hosted-user-pill {
    padding: 0;
    gap: 4px;
    min-height: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .header-account-pill:has(> #profile-switcher-btn:not([hidden])):has(> #hosted-user-pill:not([hidden])) .hosted-user-dot,
  .header-account-pill:has(> #profile-switcher-btn:not([hidden])):has(> #hosted-user-pill:not([hidden])) #hosted-user-name {
    display: none;
  }
}
.hosted-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 10px;
  border-radius: 999px;
  background: var(--header-surface);
  border: 1px solid var(--header-line);
  color: var(--header-ink);
  font-size: 12px;
  min-height: 30px;
  box-shadow: 0 1px 2px rgba(20, 44, 39, 0.04);
}
.hosted-user-pill[hidden] {
  display: none;
}
.hosted-user-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--header-teal);
  flex: none;
  box-shadow: 0 0 0 2px var(--header-teal-soft);
}
.hosted-user-name {
  font-weight: 600;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hosted-logout-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 550;
  padding: 2px 8px;
  border-radius: 999px;
  min-height: 24px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.hosted-logout-btn:hover {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

/* Inline Per-Module Queued Card (all 7 compute modules) */
.hosted-module-queue-card {
  border: 1.5px solid var(--amber);
  background: linear-gradient(180deg, var(--amber-soft) 0%, var(--bg-elevated) 65%);
  display: grid;
  gap: 10px;
}
.hosted-mq-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hosted-mq-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.hosted-mq-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  margin-top: 5px;
  flex: none;
  box-shadow: 0 0 0 3px var(--amber-soft);
  animation: pulseDot 1.2s infinite ease-in-out;
}
.hosted-mq-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14.5px;
  color: var(--ink);
}
.hosted-mq-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.hosted-mq-cancel {
  border-color: var(--danger);
  color: var(--danger-ink);
  flex: none;
}
.hosted-mq-cancel:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}
.hosted-queued-cta {
  border-color: var(--amber) !important;
  color: var(--amber-ink) !important;
  background: var(--amber-soft) !important;
}
.hosted-queued-cta:hover:not(:disabled) {
  border-color: var(--danger) !important;
  color: var(--danger-ink) !important;
  background: var(--danger-soft) !important;
}
.status-pill.queued {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border-color: rgba(217, 119, 6, 0.35);
}
.status-pill.queued .status-dot {
  background: var(--amber);
  animation: pulseDot 1.2s infinite ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .hosted-mq-dot,
  .status-pill.queued .status-dot {
    animation: none;
  }
}

/* ==================== Overview Hosted Onboarding Banner ==================== */
.hosted-onboarding-card {
  border: 1.5px solid var(--brand);
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--brand-soft) 160%);
}
.hosted-onboarding-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.hosted-onboarding-head h2 {
  font-size: 16px;
  color: var(--ink);
}
.hosted-onboarding-head p {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.hosted-onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.hosted-step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hosted-step-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.03em;
}
.hosted-step-num span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
}
html[data-theme="dark"] .hosted-step-num span {
  color: #042420;
}
.hosted-step-card h3 {
  font-size: 14px;
  color: var(--ink);
}
.hosted-step-card p {
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
}
.hosted-step-action {
  margin-top: auto;
  padding-top: 4px;
}
.hosted-mini-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 10px;
  border: 2px dashed var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.12s;
}
.hosted-mini-dropzone:hover,
.hosted-mini-dropzone.is-dragover {
  background: var(--brand);
  color: #fff;
}
html[data-theme="dark"] .hosted-mini-dropzone:hover,
html[data-theme="dark"] .hosted-mini-dropzone.is-dragover {
  color: #042420;
}
.hosted-mini-dropzone small {
  font-weight: 450;
  opacity: 0.85;
}
.hosted-mini-dropzone input[type="file"] {
  display: none;
}

/* ==================== Hosted Limit Notice ==================== */
.hosted-limits-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 550;
  margin-top: 4px;
}
.hosted-preset-disabled {
  display: none !important;
}

/* ==================== Login Gate Overlay (Friend & Admin) ==================== */
.hosted-auth-gate {
  align-items: flex-start;
  padding: 24px 16px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 15%, var(--brand-soft) 0%, transparent 45%),
    radial-gradient(circle at 84% 82%, var(--combat-soft) 0%, transparent 42%),
    var(--bg);
}
.hosted-auth-shell {
  width: 100%;
  max-width: 1060px;
  margin: auto 0;
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.hosted-auth-gate > .hosted-auth-card {
  margin: auto 0;
}
.hosted-auth-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hosted-tutorial-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.hosted-tutorial-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.hosted-tutorial-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--ink);
}
.hosted-tutorial-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.import-tutorial-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0d1d24;
  cursor: zoom-in;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.14s;
}
.import-tutorial-trigger:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 20px rgba(13, 130, 114, 0.22);
}
.import-tutorial-stage {
  position: relative;
  display: block;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0d1d24;
}
.import-tutorial-img,
.import-tutorial-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1060 / 700;
  object-fit: contain;
  background: #0d1d24;
}
.import-tutorial-poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  aspect-ratio: 1060 / 700;
  padding: 24px 20px;
  border: 0;
  color: #ecfdf5;
  text-align: center;
  cursor: pointer;
  background:
    radial-gradient(circle at 25% 20%, rgba(20, 184, 166, 0.28) 0%, transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(79, 70, 229, 0.24) 0%, transparent 55%),
    linear-gradient(145deg, #0d1d24 0%, #132c33 100%);
  transition: background-color 0.18s ease, transform 0.14s ease;
}
.import-tutorial-poster:hover .import-tutorial-play-btn {
  transform: scale(1.08);
  background: #14b8a6;
  box-shadow: 0 0 0 8px rgba(20, 184, 166, 0.22);
}
.import-tutorial-play-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(13, 130, 114, 0.92);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 0 5px rgba(20, 184, 166, 0.18);
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.import-tutorial-poster-title {
  font-size: 15px;
  font-weight: 700;
  color: #f0fdfa;
}
.import-tutorial-poster-sub {
  font-size: 12.5px;
  color: rgba(236, 253, 245, 0.78);
  max-width: 42ch;
  line-height: 1.45;
}
.import-tutorial-zoom-pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 28, 36, 0.84);
  border: 1px solid rgba(94, 234, 212, 0.45);
  color: #ecfdf5;
  font-size: 11.5px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.15s, background-color 0.15s;
}
.import-tutorial-trigger:hover .import-tutorial-zoom-pill {
  opacity: 1;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.import-tutorial-steps {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.5;
}
.import-tutorial-steps strong {
  color: var(--ink);
}
.import-tutorial-steps code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
}
.import-tutorial-sync-tip {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-muted);
}
#import-tutorial-modal {
  z-index: 190;
}
.import-tutorial-modal-card {
  max-width: 980px;
  width: min(96vw, 980px);
}
.import-tutorial-modal-stage {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #0d1d24;
}
.bookmark-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 960px) {
  .hosted-auth-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: 560px;
  }
  .hosted-auth-card {
    max-width: none;
  }
}
.hosted-auth-stripe {
  height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, #34d399 55%, var(--combat) 100%);
}
.hosted-auth-body {
  padding: 22px 24px 20px;
  display: grid;
  gap: 14px;
}
.hosted-auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hosted-auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hosted-auth-brand h1 {
  font-size: 19px;
  line-height: 1.25;
}
.hosted-auth-brand p {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.hosted-auth-theme-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 550;
  padding: 5px 10px;
  border-radius: 999px;
  flex: none;
}
.hosted-auth-theme-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-color: var(--brand);
}

.hosted-auth-desc {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.hosted-auth-desc:empty {
  display: none;
}
.hosted-auth-form {
  display: grid;
  gap: 12px;
}
.hosted-auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
}
.hosted-code-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hosted-code-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--bg-elevated);
}
.hosted-code-input.is-secret {
  text-transform: none;
  letter-spacing: 0.05em;
}
.hosted-auth-autofill-hint {
  font-size: 12px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.hosted-gate-steps {
  display: grid;
  gap: 12px;
}
.hosted-import-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}
.hosted-import-tabs button {
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}
.hosted-import-panel {
  display: grid;
  gap: 10px;
}
.hosted-import-panel[hidden] {
  display: none;
}
.hosted-bridge-box {
  display: grid;
  gap: 10px;
}
.hosted-bridge-guide {
  display: grid;
  gap: 10px;
}
.hosted-bridge-guide[hidden],
.hosted-bridge-ready[hidden] {
  display: none;
}
.hosted-bridge-ready {
  display: grid;
  gap: 8px;
}
.hosted-bridge-cta {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.hosted-bridge-cta:hover:not(:disabled) {
  background: var(--brand);
  border-color: var(--brand-hover);
  color: #fff;
}
.hosted-bridge-cta:hover:not(:disabled) .hosted-bridge-cta-sub {
  color: rgba(255, 255, 255, 0.88);
}
html[data-theme="dark"] .hosted-bridge-cta:hover:not(:disabled) {
  color: #042420;
}
html[data-theme="dark"] .hosted-bridge-cta:hover:not(:disabled) .hosted-bridge-cta-sub {
  color: rgba(4, 36, 32, 0.85);
}
.hosted-bridge-cta-title {
  font-size: 15px;
  font-weight: 700;
}
.hosted-bridge-cta-sub {
  font-size: 12px;
  color: var(--ink-secondary);
}
.hosted-bridge-ready-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hosted-bridge-box a.btn {
  text-decoration: none;
}
.hosted-bridge-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-secondary);
}
.hosted-paste-btn-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.hosted-gate-step-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.hosted-gate-step-badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}
html[data-theme="dark"] .hosted-gate-step-badge {
  color: #042420;
}
.hosted-gate-step-text {
  flex: 1 1 200px;
  line-height: 1.45;
}
.hosted-gate-dropzone {
  display: grid;
  gap: 5px;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--brand);
  background: var(--brand-soft);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.12s;
}
.hosted-gate-dropzone:hover,
.hosted-gate-dropzone.is-dragover {
  background: var(--brand);
  border-color: var(--brand-hover);
  color: #fff;
}
.hosted-gate-dropzone:hover .hosted-gate-drop-sub,
.hosted-gate-dropzone.is-dragover .hosted-gate-drop-sub {
  color: rgba(255, 255, 255, 0.88);
}
html[data-theme="dark"] .hosted-gate-dropzone:hover,
html[data-theme="dark"] .hosted-gate-dropzone.is-dragover {
  color: #042420;
}
html[data-theme="dark"] .hosted-gate-dropzone:hover .hosted-gate-drop-sub,
html[data-theme="dark"] .hosted-gate-dropzone.is-dragover .hosted-gate-drop-sub {
  color: rgba(4, 36, 32, 0.85);
}
.hosted-gate-dropzone.is-busy {
  opacity: 0.65;
  pointer-events: none;
}
.hosted-gate-dropzone input[type="file"] {
  display: none;
}
.hosted-gate-drop-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--brand-ink);
}
.hosted-gate-dropzone:hover .hosted-gate-drop-title,
.hosted-gate-dropzone.is-dragover .hosted-gate-drop-title {
  color: inherit;
}
.hosted-gate-drop-sub {
  font-size: 12px;
  color: var(--ink-secondary);
}
.hosted-gate-alt-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.hosted-code-submit {
  margin-left: auto;
}
.hosted-code-toggle {
  border: 0;
  background: transparent;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}
.hosted-code-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
#hosted-privacy-modal {
  z-index: 160;
}
html.is-hosted-mode .toast {
  z-index: 180;
}
.hosted-auth-submit {
  width: 100%;
  min-height: 42px;
  font-size: 14px;
  border-radius: var(--radius-md);
}
.hosted-auth-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hosted-auth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-muted);
}
.hosted-gate-companion-btn {
  color: var(--ink-secondary);
  font-weight: 550;
}
.hosted-gate-companion-btn:hover {
  color: var(--brand);
}

.hosted-sync-modal-card {
  max-width: 460px;
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.danger:hover:not(:disabled) {
  filter: brightness(0.92);
}

/* ==================== Responsive ==================== */
@media (max-width: 1120px) {
  .hosted-onboarding-steps {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  .hosted-auth-body {
    padding: 20px 18px;
  }
}

/* ==================== Pre-Upload Privacy Review Modal ==================== */
.privacy-modal-card {
  max-width: 780px;
  max-height: min(90vh, 840px);
  display: flex;
  flex-direction: column;
}
.privacy-modal-card > .la-modal-head,
.privacy-modal-card > .la-modal-footer {
  flex: 0 0 auto;
}
.privacy-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-right: 4px;
}
.privacy-scroll > * {
  flex: 0 0 auto;
}
.privacy-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.privacy-box {
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: grid;
  gap: 6px;
  align-content: start;
}
.privacy-box.is-upload {
  border-color: rgba(13, 130, 114, 0.45);
  background: var(--brand-soft);
}
.privacy-box.is-stripped {
  border-color: rgba(217, 119, 6, 0.4);
  background: var(--amber-soft);
}
.privacy-box-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}
.privacy-box.is-upload .privacy-box-title {
  color: var(--brand-ink);
}
.privacy-box.is-stripped .privacy-box-title {
  color: var(--amber-ink);
}
.privacy-bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink);
}
.privacy-bullet-list li {
  display: block;
  line-height: 1.55;
}
.privacy-alias-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.privacy-id-info {
  display: grid;
  gap: 6px;
  width: 100%;
}
.privacy-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
}
.privacy-id-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.privacy-alias-field {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.privacy-alias-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}
.privacy-alias-field input {
  min-height: 36px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: 13.5px;
  font-weight: 600;
}
.privacy-details {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.privacy-accordion-btn {
  width: 100%;
  border: 0;
  border-radius: calc(var(--radius-md) - 1px);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  background: var(--bg-soft);
  color: var(--ink);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.privacy-accordion-btn[aria-expanded="true"] {
  border-radius: calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px) 0 0;
}
.privacy-accordion-btn:hover {
  background: var(--bg-subtle);
}
.privacy-details-body {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.privacy-preview-group {
  flex: 0 0 auto;
}
.privacy-preview-group h4 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}
.privacy-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 12px;
}
.privacy-json-textarea {
  width: 100%;
  min-height: 220px;
  max-height: 360px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  resize: vertical;
}
@media (max-width: 720px) {
  .privacy-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==================== WeChat/QQ Banner, Paste JSON & Global Onboarding ==================== */
.hosted-webview-banner {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(217, 119, 6, 0.45);
  background: var(--amber-soft);
  color: var(--amber-ink);
  font-size: 12.5px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.hosted-webview-banner.is-global {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 8px max(20px, calc((100vw - 1360px) / 2));
}
.hosted-bm-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.hosted-copy-bm-btn {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 11.5px;
}
.hosted-paste-wrap {
  display: grid;
  gap: 8px;
}
.hosted-paste-box {
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.hosted-paste-textarea {
  width: 100%;
  min-height: 84px;
  max-height: 180px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
  resize: vertical;
}
.hosted-paste-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.hosted-global-onboarding {
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1.5px solid var(--brand);
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--brand-soft) 160%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hosted-global-onboarding-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.hosted-global-onboarding-text strong {
  font-size: 14px;
  color: var(--ink);
}
.hosted-global-onboarding-text span {
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.hosted-global-onboarding-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bopt-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .hosted-auth-gate {
    padding: 14px 10px;
  }
  .hosted-global-onboarding {
    padding: 12px;
  }
}

/* ==================== Boot Splash, Elastic Workers Badge, Deduplicated Upload & Load Hint ==================== */
.app-boot-splash {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--bg);
}
.app-boot-splash[hidden] {
  display: none !important;
}
.app-boot-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 550;
  transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.app-boot-card.is-expanded {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: min(420px, 100%);
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
}
.app-boot-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.app-boot-title {
  color: inherit;
  line-height: 1.4;
  word-break: break-word;
}
.app-boot-card.is-expanded .app-boot-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.app-boot-spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  animation: bootSpin 0.8s linear infinite;
}
.app-boot-status-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand);
}
.app-boot-detail {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink-secondary);
}
.app-boot-meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.app-boot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.app-boot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--ink);
  font: 550 13px/1.2 var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.app-boot-btn:hover {
  background: var(--bg-subtle);
}
.app-boot-btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}
.app-boot-btn-primary:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}
.app-boot-card.is-updating {
  border-color: var(--brand);
}
.app-boot-card.is-updating .app-boot-spinner {
  border-top-color: var(--brand);
}
.app-boot-card.is-updating .app-boot-status-dot {
  background: var(--brand);
}
.app-boot-card.is-warn {
  border-color: var(--amber);
}
.app-boot-card.is-warn .app-boot-spinner {
  border-top-color: var(--amber);
}
.app-boot-card.is-warn .app-boot-status-dot {
  background: var(--amber);
}
.app-boot-card.is-error {
  border-color: var(--danger);
}
.app-boot-card.is-error .app-boot-spinner {
  border-top-color: var(--danger);
}
.app-boot-card.is-error .app-boot-status-dot {
  background: var(--danger);
}
.app-boot-card.is-offline {
  border-color: var(--border-strong);
}
.app-boot-card.is-offline .app-boot-status-dot {
  background: var(--ink-muted);
}
@keyframes bootSpin {
  to { transform: rotate(360deg); }
}
@media (max-width: 440px) {
  .app-boot-card.is-expanded {
    padding: 16px;
  }
  .app-boot-actions .app-boot-btn {
    flex: 1 1 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-boot-spinner {
    animation: none;
  }
}

html.is-hosted-mode .focus-workers-inline.is-worker-control,
html.is-hosted-mode #f-workers-box,
html.is-hosted-mode #mon-worker-section {
  display: none !important;
}
html.is-hosted-mode .hosted-elastic-workers-badge {
  display: none !important;
}
html.is-hosted-mode.is-unified-disabled .focus-topbar-right [data-action="hosted-upload-trigger"] {
  display: none !important;
}
.hosted-load-hint {
  margin: 0;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(217, 119, 6, 0.35);
  background: var(--amber-soft);
  color: var(--amber-ink);
  font-size: 12px;
  line-height: 1.45;
}

/* ==================== Multi-Profile Switcher & Manager ==================== */
.profile-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  inline-size: max-content;
  max-inline-size: 184px;
}
.profile-switcher-btn[hidden] {
  display: none;
}
.profile-switcher-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  text-align: start;
}
.profile-switcher-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--header-accent-soft);
  color: var(--header-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.profile-switcher-caret {
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.78;
}
.profile-env-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  flex-shrink: 0;
}
.profile-env-tag[hidden] {
  display: none;
}
.profile-env-tag.is-live {
  background: rgba(13, 148, 136, 0.18);
  color: #0f766e;
  border: 1px solid rgba(20, 184, 166, 0.38);
}
.profile-env-tag.is-test {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.42);
}
html[data-theme="dark"] .profile-env-tag.is-live {
  background: rgba(20, 184, 166, 0.22);
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.38);
}
html[data-theme="dark"] .profile-env-tag.is-test {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.4);
}
#profile-modal {
  z-index: 145;
  align-items: flex-start;
  padding-top: clamp(20px, 8vh, 64px);
}
:is(#profile-modal, #profile-export-modal) :is(.profile-modal-card, .profile-export-modal-card) {
  border-radius: 14px;
  border: 1px solid var(--header-line);
  background: var(--header-surface);
}
:is(#profile-modal, #profile-export-modal) .la-modal-head {
  border-bottom-color: var(--header-line);
}
:is(#profile-modal, #profile-export-modal) .btn.primary {
  background: var(--header-accent);
  border-color: var(--header-accent);
  color: #ffffff;
}
:is(#profile-modal, #profile-export-modal) .btn.primary:hover:not(:disabled) {
  background: var(--header-accent-hover);
  border-color: var(--header-accent-hover);
}
:is(#profile-modal, #profile-export-modal) .btn.secondary {
  background: var(--header-surface);
  border-color: var(--header-line);
  color: var(--ink);
}
:is(#profile-modal, #profile-export-modal) .btn.secondary:hover:not(:disabled) {
  border-color: var(--header-accent-border);
  background: var(--header-bg);
}
:is(#profile-modal, #profile-export-modal) .btn.ghost:hover:not(:disabled) {
  background: var(--header-surface-hover);
}
:is(#profile-modal, #profile-export-modal) .segmented {
  background: var(--header-seg-bg);
  border: 1px solid var(--header-line);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
:is(#profile-modal, #profile-export-modal) .segmented button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 550;
  box-shadow: none;
}
:is(#profile-modal, #profile-export-modal) .segmented button[aria-pressed="true"] {
  background: var(--header-surface);
  color: var(--header-accent);
  box-shadow: 0 1px 2px rgba(20, 44, 39, 0.08);
}
:is(#profile-modal, #profile-export-modal) .lang-switch {
  border: 1px solid var(--header-line);
  border-radius: 8px;
  background: var(--header-seg-bg);
  padding: 1px;
  gap: 1px;
  font-size: 11.5px;
  font-weight: 600;
}
:is(#profile-modal, #profile-export-modal) .lang-switch button {
  min-width: 24px;
  min-height: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  line-height: 1;
  color: var(--header-muted);
}
:is(#profile-modal, #profile-export-modal) .lang-switch button[aria-pressed="true"] {
  background: var(--header-accent-soft);
  color: var(--header-accent);
  box-shadow: inset 0 0 0 1px var(--header-accent-border);
}
#profile-capacity-badge {
  background: var(--header-seg-bg);
  border: 1px solid var(--header-line);
  color: var(--ink-secondary);
  border-radius: 999px;
}
.profile-modal-card {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - clamp(20px, 8vh, 64px) - 20px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.profile-modal-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.profile-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-search-input {
  flex: 1 1 160px;
  min-width: 140px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--header-line);
  background: var(--header-bg);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}
.profile-search-input:focus {
  outline: none;
  background: var(--header-surface);
  border-color: var(--header-accent);
  box-shadow: 0 0 0 2px var(--header-accent-soft);
}
.profile-list {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 2px;
}
.profile-empty {
  padding: 18px 14px;
  text-align: center;
  border-radius: 10px;
  border: 1px dashed var(--header-line);
  background: var(--header-bg);
  color: var(--ink-secondary);
  font-size: 13px;
}
.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--header-line);
  background: var(--header-bg);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.profile-item:hover {
  background: var(--header-surface);
  border-color: var(--header-accent-border);
}
.profile-item.is-active {
  border-color: var(--header-accent-border);
  background: var(--header-accent-soft);
}
.profile-item-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-item-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.profile-item-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.profile-item-meta {
  line-height: 1.4;
}
.profile-item-captured {
  white-space: nowrap;
}
.profile-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.profile-active-hint {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--header-surface);
  border: 1px solid var(--header-accent-border);
  color: var(--header-accent);
  font-size: 11.5px;
  font-weight: 600;
}
.profile-inline-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.profile-rename-input {
  flex: 1 1 180px;
  min-width: 140px;
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--header-accent);
  background: var(--header-surface);
  color: var(--ink);
  font-size: 13px;
}
.profile-rename-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--header-accent-soft);
}
.profile-add-section {
  border-top: 1px solid var(--header-line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 10px;
}
.profile-add-toggle-btn {
  align-self: flex-start;
  height: 32px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--header-accent-border);
  background: var(--header-accent-soft);
  color: var(--header-accent);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}
.profile-add-toggle-btn:hover {
  border-color: var(--header-accent);
}
.profile-add-toggle-btn[aria-expanded="true"] {
  background: var(--header-accent);
  border-color: var(--header-accent);
  color: #ffffff;
}
.profile-add-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--header-line);
  background: var(--header-bg);
}
.profile-add-body[hidden] {
  display: none;
}
#profile-modal .hosted-gate-dropzone {
  border-color: var(--header-line);
  border-radius: 10px;
  background: var(--header-surface);
}
#profile-modal .hosted-gate-dropzone:hover,
#profile-modal .hosted-gate-dropzone.is-dragover {
  border-color: var(--header-accent);
  background: var(--header-accent-soft);
}
#profile-modal .hosted-gate-drop-title {
  color: var(--header-accent);
}
:is(#profile-modal, #profile-export-modal) :is(.profile-item, .profile-export-item) .badge-verified {
  background: var(--header-accent-soft);
  border: 1px solid var(--header-accent-border);
  color: var(--header-accent);
}
#profile-export-mode-badge.badge-verified {
  background: var(--header-teal-soft);
  color: var(--header-teal);
}
#profile-modal .bookmark-pill {
  background: var(--header-accent-soft);
  border-color: var(--header-accent-border);
  color: var(--header-accent);
}
#profile-modal .hosted-code-toggle {
  color: var(--header-accent);
}
.profile-add-label-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.profile-new-label-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--header-line);
  background: var(--header-surface);
  color: var(--ink);
  font-size: 13px;
}
.profile-new-label-input:focus {
  outline: none;
  border-color: var(--header-accent);
  box-shadow: 0 0 0 2px var(--header-accent-soft);
}
.profile-add-live-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-perm-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.profile-perm-tag.is-readonly {
  background: rgba(154, 101, 43, 0.13);
  color: var(--amber, #9a652b);
}
.profile-perm-tag.is-static {
  background: var(--header-seg-bg);
  color: var(--ink-muted);
}
html[data-theme="dark"] .profile-perm-tag.is-readonly {
  background: rgba(224, 169, 109, 0.18);
  color: #e6b376;
}
.profile-revoke-btn {
  color: var(--danger);
}
#profile-export-modal {
  align-items: flex-start;
  padding-top: min(10vh, 72px);
}
#profile-export-modal .la-modal-head > .hosted-bm-action-group {
  display: grid;
  grid-template-columns: 61px 58px;
  flex: none;
}
#profile-export-modal .lang-switch button {
  inline-size: 28px;
  flex: none;
}
.profile-export-modal-card {
  width: min(640px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-export-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 2px;
}
.profile-export-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-export-section + .profile-export-section {
  padding-top: 10px;
  border-top: 1px solid var(--header-line);
}
.profile-export-section[hidden] {
  display: none;
}
.profile-export-row-anchor {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-height: 30px;
}
.profile-export-field-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
  flex: 0 0 auto;
}
.profile-export-desc {
  margin: 0;
  line-height: 1.5;
}
.profile-export-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-export-list-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-export-quick-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.profile-export-quick-btns[hidden] {
  display: none;
}
.profile-export-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.profile-export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--header-line);
  border-radius: 10px;
  background: var(--header-bg);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.profile-export-item:hover:not(.is-disabled) {
  background: var(--header-surface);
  border-color: var(--header-accent-border);
}
.profile-export-item.is-selected {
  border-color: var(--header-accent-border);
  background: var(--header-accent-soft);
}
.profile-export-item.is-disabled {
  opacity: 0.56;
  cursor: not-allowed;
  background: var(--header-bg);
}
.profile-export-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.profile-export-item-main input[type="checkbox"] {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  accent-color: var(--header-accent);
}
.profile-export-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-export-item-meta {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}
.profile-export-sync-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 20px;
}
.profile-export-perm-hint {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--header-line);
  background: var(--header-bg);
  line-height: 1.5;
}
.profile-export-cap-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--header-line);
  background: var(--header-bg);
}
.profile-export-cap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-export-filename {
  font-size: 12px;
  color: var(--ink-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-export-caps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
  font-size: 12px;
}
.profile-export-cap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--ink);
}
.profile-export-cap.is-no {
  color: var(--ink-muted);
}
.profile-export-cap-mark {
  font-weight: 700;
  flex: 0 0 auto;
}
.profile-export-cap.is-ok .profile-export-cap-mark {
  color: var(--header-teal);
}
.profile-export-cap.is-no .profile-export-cap-mark {
  color: var(--danger);
}
.profile-export-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--header-line);
}
.profile-export-foot-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 640px) {
  .profile-export-caps {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-export-item {
    flex-wrap: wrap;
  }
}
@media (max-width: 640px) {
  .profile-item {
    flex-direction: column;
    align-items: stretch;
  }
  .profile-item-actions {
    justify-content: flex-end;
  }
  .profile-switcher-btn {
    max-inline-size: 132px;
  }
}

/* Leave room for the longer sign-in and profile labels. */
html[lang="en"] :is(.hosted-auth-shell, .hosted-auth-shell > *, .hosted-auth-top > *,
                    .profile-toolbar, .profile-toolbar > *, .profile-item-main) {
  min-width: 0;
  overflow-wrap: anywhere;
}

html[lang="en"] .hosted-auth-top {
  gap: 6px;
}

html[lang="en"] .hosted-auth-top .lang-switch {
  margin-inline-start: auto;
}

html[lang="en"] .hosted-auth-theme-btn {
  min-height: 28px;
  padding: 0 8px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  html[lang="en"] .hosted-auth-shell {
    max-width: min(100%, 560px);
  }

  html[lang="en"] :is(.hosted-auth-card, .hosted-auth-body, .hosted-auth-body > *,
                      .hosted-auth-form > *, .feedback-gate-actions) {
    min-width: 0;
    max-width: 100%;
  }

  /* Keep the grid tracks within the card even when a row has long English labels. */
  html[lang="en"] :is(.hosted-auth-body, .hosted-auth-form, .hosted-gate-steps) {
    grid-template-columns: minmax(0, 1fr);
  }

  html[lang="en"] :is(.hosted-auth-top, .feedback-gate-actions) {
    flex-wrap: wrap;
  }

  html[lang="en"] :is(.feedback-gate-actions button, .hosted-auth-features .badge) {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    text-align: start;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 520px) {
  html[lang="en"] .hosted-auth-brand {
    flex-basis: 100%;
  }

  html[lang="en"] .profile-modal-head-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ==================== Read-Only Demo Mode UI ==================== */
html.is-hosted-gate-modal {
  overflow: hidden;
}

.hosted-auth-gate.is-demo-overlay {
  background: transparent;
}

.hosted-auth-close {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.hosted-auth-close:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--ink);
}
.hosted-auth-close[hidden] {
  display: none;
}

.hosted-auth-demo-hint {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  border: 1px solid var(--border);
  color: var(--brand-ink);
  font-size: 12.5px;
  line-height: 1.5;
}
.hosted-auth-demo-hint[hidden] {
  display: none;
}

.hosted-user-pill.is-demo-pill {
  background: rgba(54, 95, 204, 0.24);
  border-color: rgba(147, 197, 253, 0.42);
}
.hosted-user-pill.is-demo-pill .hosted-user-dot {
  background: var(--header-accent);
  box-shadow: 0 0 0 2px var(--header-accent-soft);
}
.hosted-login-btn {
  background: var(--header-accent);
  border: 1px solid var(--header-accent);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  min-height: 24px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.hosted-login-btn:hover:not(:disabled) {
  background: var(--header-accent-hover);
  border-color: var(--header-accent-hover);
}
.hosted-sync-btn {
  background: var(--header-accent-soft);
  border: 1px solid var(--header-accent-border);
  color: var(--header-accent);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  min-height: 24px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}
.hosted-sync-btn:hover:not(:disabled) {
  background: var(--header-accent);
  border-color: var(--header-accent);
  color: #ffffff;
}
.hosted-login-btn:disabled,
.hosted-sync-btn:disabled,
.hosted-login-btn[aria-busy="true"],
.hosted-sync-btn[aria-busy="true"] {
  opacity: 0.65;
  cursor: progress;
}
.hosted-login-btn[hidden],
.hosted-sync-btn[hidden],
.hosted-logout-btn[hidden] {
  display: none;
}

.hosted-demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-secondary);
}
.hosted-demo-banner[hidden] {
  display: none;
}
.hosted-demo-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 0;
}
.hosted-demo-banner-text .badge {
  flex: none;
  color: var(--brand);
  font-weight: 700;
}
.hosted-demo-banner-message {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.hosted-demo-banner-message strong {
  color: var(--ink);
  font-weight: 700;
}
.hosted-demo-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

@media (max-width: 640px) {
  .hosted-demo-banner {
    padding: 8px 10px;
    gap: 8px;
  }
  .hosted-demo-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
