/* ================================================================
   NoviSSO · Single Sign-On system styles
   Built on Novi design tokens (auth.css). Ported from sso-styles.css.
   ================================================================ */

@keyframes spin { to { transform: rotate(360deg); } }

.sso-root { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Brand image logos (black line-art → invert in dark mode) ---- */
.novi-img { user-select: none; -webkit-user-drag: none; }
[data-theme="dark"] .novi-img { filter: invert(1) brightness(1.7) contrast(1.04); }

/* ---- Sparrow 啾啾 mascot ---- */
.sparrow { user-select: none; -webkit-user-drag: none; image-rendering: pixelated; cursor: pointer; }
.sparrow-bob { animation: sp-bob 2.8s ease-in-out infinite; transform-origin: bottom center; }
@keyframes sp-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30% { transform: translateY(-5px) rotate(-3deg); }
  60% { transform: translateY(-2px) rotate(3deg); }
}
.sparrow:hover { animation: sp-hop 0.5s ease; }
@keyframes sp-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-11px); } }

.auth-perch {
  position: relative; z-index: 1; margin-top: var(--s-7);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2);
}
.auth-perch .chirp {
  position: relative; margin-left: 16px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 13px;
  padding: 8px 13px; font-size: 12.5px; color: var(--text-muted); box-shadow: var(--shadow-1);
}
.auth-perch .chirp strong { color: var(--primary); font-weight: 600; }
.auth-perch .chirp::after {
  content: ""; position: absolute; left: 22px; bottom: -5px; width: 9px; height: 9px;
  background: var(--bg-elev); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.auth-perch .bird-line { display: flex; align-items: flex-end; gap: var(--s-3); width: 100%; }
.auth-perch .branch {
  flex: 1; height: 0; border-top: 1.5px solid var(--line-strong);
  margin-bottom: 12px; position: relative;
}
.auth-perch .branch::before, .auth-perch .branch::after {
  content: ""; position: absolute; top: -3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--line-strong);
}
.auth-perch .branch::before { left: 0; }
.auth-perch .branch::after { right: 0; }
.auth-head .eyebrow .sparrow { display: inline-block; }

/* ---- Inline icon sizing safety net ---- */
.auth-head .eyebrow svg { width: 14px; height: 14px; }
.badge svg { width: 12px; height: 12px; }
.role-pill svg { width: 11px; height: 11px; }
.section-label svg { width: 13px; height: 13px; }
.set-row .tx .t svg,
.conn .tx .t svg { width: 13px; height: 13px; }
.resend svg, .field .err svg, .auth-fine svg,
.consent-user svg, .auth-alt svg { width: 12px; height: 12px; }
.crumb svg { width: 12px; height: 12px; }

/* ================================================================
   AUTH SHELL — left brand rail + right form stage
   ================================================================ */
.auth {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}
.auth.is-centered { grid-template-columns: 1fr; }

/* — Brand rail (blueprint) — */
.auth-brand {
  position: relative;
  overflow: hidden;
  background: var(--bg-sunken);
  border-right: 1px solid var(--line);
  padding: var(--s-7) var(--s-8);
  display: flex;
  flex-direction: column;
}
.auth-brand::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 0.5px, transparent 0.5px),
    linear-gradient(90deg, var(--line) 0.5px, transparent 0.5px);
  background-size: 28px 28px;
  mask-image: radial-gradient(120% 90% at 30% 20%, #000 35%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 30% 20%, #000 35%, transparent 78%);
  opacity: 0.7;
  pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .bk { display: flex; align-items: center; gap: var(--s-3); }
.auth-brand .bk .sso-tag {
  margin-left: var(--s-2); font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em; color: var(--primary);
  border: 1px solid color-mix(in oklab, var(--primary) 35%, transparent);
  padding: 2px 7px; border-radius: var(--r-pill); text-transform: uppercase;
}
.auth-brand .center { margin: auto 0; display: flex; flex-direction: column; gap: var(--s-6); }
.auth-brand .big-mark img { width: 132px; height: 132px; }
.auth-brand .tagline {
  font-family: var(--font-display); font-weight: 250;
  font-size: clamp(32px, 3.4vw, 46px); line-height: 1.04; letter-spacing: -0.025em;
  max-width: 15ch;
}
.auth-brand .tagline em { font-style: normal; color: var(--primary); }
.auth-brand .lede {
  color: var(--text-muted); font-size: 14.5px; font-weight: 300;
  line-height: 1.65; max-width: 40ch;
}
.auth-brand .stamp {
  display: flex; gap: var(--s-5); flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.auth-brand .stamp span { display: inline-flex; align-items: center; gap: 6px; }
.auth-brand .stamp .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.auth-brand .foot {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  letter-spacing: 0.06em; display: flex; justify-content: space-between;
}

/* — Form stage — */
.auth-stage {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--s-8) var(--s-6);
}
.auth-stage .topright {
  position: absolute; top: var(--s-6); right: var(--s-6);
  display: flex; align-items: center; gap: var(--s-2);
}
.auth-stage .backlink {
  position: absolute; top: var(--s-6); left: var(--s-6);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
  padding: 6px 10px; border-radius: var(--r-2);
}
.auth-stage .backlink:hover { background: var(--bg-hover); color: var(--text); }
.auth-stage .backlink svg { width: 15px; height: 15px; }

.auth-card {
  width: 100%; max-width: 384px;
  display: flex; flex-direction: column; gap: var(--s-5);
}
.auth-card.is-wide { max-width: 440px; }

/* centered variant: card sits on a blueprint field with a frame */
.auth.is-centered .auth-stage {
  background:
    linear-gradient(var(--line-faint) 0.5px, transparent 0.5px) center / 30px 30px,
    linear-gradient(90deg, var(--line-faint) 0.5px, transparent 0.5px) center / 30px 30px,
    var(--bg);
}
.auth.is-centered .auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-3);
  padding: var(--s-7);
}
.auth.is-centered .auth-brand { display: none; }

