/* ======================================================================
   ZoneFoundry Console — P1 styles
   Reuses the shared design system (../styles.css): tokens, .btn*, .shell,
   .brand, .brand-mark, .lang-btn, .icon-btn, .nav-tools, .nav-spacer.
   ====================================================================== */

body.console {
  --bg-1: var(--bg, #06080b);
  --bg-2: #0b1016;
  --bg-3: #121820;
  --bg-4: #1a222c;
  --ink-1: var(--text, #f7f4ef);
  --ink-2: #e7e1da;
  --ink-3: #d5d0c9;
  --ink-4: var(--muted, #b7b1a9);
  --ink-5: var(--quiet, #7f858c);
  --line-1: var(--line, rgba(255,255,255,0.12));
  --line-2: var(--line-strong, rgba(255,255,255,0.2));
  --accent-1: var(--accent, #ff6554);
  --accent-2: var(--accent-2, #ff9a8d);
  --accent-deep: var(--accent-2, #ff9a8d);
  --accent-soft: rgba(255, 101, 84, 0.13);
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;
  --r-5: 26px;
  --shadow-3: 0 32px 80px rgba(0,0,0,0.42);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: var(--bg-1);
  color: var(--ink-3);
  min-height: 100vh;
}

[hidden] { display: none !important; }

.console .nav-spacer { flex: 1; }
.console .nav-tools {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.console .brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-1);
  background: rgba(255,101,84,0.11);
}
.console .icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-1);
  border-radius: 12px;
  color: var(--ink-3);
  background: rgba(255,255,255,0.035);
}
.console .btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--ink-1);
  background: rgba(255,255,255,0.045);
  font-weight: 650;
  cursor: pointer;
}
.console .btn-accent {
  border-color: transparent;
  color: white;
  background: linear-gradient(180deg, #ff8171, #ff5f4d);
  box-shadow: 0 16px 34px rgba(255,101,84,0.22);
}
.console .btn-ghost {
  background: rgba(255,255,255,0.035);
}
.console .btn-sm {
  min-height: 34px;
  padding-inline: 12px;
  font-size: 13px;
}

/* -------- top bar -------- */
.console-top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-1) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-1);
}
.console-top-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand-sub {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent-deep);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 2px 8px; margin-left: 2px;
}
.account { display: inline-flex; align-items: center; gap: 10px; }
.account-email { font-size: 13px; color: var(--ink-4); max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------- main shell -------- */
.console-main { max-width: 920px; padding-block: clamp(28px, 5vw, 56px); }

/* -------- login -------- */
.login-wrap { display: grid; place-items: center; min-height: 62vh; }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-5); padding: clamp(28px, 4vw, 40px);
  text-align: center; box-shadow: var(--shadow-3);
}
.brand-mark.big {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent-1); color: #3A1100;
  display: grid; place-items: center; margin: 0 auto 18px;
}
.login-logo { width: 56px; height: 56px; border-radius: 14px; display: block; margin: 0 auto 18px; object-fit: cover; }
.login-card h1 { font-size: 24px; font-weight: 700; color: var(--ink-1); letter-spacing: -0.01em; }
.login-sub { margin-top: 8px; font-size: 14.5px; color: var(--ink-4); }
.login-methods { display: flex; flex-direction: column; gap: 10px; margin: 26px 0 14px; }
.login-btn {
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg-1); color: var(--ink-1);
  border: 1px solid var(--line-2);
}
.login-btn svg { flex: 0 0 auto; }
.login-btn:hover { background: var(--bg-3); border-color: var(--ink-5); }
/* Google Identity Services renders its own button here; center it in the row. */
.g-signin-slot { display: flex; justify-content: center; min-height: 0; }
.g-signin-slot:empty { display: none; }
.email-form, .code-form { display: flex; gap: 8px; margin-bottom: 8px; }
.email-input, .code-input {
  flex: 1; height: 46px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--bg-1); color: var(--ink-1); font: inherit; font-size: 15px;
}
.code-input {
  text-align: center; letter-spacing: 0.5em; font-family: var(--font-mono);
  font-weight: 700; padding-right: 0;
}
.email-input:focus, .code-input:focus { outline: 2px solid var(--accent-1); outline-offset: 1px; border-color: transparent; }
.email-form .btn-accent, .code-form .btn-accent { height: 46px; }
/* #85 设密码表单:竖排(新密码 / 确认 / 掣),避免 flex row 挤压 */
.pw-set-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.pw-set-form .email-input { flex: none; }
.pw-set-form .btn-accent { height: 46px; }
/* #85 验证码 / 密码 分隔线:两边横线 + 中间「或用密码登录」,令两种登录方式清晰分开 */
.login-or { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; font-size: 12px; color: var(--ink-4); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line, rgba(0,0,0,.12)); }
.email-sent-note { font-size: 12.5px; color: var(--ink-4); margin: 0 0 8px; }
.login-error {
  font-size: 13px; color: #E5534B; margin: 4px 0 0;
  background: rgba(229,83,75,0.10); border-radius: 10px; padding: 8px 12px;
}
.login-fine { font-size: 12.5px; color: var(--ink-5); margin-top: 18px; }
.login-fine a { color: var(--ink-4); text-decoration: underline; text-underline-offset: 2px; }
.login-fine a:hover { color: var(--accent-deep); }
.login-mock-note {
  margin-top: 14px; font-size: 12px; color: var(--ink-5);
  background: var(--accent-soft); border-radius: 10px; padding: 8px 12px;
}

