:root {
  --phase8b-ink: #07142f;
  --phase8b-muted: #64748b;
  --phase8b-line: #d8e5f4;
  --phase8b-blue: #2563eb;
  --phase8b-green: #16a34a;
  --phase8b-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

.phase8b-role-shell {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 99996;
  width: min(440px, calc(100vw - 32px));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--phase8b-ink);
}

.phase8b-role-shell.phase8b-hidden {
  display: none;
}

.phase8b-mini-button {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 26px;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.28), transparent 30%),
    linear-gradient(135deg, var(--phase8b-accent, #2563eb), #07142f);
  box-shadow: 0 22px 54px rgba(37, 99, 235, 0.32);
  font-weight: 950;
  letter-spacing: -0.06em;
}

.phase8b-role-panel {
  display: none;
  width: 100%;
  max-height: min(720px, calc(100vh - 120px));
  overflow: auto;
  border-radius: 34px;
  border: 1px solid rgba(199, 215, 238, 0.98);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--phase8b-accent, #2563eb) 12%, transparent), transparent 38%),
    rgba(255, 255, 255, 0.97);
  box-shadow: var(--phase8b-shadow);
  padding: 18px;
  backdrop-filter: blur(20px);
}

.phase8b-role-shell.phase8b-open .phase8b-role-panel {
  display: block;
  animation: phase8bUp 0.2s ease both;
}

.phase8b-role-shell.phase8b-open .phase8b-mini-button {
  display: none;
}

.phase8b-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--phase8b-line);
}

.phase8b-logo {
  width: 54px;
  height: 54px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--phase8b-accent, #2563eb);
  font-size: 16px;
  font-weight: 950;
  box-shadow: 0 16px 34px color-mix(in srgb, var(--phase8b-accent, #2563eb) 32%, transparent);
}

.phase8b-head h3 {
  margin: 0;
  color: var(--phase8b-ink);
  font-size: 19px;
  line-height: 1.08;
  font-weight: 950;
  letter-spacing: -0.055em;
}

.phase8b-head span {
  display: block;
  margin-top: 5px;
  color: var(--phase8b-muted);
  font-size: 12px;
  font-weight: 760;
}

.phase8b-close {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  border: 1px solid var(--phase8b-line);
  background: #f8fafc;
  color: var(--phase8b-ink);
  font-size: 20px;
  font-weight: 950;
  cursor: pointer;
}

.phase8b-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.phase8b-btn {
  min-height: 44px;
  border: 1px solid #c6dbff;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
  color: #1d4ed8;
  text-decoration: none;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.phase8b-btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--phase8b-accent, #2563eb), #1d4ed8);
  border-color: transparent;
}

.phase8b-btn.dark {
  color: #fff;
  background: linear-gradient(135deg, #07142f, #111d3d);
  border-color: transparent;
}

.phase8b-section-title {
  margin: 14px 0 8px;
  color: #7c8da6;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 950;
}

.phase8b-menu {
  display: grid;
  gap: 9px;
}

.phase8b-menu a {
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid var(--phase8b-line);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: var(--phase8b-ink);
  text-decoration: none;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.phase8b-menu a:hover {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 18px 34px rgba(37, 99, 235, .12);
}

.phase8b-menu i {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--phase8b-accent, #2563eb);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
}

.phase8b-menu b {
  display: block;
  font-size: 13px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.phase8b-menu span {
  display: block;
  margin-top: 4px;
  color: var(--phase8b-muted);
  font-size: 11px;
  font-weight: 720;
}

.phase8b-menu em {
  font-style: normal;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: #e7f9ef;
  color: #15803d;
  font-size: 10px;
  font-weight: 950;
}

.phase8b-widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.phase8b-widget {
  min-height: 76px;
  border-radius: 18px;
  border: 1px solid var(--phase8b-line);
  background: #fbfdff;
  padding: 12px;
}

.phase8b-widget span {
  display: block;
  color: var(--phase8b-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 950;
}

.phase8b-widget b {
  display: block;
  margin-top: 8px;
  color: var(--phase8b-ink);
  font-size: 15px;
  line-height: 1.12;
  letter-spacing: -0.035em;
  word-break: break-word;
}

.phase8b-login-box {
  display: none;
  width: 100%;
  max-height: min(720px, calc(100vh - 120px));
  overflow: auto;
  border-radius: 34px;
  border: 1px solid rgba(199, 215, 238, 0.98);
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.1), transparent 36%),
    rgba(255, 255, 255, 0.97);
  box-shadow: var(--phase8b-shadow);
  padding: 18px;
  backdrop-filter: blur(20px);
}

.phase8b-role-shell.phase8b-login .phase8b-login-box {
  display: block;
  animation: phase8bUp 0.2s ease both;
}

.phase8b-role-shell.phase8b-login .phase8b-mini-button,
.phase8b-role-shell.phase8b-login .phase8b-role-panel {
  display: none;
}

.phase8b-login-box h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.055em;
}

.phase8b-login-box p {
  margin: 8px 0 16px;
  color: var(--phase8b-muted);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.45;
}

.phase8b-input,
.phase8b-select {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--phase8b-line);
  background: #fff;
  padding: 0 13px;
  color: var(--phase8b-ink);
  font-size: 13px;
  font-weight: 760;
  outline: none;
  margin-bottom: 10px;
}

.phase8b-login-grid {
  display: grid;
  gap: 10px;
}

.phase8b-login-row {
  border: 1px solid var(--phase8b-line);
  border-radius: 17px;
  padding: 11px;
  background: #fbfdff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.phase8b-login-row b {
  display: block;
  font-size: 13px;
}

.phase8b-login-row span {
  display: block;
  margin-top: 4px;
  color: var(--phase8b-muted);
  font-size: 11px;
  font-weight: 720;
}

.phase8b-login-row button {
  min-height: 34px;
  border-radius: 999px;
  border: 0;
  padding: 0 11px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

@keyframes phase8bUp {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .phase8b-role-shell {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
  }

  .phase8b-actions,
  .phase8b-widget-grid {
    grid-template-columns: 1fr;
  }
}