.auth-head .eyebrow {
  font-family: var(--font-body); font-size: 12.5px; letter-spacing: 0;
  color: var(--text-faint); margin-bottom: var(--s-3);
  display: flex; align-items: center; gap: var(--s-2);
}
.auth-head h1 {
  font-family: var(--font-display); font-weight: 300; font-size: 27px;
  letter-spacing: -0.02em; line-height: 1.1;
}
.auth-head .sub { font-size: 14px; color: var(--text-muted); margin-top: 8px; line-height: 1.55; }
.auth-head .sub strong { color: var(--text); font-weight: 500; }

/* org chip on auth head */
.auth-orgchip {
  display: inline-flex; align-items: center; gap: var(--s-3);
  padding: 6px 12px 6px 6px; border: 1px solid var(--line);
  background: var(--bg-elev); border-radius: var(--r-pill);
  align-self: flex-start;
}

/* ================================================================
   FORM FIELDS
   ================================================================ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
}
.field > label .link { font-family: var(--font-body); font-size: 12px; font-weight: 400; color: var(--primary); cursor: pointer; }
.field > label .link:hover { text-decoration: underline; }
.input-wrap {
  display: flex; align-items: center; gap: var(--s-3);
  height: 44px; padding: 0 var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-2);
  background: var(--bg-elev); transition: all var(--dur-1) var(--ease);
}
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-wrap.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 12%, transparent); }
.input-wrap > svg { width: 17px; height: 17px; color: var(--text-faint); flex-shrink: 0; }
.input-wrap input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font: inherit; font-size: 14.5px; color: var(--text);
}
.input-wrap input::placeholder { color: var(--text-faint); }
.input-wrap .reveal { color: var(--text-faint); cursor: pointer; display: inline-flex; }
.input-wrap .reveal:hover { color: var(--text); }
.input-wrap .reveal svg { width: 17px; height: 17px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); }
.field .err { font-size: 11.5px; color: var(--danger); display: flex; align-items: center; gap: 5px; }
.field .err svg { width: 12px; height: 12px; }

/* SSO / provider buttons */
.prov-btn {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; height: 48px; padding: 0 var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-2);
  background: var(--bg-elev); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: all var(--dur-1) var(--ease);
}
.prov-btn:hover { border-color: var(--text-faint); background: var(--bg-hover); }
.prov-btn:disabled { opacity: 0.6; cursor: default; }
.prov-btn.is-dark { background: var(--text); color: var(--text-inv); border-color: var(--text); }
.prov-btn.is-dark:hover { opacity: 0.9; }
.prov-btn > svg:first-child { width: 18px; height: 18px; flex-shrink: 0; }
.prov-btn .arr { margin-left: auto; display: inline-flex; }
.prov-btn .arr svg { width: 16px; height: 16px; }
.prov-btn .sub-lbl { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.06em; }

.btn-submit { width: 100%; height: 46px; font-size: 14.5px; }