/* -------- dashboard head -------- */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dash-head h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 700; color: var(--ink-1); letter-spacing: -0.015em; }
.dash-sub { margin-top: 6px; font-size: 14.5px; color: var(--ink-4); max-width: 46ch; }
.tier-badge {
  flex: none; font-size: 12.5px; font-weight: 600;
  color: var(--accent-deep); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent-1) 35%, transparent);
  border-radius: 999px; padding: 6px 12px; white-space: nowrap;
}

/* -------- cards -------- */
.card {
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-4); padding: 24px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head h2 { font-size: 17px; font-weight: 600; color: var(--ink-1); }
.muted { font-size: 13.5px; color: var(--ink-4); }

/* -------- bridge list -------- */
.bridge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bridge-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-3);
  background: var(--bg-1); border: 1px solid var(--line-1);
}
.dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.dot.on { background: #35C46A; box-shadow: 0 0 0 3px rgba(53, 196, 106, 0.18); }
.dot.off { background: var(--ink-5); }
.bridge-id { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.bridge-name { font-size: 14.5px; font-weight: 600; color: var(--ink-1); }
.bridge-meta { font-size: 12.5px; color: var(--ink-4); }
.bridge-actions { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.bridge-status { font-size: 12.5px; font-weight: 600; flex: none; }
.bridge-status.is-active { color: #35C46A; }
.bridge-status.is-standby { color: var(--ink-4); }
.bridge-status.is-offline { color: var(--ink-5); }
.btn-upgrade {
  height: 34px; padding: 0 14px; border-radius: 9px;
  background: var(--accent-1); color: #3A1100;
  font-weight: 650; font-size: 13px; border: none; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-upgrade:hover { background: var(--accent-2); }
.btn-upgrade:disabled { opacity: 0.55; cursor: progress; }
.bridge-applying { font-size: 12.5px; font-weight: 600; color: var(--accent-deep); }
.bridge-apply { font-size: 12px; color: var(--ink-4); max-width: 22ch; text-align: right; }
.bridge-empty { font-size: 14px; color: var(--ink-4); padding: 8px 2px; }

/* -------- install tabs -------- */
.tabs { display: inline-flex; gap: 4px; background: var(--bg-1); border: 1px solid var(--line-1); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 16px; border: none; border-radius: 999px;
  background: transparent; color: var(--ink-4); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.tab.is-active { background: var(--accent-1); color: #3A1100; }
.tab-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-deep); background: var(--accent-soft);
  border-radius: 999px; padding: 2px 7px;
}
.tab.is-active .tab-tag { color: #3A1100; background: rgba(255, 255, 255, 0.35); }
.tab-panel[hidden] { display: none; }

/* -------- code blocks -------- */
.code-row { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 8px; }
.code {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  color: var(--ink-2); background: var(--bg-1);
  border: 1px solid var(--line-1); border-radius: var(--r-2);
  padding: 14px 16px; margin: 0;
  white-space: pre; overflow-x: auto;
}
.code.one { white-space: nowrap; }
.code::-webkit-scrollbar { height: 8px; }
.code::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.copy {
  flex: none; height: 36px; padding: 0 14px; border-radius: 9px;
  background: var(--accent-1); color: #3A1100;
  font-weight: 600; font-size: 13px; border: none;
  transition: background .15s, opacity .15s;
}
.copy:hover { background: var(--accent-2); }
.copy.copied { background: var(--bg-4); color: var(--ink-2); }
.copy:disabled { opacity: 0.5; cursor: not-allowed; }
.hint { font-size: 13px; color: var(--ink-4); margin-top: 6px; }

/* -------- manual pairing -------- */
.pair-issue { margin-top: 4px; }
.pair-result { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pair-code-box {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--bg-1); border: 1px dashed color-mix(in srgb, var(--accent-1) 50%, var(--line-2));
  border-radius: var(--r-3); padding: 10px 12px 10px 16px;
}
.pair-code {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  letter-spacing: 0.12em; color: var(--accent-deep);
}
.pair-expiry { font-size: 12.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.pair-expiry.is-expired { color: #E5534B; }
.btn-link { background: none; border: none; color: var(--ink-4); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; padding: 0; }
.btn-link:hover { color: var(--accent-deep); }

/* -------- OS picker -------- */
.os-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-1); }
.os-label { font-size: 13px; color: var(--ink-4); margin-bottom: 10px; }
.os-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.os-pill {
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--bg-1); border: 1px solid var(--line-2);
  color: var(--ink-3); font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s, border-color .15s;
}
.os-pill:hover { border-color: var(--ink-5); color: var(--ink-1); }
.os-pill.is-active { background: var(--accent-1); color: #3A1100; border-color: transparent; }
.os-note { font-size: 12.5px; color: var(--ink-4); margin-top: 8px; }

/* -------- footer -------- */
.console-foot { border-top: 1px solid var(--line-1); padding: 24px 0 40px; margin-top: 12px; }
.console-foot-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--ink-5); }
.foot-links a { color: var(--ink-4); }
.foot-links a:hover { color: var(--accent-deep); }

@media (max-width: 560px) {
  .dash-head { flex-direction: column; }
  .pair-code { font-size: 19px; }
  .code-row { flex-direction: column; }
  .copy { align-self: flex-end; }
}