.auth-divider {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-fine { font-size: 12px; color: var(--text-faint); line-height: 1.6; text-align: center; }
.auth-fine a { color: var(--text-muted); text-decoration: underline; cursor: pointer; }

/* form pane (tab content) */
.auth-pane { display: flex; flex-direction: column; gap: var(--s-5); }
.hidden { display: none !important; }

/* phone-code login (primary method) */
.auth-tabs {
  display: flex; gap: 3px; background: var(--bg-sunken);
  border: 1px solid var(--line); border-radius: var(--r-2); padding: 3px;
}
.auth-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px; font-size: 13.5px; color: var(--text-muted);
  border-radius: var(--r-1); cursor: pointer; transition: all var(--dur-1) var(--ease);
}
.auth-tab svg { width: 15px; height: 15px; }
.auth-tab:hover { color: var(--text); }
.auth-tab.is-active { background: var(--bg-elev); color: var(--text); font-weight: 500; box-shadow: var(--shadow-1); }
.input-wrap .ccode {
  font-size: 14.5px; color: var(--text-muted); padding-right: var(--s-3);
  border-right: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.input-wrap .code-btn {
  flex-shrink: 0; border: none; background: transparent; color: var(--primary);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap; padding: 0 0 0 var(--s-3);
}
.input-wrap .code-btn:disabled { color: var(--text-faint); cursor: default; font-family: var(--font-mono); font-size: 12.5px; }
.input-wrap .code-btn:not(:disabled):hover { color: var(--primary-strong); }
.auth-alt { font-size: 13px; color: var(--text-muted); text-align: center; }
.auth-alt a { color: var(--primary); cursor: pointer; font-weight: 500; }
.auth-alt a:hover { text-decoration: underline; }

/* remember + checkbox */
.checkrow { display: flex; align-items: center; gap: var(--s-3); font-size: 13px; color: var(--text-muted); }
.check {
  width: 18px; height: 18px; border: 1px solid var(--line-strong); border-radius: var(--r-1);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0; background: var(--bg-elev); transition: all var(--dur-1);
}
.check svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.check.is-on { background: var(--primary); border-color: var(--primary); }
.check.is-on svg { opacity: 1; }

/* alerts (form messages) */
.alert {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 11px var(--s-4); border-radius: var(--r-2); font-size: 13px;
  border: 1px solid currentColor;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; }
.alert-success { color: var(--success); background: color-mix(in oklab, var(--success) 8%, transparent); }
.alert-error { color: var(--danger); background: color-mix(in oklab, var(--danger) 8%, transparent); }
.alert span, .alert div { color: var(--text); }

/* ================================================================
   OTP / verification code input
   ================================================================ */
.otp { display: flex; gap: var(--s-3); justify-content: space-between; }
.otp-cell {
  flex: 1; height: 56px; border: 1px solid var(--line-strong); border-radius: var(--r-2);
  background: var(--bg-elev); font-family: var(--font-mono); font-size: 24px;
  text-align: center; color: var(--text); outline: none; min-width: 0;
  transition: all var(--dur-1) var(--ease);
}
.otp-cell:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.otp-cell.is-filled { border-color: var(--text-faint); }

.mfa-method {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--bg-elev); cursor: pointer; transition: all var(--dur-1);
}
.mfa-method:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.mfa-method.is-active { border-color: var(--primary); background: var(--primary-soft); }
.mfa-method .ic {
  width: 36px; height: 36px; border-radius: var(--r-2); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--text); background: var(--bg-sunken);
}
.mfa-method .ic svg { width: 18px; height: 18px; }
.mfa-method .tx { flex: 1; }
.mfa-method .tx .t { font-weight: 500; font-size: 13.5px; }
.mfa-method .tx .d { font-size: 12px; color: var(--text-muted); }

.resend { font-size: 12.5px; color: var(--text-muted); text-align: center; }
.resend a { color: var(--primary); cursor: pointer; font-weight: 500; }
.resend a:hover { text-decoration: underline; }
.resend .timer { font-family: var(--font-mono); color: var(--text-faint); }

/* password strength meter */
.pw-meter { display: flex; flex-direction: column; gap: 6px; margin-top: -8px; }
.pw-meter .bars { display: flex; gap: 4px; }
.pw-meter .bars span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background var(--dur-1); }
.pw-meter .hint { font-size: 11.5px; }

/* ================================================================
   OAUTH AUTHORIZE / CONSENT
   ================================================================ */
.consent-app {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--bg-sunken);
}
.consent-app .logo {
  width: 48px; height: 48px; border-radius: var(--r-2); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 20px;
}
.consent-app .logo svg { width: 24px; height: 24px; }
.consent-app .nm { font-family: var(--font-display); font-weight: 500; font-size: 16px; }
.consent-app .by { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.consent-flow {
  display: flex; align-items: center; justify-content: center; gap: var(--s-4);
  padding: var(--s-2) 0;
}
.consent-flow .node {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-elev); display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.consent-flow .node img { width: 26px; height: 26px; }
.consent-flow .node.is-app { color: #fff; border: none; }
.consent-flow .node.is-app svg { width: 22px; height: 22px; }
.consent-flow .dots { display: flex; gap: 5px; }
.consent-flow .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: scopepulse 1.4s infinite; }
.consent-flow .dots i:nth-child(2) { animation-delay: 0.2s; }
.consent-flow .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes scopepulse { 0%,100% { opacity: 0.25; } 50% { opacity: 1; } }

.scopes { display: flex; flex-direction: column; gap: var(--s-2); }
.scope {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3); border: 1.5px solid var(--line); border-radius: var(--r-2);
  cursor: pointer; user-select: none;
  transition: border-color .15s ease, background .15s ease;
}
.scope:hover { border-color: var(--text-faint); }
/* 选中态：高亮边框 + 浅色底，明确可见 */
.scope.is-on {
  border-color: var(--success);
  background: color-mix(in oklab, var(--success) 8%, transparent);
}
.scope .ck {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  background: var(--success); color: #fff; border: 1.5px solid var(--success);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.scope .ck svg { width: 13px; height: 13px; }
/* 未选中：空心圆环，不显示对勾 */
.scope .ck.is-deny { background: transparent; color: transparent; border-color: var(--line); }
.scope .t { font-weight: 500; font-size: 13.5px; }
.scope .d { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; line-height: 1.5; }
.scope input { position: absolute; opacity: 0; pointer-events: none; }

/* ================================================================
   MODAL · 确认弹窗（替代 alert）
   ================================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: var(--s-5);
  background: color-mix(in oklab, #000 42%, transparent); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease;
}
.modal-mask.is-open { opacity: 1; visibility: visible; }
.modal-card {
  width: 100%; max-width: 400px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-3);
  padding: var(--s-5); transform: translateY(10px) scale(.98); transition: transform .18s ease;
}
.modal-mask.is-open .modal-card { transform: none; }
.modal-card .modal-ic {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in oklab, var(--warning) 16%, transparent); color: var(--warning); margin-bottom: var(--s-3);
}
.modal-card h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.modal-card p { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 var(--s-5); }
.modal-actions { display: flex; gap: var(--s-3); }
.modal-actions .btn { flex: 1; height: 44px; }
.consent-user {
  display: flex; align-items: center; gap: var(--s-3); justify-content: center;
  font-size: 12.5px; color: var(--text-muted);
}

/* ================================================================
   APP TOPBAR (portal + account pages)
   ================================================================ */
.sso-topbar {
  height: 56px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-6);
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 30;
}
.sso-topbar .bk { display: flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.sso-topbar .bk .sso-tag {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  color: var(--primary); border: 1px solid color-mix(in oklab, var(--primary) 35%, transparent);
  padding: 1px 6px; border-radius: var(--r-pill); text-transform: uppercase;
}
.topbar-nav { display: flex; gap: 2px; }
.topbar-nav a {
  padding: 6px 12px; font-size: 13.5px; color: var(--text-muted);
  border-radius: var(--r-2); cursor: pointer; transition: color var(--dur-1), background var(--dur-1);
}
.topbar-nav a:hover { color: var(--text); background: var(--bg-hover); }
.topbar-nav a.is-active { color: var(--text); font-weight: 500; }
.sso-topbar .spacer { flex: 1; }
.sso-topbar .actions { display: flex; align-items: center; gap: var(--s-2); }

/* avatar */
.sso-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 500; flex-shrink: 0; letter-spacing: 0.02em;
}
.sso-avatar.lg { width: 56px; height: 56px; font-size: 21px; }

/* ================================================================
   APP PORTAL (launcher)
   ================================================================ */
.portal { flex: 1; }
.portal-wrap { max-width: 1080px; margin: 0 auto; width: 100%; padding: var(--s-8) var(--s-6) var(--s-9); }
.portal-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-7); }
.portal-hero h1 {
  font-family: var(--font-display); font-weight: 300; font-size: 34px; letter-spacing: -0.025em;
}
.portal-hero h1 em { font-style: normal; color: var(--primary); }
.portal-hero .sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--text-faint); text-transform: uppercase; margin-top: var(--s-3); }
.portal-hero .who { display: flex; align-items: center; gap: var(--s-3); }

.section-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint);
  display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4);
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.app-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: var(--s-4);
}
.app-tile {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-elev);
  padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4);
  cursor: pointer; transition: all var(--dur-1) var(--ease); min-height: 168px;
}
.app-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.app-tile .top { display: flex; align-items: flex-start; justify-content: space-between; }
.app-tile .logo {
  width: 44px; height: 44px; border-radius: var(--r-2); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 20px;
}
.app-tile .logo svg { width: 22px; height: 22px; }
.app-tile .nm { font-family: var(--font-display); font-weight: 500; font-size: 16px; letter-spacing: -0.005em; }
.app-tile .desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; flex: 1; }
.app-tile .meta {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding-top: var(--s-3); border-top: 1px dashed var(--line);
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.04em;
}
.app-tile .meta > span:first-child { word-break: break-all; line-height: 1.45; }
.app-tile .open-ic { color: var(--text-faint); transition: all var(--dur-1); }
.app-tile .open-ic svg { width: 16px; height: 16px; }
.app-tile:hover .open-ic { color: var(--primary); transform: translate(2px, -2px); }

/* ================================================================
   CONTENT PAGES (profile / change-password / authorizations)
   ================================================================ */
.content-wrap { max-width: 720px; margin: 0 auto; width: 100%; padding: var(--s-7) var(--s-6) var(--s-9); }
.page-head { margin-bottom: var(--s-6); }
.page-head .crumb { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.06em; margin-bottom: var(--s-3); }
.page-head h1 { font-family: var(--font-display); font-weight: 300; font-size: 30px; letter-spacing: -0.025em; }
.page-head .sub { font-size: 14px; color: var(--text-muted); margin-top: var(--s-3); max-width: 60ch; line-height: 1.6; }

/* card / panel */
.panel {
  border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-elev);
  margin-bottom: var(--s-5); overflow: hidden;
}
.panel-head {
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
}
.panel-head h3 { font-family: var(--font-display); font-weight: 500; font-size: 16px; }
.panel-head .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.panel-body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }

/* settings row */
.set-row {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: none; }
.set-row .ic {
  width: 38px; height: 38px; border-radius: var(--r-2); flex-shrink: 0;
  border: 1px solid var(--line); background: var(--bg-sunken); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.set-row .ic svg { width: 18px; height: 18px; }
.set-row .tx { flex: 1; min-width: 0; }
.set-row .tx .t { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: var(--s-2); }
.set-row .tx .d { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }
.set-row .act { flex-shrink: 0; display: flex; align-items: center; gap: var(--s-2); }

/* toggle switch */
.tgl {
  position: relative; width: 40px; height: 23px; border-radius: 999px;
  background: var(--line-strong); border: none; cursor: pointer; transition: background var(--dur-1); flex-shrink: 0;
}
.tgl.is-on { background: var(--success); }
.tgl i { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--dur-1) var(--ease); }
.tgl.is-on i { transform: translateX(17px); }

/* connection card (authorized apps) */
.conn {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line);
}
.conn:last-child { border-bottom: none; }
.conn .logo {
  width: 40px; height: 40px; border-radius: var(--r-2); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-sunken); border: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: #fff;
}
.conn .tx { flex: 1; min-width: 0; }
.conn .tx .t { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: var(--s-3); }
.conn .tx .d { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.conn .act { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }

/* role pill */
.role-pill {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-1); border: 1px solid var(--line-strong); color: var(--text-muted);
}

/* empty state */
.empty-state {
  padding: var(--s-8) var(--s-5); text-align: center; color: var(--text-muted); font-size: 13.5px;
}

/* result icon (verify-result / error) */
.result-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.result-icon svg { width: 30px; height: 30px; }
.result-icon.ok { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }
.result-icon.fail { background: color-mix(in oklab, var(--danger) 12%, transparent); color: var(--danger); }

/* ================================================================
   redirect splash + toast
   ================================================================ */
.redirect-splash {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--s-5);
  background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
}
.redirect-splash .ring {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.redirect-splash .tx { font-size: 14px; color: var(--text-muted); }
.redirect-splash .tx strong { color: var(--text); font-weight: 500; }
.redirect-splash .mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.06em; }

.toast {
  position: fixed; bottom: var(--s-6); left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; align-items: center; gap: var(--s-3);
  padding: 11px var(--s-5); border-radius: var(--r-2);
  background: var(--text); color: var(--text-inv); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-3); animation: toastin var(--dur-2) var(--ease);
}
.toast svg { width: 16px; height: 16px; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } }

/* spinner */
.spinner {
  width: 16px; height: 16px; display: inline-block;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}
@media (max-width: 560px) {
  .portal-hero { flex-direction: column; align-items: flex-start; }
  .topbar-nav { display: none; }
}
